:root {
    --ui-bg-0: #0f1220;
    --ui-bg-1: #151a2e;
    --ui-bg-2: #1b2240;
    --ui-border: #37406a;
    --ui-border-strong: #4d5aa3;
    --ui-text: #eef2ff;
    --ui-text-muted: #aab3d9;
    --ui-accent: #6c7dff;
    --ui-accent-2: #7fddff;
    --ui-danger: #ff6b6b;
    --ui-warn: #ffb454;
    --ui-success: #6be7a8;
    --ui-radius: 14px;
    --ui-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    --ui-display-font: "Segoe UI", "Trebuchet MS", "Verdana", sans-serif;
}

/* Dark theme (default) */
:root[data-theme="dark"],
:root {
    --ui-bg-0: #0f1220;
    --ui-bg-1: #151a2e;
    --ui-bg-2: #1b2240;
    --ui-border: #37406a;
    --ui-border-strong: #4d5aa3;
    --ui-text: #eef2ff;
    --ui-text-muted: #aab3d9;
}

/* Light theme */
:root[data-theme="light"] {
    --ui-bg-0: #f5f7fa;
    --ui-bg-1: #ffffff;
    --ui-bg-2: #f0f3f7;
    --ui-border: #d0d8e8;
    --ui-border-strong: #b8c5e0;
    --ui-text: #1a2540;
    --ui-text-muted: #5a6b8f;
}

.ui-panel {
    background: linear-gradient(180deg, var(--ui-bg-1), var(--ui-bg-0));
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.ui-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--ui-border);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem 0.65rem;
    font-weight: 700;
}

.ui-btn-primary {
    border: 1px solid transparent;
    border-radius: 12px;
    background: linear-gradient(180deg, #7f8eff, #5f70f3);
    color: white;
    font-weight: 800;
    letter-spacing: 0.02em;
    transition: transform 120ms ease, filter 120ms ease;
}

.ui-btn-primary:hover {
    filter: brightness(1.06);
}

.ui-btn-primary:active {
    transform: translateY(1px) scale(0.995);
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    /* dvh accounts for mobile browser chrome (address bar, etc.) */
    height: 100dvh;
    overflow: hidden;
    background: var(--ui-bg-0);
    color: var(--ui-text);
}

.game-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* ── Game HUD — top bar ──────────────────────────── */

.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    height: 44px;
    flex-shrink: 0;
    background: var(--ui-bg-1);
    border-bottom: 1px solid var(--ui-border);
    gap: 0.5rem;
}

.game-hud--game {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
}

.hud-btn {
    background: none;
    border: none;
    color: var(--ui-text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.hud-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.hud-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.hud-level {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--ui-text-muted);
    text-transform: uppercase;
}

.hud-timer {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #ffd166;
}

.hud-hint-btn--active {
    color: #ffd700;
    font-weight: 700;
    cursor: pointer;
    transition: filter 100ms ease;
}

.hud-hint-btn--active:hover {
    filter: brightness(1.15);
}

.hud-hint-btn--cooldown {
    color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

/* ── Home / start screen ──────────────────────────── */

.home-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

.home-shell--game {
    background:
        radial-gradient(circle at 20% 10%, rgba(127, 142, 255, 0.2), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(127, 221, 255, 0.15), transparent 28%);
}

.home-card {
    width: min(640px, 100%);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    background: var(--ui-bg-1);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.home-hero {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--ui-border);
}

.home-title {
    margin: 0 0 0.25rem 0;
    font-family: var(--ui-display-font);
    font-size: 2.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--ui-text);
}

.home-title:focus,
.home-title:focus-visible,
.home-hero:focus,
.home-hero:focus-visible {
    outline: none;
    box-shadow: none;
}

.home-hero *:focus,
.home-hero *:focus-visible {
    outline: none;
    box-shadow: none;
}

.home-subtitle {
    margin: 0 0 1rem 0;
    color: var(--ui-text-muted);
}

.home-group {
    margin: 0 0 0.85rem 0;
    background: var(--ui-bg-0);
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    padding: 0.75rem;
}

.home-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--ui-text-muted);
}

.home-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.home-radio-row .home-radio-label {
    flex: 1;
    min-width: 150px;
}

.home-radio-col {
    display: grid;
    gap: 0.45rem;
}

.home-radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    font-family: var(--ui-display-font);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    user-select: none;
    background: var(--ui-bg-2);
    color: var(--ui-text);
    transition: all 0.15s ease;
}

