* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #05070b; color: #e6edf3; font: 14px/1.4 system-ui, sans-serif; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
body.noui .ui { display: none !important; }

.glass { background: rgba(16, 20, 28, 0.92); border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }

button { font: inherit; color: inherit; background: #222c3b; border: 1px solid #344257; border-radius: 7px; padding: 4px 10px; cursor: pointer; transition: background 0.12s, transform 0.08s; }
button:hover { background: #2c3950; }
button:active { transform: scale(0.96); }
button.big { font-size: 18px; font-weight: 700; padding: 11px; background: #33a35d; border-color: #33a35d; }
button.big:hover { background: #3bb468; }
kbd { display: inline-block; min-width: 20px; text-align: center; font: 600 12px system-ui, sans-serif; background: #222c3b; border: 1px solid #344257; border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; margin-right: 6px; }

#board { position: fixed; top: 12px; right: 12px; width: 220px; padding: 10px 14px 12px; pointer-events: none; }
#board h2 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; text-align: center; opacity: 0.7; }
#board ol { margin: 0; padding-left: 24px; }
#board li { white-space: nowrap; line-height: 1.6; }
#board li::marker { color: #7d8896; }
#board li:first-child { color: #ffd866; font-weight: 700; }
#board li i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
#board li span { display: inline-block; max-width: 105px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
#board li .m { float: right; max-width: none; opacity: 0.65; font-variant-numeric: tabular-nums; }
#board li.me { color: #7fd8ff; font-weight: 700; }

#feed { position: fixed; top: 322px; right: 12px; width: 240px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; pointer-events: none; }
#feed li { background: rgba(16, 20, 28, 0.88); border-radius: 6px; padding: 2px 9px; font-size: 13px; white-space: nowrap; overflow: hidden; max-width: 100%; text-overflow: ellipsis; animation: slidein 0.25s ease-out; transition: opacity 0.6s, transform 0.6s; }
#feed li.me { background: rgba(34, 70, 104, 0.92); }
#feed li.gone { opacity: 0; transform: translateX(20px); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }

#hud { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; min-width: 150px; padding: 6px 18px 8px; text-align: center; background: rgba(16, 20, 28, 0.88); border-radius: 10px; pointer-events: none; }
#hud .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.6; }
#hudMass { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
#hudSub { opacity: 0.7; font-size: 13px; }
#hudFlags { color: #ffd866; font-size: 12px; max-width: 360px; margin: 0 auto; }
#hudFlags:empty { display: none; }
#paused, #spectate { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(14, 19, 28, 0.75); padding: 5px 16px; border-radius: 8px; pointer-events: none; }
#paused { font-size: 20px; font-weight: 700; }

#debugBtn { position: fixed; top: 12px; left: 12px; z-index: 2; }
#debug { position: fixed; top: 48px; left: 12px; width: 284px; max-height: calc(100% - 60px); overflow-y: auto; padding: 10px 12px 12px; z-index: 2; scrollbar-width: thin; }
#debug .head { display: flex; justify-content: space-between; align-items: baseline; }
#debug .head .ver { opacity: 0.5; font-size: 12px; }
#tabs { display: flex; gap: 2px; margin: 8px 0 10px; padding: 3px; background: rgba(255, 255, 255, 0.06); border-radius: 8px; }
#tabs .tab { flex: 1; padding: 4px 0; font-size: 13px; background: none; border: none; border-radius: 6px; opacity: 0.65; }
#tabs .tab:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); }
#tabs .tab.on { opacity: 1; background: #2c3950; font-weight: 600; }
#debug label.sub { margin-left: 4px; padding-left: 10px; border-left: 2px solid #344257; }
#debug .row { display: flex; gap: 6px; margin: 5px 0; }
#debug .row button { flex: 1; padding: 4px 0; font-size: 13px; white-space: nowrap; }
#debug label { display: block; margin: 6px 0; cursor: pointer; }
#debug input[type=checkbox] { accent-color: #3aa865; }
#debug label.range { display: grid; grid-template-columns: 1fr auto; }
#debug label.range input, #debug label.range select { grid-column: 1 / -1; width: 100%; margin: 3px 0 0; }
#debug input[type=range] { accent-color: #4f9cf0; }
#debug select { font: inherit; color: inherit; background: #222c3b; border: 1px solid #344257; border-radius: 6px; padding: 3px 6px; }
#debug .val { opacity: 0.7; font-variant-numeric: tabular-nums; }
#debug .keys { display: grid; gap: 4px; font-size: 13px; opacity: 0.85; }
#stats { margin-top: 12px; font-size: 11px; opacity: 0.55; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(5, 7, 11, 0.2), rgba(5, 7, 11, 0.65)); z-index: 3; animation: fadein 0.35s ease-out; }
.card { width: 330px; background: rgba(20, 24, 31, 0.95); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 12px; text-align: center; animation: rise 0.25s ease-out; }
@keyframes fadein { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.card h1 { margin: 0; font-size: 32px; font-weight: 800; }
.card p { margin: 0; }
.card input { font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 8px; border: 1px solid #344257; background: #0a0e14; color: inherit; text-align: center; outline: none; }
.card input:focus { border-color: #4f9cf0; }
#swatches { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.swatch { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: #fff; transform: scale(1.15); }
.controls { list-style: none; margin: 4px 0 0; padding: 0; text-align: left; display: grid; gap: 3px; opacity: 0.8; }
.controls span { display: inline-block; width: 64px; font-weight: 600; }
.card .ver { font-size: 12px; opacity: 0.45; }
.hint { font-size: 12px; opacity: 0.55; }
#deadStats { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 4px 0; text-align: left; }
#deadStats dt { opacity: 0.65; }
#deadStats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
