/* HEXBALL — style.css
 *
 * Brand A: JMI Interactive, the studio face (docs/BRAND.md) — dark arcade,
 * alive, cyan #1de9e2 with rare gold. Hexball is a cabinet, so the page is built
 * like one: one court, one scoreboard, no marketing chrome between the player
 * and the match.
 *
 * Self-contained on purpose. This folder ships as its own product lane and does
 * not import the hub stylesheet, so a change to the hub's CSS cannot silently
 * re-layout a live match.
 */

:root {
    --void: #050b10;
    --surface: #0a1723;
    --surface-2: #0e2130;
    --line: #17384c;
    --cyan: #1de9e2;
    --cyan-deep: #0b7f7c;
    --gold: #facc15;
    --gold-deep: #8a6a05;
    --hot: #ff2d78;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --danger: #ef4444;
    --radius: 12px;
    --font: "Outfit", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(1200px 700px at 50% -10%, rgba(29, 233, 226, 0.09), transparent 60%),
        radial-gradient(900px 600px at 90% 110%, rgba(250, 204, 21, 0.06), transparent 60%),
        var(--void);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100%;
}

body { -webkit-text-size-adjust: 100%; }

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    gap: 14px;
    padding: 14px clamp(12px, 3vw, 28px) 0;
    max-width: 1180px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(14, 33, 48, 0.92), rgba(10, 23, 35, 0.92));
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.brand-emblem {
    color: var(--cyan);
    font-size: 1.5rem;
    text-shadow: 0 0 14px rgba(29, 233, 226, 0.65);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { letter-spacing: 0.16em; font-size: 1.02rem; }
.brand-copy small { color: var(--muted); letter-spacing: 0.1em; font-size: 0.62rem; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.icon-button, .btn {
    font-family: var(--font);
    font-size: 0.86rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(14, 33, 48, 0.8);
    color: var(--text);
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color 140ms ease, background 140ms ease, transform 90ms ease;
}

.icon-button:hover, .btn:hover { border-color: var(--cyan); background: rgba(29, 233, 226, 0.1); }
.icon-button:active, .btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(180deg, var(--cyan), var(--cyan-deep));
    border-color: transparent;
    color: #04222a;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.btn-primary:hover { background: linear-gradient(180deg, #5ff5ef, var(--cyan)); border-color: transparent; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }

.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(239, 68, 68, 0.5); color: #fecaca; background: rgba(239, 68, 68, 0.12); }
.btn-danger:hover { border-color: var(--danger); background: rgba(239, 68, 68, 0.2); }

:is(.btn, .icon-button, a, button, input, select):focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- screens */

main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.7rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cyan);
    text-shadow: 0 0 22px rgba(29, 233, 226, 0.35);
}

h2 { margin: 0 0 6px; font-size: 1.02rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); }
h3 { margin: 14px 0 4px; font-size: 0.95rem; letter-spacing: 0.04em; color: var(--cyan); }

.tagline { margin: 0; color: var(--muted); max-width: 62ch; }
.tagline em { color: var(--gold); font-style: normal; }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.menu-card, .menu-foot {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(14, 33, 48, 0.7), rgba(5, 11, 16, 0.7));
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.field small { color: var(--muted); opacity: 0.75; }

input[type="text"], select {
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(5, 11, 16, 0.85);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 11px;
}
input[type="text"]:focus, select:focus { border-color: var(--cyan); outline: none; }

.note { margin: 0; font-size: 0.84rem; color: var(--muted); }
.note[data-tone="warn"] { color: var(--gold); }
.note[data-tone="ok"] { color: var(--cyan); }

.rules-list { margin: 0; padding-left: 1.15rem; color: var(--muted); font-size: 0.92rem; display: grid; gap: 6px; }
.rules-list strong { color: var(--text); }
.rules-list em { color: var(--cyan); font-style: normal; }

kbd {
    font-family: var(--mono);
    font-size: 0.74rem;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 6px;
    background: rgba(14, 33, 48, 0.9);
    color: var(--text);
}

/* ---------------------------------------------------------------- queue */

.queue-status { margin: 0; font-size: 1.05rem; color: var(--text); }
.queue-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- match */

.screen-match { gap: 10px; }

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(10, 23, 35, 0.85);
    padding: 8px 12px;
}