.home-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.home-radio-label.selected {
    border-width: 2px;
    border-color: var(--ui-border-strong);
    background: rgba(108, 125, 255, 0.2);
}

.home-select {
    width: 100%;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    background: var(--ui-bg-0);
    color: var(--ui-text);
    padding: 0.5rem 0.55rem;
    font-size: 0.95rem;
}

.home-mode-hint {
    margin: 0.35rem 0 0.85rem;
    color: var(--ui-text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.home-start-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    background: #5b6dee;
    color: #fff;
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.04s ease;
}

.home-start-btn:hover {
    background: #7382f3;
}

.home-start-btn:active {
    transform: translateY(1px);
}

.game-secondary-btn {
    background: var(--ui-bg-2);
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
}

.game-secondary-btn:hover {
    background: var(--ui-bg-1);
}

/* Home theme toggle button */
.home-theme-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.home-theme-btn:hover {
    transform: scale(1.1);
}

.home-theme-btn:active {
    transform: scale(0.95);
}

/* Back link shown on /practice */
.home-back-link {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--ui-text);
    text-decoration: none;
    font-family: var(--ui-display-font);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.6rem;
}

.home-back-link:hover {
    border-color: var(--ui-border-strong);
    background: rgba(108, 125, 255, 0.2);
}

/* ── Main menu + placeholder pages ─────────────────── */

.menu-shell,
.placeholder-shell {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background:
        radial-gradient(circle at 20% 10%, rgba(127, 142, 255, 0.2), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(127, 221, 255, 0.15), transparent 28%);
}

.menu-card,
.placeholder-card {
    width: min(640px, 100%);
    background: var(--ui-bg-1);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.menu-hero,
.placeholder-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--ui-border);
}

.menu-title {
    margin: 0;
    font-family: var(--ui-display-font);
    font-size: 2.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--ui-text);
    text-align: center;
    position: relative;
    z-index: 2;
}

.menu-logo {
    display: block;
    width: min(340px, 82vw);
    height: auto;
    position: relative;
    z-index: 2;
}

.menu-subtitle,
.placeholder-header p,
.placeholder-note {
    margin: 0;
    color: var(--ui-text-muted);
}

.menu-title-wrap {
    position: relative;
    width: fit-content;
    margin: 0 auto 0.7rem;
    padding: 0.6rem 1.1rem;
}

.menu-logo-orbit {
    position: absolute;
    inset: -120px -190px;
    z-index: 3;
    pointer-events: none;
}

.menu-note {
    position: absolute;
    left: 50%;
    top: 50%;
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 10px rgba(127, 221, 255, 0.35);
    animation-name: var(--orbit-animation, note-orbit);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-duration: var(--orbit-duration, 12s);
    animation-delay: var(--orbit-delay, 0s);
}

@keyframes note-orbit {
    from {
        transform: translate(-50%, -50%) rotate(var(--orbit-start, 0deg)) translateX(var(--orbit-radius, 110px));
    }
    to {
        transform: translate(-50%, -50%) rotate(calc(var(--orbit-start, 0deg) + 360deg)) translateX(var(--orbit-radius, 110px));
    }
}

@keyframes note-orbit-reverse {
    from {
        transform: translate(-50%, -50%) rotate(var(--orbit-start, 0deg)) translateX(var(--orbit-radius, 110px));
    }
    to {
        transform: translate(-50%, -50%) rotate(calc(var(--orbit-start, 0deg) - 360deg)) translateX(var(--orbit-radius, 110px));
    }
}

