/* CloseFront — "war room" look: dark glass, cyan for you, gold for resources, red for danger. */
:root {
  --bg: #070c17;
  --glass: rgba(11, 17, 31, 0.84);
  --glass-hi: rgba(20, 30, 52, 0.92);
  --line: rgba(148, 170, 210, 0.16);
  --line-hi: rgba(148, 190, 255, 0.34);
  --text: #e7eefb;
  --muted: #8796b0;
  --dim: #5b6a85;
  --accent: #38bdf8;
  --accent-2: #7dd3fc;
  --accent-deep: #0b6fa8;
  --gold: #fbbf24;
  --good: #4ade80;
  --warn: #fb923c;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Rajdhani", "Bahnschrift", "Segoe UI", sans-serif;
  font-family: var(--font);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
[hidden] { display: none !important; }
::selection { background: rgba(56, 189, 248, 0.35); }

#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; touch-action: none; }
#view.placing { cursor: copy; }
#vignette {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 58%, rgba(3, 6, 14, 0.55) 100%),
    linear-gradient(180deg, rgba(3, 6, 14, 0.35) 0%, transparent 12%, transparent 88%, rgba(3, 6, 14, 0.45) 100%);
}

/* ------------------------------------------------ base controls */
input, select, button { font: inherit; color: var(--text); }
input:not([type=range]), select {
  background: rgba(6, 11, 22, 0.7); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:not([type=range]):focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18); }
select option { background: #0f172a; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

button {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
  border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
button:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-hi); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary {
  background: linear-gradient(180deg, #4cc7fb, #1f9ad6); border-color: rgba(255, 255, 255, 0.2); color: #04111d;
  font-weight: 800; letter-spacing: 0.3px; box-shadow: 0 6px 22px rgba(56, 189, 248, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
button.primary:hover { background: linear-gradient(180deg, #6fd4fd, #2aa8e6); }
button.ghost { background: transparent; }

.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: var(--shadow); font-size: 13px;
}
i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,0.4); }
small { color: var(--muted); font-weight: 500; }
.num { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
svg.ico { width: 14px; height: 14px; flex: none; }

/* ------------------------------------------------ menu */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; }
.menu-overlay {
  align-items: stretch; pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 8, 18, 0.94) 0%, rgba(4, 8, 18, 0.78) 30%, rgba(4, 8, 18, 0.1) 62%, rgba(4, 8, 18, 0) 100%);
}
.menu-side { pointer-events: auto; width: min(460px, 100vw); padding: 6vh 0 4vh 6vw; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 6px 18px rgba(56, 189, 248, 0.45)); }
h1 { margin: 0; font-family: var(--display); font-size: 46px; line-height: 0.95; letter-spacing: 3px; font-weight: 700; text-transform: uppercase; }
h1 span { color: var(--accent); }
.tag { margin: 6px 0 0; color: var(--muted); font-size: 14px; letter-spacing: 0.2px; }

.card {
  width: 100%; max-width: 380px; padding: 22px 22px 18px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.card-title { font-family: var(--display); font-size: 13px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.field b { color: var(--accent-2); font-family: var(--display); font-size: 15px; letter-spacing: 0; }
.field .row-lbl { display: flex; justify-content: space-between; align-items: baseline; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seed-row { display: flex; gap: 8px; }
.seed-row input { flex: 1; min-width: 0; }
.seed-row button { font-size: 12px; padding: 0 12px; text-transform: none; letter-spacing: 0; }

.seg-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; background: rgba(6, 11, 22, 0.7); border: 1px solid var(--line); border-radius: 10px; }
.seg-pick button { border: none; background: transparent; padding: 7px 0; font-size: 12px; font-weight: 700; color: var(--muted); border-radius: 7px; text-transform: none; letter-spacing: 0.3px; }
.seg-pick button.on { background: rgba(56, 189, 248, 0.18); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45); }

#btn-start { width: 100%; padding: 14px; font-size: 16px; margin-top: 4px; font-family: var(--display); letter-spacing: 2px; text-transform: uppercase; }
.help { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12px; color: var(--muted); max-width: 380px; }
.help kbd {
  font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--text); white-space: nowrap;
  padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-bottom-width: 2px;
}
.credits { font-size: 11px; color: var(--dim); }

