/* Shared foundation: tokens, reset, buttons, answer tiles, dark "stage" theme. */

:root {
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: ui-rounded, "SF Pro Rounded", var(--font);

    --brand: #ffcc00;
    --brand-strong: #f5b400;
    --brand-ink: #1d1600;

    --ans-red: #e5484d;
    --ans-blue: #3e63dd;
    --ans-yellow: #f5a623;
    --ans-green: #2f9e66;

    --ok: #30a46c;
    --bad: #e5484d;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    font-family: var(--font);
    line-height: 1.4;
}

img,
video {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

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

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.65em 1.2em;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    background: rgba(127, 127, 127, 0.16);
    transition: transform 0.15s var(--ease), background-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand);
    color: var(--brand-ink);
    box-shadow: 0 4px 0 var(--brand-strong), 0 8px 20px rgba(255, 204, 0, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: #ffd633;
}

.btn-dark {
    background: #1f2233;
    color: #fff;
}

.btn-danger {
    background: var(--bad);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    box-shadow: inset 0 0 0 2px currentColor;
}

.btn-lg {
    font-size: 1.15rem;
    padding: 0.8em 1.8em;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background: rgba(127, 127, 127, 0.18);
}

/* ---------- Dark stage theme (host, player, results) ---------- */

.theme-stage {
    min-height: 100vh;
    min-height: 100dvh;
    color: #f5f6fb;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(120, 90, 255, 0.35), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(0, 200, 190, 0.25), transparent 60%),
        radial-gradient(800px 600px at 50% 120%, rgba(255, 204, 0, 0.16), transparent 60%),
        #0e1022;
    background-attachment: fixed;
}

.glass {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.eyebrow {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.7;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.35em 0.9em;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--brand);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Answer tiles (host + player) ---------- */

.answer-tile {
    --tile: var(--ans-red);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 4.5rem;
    padding: 0.9rem 1.1rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--tile);
    color: #fff;
    font-weight: 700;
    text-align: left;
    box-shadow: 0 5px 0 color-mix(in srgb, var(--tile) 70%, #000), 0 12px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s var(--ease), opacity 0.3s, filter 0.3s;
    overflow-wrap: anywhere;
}

.answer-tile.red {
    --tile: var(--ans-red);
}

.answer-tile.blue {
    --tile: var(--ans-blue);
}

.answer-tile.yellow {
    --tile: var(--ans-yellow);
}

.answer-tile.green {
    --tile: var(--ans-green);
}

.answer-letter {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
}

.answer-tile.is-correct::after,
.answer-tile.is-wrong::after {
    margin-left: auto;
    font-size: 1.6rem;
}

.answer-tile.is-correct::after {
    content: "✓";
}

.answer-tile.is-wrong {
    opacity: 0.35;
    filter: saturate(0.4);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