.menu-note--1  { color: #7fddff; --orbit-start: 5deg;   --orbit-radius: 98px;  --orbit-duration: 7.8s;  --orbit-delay: -1.2s; --orbit-animation: note-orbit; }
.menu-note--2  { color: #7da2ff; --orbit-start: 58deg;  --orbit-radius: 204px; --orbit-duration: 21.6s; --orbit-delay: -3.9s; --orbit-animation: note-orbit-reverse; }
.menu-note--3  { color: #8ef0bf; --orbit-start: 96deg;  --orbit-radius: 142px; --orbit-duration: 10.6s; --orbit-delay: -6.4s; --orbit-animation: note-orbit; }
.menu-note--4  { color: #ffc67d; --orbit-start: 141deg; --orbit-radius: 185px; --orbit-duration: 18.2s; --orbit-delay: -0.8s; --orbit-animation: note-orbit-reverse; }
.menu-note--5  { color: #7fddff; --orbit-start: 182deg; --orbit-radius: 113px; --orbit-duration: 8.9s;  --orbit-delay: -4.2s; --orbit-animation: note-orbit; }
.menu-note--6  { color: #7da2ff; --orbit-start: 221deg; --orbit-radius: 166px; --orbit-duration: 15.1s; --orbit-delay: -2.3s; --orbit-animation: note-orbit-reverse; }
.menu-note--7  { color: #8ef0bf; --orbit-start: 257deg; --orbit-radius: 127px; --orbit-duration: 12.0s; --orbit-delay: -7.1s; --orbit-animation: note-orbit; }
.menu-note--8  { color: #ffc67d; --orbit-start: 289deg; --orbit-radius: 194px; --orbit-duration: 19.3s; --orbit-delay: -5.0s; --orbit-animation: note-orbit-reverse; }
.menu-note--9  { color: #7fddff; --orbit-start: 322deg; --orbit-radius: 151px; --orbit-duration: 13.4s; --orbit-delay: -8.2s; --orbit-animation: note-orbit; }
.menu-note--10 { color: #7da2ff; --orbit-start: 348deg; --orbit-radius: 175px; --orbit-duration: 16.8s; --orbit-delay: -1.6s; --orbit-animation: note-orbit-reverse; }

.menu-actions,
.placeholder-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.menu-feedback-link {
    border: 1px solid var(--ui-border);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-text-muted);
    font-family: var(--ui-display-font);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.menu-feedback-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.menu-feedback-link:hover {
    border-color: var(--ui-border-strong);
    background: rgba(108, 125, 255, 0.2);
    color: var(--ui-text);
}

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.placeholder-block,
.repertoire-reco {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    padding: 0.75rem;
}

.placeholder-block h2,
.repertoire-reco h2,
.placeholder-header h1 {
    margin: 0 0 0.35rem 0;
    color: var(--ui-text);
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-bg-2);
    color: var(--ui-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.75rem 1rem;
    transition: background 0.15s ease, transform 0.04s ease;
}

.menu-btn:hover {
    background: #7382f3;
    color: #fff;
    text-decoration: none;
}

.menu-btn:active {
    transform: translateY(1px);
}

.repertoire-tag {
    display: inline-flex;
    margin-bottom: 0.45rem;
    border: 1px solid var(--ui-border-strong);
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    color: var(--ui-text);
    font-size: 0.72rem;
    font-weight: 700;
}

.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.55rem;
    color: var(--ui-text);
    font-weight: 700;
}

.settings-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* ── Timed countdown (above staff) ─────────────────── */

.timed-countdown-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.35rem;
    margin-bottom: 0.5rem;
}

.timed-countdown {
    min-width: 116px;
    text-align: center;
    font-size: clamp(2.4rem, 7.8vw, 3.8rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.95rem 0.4rem;
    border-radius: 16px;
    border: 2px solid transparent;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
    animation: countdown-bounce 1s ease-in-out infinite;
}

.timed-countdown--game {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 10px 22px rgba(0, 0, 0, 0.35);
}

.timed-countdown--normal {
    --bounce-height: 4px;
    --bounce-scale: 1.025;
    color: #d9e1ff;
    border-color: #4c5bb8;
    background: rgba(76, 91, 184, 0.22);
    box-shadow: 0 0 12px rgba(76, 91, 184, 0.3);
}

.timed-countdown--warning {
    --bounce-height: 8px;
    --bounce-scale: 1.05;
    color: #ffe4b5;
    border-color: #d08a2a;
    background: rgba(208, 138, 42, 0.25);
    box-shadow: 0 0 16px rgba(208, 138, 42, 0.35);
}

.timed-countdown--critical {
    --bounce-height: 13px;
    --bounce-scale: 1.1;
    color: #ffd2d2;
    border-color: #d14848;
    background: rgba(209, 72, 72, 0.28);
    box-shadow: 0 0 18px rgba(209, 72, 72, 0.42);
}

@keyframes countdown-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    32% {
        transform: translateY(calc(-1 * var(--bounce-height))) scale(var(--bounce-scale));
    }
    58% {
        transform: translateY(0) scale(0.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .timed-countdown,
    .hud-streak--active,
    .ui-btn-primary {
        animation: none !important;
        transition: none !important;
    }
}

/* ── Timed summary overlay ─────────────────────────── */

.timed-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.timed-overlay--game {
    background: radial-gradient(circle at center, rgba(23, 27, 50, 0.62), rgba(5, 7, 14, 0.8));
}

.timed-summary-card {
    width: min(420px, 100%);
    background: var(--ui-bg-1);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    color: var(--ui-text);
}

.timed-summary-title {
    margin: 0 0 0.85rem 0;
    font-size: 1.2rem;
}

.timed-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}

.timed-summary-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ui-border);
    border-radius: 9px;
    padding: 0.55rem 0.6rem;
}

.timed-summary-actions {
    display: grid;
    gap: 0.55rem;
}

.timed-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ui-text-muted);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

    .game-playfield {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 0.65rem;
        padding: 0.65rem;
        min-height: 0;
        flex: 1;
    }

    .game-stats-bar {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .game-health {
        position: relative;
        width: 100%;
        max-width: 540px;
        border: 1px solid var(--ui-border);
        border-radius: 5px;
        background: var(--ui-bg-1);
        padding: 0.5rem 0.6rem 0.6rem;
        overflow: visible;
    }

    .game-health-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.35rem;
        font-size: 0.78rem;
        color: var(--ui-text-muted);
    }

    .game-health-meta strong {
        color: var(--ui-text);
        font-size: 0.83rem;
    }

    .game-health-track {
        position: relative;
        height: 30px;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid var(--ui-border);
        border-radius: 5px;
        overflow: visible;
    }

    .game-health-fill {
        height: 100%;
        border-radius: 4px;
        background: linear-gradient(90deg, #53d66e 0%, #8be94c 55%, #d3f572 100%);
        transition: width 240ms ease, filter 200ms ease;
    }

    .game-health--minimal .game-health-meta {
        display: none;
    }

    .game-health--minimal {
        padding-top: 0.55rem;
    }

    .game-health--minimal .game-health-fill {
        transition: width 120ms linear, filter 160ms ease;
    }

    .game-health--damage .game-health-fill {
        filter: saturate(1.25) brightness(0.9);
    }

    .game-health--recover .game-health-fill {
        filter: brightness(1.15);
    }

    .game-health--damage {
        animation: health-shake 500ms ease-in-out;
    }

    .game-health--recover {
        animation: health-recover-pulse 320ms ease-out;
    }

    .game-health-particles {
        position: absolute;
        inset: -2px 0 0 0;
        pointer-events: none;
    }

    .game-health-particle {
        position: absolute;
        top: 12px;
        width: 5px;
        height: 5px;
        border-radius: 2px;
        background: #ff967a;
        box-shadow: 0 0 8px rgba(255, 150, 122, 0.7);
        animation: health-particle-fly 1800ms cubic-bezier(0.16, 0.59, 0.2, 1) forwards;
    }

    @keyframes health-shake {
        0%, 100% { transform: translateX(0); }
        20% { transform: translateX(-2px); }
        40% { transform: translateX(2px); }
        60% { transform: translateX(-1.5px); }
        80% { transform: translateX(1px); }
    }

    @keyframes health-recover-pulse {
        0% { box-shadow: 0 0 0 rgba(118, 255, 130, 0); }
        35% { box-shadow: 0 0 22px rgba(118, 255, 130, 0.4); }
        100% { box-shadow: 0 0 0 rgba(118, 255, 130, 0); }
    }

    @keyframes health-particle-fly {
        0% {
            transform: translate(0, 0) scale(1);
            opacity: 1;
        }
        55% {
            transform: translate(var(--dx), var(--dy)) scale(0.9);
            opacity: 0.95;
        }
        100% {
            transform: translate(calc(var(--dx) * 1.15), calc(var(--dy) + var(--drop))) scale(0.35);
            opacity: 0;
        }
    }

    /* ── Staff SVG component ─────────────────────────── */

    .staff-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
        gap: 0.75rem;
    flex: 1;
    padding: 1rem;
}

.staff-note-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.staff-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.staff-footer {
    width: 100%;
    display: flex;
    justify-content: center;
}

.staff-footer-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--ui-text-muted);
    opacity: 0.85;
}

.game-metric {
    justify-content: center;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--ui-text-muted);
}

.game-metric strong {
    color: var(--ui-text);
    font-size: 0.95rem;
}

    /* Hint button below the staff */
    .hint-btn {
        padding: 0.75rem 1.5rem;
        border: 2px solid #ffd700;
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
        color: #ffd700;
        font-weight: 700;
        font-size: 1rem;
        letter-spacing: 0.05em;
        cursor: pointer;
        transition: all 150ms ease;
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    }

    .hint-btn:hover:not(:disabled) {
        background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.15));
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
        transform: translateY(-2px);
    }

    .hint-btn:active:not(:disabled) {
        transform: translateY(0);
    }

    .hint-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        border-color: #666;
        color: #666;
        box-shadow: 0 0 4px rgba(100, 100, 100, 0.2);
    }

