/* Nav Arena. One DOM for the nav; the class on <body> (l-top_bar / l-left_sidebar / l-icon_rail)
   is the ONLY thing that changes between variants. Content, menus, item order and labels are identical. */
:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2330; --muted: #6b7386; --line: #e3e6ec;
  --nav: #151a24; --nav-ink: #d9deea; --nav-hover: #232a38; --accent: #5b6cff; --ok: #1f9d63; --bad: #d64545;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(15, 18, 26, .55); backdrop-filter: blur(2px); }
#splash, #narrow { background: radial-gradient(1200px 600px at 50% -10%, #2b3350, #11141c); }
.card { background: var(--panel); border-radius: 16px; padding: 32px 36px; width: min(560px, 92vw); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.card.small { width: min(420px, 92vw); }
.card h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.5px; }
.card h2 { margin: 6px 0 18px; font-size: 24px; }
.lede { font-size: 17px; line-height: 1.5; color: #333a4a; }
.rules { text-align: left; color: var(--muted); line-height: 1.7; margin: 14px auto 22px; width: fit-content; padding-left: 18px; }
.fine { font-size: 13px; color: var(--muted); margin-top: 18px; }
.fine a { color: var(--accent); }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px 22px; font-weight: 600; }
.primary:disabled { opacity: .55; cursor: wait; }
.primary.big { font-size: 20px; padding: 16px 44px; }
.round { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.row button:not(.primary) { background: #eef0f5; border: 0; border-radius: 10px; padding: 12px 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 14px; }
.stats div { background: #f3f4f8; border-radius: 12px; padding: 14px 6px; }
.stats b { display: block; font-size: 26px; }
.stats span { font-size: 12px; color: var(--muted); }
.choices { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.choice { background: #f3f4f8; border: 2px solid transparent; border-radius: 12px; padding: 12px; width: 140px; display: grid; gap: 8px; justify-items: center; }
.choice:hover { border-color: var(--accent); }
.thumb { width: 100px; height: 64px; border-radius: 6px; background: #fff; border: 1px solid var(--line); position: relative; overflow: hidden; }
.thumb::before { content: ""; position: absolute; background: var(--nav); }
.t-top::before { left: 0; right: 0; top: 0; height: 12px; }
.t-side::before { left: 0; top: 0; bottom: 0; width: 28px; }
.t-rail::before { left: 0; top: 0; bottom: 0; width: 11px; }

/* ---------- chip (shows the served variation) ---------- */
.chip { position: fixed; right: 10px; bottom: 10px; z-index: 60; font: 12px ui-monospace, Consolas, monospace; background: rgba(20,24,34,.85); color: #cfd6e6; padding: 5px 9px; border-radius: 8px; }

/* ---------- HUD during a round ---------- */
#hud { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; background: #11141c; color: #fff; border-radius: 12px; padding: 10px 16px; display: flex; gap: 14px; align-items: center; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
#hud .bar { width: 120px; height: 6px; background: #333a4a; border-radius: 3px; overflow: hidden; }
#hud i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
#hud.found { background: var(--ok); }
#hud.missed { background: var(--bad); }

/* ---------- shell + nav (shared) ---------- */
#shell { min-height: 100vh; display: flex; }
#nav { background: var(--nav); color: var(--nav-ink); display: flex; gap: 6px; z-index: 30; }
#nav button { background: transparent; border: 0; color: inherit; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #fff; padding: 0 10px; white-space: nowrap; }
.logo { color: var(--accent); font-size: 18px; }
.group { display: flex; gap: 2px; position: relative; }
.item { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 10px; white-space: nowrap; position: relative; }
.item:hover, .item.open { background: var(--nav-hover); color: #fff; }
.item.active { color: #fff; }
.ico { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: none; }
.ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ws-ico, .avatar { background: #2f3850; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; }
.avatar { border-radius: 50%; }
.caret { opacity: .6; font-size: 11px; }
.spacer { flex: 1; }
.acct { position: relative; }
.menu { position: absolute; z-index: 35; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; min-width: 200px; padding: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.18); display: grid; }
.menu-title { font-size: 12px; color: var(--muted); padding: 6px 10px; }
#nav .menu button { color: var(--ink); text-align: left; padding: 9px 10px; border-radius: 6px; }
#nav .menu button:hover { background: #f1f3f8; }
.tick { color: var(--ok); float: right; }
.flash-ok { outline: 2px solid var(--ok) !important; outline-offset: 2px; }

/* ---------- content (identical in every layout) ---------- */
#content { flex: 1; padding: 28px 34px 110px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.page-head h1 { margin: 0; font-size: 26px; }
.muted { color: var(--muted); margin: 4px 0 0; }
.pill { font-size: 12px; background: #eceefe; color: #4150d6; padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 6px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { font-size: 24px; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }
.stat .up { color: var(--ok); } .stat .down { color: var(--ok); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel h3 { margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; border-top: 0; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: #eef0f5; }
.tag.ok { background: #e3f6ec; color: #17784b; } .tag.warn { background: #fff3dc; color: #9a6400; }

/* ---------- variant: top_bar (control) ---------- */
.l-top_bar #shell { flex-direction: column; }
.l-top_bar #nav { height: 56px; align-items: center; padding: 0 12px; position: sticky; top: 0; }
.l-top_bar .menu { top: calc(100% + 6px); left: 0; }
.l-top_bar .acct .menu { left: auto; right: 0; }

/* ---------- variant: left_sidebar ---------- */
.l-left_sidebar #nav { flex-direction: column; width: 232px; padding: 14px 10px; position: sticky; top: 0; height: 100vh; }
.l-left_sidebar .brand { height: 40px; }
.l-left_sidebar .group { flex-direction: column; }
.l-left_sidebar .menu { top: calc(100% + 4px); left: 0; right: 0; }
.l-left_sidebar .acct .menu { top: auto; bottom: calc(100% + 4px); }

/* ---------- variant: icon_rail (same sidebar, labels hidden, tooltip on hover) ---------- */
.l-icon_rail #nav { flex-direction: column; align-items: center; width: 64px; padding: 14px 8px; position: sticky; top: 0; height: 100vh; }
.l-icon_rail .brand { height: 40px; padding: 0; }
.l-icon_rail .group { flex-direction: column; }
.l-icon_rail .item { justify-content: center; padding: 10px; }
.l-icon_rail #nav .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.l-icon_rail .item[data-label]:hover::after { content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #11141c; color: #fff; font-size: 13px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 36; }
.l-icon_rail .item.open::after { display: none; }
.l-icon_rail .menu { left: calc(100% + 8px); top: 0; }
.l-icon_rail .acct .menu { top: auto; bottom: 0; }