.center-overlay { align-items: center; justify-content: center; background: radial-gradient(circle at center, rgba(4, 8, 18, 0.55), rgba(4, 8, 18, 0.85)); }
.card.small { width: 380px; text-align: center; padding: 30px 26px 24px; }
#end-title { margin: 0 0 6px; font-family: var(--display); font-size: 54px; letter-spacing: 4px; text-transform: uppercase; }
#end-title.win { color: var(--gold); text-shadow: 0 0 30px rgba(251, 191, 36, 0.5); }
#end-title.loss { color: var(--danger); text-shadow: 0 0 30px rgba(248, 113, 113, 0.45); }
#end-text { color: var(--muted); margin: 0; }
.btns { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

/* ------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud .panel, #hud button, #hud input { pointer-events: auto; }

#spawnbar { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(0, 0, 0, 0.4); }
#spawnbar div { height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent), #e0f6ff); box-shadow: 0 0 12px var(--accent); transition: width 0.1s linear; }
#banner {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--glass-hi); border: 1px solid var(--line-hi); border-radius: 999px;
  padding: 8px 22px; font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
#banner b { color: var(--accent); margin-left: 6px; font-family: var(--display); font-size: 17px; }

/* top-left: nation card, buttons, advisor */
.top-left { position: absolute; top: 12px; left: 12px; width: 300px; display: flex; flex-direction: column; gap: 8px; }
#nation { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
#nation .flag { width: 34px; height: 34px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), 0 4px 14px rgba(0,0,0,0.4); }
#nation .who { flex: 1; min-width: 0; }
#nation .who b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nation .who span { font-size: 11px; color: var(--muted); letter-spacing: 0.4px; }
#nation .rank { text-align: right; }
#nation .rank b { display: block; font-family: var(--display); font-size: 24px; line-height: 1; color: var(--accent); }
#nation .rank span { font-size: 10px; color: var(--muted); letter-spacing: 1.2px; text-transform: uppercase; }
.tl-btns { display: flex; gap: 6px; }
.tl-btns button { font-size: 12px; padding: 6px 11px; background: var(--glass); display: flex; align-items: center; gap: 6px; backdrop-filter: blur(8px); }
#btn-view.on { background: rgba(56, 189, 248, 0.2); border-color: rgba(56, 189, 248, 0.5); color: var(--accent-2); }

#advisor { padding: 11px 13px; border-color: rgba(251, 191, 36, 0.3); position: relative; overflow: hidden; }
#advisor::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
#advisor .adv-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
#advisor .adv-hd span { color: var(--gold); font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; }
#advisor .adv-hd small { flex: 1; font-family: var(--display); }
#advisor .adv-hd button { font-size: 11px; padding: 2px 6px; background: transparent; border: none; color: var(--muted); text-decoration: underline; }
#advisor p { margin: 0 0 7px; line-height: 1.5; color: #d3dcec; }
#advisor button.primary { padding: 5px 14px; font-size: 12px; }
.focus-ring { outline: 2px solid var(--gold) !important; outline-offset: 3px; border-radius: 10px; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 50% { outline-color: rgba(251, 191, 36, 0.2); } }

/* leaderboard */
#leaderboard { position: absolute; top: 12px; right: 12px; width: 340px; padding: 10px 10px 8px; }
.lb-title { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 8px; font-family: var(--display); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.lb-title b { color: var(--text); font-size: 15px; letter-spacing: 0.5px; }
.lb-head, .lb-row { display: grid; grid-template-columns: 22px 1fr 46px 48px 48px; gap: 6px; align-items: center; }
.lb-head { color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 0 6px 5px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.lb-head span:not(.nm), .lb-row span:not(.nm) { text-align: right; }
.lb-row { padding: 4px 6px; border-radius: 7px; font-family: var(--display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; position: relative; }
.lb-row:nth-child(odd) { background: rgba(255, 255, 255, 0.02); }
.lb-row.me { background: linear-gradient(90deg, rgba(56, 189, 248, 0.26), rgba(56, 189, 248, 0.06)); box-shadow: inset 2px 0 0 var(--accent); }
.lb-row .rk { color: var(--dim); }
.lb-row:nth-child(3) .rk { color: var(--gold); }
.lb-row .nm { display: flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font); font-weight: 600; font-size: 12.5px; }
.lb-row .gd { color: var(--gold); }
.lb-bar { position: absolute; left: 0; bottom: 0; height: 2px; border-radius: 2px; opacity: 0.6; }

/* bottom dock */
#dock { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: stretch; gap: 7px; max-width: calc(100vw - 20px); }
#chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.opc {
  pointer-events: auto; display: flex; align-items: center; gap: 7px; padding: 5px 6px 5px 10px; border-radius: 9px;
  background: var(--glass-hi); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; position: relative; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); backdrop-filter: blur(8px); animation: chipin 0.18s ease-out;
}
@keyframes chipin { from { transform: translateY(6px); opacity: 0; } }
.opc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.opc .ic { font-size: 12px; }
.opc b { font-family: var(--display); font-size: 14px; }
.opc .tg { max-width: 150px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.opc.out::before { background: var(--accent); }
.opc.out b { color: var(--accent-2); }
.opc.in { background: rgba(55, 12, 18, 0.92); border-color: rgba(248, 113, 113, 0.45); }
.opc.in::before { background: var(--danger); }
.opc.in b { color: var(--danger); }
.opc button { padding: 1px 7px; font-size: 11px; line-height: 18px; border-radius: 6px; }
.opc.out button:hover { background: rgba(248, 113, 113, 0.45); }
.opc.in button { background: rgba(248, 113, 113, 0.25); color: #fff; border-color: rgba(248, 113, 113, 0.5); }

#control { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.cp-row { display: flex; align-items: center; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 9px; white-space: nowrap; border: 1px solid;
  font-family: var(--display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.pill .ic { font-size: 10px; }
.pill small { font-family: var(--font); font-size: 11px; }
#growth { color: var(--good); border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); min-width: 98px; }
#growth.slow { color: var(--warn); border-color: rgba(251, 146, 60, 0.45); background: rgba(251, 146, 60, 0.08); }
.pill.gold { color: var(--gold); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); }
#troopbar {
  position: relative; flex: 1; min-width: 230px; height: 30px; border-radius: 9px; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 10%), rgba(2, 6, 14, 0.75);
  border: 1px solid var(--line); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}
#tb-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #4cc7fb 0%, #1789c9 55%, #0b5f95 100%); box-shadow: 0 0 16px rgba(56, 189, 248, 0.5); transition: width 0.12s linear; }
#tb-fill::after { content: ""; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,0.28), transparent); }
#tb-away { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(125, 211, 252, 0.35) 0 6px, rgba(125, 211, 252, 0.18) 6px 12px); transition: left 0.12s linear, width 0.12s linear; }
#tb-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.5px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
#ratio-row { font-size: 12px; }
#ratio-lbl { white-space: nowrap; min-width: 112px; font-family: var(--display); font-weight: 700; font-size: 15px; }
#ratio-lbl small { font-family: var(--font); }
#ratio-row input { flex: 1; }
#land-lbl { color: var(--muted); white-space: nowrap; min-width: 84px; text-align: right; font-family: var(--display); font-weight: 600; font-size: 14px; }
#btn-recruit {
  font-size: 12px; font-weight: 700; padding: 6px 11px; color: var(--accent-2); white-space: nowrap;
  border-color: rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.1);
}
#btn-recruit:hover { background: rgba(56, 189, 248, 0.22); }

#buildbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding-top: 2px; max-width: 780px; }
.bb {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  width: 48px; flex: none; padding: 5px 1px 3px; border-radius: 9px; background: rgba(255, 255, 255, 0.03); border-color: transparent;
}
.bb:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-hi); }
.bb canvas { width: 28px; height: 28px; }
.bb .cost { font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--gold); line-height: 1; }
.bb .key { position: absolute; top: 2px; left: 4px; font-family: var(--display); font-size: 10px; color: var(--dim); font-weight: 700; }
.bb .cnt { position: absolute; top: 2px; right: 3px; font-family: var(--display); font-size: 10px; font-weight: 700; color: #04111d; background: var(--accent-2); border-radius: 6px; padding: 0 4px; line-height: 13px; }
.bb .cnt:empty, .bb .cnt[data-z="1"] { display: none; }
.bb.active { background: rgba(56, 189, 248, 0.2); border-color: rgba(56, 189, 248, 0.6); box-shadow: 0 0 14px rgba(56, 189, 248, 0.35); }
.bb.poor .cost { color: var(--danger); }
.bb.poor canvas, .bb.locked canvas { opacity: 0.35; filter: grayscale(0.6); }
.bb.locked .cost::after { content: " \1F512"; font-size: 9px; }
.bb.bomb { background: rgba(248, 113, 113, 0.05); }
.bb-sep { width: 1px; flex: none; margin: 4px 2px; background: var(--line); }

/* toasts, requests, alert */
#toasts { position: absolute; bottom: 196px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast {
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(8px);
  padding: 8px 16px; font-size: 13px; transition: opacity 0.6s, transform 0.6s; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: chipin 0.2s ease-out;
}
.toast.quiet { font-size: 12px; padding: 5px 12px; color: var(--muted); }
.toast.bad { border-color: rgba(248, 113, 113, 0.6); color: #ffd6d6; background: rgba(60, 12, 18, 0.95); }
.toast.fade { opacity: 0; transform: translateY(-6px); }

#requests { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; }
.request { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; pointer-events: auto; border-color: rgba(74, 222, 128, 0.4); }
.request button { padding: 5px 12px; font-size: 12px; }

#alert { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 3px rgba(248, 70, 70, 0.95), inset 0 0 120px rgba(248, 40, 40, 0.5); }
#alert.on { animation: alertflash 1.6s ease-out; }
@keyframes alertflash { 0%, 30% { opacity: 1; } 15% { opacity: 0.45; } 100% { opacity: 0; } }

/* ------------------------------------------------ action wheel */
#wheel { position: fixed; z-index: 30; width: 0; height: 0; }
#wheel svg { position: absolute; left: -200px; top: -200px; overflow: visible; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.6)); }
#wheel .ring { transform-origin: 0 0; animation: ringpop 0.18s cubic-bezier(.2,1.4,.4,1); }
#wheel .ring.outer { animation-duration: 0.14s; }
@keyframes ringpop { from { transform: scale(0.7) rotate(-8deg); opacity: 0; } }
#wheel .seg { cursor: pointer; }
#wheel .seg path { fill: rgba(13, 20, 36, 0.95); stroke: rgba(148, 190, 255, 0.22); stroke-width: 1.2; transition: fill 0.12s, stroke 0.12s; }
#wheel .seg:hover path, #wheel .seg.open path { fill: rgba(28, 48, 82, 0.98); stroke: var(--accent); }
#wheel .seg.k-atk path { fill: rgba(120, 30, 34, 0.95); }
#wheel .seg.k-atk:hover path { fill: rgba(176, 44, 48, 1); stroke: #ffb4b4; }
#wheel .seg.k-boat path { fill: rgba(16, 66, 112, 0.95); }
#wheel .seg.k-boat:hover path { fill: rgba(22, 98, 160, 1); stroke: var(--accent-2); }
#wheel .seg.k-ally path { fill: rgba(20, 92, 56, 0.95); }
#wheel .seg.k-ally:hover path { fill: rgba(28, 128, 76, 1); stroke: #b6f7cf; }
#wheel .seg.k-warn path { fill: rgba(96, 26, 60, 0.95); }
#wheel .seg.k-warn:hover path { fill: rgba(140, 38, 88, 1); }
#wheel .seg.k-bomb path { fill: rgba(70, 22, 22, 0.95); }
#wheel .seg.k-bomb:hover path, #wheel .seg.k-bomb.open path { fill: rgba(112, 34, 34, 1); stroke: #ffb4b4; }
#wheel .seg.off { opacity: 0.38; cursor: not-allowed; }
#wheel .seg.off:hover path { fill: rgba(30, 34, 46, 0.95); stroke: rgba(148, 170, 210, 0.2); }
#wheel .glyph { font-size: 24px; text-anchor: middle; pointer-events: none; }
#wheel .lbl { font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: 1px; fill: #e7eefb; text-anchor: middle; pointer-events: none; text-transform: uppercase; }
#wheel image { pointer-events: none; }
#wheel .hub {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); width: 104px; height: 104px;
  border-radius: 50%; background: radial-gradient(circle at 50% 30%, #18243d, #070c17); border: 1px solid var(--line-hi);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px;
  pointer-events: none; animation: hubpop 0.14s ease-out; box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.12);
}
#wheel .hub b { font-size: 12px; line-height: 1.2; }
#wheel .hub span { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
#wheel .hub span.bad { color: #ff9a9a; }
@keyframes hubpop { from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } }

/* ------------------------------------------------ tooltip */
#tooltip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--glass-hi); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 12px; color: var(--muted);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
#tooltip b { color: var(--text); display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 2px; }
#tooltip .warn { color: #bef264; }

@media (max-width: 1150px) {
  #leaderboard { width: 260px; }
  .lb-head, .lb-row { grid-template-columns: 18px 1fr 42px 46px; }
  .lb-head span:nth-child(4), .lb-row span:nth-child(4) { display: none; }
}

@media (max-width: 760px) {
  .menu-overlay { background: rgba(4, 8, 18, 0.75); justify-content: center; }
  .menu-side { padding: 16px; }
  h1 { font-size: 36px; }
  #leaderboard { display: none; }
  .top-left { width: 220px; }
  #troopbar { min-width: 120px; }
  #banner { font-size: 12px; white-space: normal; text-align: center; width: calc(100vw - 32px); }
}

/* ------------------------------------------------ menu: tabs, multiplayer, options */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-bottom: 16px; background: rgba(6, 11, 22, 0.7); border: 1px solid var(--line); border-radius: 11px; }
.tabs button { border: none; background: transparent; padding: 8px 0; font-family: var(--display); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button.on { background: rgba(56, 189, 248, 0.18); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45); }
.wide { width: 100%; margin-bottom: 10px; }
.join-row { display: flex; gap: 8px; margin-bottom: 4px; }
#in-code { flex: 1; min-width: 0; text-transform: uppercase; font-family: var(--display); font-size: 18px; letter-spacing: 6px; text-align: center; }
.mp-note { margin: 6px 0 12px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.mp-note.bad { color: var(--danger); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.3); }
.lobby-head small { display: block; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
#lobby-code { font-family: var(--display); font-size: 30px; letter-spacing: 8px; color: var(--accent); line-height: 1; }
#btn-copy { font-size: 12px; padding: 7px 10px; }
#lobby-players { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.lp { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); font-size: 13px; font-weight: 600; }
.lp span { flex: 1; }
.lp.me { box-shadow: inset 2px 0 0 var(--accent); background: rgba(56, 189, 248, 0.08); }
.lp small { color: var(--gold); font-family: var(--display); letter-spacing: 1px; text-transform: uppercase; }
.small-btn { font-size: 12px; padding: 5px 10px; margin-bottom: 6px; }
details.opts { margin: 2px 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; }
details.opts summary { cursor: pointer; padding: 9px 0; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); list-style: none; display: flex; justify-content: space-between; }
details.opts summary::-webkit-details-marker { display: none; }
details.opts summary::after { content: "+"; font-size: 14px; }
details.opts[open] summary::after { content: "\2212"; }
details.opts .field { margin-bottom: 10px; }
#settings-box select:disabled, #settings-box input:disabled, #settings-box button:disabled { opacity: 0.6; cursor: not-allowed; }
.menu-side { overflow-y: auto; }
.menu-side { scrollbar-width: thin; scrollbar-color: rgba(148, 170, 210, 0.25) transparent; }
.menu-side::-webkit-scrollbar { width: 6px; }
.menu-side::-webkit-scrollbar-thumb { background: rgba(148, 170, 210, 0.25); border-radius: 3px; }