.staff-svg {
    width: 100%;
    max-width: 520px;
    display: block;
    overflow: visible; /* allow ledger lines to render outside viewBox if needed */
}

.staff-line,
.ledger-line {
    stroke: var(--ui-text);
    stroke-width: 1.5;
    stroke-linecap: square;
}

.clef-symbol {
    fill: var(--ui-text);
    /* Music symbols: Segoe UI Symbol (Win), Apple Symbols (Mac), Noto Music (Linux/Android) */
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Music', 'FreeSerif', serif;
}

.treble-clef {
    font-size: 75px;
}

.bass-clef {
    font-size: 36px;
}

.key-sig-symbol {
    fill: var(--ui-text);
    font-size: 14px;
    font-family: 'Segoe UI Symbol', 'Apple Symbols', serif;
    text-anchor: middle;
    dominant-baseline: middle;
}

.note-head {
    fill: var(--ui-text);
}

.inline-accidental {
    fill: var(--ui-text);
    font-size: 13px;
    font-family: 'Segoe UI Symbol', 'Apple Symbols', serif;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* ── Piano Keyboard component ────────────────────── */

.keyboard-area {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 0.5rem 0;
}

.staff-area--game,
.keyboard-area--game {
    border-color: var(--ui-border);
    background: var(--ui-bg-0);
}

/* Horizontally scrollable container for the keyboard */
.keyboard-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    margin: 0 auto;
    /* Hide scrollbar on browsers that support it but keep functionality */
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
    -webkit-overflow-scrolling: touch;
}

