/* Pong — dumbshit.app */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #09090b;
    --bg-2: #18181b;
    --bg-3: #27272a;
    --border: #3f3f46;
    --text: #fafafa;
    --text-dim: #a1a1aa;
    --text-mute: #71717a;
    --accent: #10b981;
    --accent-hov: #34d399;
    --warn: #fbbf24;
    --danger: #ef4444;
    --court: #050507;
    --line: #fafafa;
}

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: contain;
}
.hidden { display: none !important; }

/* --- topbar --- */
.topbar {
    padding: 24px 24px 8px;
    max-width: 1200px;
    margin: 0 auto;
}
.back {
    color: var(--text-mute);
    text-decoration: none;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
}
.back:hover { color: var(--text); }
.topbar h1 {
    margin: 12px 0 4px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.02em;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.topbar .sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 15px;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 40px;
}

/* --- generic screen card --- */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 520px;
    margin: 0 auto;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.lbl {
    font-family: ui-monospace, monospace;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--text-mute);
}
input[type=text], input[type=email] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    padding: 11px 14px;
    width: 100%;
    transition: border-color 0.15s;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }

/* tabs + panes */
.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--bg);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 14px;
}
.tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--accent); color: var(--bg); }
.pane { min-height: 80px; }

.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none; margin-bottom: 14px; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.chk:hover { color: var(--text); }

.lobby-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: var(--text-mute); margin-bottom: 8px;
}
.lobby-head .dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 999px;
    background: var(--accent); margin-left: 6px;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.count { font-family: ui-monospace, monospace; color: var(--text); }

.lobby-list {
    list-style: none; padding: 0; margin: 0;
    max-height: 280px; overflow-y: auto;
}
.lobby-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
    background: var(--bg);
}
.lobby-list li.empty {
    color: var(--text-mute); justify-content: center; font-style: italic;
}
.lobby-row-name { font-weight: 600; }
.lobby-row-age { font-size: 11px; color: var(--text-mute); font-family: ui-monospace, monospace; margin-left: 8px; }
.lobby-row-mid { flex: 1; min-width: 0; }

/* --- buttons --- */
.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-3);
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    width: 100%;
    margin-bottom: 8px;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); border-color: var(--accent-hov); }
.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    width: 100%;
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }

/* --- waiting screen --- */
.join-sub { color: var(--text-dim); font-size: 14px; margin-top: 0; }
.join-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: #fecaca;
    font-size: 13px;
    line-height: 1.4;
}
#waitingTitle { margin: 8px 0 4px; font-size: 22px; }
.hint { color: var(--text-mute); font-size: 13px; margin: 0 0 14px; }
.share-row { display: flex; gap: 6px; margin-bottom: 16px; }
.share-row input { font-family: ui-monospace, monospace; font-size: 12px; }
.share-row .btn { flex-shrink: 0; }
.waiting-status {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-dim); font-size: 13px;
    padding: 12px 14px;
    background: var(--bg); border-radius: 8px;
    margin-bottom: 16px;
    font-family: ui-monospace, monospace;
}
.pulse {
    width: 10px; height: 10px; border-radius: 999px; background: var(--accent);
    animation: pulse 1.4s ease-in-out infinite;
}
.konami-flag {
    margin: 16px 0 0; padding: 8px 10px;
    border: 1px dashed var(--warn);
    border-radius: 8px;
    color: var(--warn);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    text-align: center;
    animation: pulse 2s ease-in-out infinite;
}

/* --- game shell --- */
.game-shell {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    align-items: start;
}
.court-wrap {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    position: relative;
}

/* HUD */
.hud {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-family: ui-monospace, monospace;
}
.hud-side { font-size: 13px; }
.hud-side.end { text-align: right; }
.alias { font-weight: 700; color: var(--text); }
.score {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    text-align: center;
    line-height: 1;
}
.score .dash { color: var(--text-mute); margin: 0 12px; }
.score-num { display: inline-block; transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1); }
.score-num.bumped { transform: scale(1.5); color: var(--accent); }

/* canvas — CRT scanlines via gradient overlay */
canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 800 / 500;
    background: var(--court);
    border-radius: 6px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
    cursor: crosshair;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.6);
}
canvas:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.court-wrap::after {
    content: '';
    position: absolute;
    inset: 12px;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.025) 0px,
        rgba(255,255,255,0.025) 1px,
        transparent 1px,
        transparent 3px
    );
    border-radius: 6px;
    mix-blend-mode: lighten;
}

.court-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: var(--text-mute);
    font-family: ui-monospace, monospace;
    font-size: 11px;
}
.ping { letter-spacing: 0.04em; }
.court-hint { text-align: right; flex: 1; }
.mute-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    width: 32px; height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.12s;
}
.mute-btn:hover { background: var(--bg-3); }
.mute-btn.is-muted { color: var(--text-mute); }

/* overlays */
.overlay {
    position: absolute;
    inset: 12px;
    border-radius: 6px;
    background: rgba(9, 9, 11, 0.88);
    display: grid;
    place-items: center;
    z-index: 10;
    animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    text-align: center;
    max-width: 360px;
}
.overlay-eyebrow {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.overlay-card h2 { margin: 0 0 8px; font-size: 26px; }
.overlay-score {
    font-family: ui-monospace, monospace;
    font-size: 28px;
    color: var(--accent);
    margin: 0 0 18px;
    letter-spacing: 0.04em;
}
.overlay-actions { display: flex; gap: 8px; flex-direction: column; }

/* chat panel styles live in /assets/css/chat.css (shared with other games) */

/* responsive */
@media (max-width: 900px) {
    .game-shell { grid-template-columns: 1fr; }
    .chat-panel { height: 240px; }
}

/* --- foot --- */
.foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    color: var(--text-mute);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
}
.bmc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-mute);
    text-decoration: none;
    transition: color 0.15s;
}
.bmc-link:hover { color: #FFDD00; }
