:root {
    /* Backgrounds, from the landing page's night-sky hero */
    --color-bg-deep: #050d18;
    --color-bg-mid: #0a1d33;
    --color-bg-glow: #123a5e;

    /* Cool accent, from the globe artwork's ocean */
    --color-ocean-light: #9be8ff;
    --color-ocean: #2ea7d8;
    --color-ocean-dark: #0b5c85;

    /* Warm accent, from the "Globalissimo" title */
    --color-gold: #ffd23f;
    --color-orange: #ff8a00;
    --color-red: #e63946;
    --color-red-deep: #6b1414;
    --color-danger: #ff8a8a;

    --color-text: #ffffff;

    /* Status green — deliberately distinct from --player-2's darker green
       (#008300), which already failed as a *text* color against this app's
       background when player names were being colored; this one is lighter
       and picked specifically to read well as text. Not a player identity
       color, so it can't be confused with one. */
    --color-success: #4ade80;

    /* Player identity colors, one per join slot (Player 1 = first to join, etc.).
       Fixed order, never reassigned/cycled — validated categorical palette
       (dataviz skill), checked against this app's actual dark background. */
    --player-1: #3987e5; /* blue */
    --player-2: #008300; /* green */
    --player-3: #d55181; /* magenta */
    --player-4: #c98500; /* yellow */
    --player-5: #199e70; /* aqua */
    --player-6: #d95926; /* orange */

    /* Reusable gradients built from the palette above */
    --gradient-bg: radial-gradient(circle at 50% 28%, var(--color-bg-glow) 0%, var(--color-bg-mid) 55%, var(--color-bg-deep) 100%);
    --gradient-title: linear-gradient(180deg, var(--color-gold) 0%, var(--color-orange) 45%, var(--color-red) 100%);
    --gradient-warm: linear-gradient(135deg, var(--color-orange), var(--color-red));
    --gradient-cool: linear-gradient(135deg, var(--color-ocean), var(--color-ocean-dark));

    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.35);
    --shadow-soft-hover: 0 12px 26px rgba(0, 0, 0, 0.45);
    --radius-pill: 999px;
}

html {
    /* Always reserve the scrollbar's space, whether or not it's needed —
       otherwise a page that's a hair taller than the viewport pops the
       scrollbar in and the layout visibly shifts by its width. */
    scrollbar-gutter: stable;
}

html, body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background:
        radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 255, 255, 0.65) 50%, transparent 51%),
        radial-gradient(1px 1px at 26% 68%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 72% 14%, rgba(255, 255, 255, 0.55) 50%, transparent 51%),
        radial-gradient(1px 1px at 88% 42%, rgba(255, 255, 255, 0.45) 50%, transparent 51%),
        radial-gradient(1px 1px at 58% 82%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 15% 88%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 92% 78%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
        var(--gradient-bg);
    background-attachment: fixed;
}

a {
    color: var(--color-ocean-light);
}

/* Pure opacity, deliberately no transform/translate: a transformed element's
   shifted box still counts toward the ancestor's scrollable overflow, so a
   translateY here was flashing a vertical scrollbar on every page switch. */
@keyframes app-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Shared page-level shell: every page's root renders inside one of these,
   so navigation reads as swapping content rather than loading a new page. */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 2.5rem 1.25rem 3rem;
    text-align: center;
    color: var(--color-text);
    animation: app-fade-in 0.3s ease;
}

.panel {
    width: 100%;
    max-width: 26rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
}

.panel.wide {
    max-width: 34rem;
}

/* Wider variant for shared-screen (TV/monitor) Display pages. Fixed frame size
   (not content-driven) so every Display page reads as the same "screen",
   regardless of how much content it holds — content scrolls inside if it
   doesn't fit, rather than growing/shrinking the frame. */
.stage {
    box-sizing: border-box;
    /* Positioning context for floating overlays (e.g. a corner badge) that
       should stay pinned to the visible viewport, not scroll with content. */
    position: relative;
    width: 80vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.5rem;
    padding: clamp(1.5rem, 3vw, 4rem);
    box-shadow: var(--shadow-soft);
}

/* Row of toggle buttons for a page-level setting (game mode, category count
   bucket, etc.) — unlike .cta-row this doesn't stretch buttons to fill width,
   just lays them out with a gap and lets them wrap on narrow screens. */
.settings-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.demo-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-gold);
    background: rgba(255, 210, 63, 0.12);
    border: 1px solid rgba(255, 210, 63, 0.35);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.9rem;
    margin-bottom: 0.5rem;
}

/* .choice-grid / .choice-card / .flag-wrap / .flag-overlay / .pick-coin now
   live in Components/Shared/ChoiceGrid.razor.css and ChoiceCard.razor.css.
   .choice-flag / .choice-icon stay here (global) since they style content
   supplied by callers via ChoiceCard's ChildContent, not markup the shared
   component itself authors — Blazor CSS isolation only scopes elements a
   component's own .razor file writes. */
.choice-icon {
    width: clamp(3.5rem, 7vw, 6.5rem);
    height: clamp(3.5rem, 7vw, 6.5rem);
}

.choice-flag {
    width: clamp(4rem, 8vw, 10rem);
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-soft);
}

/* Bootstrap's default .text-muted is too dim against this dark theme */
.text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Buttons */
.btn-pill {
    display: inline-block;
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.9rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Flag-only variant of .btn-pill (e.g. language picker) — tighter padding,
   sized to frame the flag image rather than a text label. */
.flag-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.1rem;
}

.flag-pill img {
    display: block;
    width: 2.5rem;
    height: auto;
    border-radius: 3px;
}

/* Row of buttons sitting side by side (e.g. an action + a "Next" nav button).
   flex:1 lives here, scoped to buttons inside a row — NOT on .btn-pill itself,
   since flex:1 means something different (and wrong) inside a vertical .view. */
.cta-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 22rem;
}

.cta-row > .btn-pill {
    flex: 1;
}

@media (min-width: 560px) {
    .cta-row {
        flex-direction: row;
        max-width: 30rem;
    }
}

.btn-pill:hover,
.btn-pill:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft-hover);
}

.btn-pill:active {
    transform: translateY(0);
}

.btn-pill:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-pill.warm {
    background: var(--gradient-warm);
}

.btn-pill.cool {
    background: var(--gradient-cool);
}

.btn-pill.ghost {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: none;
}

.btn-pill.ghost:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-pill.ghost-danger {
    background: transparent;
    border: 2px solid rgba(230, 57, 70, 0.6);
    color: var(--color-danger);
    box-shadow: none;
}

.btn-pill.ghost-danger:hover {
    background: rgba(230, 57, 70, 0.12);
}

/* Text inputs */
.field-pill {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-pill);
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    font-size: 1.05rem;
}

.field-pill::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.field-pill:focus {
    outline: none;
    border-color: var(--color-ocean);
    background: rgba(255, 255, 255, 0.14);
}

.field-error {
    color: var(--color-danger);
    font-weight: 600;
    margin: 0;
}

/* Inline notices/banners */
.notice {
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 210, 63, 0.12);
    border: 1px solid rgba(255, 210, 63, 0.35);
    color: var(--color-gold);
}

/* Player/participant lists */
.item-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.item-list li {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5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z48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