.keyboard-wrapper::-webkit-scrollbar { height: 4px; }
.keyboard-wrapper::-webkit-scrollbar-track { background: transparent; }
.keyboard-wrapper::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

/* Inner keyboard fills wrapper width; height set via inline style */
.keyboard {
    display: block;
    position: relative;
    width: 100%;
    box-sizing: content-box;
}

/* ── Individual keys ── */
.piano-key {
    position: absolute;
    top: 0;
    cursor: pointer;
    border-radius: 0 0 5px 5px;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.06s ease;
}

.piano-key.white {
    /* Width fills an equal share of the keyboard: 100% / number-of-white-keys */
    width: calc(100% / var(--wk));
    height: 130px;
    background: #f4efe6;
    border: 1px solid #7a6e5f;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 6px;
}

.piano-key.white:active {
    background: #d8d0c4;
}

.piano-key.black {
    /* Black keys are ~55% the width of a white key (closer to real piano proportions).
       Narrower = less overlap onto adjacent white keys, improving click accuracy. */
    width: calc(100% * 0.55 / var(--wk));
    height: 82px;
    background: #1e1a14;
    border: 1px solid #000;
    border-top: none;
    z-index: 2;
}

.piano-key.black:active {
    background: #3a3228;
}

/* Octave label on C keys */
.c-label {
    font-size: 9px;
    color: #7a6e5f;
    font-family: 'Helvetica Neue', sans-serif;
    letter-spacing: 0;
    line-height: 1;
}

/* ── Highlight states ── */

/* Correct: stays green until parent clears it */
.piano-key.correct {
    background: #2e7d32 !important;
}

.piano-key.white.correct:active,
.piano-key.black.correct:active {
    background: #1b5e20 !important;
}

/* Hint: yellow with glow effect */
.piano-key.hint {
    background: #ffd700 !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), inset 0 0 6px rgba(255, 255, 255, 0.3) !important;
}

.piano-key.white.hint {
    color: #1a1a1a;
}

.piano-key.white.hint:active,
.piano-key.black.hint:active {
    background: #ffed4e !important;
    box-shadow: 0 0 16px rgba(255, 215, 0, 1), inset 0 0 8px rgba(255, 255, 255, 0.4) !important;
}

/* Wrong: red flash that auto-returns to normal colour after 0.6 s.
   No persistent background set on .wrong itself so the animation
   end-frame reverts to the .white / .black colour automatically. */
.piano-key.white.wrong {
    animation: wrong-flash-white 0.6s ease;
}

.piano-key.black.wrong {
    animation: wrong-flash-black 0.6s ease;
}