.side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-gold { justify-content: flex-end; text-align: right; }
.side-name {
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 22ch;
}
.side-cyan .side-name { color: var(--cyan); }
.side-gold .side-name { color: var(--gold); }

.bars { display: inline-flex; gap: 4px; }
.side-gold .bars { flex-direction: row-reverse; }

.bar {
    width: 22px;
    height: 10px;
    border-radius: 3px;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}
.side-cyan .bar { color: var(--cyan); }
.side-gold .bar { color: var(--gold); }
.bar.is-spent { background: rgba(148, 163, 184, 0.18); box-shadow: none; color: transparent; }

.goals { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.goals b { color: var(--text); font-family: var(--mono); }

.clock-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clock { font-family: var(--mono); font-size: 1.35rem; letter-spacing: 0.06em; color: var(--text); }

.phase-banner {
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cyan);
    text-align: center;
}
.phase-banner[hidden] { display: none; }
.phase-banner[data-tone="hot"] { color: var(--hot); }
.phase-banner[data-tone="warn"] { color: var(--gold); }

.court-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: min(62vh, 520px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--void);
}

#court { display: block; width: 100%; height: 100%; }

.net-stats {
    position: absolute;
    right: 10px;
    bottom: 8px;
    margin: 0;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    color: rgba(148, 163, 184, 0.75);
    pointer-events: none;
}

.match-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 8px;
}
.controls-hint { margin: 0; font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- touch */

.touch-controls {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px 22px;
    pointer-events: none;
    z-index: 5;
}
.touch-controls[hidden] { display: none; }

.touch-stick, .touch-button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }

.touch-stick {
    --knob-x: 0px;
    --knob-y: 0px;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    border: 1px solid rgba(29, 233, 226, 0.45);
    background: radial-gradient(circle at 50% 50%, rgba(29, 233, 226, 0.12), rgba(5, 11, 16, 0.6));
    display: grid;
    place-items: center;
}
.touch-stick.is-live { border-color: var(--cyan); }

.touch-stick .knob {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(29, 233, 226, 0.35);
    border: 1px solid var(--cyan);
    transform: translate(var(--knob-x), var(--knob-y));
}

.touch-button {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 1px solid rgba(250, 204, 21, 0.55);
    background: radial-gradient(circle at 50% 40%, rgba(250, 204, 21, 0.28), rgba(5, 11, 16, 0.7));
    color: var(--gold);
    font-family: var(--font);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.2;
}
.touch-button.is-live { background: radial-gradient(circle at 50% 40%, rgba(250, 204, 21, 0.55), rgba(5, 11, 16, 0.7)); }

/* ---------------------------------------------------------------- result */

#resultTitle[data-outcome="win"] { color: var(--cyan); }
#resultTitle[data-outcome="loss"] { color: var(--hot); }
#resultTitle[data-outcome="draw"] { color: var(--gold); }

.result-detail { margin: 0; font-size: 1.05rem; }
.result-stats { margin: 0; font-family: var(--mono); font-size: 0.86rem; color: var(--muted); }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- dialog */

dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    max-width: min(680px, 92vw);
    padding: 20px;
    font-family: var(--font);
}
dialog::backdrop { background: rgba(5, 11, 16, 0.78); }
dialog p { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; }
dialog ul { margin: 0 0 8px; padding-left: 1.15rem; color: var(--muted); font-size: 0.92rem; }
dialog form { margin-top: 14px; }

.swatch { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 3px; vertical-align: -0.05em; }
.swatch-cyan { background: var(--cyan); }
.swatch-gold { background: var(--gold); }

/* ---------------------------------------------------------------- chrome */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.page-foot {
    border-top: 1px solid var(--line);
    margin-top: 10px;
    padding: 12px 4px 18px;
    color: var(--muted);
    font-size: 0.8rem;
}
.page-foot p { margin: 0; }
.page-foot a { color: var(--cyan); }

/* ---------------------------------------------------------------- small */

@media (max-width: 720px) {
    .scoreboard { grid-template-columns: 1fr auto 1fr; padding: 6px 8px; gap: 6px; }
    .side-name { font-size: 0.74rem; max-width: 12ch; }
    .goals { display: none; }
    .bar { width: 15px; height: 8px; }
    .clock { font-size: 1.05rem; }
    .controls-hint { display: none; }
    .court-wrap { min-height: 52vh; }
    .brand-copy small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
