/* =====================================================================
   Send More Creeps — winter glass theme
   ===================================================================== */
:root {
  --bg: #050a14;
  --glass: rgba(12, 22, 40, 0.58);
  --glass-2: rgba(16, 30, 54, 0.72);
  --glass-3: rgba(8, 16, 30, 0.82);
  --line: rgba(160, 210, 255, 0.14);
  --line-2: rgba(160, 210, 255, 0.28);
  --ice: #8fd8ff;
  --ice-hi: #e6f7ff;
  --ice-lo: #2c6aa0;
  --text: #eaf3ff;
  --muted: #8ea4c2;
  --gold: #ffd36b;
  --red: #ff6b6b;
  --green: #6be2a0;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Cinzel', Georgia, serif;
  --panel-w: 300px;
  --top-h: 56px;
  --radius: 16px;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 2px 0 rgba(255, 255, 255, 0.04) inset;
  --blur: blur(18px) saturate(150%);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
b { font-weight: 700; }
code { background: rgba(143, 216, 255, 0.12); color: var(--ice-hi); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px 2px 0; border-radius: 6px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: rgba(143, 216, 255, 0.08);
  font: 600 12px var(--font); text-align: center; color: var(--ice-hi);
}
::selection { background: rgba(143, 216, 255, 0.35); }

.screen { position: fixed; inset: 0; z-index: 2; }

/* ---------- backdrop ---------- */
#bg-fallback {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 700px at 70% 70%, rgba(80, 150, 230, 0.35), transparent 60%),
    radial-gradient(900px 600px at 20% 10%, rgba(120, 90, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #060b18, #16294a 60%, #3d6290);
}
#bg3d { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0; transition: opacity 1.2s ease; }
#bg3d.ready { opacity: 1; }
#bg3d.off { opacity: 0; transition: opacity 0.3s; }
#bg-vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 60% 50%, transparent 40%, rgba(2, 6, 14, 0.55)); }
body[data-screen='game'] #bg-vignette, body[data-screen='game'] #bg-fallback { display: none; }
#btn-sound-menu { position: fixed; top: 14px; right: 14px; z-index: 20; backdrop-filter: blur(8px); }
body[data-screen='game'] #btn-sound-menu { display: none; }

/* ---------- glass frames & buttons ---------- */
.frame {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  appearance: none; cursor: pointer; user-select: none; position: relative;
  padding: 9px 16px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  color: var(--text); font-weight: 600; letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.btn:hover { background: rgba(143, 216, 255, 0.12); border-color: rgba(143, 216, 255, 0.55); box-shadow: 0 0 18px rgba(143, 216, 255, 0.18); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; background: rgba(255, 255, 255, 0.04); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 13px 22px; font-size: 17px; }
.btn.gold {
  background: linear-gradient(135deg, #d9f4ff 0%, #7fcdff 45%, #3d86ff 100%);
  color: #04142a; border-color: rgba(220, 245, 255, 0.9); font-weight: 800;
  box-shadow: 0 10px 30px rgba(70, 160, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn.gold:hover { filter: brightness(1.07); box-shadow: 0 12px 36px rgba(70, 160, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.btn.gold:disabled { filter: grayscale(0.6); }
.btn.danger { border-color: rgba(255, 107, 107, 0.4); }
.btn.danger:hover { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.7); box-shadow: 0 0 18px rgba(255, 107, 107, 0.2); }

input, select {
  background: rgba(4, 10, 22, 0.55); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--ice); box-shadow: 0 0 0 3px rgba(143, 216, 255, 0.18); }
input::placeholder { color: #5f7593; }
select { cursor: pointer; }
select option { background: #0c1628; }

h1, h2, h3 { margin: 0; }
h2 { font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ice); margin: 16px 0 9px; }

/* ---------- menu ---------- */
.menu-wrap { position: absolute; inset: 0; display: flex; align-items: center; padding: 24px max(16px, 6vw); }
.menu-card { width: min(450px, 100%); padding: 30px 30px 24px; display: flex; flex-direction: column; gap: 14px; animation: rise 0.7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) { .menu-wrap { justify-content: center; } }
.logo { display: flex; align-items: center; gap: 16px; }
.logo-cube { width: 62px; height: 62px; flex: none; filter: drop-shadow(0 6px 20px rgba(110, 190, 255, 0.55)); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-2deg); } }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ice); opacity: 0.9; }
.title {
  font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1.05; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffffff 30%, #a9dcff 75%, #5aa8ef);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 18px rgba(120, 200, 255, 0.35));
}
.title span { font-weight: 700; }
.tag { margin: -2px 0 2px; color: #b7c9e2; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 0.4em; font-weight: 800; text-align: center; font-size: 18px; }
.error-text { color: var(--red); min-height: 1em; margin: 0; font-size: 14px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { padding: 11px 12px; border-radius: 12px; background: rgba(143, 216, 255, 0.06); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.mode-card b { color: var(--ice-hi); font-size: 14px; }
.menu-hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.start-row { display: flex; gap: 8px; }
.start-row .btn { flex: 1; }
.start-row #btn-create { flex: 1.4; }
/* solo games run in the browser: nothing to invite anyone to */
body.solo .invite, body.solo .lobby-head .sub, body.solo #invite-warn, body.solo #lobby-chat-in { display: none !important; }
#btn-speed.on { color: #ffe27a; border-color: rgba(255, 226, 122, 0.55); }
.menu-foot { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(200, 225, 255, 0.55); pointer-events: none; }

/* ---------- lobby ---------- */
#screen-lobby { overflow: auto; }
.lobby { width: min(1200px, calc(100vw - 32px)); margin: 28px auto; padding: 22px 24px; animation: rise 0.5s cubic-bezier(.2,.8,.2,1) both; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.lobby-head h2 { font-size: 26px; }
.sub { color: var(--muted); margin-top: 4px; }
.code { font-family: var(--display); font-size: 22px; letter-spacing: 0.3em; color: var(--ice-hi); text-shadow: 0 0 18px rgba(143, 216, 255, 0.6); }
.invite { display: flex; gap: 8px; align-items: center; flex: 1; max-width: 540px; }
.invite input { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.warn { margin-top: 14px; padding: 11px 14px; border-radius: 12px; background: rgba(255, 196, 90, 0.08); border: 1px solid rgba(255, 196, 90, 0.3); color: #ffe6b0; font-size: 14px; line-height: 1.45; }
.lobby-body { display: grid; grid-template-columns: 1.1fr 1.35fr 0.9fr; gap: 22px; margin-top: 6px; }
.col { min-width: 0; }
@media (max-width: 980px) { .lobby-body { grid-template-columns: 1fr; } }

.pl-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 9px 11px; margin-bottom: 7px; border-radius: 12px; background: rgba(4, 10, 22, 0.45); border: 1px solid var(--line); transition: border-color 0.15s; }
.pl-row .swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 10px rgba(143, 216, 255, 0.25); }
.pl-row .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row .meta { font-size: 12.5px; color: var(--muted); }
.pl-row .ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pl-row .ctl:has(select + select) { grid-column: 2 / -1; justify-content: flex-start; }
.pl-row select { padding: 4px 7px; font-size: 12.5px; border-radius: 8px; }
.pl-row .x { padding: 3px 9px; }
.pl-row.me { border-color: rgba(143, 216, 255, 0.5); box-shadow: 0 0 0 1px rgba(143, 216, 255, 0.15) inset; }
.pl-row.off { opacity: 0.5; }
.badge { font-size: 10.5px; padding: 2px 7px; border-radius: 20px; background: rgba(143, 216, 255, 0.12); color: var(--ice); margin-left: 6px; font-weight: 700; letter-spacing: 0.04em; }
.badge.host { background: rgba(255, 211, 107, 0.16); color: var(--gold); }
.bot-row { display: flex; gap: 8px; margin-top: 8px; }
.bot-row select { padding: 5px 9px; font-size: 13px; border-radius: 8px; }

.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.map-card { cursor: pointer; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: rgba(4, 10, 22, 0.45); text-align: left; padding: 0; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.map-card:hover:not(:disabled) { transform: translateY(-2px); }
.map-card canvas { display: block; width: 100%; height: 118px; }
.map-card .mc-body { padding: 9px 12px 11px; }
.map-card .mc-name { font-weight: 800; font-size: 15px; }
.map-card .mc-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.map-card.sel { border-color: var(--ice); box-shadow: 0 0 0 1px var(--ice) inset, 0 0 26px rgba(143, 216, 255, 0.28); }
.map-card:disabled { cursor: default; }

.settings-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; align-items: center; }
.settings-grid label { color: var(--muted); font-size: 14px; }
.settings-grid select { width: 100%; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: rgba(4, 10, 22, 0.45); }
.seg button { flex: 1; padding: 7px 8px; background: transparent; border: 0; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: linear-gradient(180deg, rgba(143, 216, 255, 0.25), rgba(80, 150, 255, 0.18)); color: var(--ice-hi); }
.seg button:disabled { cursor: default; }

.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 9px; }
.race-card { cursor: pointer; text-align: left; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 10, 22, 0.45); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.race-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--line-2); }
.race-card .rc-top { display: flex; align-items: center; gap: 8px; }
.race-card canvas { width: 40px; height: 40px; }
.race-card .rc-name { font-weight: 800; }
.race-card .rc-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.race-card.sel { border-color: var(--ice); box-shadow: 0 0 0 1px var(--ice) inset, 0 0 20px rgba(143, 216, 255, 0.22); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.style-card:disabled { cursor: default; }
.style-card .rc-name .badge { margin-left: 5px; font-size: 9.5px; vertical-align: 1px; }

.chat-lines { overflow-y: auto; font-size: 14px; line-height: 1.45; }
.chat-col .chat-lines { height: 350px; padding: 10px; background: rgba(4, 10, 22, 0.45); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.chat-col input { width: 100%; }
.chat-lines .ln { margin: 1px 0; word-wrap: break-word; }
.chat-lines .who { font-weight: 700; }
.lobby-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 12px; }

/* ---------- game ---------- */
#screen-game { background: #0b1220; }
#cv3d { position: absolute; display: block; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
#cv.building { cursor: crosshair; }

#topbar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--top-h); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 14px;
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.9), rgba(10, 18, 34, 0.72));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.tb-wave { min-width: 0; }
.tb-title { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.01em; }
.tb-sub { font-size: 12.5px; color: var(--muted); }
.tb-res { display: flex; gap: 10px; }
.res { display: flex; align-items: center; gap: 7px; font-size: 18px; padding: 5px 12px; border-radius: 999px; background: rgba(4, 10, 22, 0.5); border: 1px solid var(--line); }
.res b { font-variant-numeric: tabular-nums; font-weight: 800; }
.res small { color: var(--muted); font-size: 11.5px; margin-left: 1px; }
.ico { width: 17px; height: 17px; display: inline-block; border-radius: 50%; }
.ico.gold { background: radial-gradient(circle at 35% 30%, #fff6c2, #f3c74a 45%, #a37514); box-shadow: 0 0 8px rgba(243, 199, 74, 0.6); }
.ico.income { border-radius: 3px; background: linear-gradient(135deg, #b8ffd4, #2fbf6f); clip-path: polygon(50% 0, 100% 55%, 70% 55%, 70% 100%, 30% 100%, 30% 55%, 0 55%); }
.ico.heart { border-radius: 0; background: #ff5e72; clip-path: path('M9 16 C 2 11 0 7.5 0 5 A 4.5 4.5 0 0 1 9 3 A 4.5 4.5 0 0 1 18 5 C 18 7.5 16 11 9 16 Z'); filter: drop-shadow(0 0 4px rgba(255, 94, 114, 0.6)); }
.tb-btns { display: flex; gap: 6px; }

#scoreboard {
  position: absolute; left: 12px; top: calc(var(--top-h) + 12px); z-index: 4;
  background: var(--glass-3); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-2); border-radius: 14px; padding: 7px; min-width: 260px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.sb-row { display: grid; grid-template-columns: 10px 1fr 40px 46px 34px; gap: 6px; align-items: center; padding: 4px 7px; border-radius: 8px; cursor: pointer; transition: background 0.12s; }
.sb-row:hover { background: rgba(143, 216, 255, 0.08); }
.sb-row.viewing { background: rgba(143, 216, 255, 0.14); box-shadow: 0 0 0 1px rgba(143, 216, 255, 0.35) inset; }
.sb-row.dead { opacity: 0.45; text-decoration: line-through; }
.sb-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.sb-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.sb-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.sb-head { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; cursor: default; }
.sb-head:hover { background: none; }
.sb-row .tgt { color: var(--red); font-size: 11px; }

#panel {
  position: absolute; right: 0; top: var(--top-h); bottom: 0; width: var(--panel-w); z-index: 4;
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.9), rgba(8, 14, 28, 0.94));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column; padding: 12px; gap: 11px; overflow-y: auto;
}
#view-bar { font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
#view-bar .vb-name { font-weight: 800; }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(4, 10, 22, 0.55); border: 1px solid var(--line); }
.tab { flex: 1; padding: 7px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); transition: background 0.15s, color 0.15s; }
.tab.active { color: #04142a; background: linear-gradient(135deg, #d9f4ff, #7fcdff); box-shadow: 0 4px 14px rgba(70, 160, 255, 0.3); }
.tab-body { display: flex; flex-direction: column; gap: 11px; }

.cmd-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cmd {
  position: relative; aspect-ratio: 1; padding: 0; cursor: pointer; border-radius: 10px;
  background: radial-gradient(circle at 50% 35%, rgba(143, 216, 255, 0.12), rgba(4, 10, 22, 0.6));
  border: 1px solid var(--line-2); transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
.cmd canvas { width: 100%; height: 100%; display: block; }
.cmd .hk { position: absolute; left: 4px; top: 2px; font-size: 10.5px; font-weight: 800; color: var(--ice-hi); text-shadow: 0 1px 2px #000; }
.cmd .els { position: absolute; right: 3px; top: 2px; display: flex; gap: 1px; filter: drop-shadow(0 1px 1px #000); }
.cmd .cost { position: absolute; right: 4px; bottom: 2px; font-size: 11px; font-weight: 800; color: var(--gold); text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.cmd .tgt { position: absolute; left: 3px; bottom: 3px; font-size: 8.5px; font-weight: 800; letter-spacing: 0.04em; padding: 0 3px; border-radius: 4px; line-height: 13px; color: #ffd9c8; background: rgba(150, 60, 30, 0.75); }
.cmd .tgt.air { color: #d9f2ff; background: rgba(40, 100, 170, 0.75); }
.cmd:hover { border-color: var(--ice); box-shadow: 0 0 16px rgba(143, 216, 255, 0.25); }
.cmd:active { transform: scale(0.96); }
.cmd.on { border-color: var(--ice-hi); box-shadow: 0 0 0 1px var(--ice-hi) inset, 0 0 20px rgba(143, 216, 255, 0.5); }
.cmd.poor .cost { color: var(--red); }
.cmd.poor canvas { filter: grayscale(0.7) brightness(0.7); }
.cmd.locked { opacity: 0.35; cursor: not-allowed; }

.sel-box { background: rgba(4, 10, 22, 0.5); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 120px; font-size: 13.5px; }
.sel-box .sb-title { display: flex; align-items: center; gap: 10px; }
.sel-box .sb-title canvas { width: 42px; height: 42px; }
.sel-box h4 { margin: 0; font-weight: 800; font-size: 15px; }
.sel-box .lvl { color: var(--ice); font-size: 12px; font-weight: 600; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 9px 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.stats .up { color: var(--green); }
.sel-btns { display: flex; gap: 6px; }
.sel-btns .btn { flex: 1; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
/* Element Wars: element bar and infusions */
.el-ico { display: inline-block; vertical-align: -3px; flex: none; }
.el-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; margin-right: 8px; }
.element-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.element-row .el-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.element-row .el-head b { color: #ffe27a; }
.element-row .el-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.el-chip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 4px; border-radius: 8px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--text); cursor: pointer; font: inherit; }
.el-chip:hover { border-color: currentColor; }
.el-chip .pips { display: flex; gap: 2px; }
.el-chip .pips i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.el-chip .pips i.on { background: currentColor; box-shadow: 0 0 5px currentColor; }
.el-chip.pick { animation: el-pulse 1.1s ease-in-out infinite; }
.el-chip.max { opacity: 0.55; cursor: default; }
.el-chip.armed { border-color: #ffe27a; box-shadow: 0 0 0 1px #ffe27a inset; }
@keyframes el-pulse { 50% { box-shadow: 0 0 14px currentColor; border-color: currentColor; } }
.infuse { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.infuse .inf-head { font-size: 12px; color: var(--muted); }
.infuse .inf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px; }
.inf-btn { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04); color: var(--text); cursor: pointer; font: inherit; font-size: 12px; text-align: left; }
.inf-btn canvas { width: 30px; height: 30px; flex: none; }
.inf-btn .nm { font-weight: 700; line-height: 1.15; }
.inf-btn .c { color: var(--gold); font-weight: 800; }
.inf-btn:hover:not(:disabled) { border-color: var(--ice); }
.inf-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.inf-btn.poor .c { color: var(--red); }

.target-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.target-row select { flex: 1; padding: 6px 9px; }
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.send {
  display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; align-items: center; text-align: left;
  padding: 7px 8px; border-radius: 10px; cursor: pointer; background: rgba(4, 10, 22, 0.5); border: 1px solid var(--line); font-size: 12.5px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.send canvas { grid-row: span 2; width: 34px; height: 34px; }
.send .snm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send .sinfo { color: var(--muted); }
.send .sinfo .c { color: var(--gold); font-weight: 700; }
.send .sinfo .i { color: var(--green); font-weight: 700; }
.send:hover { border-color: var(--ice); box-shadow: 0 0 14px rgba(143, 216, 255, 0.2); }
.send.poor { opacity: 0.55; }
.send.locked { opacity: 0.3; cursor: not-allowed; }
.tier-label { grid-column: 1 / -1; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ice); margin-top: 5px; }
#shrine-row .btn { width: 100%; }

#extras { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
#extras .btn { width: 100%; }
.give-row { display: flex; gap: 6px; }
.give-row select { flex: 1; padding: 5px 7px; font-size: 13px; }

#chat { position: absolute; left: 12px; bottom: 12px; width: min(470px, calc(100vw - var(--panel-w) - 40px)); z-index: 4; pointer-events: none; }
#chat .chat-lines { max-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
#chat .ln { transition: opacity 1s; }
#chat .ln.old { opacity: 0; }
#chat.open .ln.old { opacity: 0.85; }
#chat.open .chat-lines { background: var(--glass-3); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
#chat input { width: 100%; margin-top: 6px; pointer-events: auto; background: var(--glass-3); }

#banner {
  position: absolute; left: calc((100% - var(--panel-w)) / 2); top: calc(var(--top-h) + 26px); transform: translateX(-50%) translateY(-8px);
  font-family: var(--display); font-weight: 900; font-size: 34px; text-align: center; pointer-events: none; z-index: 3; letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 0, 0, 0.8); opacity: 0; transition: opacity 0.4s, transform 0.4s; white-space: nowrap;
}
#banner.show { opacity: 1; transform: translateX(-50%); }
#banner small { display: block; font-family: var(--font); font-size: 15px; font-weight: 600; letter-spacing: 0.06em; color: var(--ice-hi); }

#toasts { position: absolute; left: calc((100% - var(--panel-w)) / 2); bottom: 72px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; z-index: 6; }
.toast { padding: 7px 16px; border-radius: 999px; background: var(--glass-3); backdrop-filter: var(--blur); border: 1px solid var(--line-2); font-weight: 600; animation: toast 2.6s forwards; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.toast.err { color: #ffc2c2; border-color: rgba(255, 107, 107, 0.45); }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

#tooltip {
  position: fixed; z-index: 20; max-width: 290px; pointer-events: none;
  background: var(--glass-3); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 11px; font-size: 13px; line-height: 1.45; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}
#tooltip h5 { margin: 0 0 4px; font-size: 14px; font-weight: 800; color: var(--ice-hi); }
#tooltip .tt-role { color: var(--muted); margin-bottom: 4px; }

#pause-veil { position: absolute; inset: var(--top-h) var(--panel-w) 0 0; display: grid; place-items: center; background: rgba(4, 10, 22, 0.4); backdrop-filter: blur(3px); z-index: 3; pointer-events: none; }
#pause-veil div { font-family: var(--display); font-size: 46px; font-weight: 900; color: var(--ice-hi); text-shadow: 0 0 30px rgba(143, 216, 255, 0.6); letter-spacing: 0.25em; }

.modal { position: absolute; inset: 0; background: rgba(2, 6, 14, 0.6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 30; }
.modal-card { width: min(580px, calc(100vw - 32px)); padding: 24px; max-height: calc(100vh - 40px); overflow: auto; animation: rise 0.35s cubic-bezier(.2,.8,.2,1) both; }
.modal-card.wide { width: min(840px, calc(100vw - 32px)); }
.modal-card h2 { margin-bottom: 10px; font-family: var(--display); font-weight: 900; font-size: 28px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; align-items: center; margin: 12px 0; font-size: 14px; }
#go-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
#go-table th { text-align: left; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 5px 7px; border-bottom: 1px solid var(--line-2); }
#go-table td { padding: 7px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
#go-table tr.win td:first-child { color: var(--gold); }
.go-btns { display: flex; gap: 8px; justify-content: flex-end; }
/* end-of-game breakdown */
#go-breakdown { margin-bottom: 14px; }
.go-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.go-chip { background: rgba(143, 216, 255, 0.06); border: 1px solid var(--line); color: var(--ice-hi); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; }
.go-chip:hover { border-color: var(--line-2); }
.go-chip.on { background: rgba(143, 216, 255, 0.16); border-color: var(--ice); }
.go-sec { margin-top: 14px; }
.go-sec h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 6px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.go-sec p { margin: 6px 0 0; font-size: 12.5px; }
.go-goldbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(143, 216, 255, 0.08); margin-top: 6px; }
.go-goldbar span { display: block; height: 100%; }
.go-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; }
.go-legend i, .go-key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.go-key { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11.5px; }
.go-key i.lv { background: var(--red); } .go-key i.snd { background: #ffb43a; } .go-key i.gd { background: rgba(255, 211, 107, 0.55); margin-left: 6px; }
.go-levels { display: flex; gap: 2px; align-items: stretch; height: 84px; }
.go-lv { flex: 1 1 0; min-width: 2px; display: flex; flex-direction: column; gap: 2px; cursor: default; }
.go-lv:hover { background: rgba(143, 216, 255, 0.08); }
.go-lv-lost { flex: 3; display: flex; flex-direction: column-reverse; }
.go-lv-gold { flex: 1.4; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.go-lv-lost i { display: block; background: var(--red); border-radius: 2px 2px 0 0; }
.go-lv-lost i.snd { background: #ffb43a; border-radius: 0; }
.go-lv-gold i { display: block; background: rgba(255, 211, 107, 0.55); border-radius: 0 0 2px 2px; }
.go-towers { width: 100%; border-collapse: collapse; font-size: 13px; }
.go-towers th { text-align: left; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.go-towers td { padding: 5px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
.go-towers td:first-child { white-space: nowrap; }
.go-towers canvas { width: 24px; height: 24px; vertical-align: middle; margin-right: 7px; }
.go-towers .muted { font-size: 11.5px; }
.go-share { display: inline-block; width: 64px; height: 7px; border-radius: 4px; background: rgba(143, 216, 255, 0.1); margin-right: 7px; vertical-align: middle; overflow: hidden; }
.go-share i { display: block; height: 100%; background: var(--ice); }
@media (max-width: 560px) {
  /* phones: the results table scrolls sideways; the tower table drops its icons and bars */
  #go-table { display: block; overflow-x: auto; white-space: nowrap; }
  .go-towers canvas, .go-share { display: none; }
  .go-towers td:first-child { white-space: normal; }
}

@media (max-width: 760px) {
  :root { --panel-w: 230px; }
  .tb-res { gap: 6px; }
  .res { font-size: 15px; padding: 4px 9px; }
  .tb-btns .btn { padding: 4px 7px; }
  #scoreboard { display: none; }
  .title { font-size: 32px; }
  .mode-cards { grid-template-columns: 1fr; }
}