@keyframes wrong-flash-white {
    0%   { background: #c62828; }
    60%  { background: #c62828; }
    100% { background: #f4efe6; }
}

@keyframes wrong-flash-black {
    0%   { background: #c62828; }
    60%  { background: #c62828; }
    100% { background: #1e1a14; }
}

.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;
}

/* ── Level-up banner ─────────────────────────────── */

/* Centred overlay banner that pops up briefly when difficulty advances */
.levelup-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: var(--ui-bg-1);
    border: 2px solid var(--ui-border-strong);
    border-radius: 16px;
    padding: 1.25rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    pointer-events: none;
    animation: levelup-pop 1.8s ease forwards;
}

.levelup-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.levelup-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ui-text);
    letter-spacing: 0.04em;
}

@keyframes levelup-pop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    12%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    20%  { transform: translate(-50%, -50%) scale(1); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ── Settings drawer ─────────────────────────────── */

/* Full-screen clickable overlay behind the drawer */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
}

/* The drawer itself — slides in from the left */
.settings-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(360px, 100vw);
    height: 100vh;
    background: linear-gradient(180deg, var(--ui-bg-1), var(--ui-bg-0));
    border-right: 1px solid var(--ui-border);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.settings-drawer--open {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 48px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--ui-border);
}

.settings-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--ui-text);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-close-btn {
    background: none;
    border: none;
    color: var(--ui-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.settings-close-btn:hover {
    color: var(--ui-text);
    background: var(--ui-border);
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-border) transparent;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: none;
    margin: 0;
    padding: 0;
}

.settings-drawer .settings-group {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.settings-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.settings-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ui-text-muted);
}

.settings-select {
    background: var(--ui-bg-0);
    border: 1px solid var(--ui-border);
    border-radius: 6px;
    color: var(--ui-text);
    font-size: 0.9rem;
    padding: 0.45rem 0.6rem;
    width: 100%;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.15s ease;
}

.settings-select:focus {
    outline: none;
    border-color: var(--ui-border-strong);
}

.settings-radio-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.settings-radio-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.settings-radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    font-family: var(--ui-display-font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ui-text);
    cursor: pointer;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--ui-border);
    border-radius: 6px;
    transition: background 0.1s, border-color 0.1s;
    flex: 1;
    min-width: max-content;
    user-select: none;
    background: var(--ui-bg-2);
}

.settings-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-radio-label.selected,
.settings-radio-label:has(input:checked) {
    border-width: 2px;
    border-color: var(--ui-border-strong);
    background: rgba(121, 134, 203, 0.12);
    color: var(--ui-text);
}

.settings-hint {
    font-size: 0.78rem;
    color: var(--ui-text-muted);
    margin: 0;
    line-height: 1.4;
}

.settings-footer {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--ui-border);
    flex-shrink: 0;
}

.settings-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.settings-btn--primary {
    background: var(--ui-accent);
    color: #fff;
}

.settings-btn--primary:hover {
    background: var(--ui-border-strong);
}

.settings-btn--secondary {
    background: var(--ui-bg-2);
    color: var(--ui-text-muted);
    border: 1px solid var(--ui-border);
}

.settings-btn--secondary:hover {
    background: var(--ui-bg-1);
    color: var(--ui-text);
}
/* ── Portrait rotate prompt ──────────────────────── */

/* Hidden by default and in landscape; shown only in portrait on small screens */
.portrait-prompt {
    display: none;
}

@media (orientation: portrait) and (max-device-width: 900px) {
    .portrait-prompt {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(10, 10, 26, 0.96);
        align-items: center;
        justify-content: center;
        padding: 2rem;
    }
}

/* When explicitly dismissed, hide regardless of orientation */
.portrait-prompt--dismissed {
    display: none !important;
}

.portrait-prompt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    max-width: 300px;
}

.portrait-prompt-icon {
    font-size: 4rem;
    color: var(--ui-border-strong);
    animation: rotate-hint 2s ease-in-out infinite;
    display: inline-block;
    line-height: 1;
}

@keyframes rotate-hint {
    0%   { transform: rotate(0deg);   }
    40%  { transform: rotate(90deg);  }
    60%  { transform: rotate(90deg);  }
    100% { transform: rotate(0deg);   }
}

.portrait-prompt-text {
    font-size: 1.05rem;
    color: var(--ui-text);
    line-height: 1.5;
    margin: 0;
}

