/*
  Game look for member pages (MainLayout adds .game-ui): deep blue lobby, yellow accents and the
  dark ink outlines of the 3D figures. Staff pages never carry .game-ui and stay untouched.
  Lilita One: SIL Open Font License, see ../fonts/OFL.txt; self-hosted, no font CDN (plan §0).
*/
@font-face {
    font-family: 'Lilita One';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/lilita-one-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Lilita One';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/lilita-one-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.game-ui {
    --sf-ink: #0C0A1C;
    --sf-panel: #1B2752;
    --sf-accent: #FFD84D;
    --sf-muted: #AAB4E0;
    --sf-display: 'Lilita One', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: #F4F6FF;
    background-color: #101A3A;
    /* A dot grid and two soft glows instead of a flat color, like a game lobby. */
    background-image:
        radial-gradient(rgba(244, 246, 255, 0.07) 1.2px, transparent 1.4px),
        radial-gradient(circle at 15% 0%, rgba(45, 212, 191, 0.22), transparent 45%),
        radial-gradient(circle at 95% 35%, rgba(244, 114, 182, 0.16), transparent 40%);
    background-size: 20px 20px, 100% 100%, 100% 100%;
}

/* Header with the wordmark in the figures' style: yellow fill, ink outline. It scrolls away
   with the page: on a phone the room is worth more than a logo. */
.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 58px;
    padding-top: env(safe-area-inset-top);
    box-sizing: content-box;
}

.game-logo {
    font-family: var(--sf-display);
    font-size: 2rem;
    letter-spacing: .02em;
    color: var(--sf-accent);
    text-decoration: none;
    -webkit-text-stroke: 2px var(--sf-ink);
    paint-order: stroke fill;
    text-shadow: 0 3px 0 var(--sf-ink);
}

.game-main {
    padding-bottom: 24px;
}

.game-main.with-nav {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

/* Bottom navigation. */
.game-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px max(8px, calc((100% - 600px) / 2)) calc(8px + env(safe-area-inset-bottom));
    background: var(--sf-panel);
    border-top: 3px solid var(--sf-ink);
}

.game-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border: 2px solid transparent;
    border-radius: 14px;
    color: var(--sf-muted);
    text-decoration: none;
    font-family: var(--sf-display);
    font-size: .9rem;
    letter-spacing: .02em;
}

.game-nav-item.active {
    color: var(--sf-ink);
    background: var(--sf-accent);
    border-color: var(--sf-ink);
    box-shadow: 0 3px 0 var(--sf-ink);
}

/* Panels, buttons and chips with ink outlines and a hard drop shadow. */
.game-ui .mud-paper-outlined,
.game-ui .mud-card,
.game-ui .mud-paper.mud-elevation-2 {
    border: 3px solid var(--sf-ink);
    border-radius: 18px;
    box-shadow: 0 5px 0 var(--sf-ink);
}

.game-ui .mud-button-filled {
    border: 3px solid var(--sf-ink);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--sf-ink);
}

.game-ui .mud-button-filled:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--sf-ink);
}

.game-ui .mud-button-filled.mud-button-filled-size-large {
    font-size: 1.2rem;
    padding: 8px 22px;
}

.game-ui .mud-button-outlined {
    border-width: 3px;
    border-radius: 14px;
}

.game-ui .mud-chip {
    border: 2px solid var(--sf-ink);
    font-weight: 700;
}

/* Round portraits get the ink ring of the figures. */
.game-ui .sfida-avatar-portrait {
    border: 2px solid var(--sf-ink);
}

/* Home: the figure on its stage next to the greeting, energy and badges. */
.game-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.game-hero-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-hero .sfida-avatar-figure.with-background,
.game-stage .sfida-avatar-figure.with-background {
    border: 3px solid var(--sf-ink);
    box-shadow: 0 5px 0 var(--sf-ink);
}

.energy-bar {
    position: relative;
    height: 28px;
    border: 3px solid var(--sf-ink);
    border-radius: 14px;
    background: rgba(12, 10, 28, 0.55);
    box-shadow: 0 3px 0 var(--sf-ink);
    overflow: hidden;
}

.energy-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, #FFD84D, #FB923C);
    transition: width .8s ease-out;
}

.energy-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: var(--sf-display);
    font-size: 1.05rem;
    color: #FFFFFF;
    -webkit-text-stroke: 3px var(--sf-ink);
    paint-order: stroke fill;
}

.energy-label .mud-icon-root {
    color: var(--sf-accent);
    filter: drop-shadow(0 0 1px var(--sf-ink)) drop-shadow(0 0 1px var(--sf-ink));
}

.game-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.game-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 10px 2px 7px;
    border: 2px solid var(--sf-ink);
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--sf-ink);
    font-family: var(--sf-display);
    font-size: .95rem;
    letter-spacing: .02em;
    color: var(--sf-ink);
    text-decoration: none;
}

.game-badge .mud-icon-root {
    font-size: 1.15rem;
}

.game-badge.points { background: #FFD84D; }
.game-badge.streak { background: #FB923C; }
.game-badge.rank { background: #2DD4BF; }

/* Podium: a spotlight behind the winners, blocks with ink outlines. */
.game-ui .sfida-podium {
    padding-top: 10px;
    border-radius: 18px;
    background: radial-gradient(ellipse at 50% 80%, rgba(255, 216, 77, 0.32), transparent 65%);
}

.game-ui .sfida-podium-block {
    border: 3px solid var(--sf-ink);
    box-shadow: 0 4px 0 var(--sf-ink);
    font-family: var(--sf-display);
    font-weight: 400;
    font-size: 1.9rem;
    color: var(--sf-ink);
}

/* A row of figures greeting members on the sign-in and join pages. */
.game-lineup {
    display: flex;
    justify-content: center;
    margin: 6px 0 16px;
}

.game-lineup .sfida-avatar-portrait {
    margin-left: -12px;
    border: 3px solid var(--sf-ink);
    box-shadow: 0 3px 0 var(--sf-ink);
}

.game-lineup .sfida-avatar-portrait:first-child {
    margin-left: 0;
}

/* Toasts and dialogs live outside .game-ui (MudBlazor providers), hence :has(). Toasts float
   above the bottom navigation, as wide as the screen allows. */
body:has(.game-nav) .mud-snackbar-location-bottom-center {
    left: 16px;
    right: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body:has(.game-ui) .mud-snackbar,
body:has(.game-ui) .mud-dialog {
    border: 3px solid #0C0A1C;
    border-radius: 18px;
    box-shadow: 0 5px 0 #0C0A1C;
}

/* Confetti when a challenge is handed in; off with reduced motion. */
.game-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.game-confetti i {
    position: absolute;
    top: -12px;
    width: 9px;
    height: 14px;
    border: 1.5px solid var(--sf-ink);
    border-radius: 2px;
    animation: game-confetti-fall 1.4s ease-in forwards;
}

@keyframes game-confetti-fall {
    to {
        transform: translateY(260px) rotate(540deg);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-confetti {
        display: none;
    }

    .energy-fill {
        transition: none;
    }
}
