/* TriviaTron: provisional neon-on-dark identity (PLAN.md §13: the final palette and symbols are still open). */

:root {
    --bg: #0b0d1a;
    --bg-2: #10132a;
    --surface: #161a36;
    --surface-2: #1d2246;
    --border: #2a3066;
    --text: #eef0ff;
    --muted: #9aa1cf;
    --primary: #22d3ee;      /* cyan */
    --primary-ink: #04212a;
    --accent: #f472b6;       /* magenta */
    --accent-ink: #2a0618;
    --ok: #34d399;
    --warn: #fbbf24;
    --error: #f87171;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 10px 40px rgba(0, 0, 0, .35);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
    margin: 0;
    min-height: 100dvh;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(244, 114, 182, .12), transparent 60%),
        radial-gradient(1000px 600px at -10% 10%, rgba(34, 211, 238, .12), transparent 60%),
        var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
}

a { color: var(--primary); }
a:hover { color: #67e8f9; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .15em 0; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- Top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem max(1.25rem, env(safe-area-inset-right)) .75rem max(1.25rem, env(safe-area-inset-left));
    border-bottom: 1px solid rgba(42, 48, 102, .6);
    background: rgba(11, 13, 26, .7);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: .01em;
}
.brand b { color: var(--primary); font-weight: 800; }
.brand:hover { color: var(--text); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.topbar-link { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topbar-link:hover { color: var(--text); }

@media (max-width: 560px) {
    .topbar-link[href="/join"] { display: none; }
}

/* Account menu */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--bg);
    font-weight: 800;
    font-size: .85rem;
}
.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .4rem;
    display: flex;
    flex-direction: column;
}
.menu-head { padding: .5rem .65rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; display: flex; flex-direction: column; }
.menu-head .muted { font-size: .8rem; }
.menu-panel a, .menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: .5rem .65rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font: inherit;
    font-size: .95rem;
    background: none;
    border: 0;
    cursor: pointer;
}
.menu-panel a:hover, .menu-item:hover { background: var(--surface-2); }
.menu-panel form { margin: 0; }

/* ---------- Layout ---------- */

.page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.4rem; }

.empty-state { text-align: center; padding: 4rem 1rem; max-width: 520px; margin: 0 auto; }
.empty-code { font-size: 4rem; font-weight: 900; margin: 0; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Buttons and forms ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.15rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(1.1); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 0 24px rgba(34, 211, 238, .25); }
.btn-primary:hover { color: var(--primary-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 24px rgba(244, 114, 182, .25); }
.btn-accent:hover { color: var(--accent-ink); }
.btn-sm { padding: .4rem .8rem; font-size: .9rem; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1.1rem; border-radius: 12px; }
.btn-block { width: 100%; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small { font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input:not([type]), input[inputmode] {
    width: 100%;
    padding: .7rem .85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 211, 238, .25); }
input[readonly] { color: var(--muted); }
.check { display: flex; align-items: center; gap: .55rem; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.pill { display: inline-block; padding: .2rem .7rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .85rem; }

.notice { padding: .75rem 1rem; border-radius: 10px; border: 1px solid; margin: 0 0 1rem; }
.notice-ok { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .1); }
.notice-warn { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .1); }
.notice-error { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }

/* ---------- Auth pages ---------- */

.auth-page { display: grid; place-items: start center; padding: 3rem 1rem 4rem; }
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.6rem; }
.auth-foot { margin: 1rem 0 0; text-align: center; font-size: .95rem; }

/* ---------- PIN entry ---------- */

.pin-input {
    text-align: center;
    font-size: 1.9rem !important;
    font-weight: 800;
    letter-spacing: .18em;
    padding: .8rem !important;
    border-width: 2px !important;
}
.pin-input::placeholder { letter-spacing: .02em; font-weight: 600; color: #5d6496; }

/* ---------- Landing ---------- */

.landing { max-width: 1100px; margin: 0 auto; padding: 3rem 1.25rem 5rem; }
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center; min-height: 52vh; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.02em; }
.glow { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 36rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.join-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow), 0 0 60px rgba(244, 114, 182, .1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.join-card h2 { margin: 0; text-align: center; font-size: 1.4rem; }
.join-card p { margin: 0; text-align: center; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 4rem; }
.feature { background: rgba(22, 26, 54, .6); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.4rem; }
.feature p { color: var(--muted); margin: 0; }

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 2rem; min-height: 0; }
    .features { grid-template-columns: 1fr; margin-top: 2.5rem; }
    .landing { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