.portrait-prompt-btn {
    background: none;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    color: var(--ui-text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.portrait-prompt-btn:hover {
    color: var(--ui-text);
    border-color: var(--ui-border-strong);
}

/* ── Responsive polish ───────────────────────────── */

/* Tighten padding on compact landscape phones (height < 420px) */
@media (max-height: 420px) {
    .staff-area {
        padding: 0.25rem 0.5rem;
    }

    .game-hud {
        height: 36px;
    }

    .keyboard-area {
        padding-bottom: 0.15rem;
    }

    .game-metric {
        font-size: 0.8rem;
    }
}

/* On very narrow screens, shrink HUD stats gap */
@media (max-width: 360px) {
    .game-stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-metric {
        font-size: 0.76rem;
    }
}

@media (max-width: 600px) {
    .staff-area--game {
        min-height: clamp(280px, 44vh, 360px);
    }

    .staff-svg {
        transform: scaleX(0.94);
        transform-origin: center top;
    }

    .menu-actions,
    .placeholder-actions,
    .placeholder-grid {
        grid-template-columns: 1fr;
    }

    .menu-title-wrap {
        padding: 0.5rem 0.7rem;
    }

    .menu-logo-orbit {
        inset: -94px -124px;
    }

    .menu-note {
        width: 40px;
        height: 40px;
        font-size: 1.82rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Statistics Page
   ═════════════════════════════════════════════════════════════════════════ */

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.stats-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: var(--ui-bg-0);
}

.main-content {
    flex: 1;
    padding: 2rem;
    background: radial-gradient(circle at top, rgba(127, 142, 255, 0.1), transparent 38%), var(--ui-bg-0);
}

.stats-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    margin: 0.7rem 0.7rem 0;
    border-color: rgba(126, 144, 255, 0.4);
}

.stats-brand {
    color: var(--ui-text);
    text-decoration: none;
    font-family: var(--ui-display-font);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.stats-nav-links {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.stats-nav-link {
    color: var(--ui-text);
    text-decoration: none;
    font-family: var(--ui-display-font);
    font-size: 0.95rem;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 0.38rem 0.72rem;
    background: rgba(255, 255, 255, 0.02);
}

.stats-nav-link:hover {
    border-color: #5e6dd4;
    background: rgba(108, 125, 255, 0.13);
    color: #f2f4ff;
}

.stats-nav-link.is-active {
    border-color: #7382f3;
    background: rgba(115, 130, 243, 0.2);
}

.statistics-container {
    max-width: 1200px;
    margin: 0 auto;
}

.statistics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.statistics-header h1 {
    font-family: var(--ui-display-font);
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--ui-text);
    margin: 0;
}

.stats-clear-btn {
    border: 2px solid #c45161;
    border-radius: 10px;
    background: rgba(196, 81, 97, 0.2);
    color: #ffdce2;
    font-family: var(--ui-display-font);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
}

[data-theme="light"] .stats-clear-btn {
    background: #c45161;
    color: #fff;
    border-color: #a83650;
}

.stats-clear-btn:hover {
    background: rgba(196, 81, 97, 0.28);
}

[data-theme="light"] .stats-clear-btn:hover {
    background: #a83650;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(180deg, var(--ui-bg-1), var(--ui-bg-0));
    border: 1px solid rgba(126, 144, 255, 0.35);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.36);
}

.stats-table-wrap {
    text-align: left;
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ui-text);
    margin-bottom: 0.6rem;
}

.stats-table th,
.stats-table td {
    border-bottom: 1px solid var(--ui-border);
    padding: 0.45rem 0.4rem;
    font-size: 0.9rem;
}

.stats-table th {
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: var(--ui-text-muted);
}

.stat-value {
    font-size: 3rem;
    font-family: var(--ui-display-font);
    font-weight: 800;
    color: var(--ui-accent-2);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ui-text);
    margin-bottom: 0.5rem;
}

.stat-detail {
    font-size: 0.9rem;
    color: var(--ui-text-muted);
}

.stats-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 18, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 140;
}

.stats-modal-card {
    width: min(460px, 100%);
    border-color: rgba(126, 144, 255, 0.45);
    padding: 0.95rem;
}

.stats-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.stats-modal-title {
    margin: 0;
    font-family: var(--ui-display-font);
    font-size: 1.25rem;
    color: var(--ui-text);
}

.stats-modal-close {
    border: 1px solid #475082;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--ui-text);
    width: 2rem;
    height: 2rem;
    cursor: pointer;
}

.stats-modal-body {
    margin: 0.9rem 0;
    color: var(--ui-text-muted);
    line-height: 1.45;
}

.stats-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.stats-modal-btn {
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-family: var(--ui-display-font);
    font-weight: 700;
    cursor: pointer;
}

