/* Family Games: shared styles for phone and TV pages. Dark theme to match the 3D board. */
:root {
    --bg: #070b14;
    --bg-2: #0b1120;
    --panel: rgba(15, 23, 42, 0.78);
    --panel-solid: #0f172a;
    --line: rgba(100, 116, 139, 0.35);
    --line-strong: rgba(148, 163, 184, 0.5);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --faint: #64748b;
    --x: #ff5a5f;
    --o: #00e5ff;
    --accent: #00e5ff;
    --gold: #fbbf24;
    --ok: #34d399;
    --warn: #f59e0b;
    --danger: #f87171;
    --radius: 18px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: radial-gradient(ellipse at 50% 0%, #111c33 0%, var(--bg) 70%) fixed, var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--line-strong);
    background: rgba(30, 41, 59, 0.85);
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 600;
    min-height: 48px;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: #04121a; border-color: transparent; }
.btn.gold { background: var(--gold); color: #1a1204; border-color: transparent; }
.btn.danger { border-color: rgba(248, 113, 113, .5); color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; border-radius: 11px; font-size: 14px; }
.btn.block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select {
    width: 100%;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 17px;
    min-height: 48px;
    outline: none;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 229, 255, .18); }
.code-input { text-transform: uppercase; letter-spacing: .4em; font-family: var(--mono); font-size: 28px; text-align: center; font-weight: 700; }

.error { color: #fecaca; background: rgba(127, 29, 29, .35); border: 1px solid rgba(248, 113, 113, .4); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.45; }

.avatar-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.avatar-btn { font-size: 22px; aspect-ratio: 1; min-width: 0; border-radius: 10px; border: 2px solid transparent; background: rgba(30, 41, 59, .7); padding: 0; }
.avatar-btn.on { border-color: var(--accent); background: rgba(0, 229, 255, .12); }

.player-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(30, 41, 59, .55); border: 1px solid var(--line); }
.player-chip .av { font-size: 26px; line-height: 1; }
.player-chip .nm { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip.offline { opacity: .45; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(251, 191, 36, .15); color: var(--gold); border: 1px solid rgba(251, 191, 36, .35); }
.tag.cyan { background: rgba(0, 229, 255, .12); color: var(--o); border-color: rgba(0, 229, 255, .35); }
.tag.dim { background: rgba(100, 116, 139, .15); color: var(--muted); border-color: var(--line); }

/* Connection banner */
.conn-banner {
    position: fixed; left: 50%; top: 10px; transform: translateX(-50%);
    z-index: 100; padding: 8px 14px; border-radius: 999px;
    background: rgba(120, 53, 15, .92); border: 1px solid rgba(245, 158, 11, .6); color: #fde68a;
    font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center;
}
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: absolute; left: 50%; top: 84px; transform: translate(-50%, -8px);
    z-index: 30; pointer-events: none; opacity: 0; transition: opacity .3s, transform .3s;
    display: flex; align-items: center; gap: 12px; max-width: min(92vw, 520px);
    background: rgba(15, 23, 42, .92); border: 1px solid rgba(251, 191, 36, .4); border-radius: 18px; padding: 10px 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(251, 191, 36, .18); border: 1px solid rgba(251, 191, 36, .5); font-size: 18px; }
.toast-title { font-weight: 700; font-size: 15px; }
.toast-sub { color: #cbd5e1; font-size: 13px; }

/* Segmented control (camera presets / layer slices) */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; }
.seg button { border: 0; background: transparent; color: #cbd5e1; padding: 8px 11px; border-radius: 10px; font-size: 13px; font-weight: 600; min-width: 40px; min-height: 36px; }
.seg button.on { background: var(--accent); color: #04121a; }

/* Seat cards (TV and phone HUD) */
.seat { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(15, 23, 42, .7); min-width: 0; transition: border-color .2s, box-shadow .2s; }
.seat .mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-family: var(--mono); flex: none; }
.seat.x .mark { background: rgba(255, 90, 95, .18); color: var(--x); border: 1px solid rgba(255, 90, 95, .5); }
.seat.o .mark { background: rgba(0, 229, 255, .14); color: var(--o); border: 1px solid rgba(0, 229, 255, .5); }
.seat.x.turn { border-color: var(--x); box-shadow: 0 0 0 2px rgba(255, 90, 95, .25), 0 0 30px rgba(255, 90, 95, .25); }
.seat.o.turn { border-color: var(--o); box-shadow: 0 0 0 2px rgba(0, 229, 255, .25), 0 0 30px rgba(0, 229, 255, .25); }
.seat .who { min-width: 0; }
.seat .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .sub { font-size: 12px; color: var(--muted); }
.seat .score { font-family: var(--mono); font-weight: 800; font-size: 20px; margin-left: auto; padding-left: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid; }
.badge.good { background: rgba(16, 185, 129, .15); border-color: rgba(52, 211, 153, .45); color: #6ee7b7; }
.badge.warn { background: rgba(245, 158, 11, .15); border-color: rgba(251, 191, 36, .5); color: #fcd34d; }

.board-host { position: absolute; inset: 0; }
.board-host canvas { display: block; touch-action: none; }