.stats-modal-btn--secondary {
    border-color: #49537f;
    background: rgba(255, 255, 255, 0.05);
    color: #dce2ff;
}

.stats-modal-btn--danger {
    border-color: #c45161;
    background: rgba(196, 81, 97, 0.22);
    color: #ffdce2;
}

.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 230;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(7, 10, 20, 0.72);
}

.feedback-modal-card {
    width: min(520px, 100%);
    border-color: rgba(126, 144, 255, 0.4);
    box-sizing: border-box;
    padding: 1rem;
}

.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.feedback-title {
    margin: 0;
    font-family: var(--ui-display-font);
    font-size: 1.35rem;
}

.feedback-copy {
    margin: 0.7rem 0 0.95rem;
    color: var(--ui-text-muted);
}

.feedback-close-btn {
    border: 1px solid #475082;
    border-radius: 8px;
    width: 2rem;
    height: 2rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-text);
    font-size: 1.1rem;
    cursor: pointer;
}

.feedback-field {
    margin-bottom: 0.8rem;
}

.feedback-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
    color: var(--ui-text);
}

.feedback-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-text);
    padding: 0.55rem 0.65rem;
    font: inherit;
}

.feedback-select-wrap {
    position: relative;
}

.feedback-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.45rem;
}

.feedback-select::-ms-expand {
    display: none;
}

.feedback-select-chevron {
    position: absolute;
    right: 0.95rem;
    top: 50%;
    width: 0.62rem;
    height: 0.62rem;
    border-right: 2px solid var(--ui-text-muted);
    border-bottom: 2px solid var(--ui-text-muted);
    transform: translateY(-64%) rotate(45deg);
    transform-origin: center;
    transition: transform 180ms ease, border-color 180ms ease;
    pointer-events: none;
}

.feedback-select-wrap.is-open .feedback-select-chevron {
    transform: translateY(-36%) rotate(-135deg);
    border-color: var(--ui-text);
}

.feedback-textarea {
    min-height: 120px;
    resize: vertical;
}

.feedback-error,
.feedback-submit-error {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: #ff8c9b;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 1rem;
}

.feedback-btn {
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 0.48rem 0.85rem;
    font-family: var(--ui-display-font);
    font-weight: 700;
    cursor: pointer;
}

.feedback-btn--secondary {
    border-color: #49537f;
    background: rgba(255, 255, 255, 0.04);
    color: #dce2ff;
}

.feedback-btn--primary {
    border-color: #6c7dff;
    background: linear-gradient(135deg, #6c7dff, #63b8ff);
    color: #fff;
}

.feedback-btn:disabled,
.feedback-close-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.feedback-success {
    text-align: center;
    padding: 0.25rem 0.25rem 0.15rem;
}

.feedback-success-image {
    width: min(220px, 60vw);
    height: auto;
    display: block;
    margin: 0 auto 0.75rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .statistics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .statistics-header h1 {
        font-size: 1.8rem;
    }

    .statistics-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .main-content {
        padding: 1rem;
    }
}

/* HUD Stats Button hover effect */
.hud-btn:hover:not(:disabled) {
    color: var(--ui-text);
    transform: scale(1.1);
    transition: color 0.2s, transform 0.2s;
}

.hud-stats-btn {
    margin-left: 0.5rem;
}

.analytics-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 20, 0.72);
    z-index: 240;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.analytics-consent-card {
    width: min(680px, 100%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
}

.analytics-consent-card h2 {
    margin: 0;
    font-size: 1.35rem;
}

.analytics-consent-card p {
    margin: 0;
    color: var(--ui-text-muted);
}

.analytics-consent-detail {
    font-size: 0.95rem;
}

.analytics-consent-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.analytics-consent-options label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--ui-text);
}

.analytics-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.analytics-consent-details {
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.55rem 0.7rem;
}

.analytics-consent-details summary {
    cursor: pointer;
    color: var(--ui-text);
    font-weight: 600;
}

.analytics-consent-preview-wrap {
    margin-top: 0.6rem;
}

.analytics-consent-table {
    font-size: 0.82rem;
}

.analytics-consent-table th,
.analytics-consent-table td {
    white-space: nowrap;
}

.analytics-consent-details--nested {
    margin-top: 0.7rem;
}

.analytics-consent-json {
    margin: 0.6rem 0 0;
    padding: 0.75rem;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    max-height: 220px;
    overflow: auto;
    background: #111827;
    color: #d1d5db;
    font-size: 0.75rem;
}
