@font-face {
    font-family: 'Elves Delight';
    src: url('assets/fonts/cf-elves-delight-demo.regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #eef2f7;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --success: #15803d;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --warning: #d97706;
    --text: #111827;
    --muted-text: #7C7C7C;
    --card: #fcfdff;
    --border-color: #cbd5e1;
    --surface-muted: #e2e8f0;
    --surface-dark: #18181b;
    --surface-dark-card: #27272a;
    --focus-ring: #0f172a;
    --sudden-death-bg: #120d13;
    --sudden-death-surface: #1f1822;
    --sudden-death-text: #f8fafc;
    --sudden-death-muted: #d1d5db;
    --sudden-death-accent: #ef4444;
    --sudden-death-accent-strong: #dc2626;
    --sudden-death-accent-border: rgba(239, 68, 68, 0.72);
    --sudden-death-accent-glow: rgba(239, 68, 68, 0.45);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --control-round-size: 3rem;
    --control-round-icon-size: 1.25rem;
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.1);
    --shadow-interactive: 0 12px 24px rgba(29, 78, 216, 0.14);
    --transition-fast: 160ms ease;
    --transition-medium: 240ms cubic-bezier(0.22, 1, 0.36, 1);
    --font-stack: 'Google Sans', sans-serif;
}

* {
    box-sizing: border-box;
    touch-action: manipulation;
    letter-spacing: inherit;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-stack);
    background: var(--bg-color);
    color: var(--text);
    letter-spacing: 0.08em;

    /* Use dynamic viewport height units for better mobile browser support */
    height: 100vh;
    height: 100dvh;

    overflow: hidden;

    display: flex;
    justify-content: center;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Layout & Screens
   ========================================================================== */

.screen {
    display: none;
    flex-direction: column;

    width: 100%;
    max-width: 500px;
    height: 100%;

    /*
        Safe-area padding:
        - Keep a minimum padding for content breathing room
        - Respect notches/home-indicators using env(safe-area-inset-*)
    */
    padding: 20px;
    padding-top: max(30px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));

    /* Alignment */
    align-items: center;
    justify-content: center; /* Default vertical centering */

    background: var(--bg-color);
    text-align: center;

    position: absolute;
    top: 0;

    /* If content is too tall, allow scrolling instead of clipping */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: flex;
    animation: fadein 0.3s;
}

.screen > * {
    max-width: 100%;
    min-width: 0;
}

@keyframes fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1.logo {
    font-size: 3rem;
    font-family: 'Geom', sans-serif;
    color: var(--primary);
    margin-bottom: 0.2rem;
    display: inline-flex;
    align-items: flex-start;
    gap: 0;
    line-height: 1;
}

.quiz-logo {
    display: inline-flex;
    align-items: flex-start;
    gap: 0;
}

.quiz-logo-q {
    width: 1.5em;
    height: 1.5em;
    object-fit: contain;
    align-self: flex-start;
    transform: none;
    margin-right: -0.1em;
}

h2 {
    color: var(--text);
    margin: 0 0 20px 0;
    font-size: clamp(1.65rem, 2vw + 1rem, 2rem);
    line-height: 1.1;
}

.subtitle {
    color: var(--muted-text);
    margin-bottom: 40px;
}

.big-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.gold {
    color: var(--warning);
}

.logo-suffix {
    color: var(--muted-text);
    line-height: 1;
}

#screen-menu {
    --menu-main-max-width: 100%;
}

.home-screen-logo {
    align-self: center;
    width: calc(var(--menu-main-max-width) * 0.75);
    max-width: calc(var(--menu-main-max-width) * 0.75);
    height: auto;
    display: block;
    margin: 0 0 2.4rem;
    object-fit: contain;
}

.maria-logo {
    display: none;
    --maria-logo-max-width: 260px;
    max-width: var(--maria-logo-max-width);
    width: 80%;
    height: auto;
    margin-bottom: 0.2rem;
}

.maria-subtitle {
    display: none;
}


body[data-secret-accent="maria"] h1.logo {
    display: none;
}

body[data-secret-accent="maria"] .subtitle:not(.maria-subtitle) {
    display: none;
}

body[data-secret-accent="maria"] .maria-subtitle {
    display: block;
}

body[data-secret-accent="maria"] .maria-logo {
    display: block;
}

body[data-secret-accent="maria"] .footer-egg {
    display: none;
}

.maria-bottom-img {
    display: none;
}

body[data-secret-accent="maria"] #screen-menu {
    padding-bottom: calc(env(safe-area-inset-bottom) + 210px);
}

body[data-secret-accent="maria"] .maria-bottom-img {
    display: block;
    position: absolute;
    bottom: env(safe-area-inset-bottom);
    left: 20px;
    right: 20px;
    width: calc(100% - 40px);
    max-width: 460px;
    height: 200px;
    margin-inline: auto;
    object-fit: contain;
    object-position: bottom center;
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button {
    border: none;
    border-radius: var(--radius-pill);

    padding: 15px 30px;

    font-size: 1.1rem;
    font-weight: bold;

    cursor: pointer;
    margin: 10px 0;
    width: 100%;

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-medium),
        background-color var(--transition-medium),
        border-color var(--transition-medium),
        color var(--transition-medium);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    /* Prevent buttons from getting squashed in flex layouts */
    flex-shrink: 0;
}

button i,
.cat-btn i,
.rule-item i,
.q-badge i,
.btn-nav-round i,
.btn-small-top-left i {
    flex-shrink: 0;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.menu-primary-action {
    position: relative;
    width: 100%;
    max-width: var(--menu-main-max-width);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-primary-action > button {
    margin: 10px 0;
}

#menu-start-button {
    border: 2px solid var(--primary-dark);
}

.resume-banner {
    width: 100%;
    background: var(--card);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    animation: fadein 0.3s;
}

.resume-banner.hidden {
    display: none;
}

.resume-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.resume-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.resume-teams {
    font-size: 0.9rem;
    color: var(--muted-text);
    margin: 0;
    font-weight: 600;
}

.resume-score {
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-pill);
    padding: 1px 8px;
}

.resume-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.resume-btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.9rem;
    padding: 10px 12px;
}

.resume-banner .btn-primary.resume-btn {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.resume-banner .btn-danger.resume-btn {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    box-shadow: none;
}

.ntina-button-lizard {
    position: absolute;
    top: -36px;
    left: 14px;
    width: 78px;
    height: auto;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 3px 3px rgba(15, 23, 42, 0.42));
    transform: rotate(0deg);
    transition: opacity 180ms ease;
}

body[data-secret-accent="ntina"] .ntina-button-lizard {
    opacity: 1;
}

.ntina-custom-lizard {
    position: absolute;
    top: -22px;
    right: 24px;
    width: 58.5px;
    height: auto;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 3px 3px rgba(15, 23, 42, 0.42));
    transform: scaleX(-1) rotate(0deg);
    transition: opacity 180ms ease;
}

body[data-secret-accent="ntina"] .ntina-custom-lizard {
    opacity: 1;
}


.ntina-rules-lizard {
    position: absolute;
    top: -38px;
    right: 14px;
    left: auto;
    width: 66px;
    height: auto;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 3px 3px rgba(15, 23, 42, 0.42));
    transform: scaleX(-1);
    transition: opacity 180ms ease;
}

body[data-secret-accent="ntina"] .ntina-rules-lizard {
    opacity: 1;
}

.ntina-menu-gecko {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 140px;
    height: auto;
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 0;
}

body[data-secret-accent="ntina"] .ntina-menu-gecko {
    opacity: 1;
}

.ntina-team-lizard {
    position: absolute;
    top: -36px;
    right: 14px;
    width: 60px;
    height: auto;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 3px 3px rgba(15, 23, 42, 0.42));
    transform: scaleX(-1);
    transition: opacity 180ms ease;
}

body[data-secret-accent="ntina"] .ntina-team-lizard {
    opacity: 1;
}

.setup-cats-grid .ntina-cat-icon {
    position: static;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background: url('assets/images/ui/lizard-icon.png') center / contain no-repeat;
}

.setup-cats-grid input:not(:checked) + label .ntina-cat-icon {
    background-image: url('assets/images/ui/lizard-icon-muted.png');
}

/* Maria theme category icons */
.setup-cats-grid .maria-cat-icon {
    position: static;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    object-fit: cover;
    border-radius: 50%;
}

.setup-cats-grid input:not(:checked) + label .maria-cat-icon {
    opacity: 0.72;
}

.cat-btn-icon .maria-cat-icon {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 999px;
}

.maria-cat-icon-sm {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: cover;
    vertical-align: middle;
}

.maria-cat-icon-score {
    width: 32px;
    height: 32px;
    object-fit: cover;
    margin: 0 auto;
    display: block;
}

.cat-icon-wrapper .ntina-cat-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background: url('assets/images/ui/lizard-icon.png') center / contain no-repeat;
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    box-shadow: 0 10px 20px rgba(185, 28, 28, 0.18);
}

.btn-back {
    background: transparent;
    color: var(--muted-text);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* Menu Button (Top Left) */
.btn-small-top-left {
    position: absolute;
    top: max(15px, env(safe-area-inset-top));
    left: 15px;
    z-index: 10;

    width: var(--control-round-size);
    height: var(--control-round-size);
    min-width: var(--control-round-size);
    min-height: var(--control-round-size);
    padding: 0;

    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    font-size: var(--control-round-icon-size);
    line-height: 1;
}

/* Score Button (Top Right) */
.btn-small-top {
    position: absolute;
    top: max(15px, env(safe-area-inset-top)); /* Respect notch */
    right: 15px;

    width: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.8rem;

    z-index: 10;
}

.btn-circle {
    width: clamp(70px, min(28vw, 15vh), 120px);
    height: clamp(70px, min(28vw, 15vh), 120px);
    border-radius: 50%;

    font-size: clamp(2rem, 6vw, 3rem);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-circle.correct {
    background: var(--success);
}

.btn-circle.wrong {
    background: var(--danger);
}

/* ==========================================================================
   Inputs (General)
   ========================================================================== */

.input-group {
    width: 100%;
    text-align: left;
    margin-bottom: 15px;
}

.team-input-group {
    position: relative;
    margin-bottom: 10px !important;
}

.team-input-row {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--setup-container-radius, var(--radius-md));
    background: white;
    padding: 0 6px 0 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.team-input-row:focus-within {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border-color) 45%);
}

.team-input-row input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 12px 0;
}

#screen-setup .team-input-row input[type="text"] {
    border: 0;
    border-radius: 0;
}

.team-color-picker {
    width: 34px;
    flex: 0 0 34px;
    height: 32px;
    align-self: center;
    margin-left: 8px;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    border-radius: calc(var(--setup-container-radius, var(--radius-md)) * 0.58);
    border: 1px solid color-mix(in srgb, var(--border-color) 86%, white 14%);
    background: color-mix(in srgb, var(--card) 94%, var(--surface-muted) 6%);
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.06);
    cursor: pointer;
}

.team-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.team-color-picker::-webkit-color-swatch {
    border: 0;
    border-radius: calc(var(--setup-container-radius, var(--radius-md)) * 0.46);
}

.team-color-picker::-moz-color-swatch {
    border: 0;
    border-radius: calc(var(--setup-container-radius, var(--radius-md)) * 0.46);
}

.team-color-picker:focus-visible {
    outline: none;
}

.input-group-compact {
    margin: 0 !important;
}

label {
    display: block;
    margin-bottom: 5px;

    font-weight: bold;
    font-size: 0.9rem;
}

.setup-heading {
    display: block;
    margin: 0 0 15px 0;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
}

.hint-muted {
    color: var(--muted-text);
    font-weight: 400;
}

.score-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.score-fieldset legend {
    width: 100%;
    padding: 0;
    text-align: center;
}

.legacy-difficulty.hidden {
    display: none;
}

.legacy-difficulty {
    margin-top: 14px;
}

.legacy-difficulty.is-visible {
    display: block !important;
}

.legacy-difficulty.hidden.is-visible {
    display: block !important;
}

.category-hint {
    min-height: 25px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.form-hint,
.form-error,
.status-message {
    width: 100%;
    margin: 10px 0 0 0;
    text-align: left;
    font-size: 0.92rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.form-hint,
.status-message {
    color: var(--muted-text);
}

.form-error {
    color: var(--danger);
    font-weight: 700;
}

#screen-menu .status-message {
    max-width: 420px;
    text-align: center;
    margin-inline: auto;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);

    font-size: 1.2rem;
    background: white;
    color: var(--text);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, var(--muted-text) 82%, white 18%);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

input[type="text"]:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: none;
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border-color) 45%);
}

#screen-menu .secret-code-form {
    width: min(100%, 320px);
    margin-top: 10px;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 280ms ease, transform 280ms ease;
}

#screen-menu .secret-code-form.secret-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#screen-menu .secret-code-form.secret-dismiss {
    opacity: 0;
    transform: translateY(32px);
    pointer-events: none;
    transition: opacity 260ms ease, transform 260ms cubic-bezier(0.4, 0, 1, 1);
}

#screen-menu .secret-code-input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: rgba(252, 253, 255, 0.22);
    color: color-mix(in srgb, var(--text) 78%, var(--muted-text) 22%);
    text-align: center;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}

#screen-menu .secret-code-input::placeholder {
    color: color-mix(in srgb, var(--muted-text) 76%, white 24%);
}


#screen-menu .secret-code-input:focus-visible {
    outline: none;
    outline-offset: 0;
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.menu-easter-egg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.menu-lizard {
    position: absolute;
    display: block;
    line-height: 1;
    opacity: 0;
    font-size: clamp(2.6rem, 7vw, 3.4rem);
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.14));
    transform-origin: center;
}

.menu-lizard-glyph {
    display: block;
    width: 100%;
    height: 100%;
}

.menu-lizard-image {
    width: 24%;
    height: 24%;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.menu-lizard.peek-left {
    animation: menu-lizard-peek-left 3800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.menu-lizard.persistent.peek-left {
    animation: menu-lizard-peek-left-stay 3800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.menu-lizard.peek-left .menu-lizard-image {
    transform: rotate(70deg);
}

.menu-lizard.crawl-across {
    animation: menu-lizard-crawl 4500ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.menu-lizard.crawl-across .menu-lizard-glyph {
    animation: menu-lizard-gait 620ms ease-in-out infinite;
}

.menu-lizard.logo-takeover {
    animation: menu-lizard-logo 3600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.menu-lizard.persistent.logo-takeover {
    animation: menu-lizard-logo-stay 3600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes menu-lizard-peek-left {
    0% {
        opacity: 0;
        transform: translate3d(-120%, -50%, 0) rotate(18deg) scale(0.9);
    }
    18%,
    74% {
        opacity: 0.92;
        transform: translate3d(-35%, -50%, 0) rotate(35deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(-120%, -50%, 0) rotate(22deg) scale(0.94);
    }
}

@keyframes menu-lizard-peek-left-stay {
    0% {
        opacity: 0;
        transform: translate3d(-120%, -50%, 0) rotate(18deg) scale(0.9);
    }
    18%, 100% {
        opacity: 0.92;
        transform: translate3d(-35%, -50%, 0) rotate(35deg) scale(1);
    }
}


@keyframes menu-lizard-crawl {
    0% {
        opacity: 0;
        transform: translate3d(-140%, -50%, 0) rotate(-10deg);
    }
    10% {
        opacity: 0.96;
        transform: translate3d(-8%, -50%, 0) rotate(-6deg);
    }
    90% {
        opacity: 0.96;
        transform: translate3d(96vw, -50%, 0) rotate(4deg);
    }
    100% {
        opacity: 0;
        transform: translate3d(110vw, -50%, 0) rotate(4deg);
    }
}

@keyframes menu-lizard-gait {
    0% {
        transform: translateY(0) rotate(90deg) scale(1.02, 0.98);
    }
    25% {
        transform: translateY(-4px) rotate(96deg) scale(0.99, 1.02);
    }
    50% {
        transform: translateY(0) rotate(90deg) scale(1.01, 0.99);
    }
    75% {
        transform: translateY(-3px) rotate(96deg) scale(0.98, 1.02);
    }
    100% {
        transform: translateY(0) rotate(90deg) scale(1.02, 0.98);
    }
}

@keyframes menu-lizard-logo {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -120%, 0) rotate(180deg) scale(0.84);
    }
    22%,
    76% {
        opacity: 0.98;
        transform: translate3d(-50%, -50%, 0) rotate(180deg) scale(1.04);
    }
    100% {
        opacity: 0;
        transform: translate3d(-44%, -128%, 0) rotate(180deg) scale(0.88);
    }
}

@keyframes menu-lizard-logo-stay {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -120%, 0) rotate(180deg) scale(0.84);
    }
    22%, 100% {
        opacity: 0.98;
        transform: translate3d(-50%, -50%, 0) rotate(180deg) scale(1.04);
    }
}

/* ==========================================================================
   Stacy Video Easter Egg
   ========================================================================== */

#stacy-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#stacy-video {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 24px;
    display: block;
    animation: stacy-pop-appear 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#stacy-video.stacy-exit {
    animation: stacy-pop-exit 320ms cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes stacy-pop-appear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    60% {
        opacity: 1;
        transform: scale(1.12);
    }
    78% {
        transform: scale(0.95);
    }
    90% {
        transform: scale(1.04);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes stacy-pop-exit {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* ==========================================================================
   Screen: Setup (Overrides)
   ========================================================================== */

#screen-setup {
    --setup-stack-gap: clamp(12px, 2.2vh, 16px);
    --setup-screen-gap: var(--setup-stack-gap);
    --setup-section-gap: var(--setup-stack-gap);
    --setup-heading-gap: clamp(8px, 1.9vh, 15px);
    --setup-input-gap: clamp(8px, 1.8vh, 10px);
    --setup-input-font: clamp(1rem, 1.8vh, 1.05rem);
    --setup-input-placeholder-font: var(--setup-input-font);
    --setup-segmented-height: clamp(30px, 4.5vh, 36px);
    --setup-segmented-font: clamp(0.98rem, 2.05vh, 1.12rem);
    --setup-panel-legend-size: clamp(0.83rem, 1.7vh, 0.92rem);
    --setup-panel-padding-block: clamp(8px, 1.8vh, 12px);
    --setup-panel-padding-inline: clamp(10px, 2.4vw, 14px);
    --setup-grid-padding: clamp(6px, 1.6vh, 10px);
    --setup-grid-gap: clamp(6px, 1.4vh, 8px);
    --setup-grid-max-height: clamp(150px, 34vh, 300px);
    --setup-category-label-font: 0.86rem;
    --setup-category-label-min-height: 46px;
    --setup-container-radius: var(--radius-md);

    justify-content: flex-start;
    gap: var(--setup-screen-gap);
    overflow-y: hidden;
}

#screen-setup .setup-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(28px, 4.8vh, 42px);
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

#screen-setup p.setup-heading {
    margin: 0 0 var(--setup-heading-gap) 0;
}

#screen-setup .setup-title,
#screen-setup-categories .setup-title {
    width: 100%;
    margin: 0 0 20px 0;
    text-align: left;
    color: var(--text);
    font-size: clamp(1.2rem, 1.15vw + 0.95rem, 1.45rem);
    font-weight: 700;
    letter-spacing: inherit;
    line-height: 1.1;
}

#screen-setup .setup-title.setup-title-sub,
#screen-setup-categories .setup-title.setup-title-sub {
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 4px;
    color: inherit;
}

#screen-setup .setup-title.setup-title-sub::after,
#screen-setup-categories .setup-title.setup-title-sub::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: clamp(110px, 34vw, 180px);
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 34%, transparent 66%));
}

#screen-setup .input-group {
    margin-bottom: 0;
}

#screen-setup label {
    margin-bottom: 12px;
    display: block;
}

#screen-setup input[type="text"] {
    font-size: var(--setup-input-font);
    border-radius: var(--setup-container-radius);
}

#screen-setup input[type="text"]::placeholder {
    font-size: var(--setup-input-placeholder-font);
}

#screen-setup h2,
#screen-setup-categories h2 {
    margin-bottom: 0 !important;
}

#screen-setup .setup-section {
    margin: 0 !important;
    width: 100%;
    min-height: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 0;
}

#screen-setup .setup-section:nth-of-type(1) {
    display: flex;
    flex-direction: column;
    gap: var(--setup-input-gap);
}

#screen-setup .setup-section:nth-of-type(1) .input-group-compact {
    margin-top: 0 !important;
}

#screen-setup .setup-panel {
    width: 100%;
    min-width: 0;
    margin: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 0;
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, white 16%);
    border-radius: var(--setup-container-radius);
    background: color-mix(in srgb, var(--card) 95%, var(--surface-muted) 5%);
    padding: var(--setup-panel-padding-block) var(--setup-panel-padding-inline);
}

#screen-setup .setup-panel > legend,
#screen-setup .score-fieldset > legend {
    width: auto;
    margin: 0 auto;
    padding: clamp(1px, 0.3vh, 2px) clamp(8px, 2.6vw, 12px);
    text-align: center;
    color: var(--text);
    font-size: var(--setup-panel-legend-size);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    background: var(--bg-color);
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, white 16%);
    border-radius: var(--setup-container-radius);
}

#screen-setup .setup-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    gap: clamp(28px, 4.8vh, 42px);
    z-index: 2;
}

#screen-setup .setup-group {
    display: flex;
    flex-direction: column;
    gap: var(--setup-section-gap);
}

#screen-setup .setup-group-teams {
    gap: var(--setup-screen-gap);
}

#screen-setup #setup-difficulty-title.hidden {
    display: none;
}

#screen-setup .setup-helper-text {
    margin: 2px 2px 0;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.35;
    font-weight: 650;
    color: var(--muted-text);
    min-height: 1.35em;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.985);
    filter: blur(1px);
    transition:
        opacity 220ms ease,
        transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 220ms ease,
        visibility 0ms linear 240ms;
}

#screen-setup .setup-helper-text.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    filter: blur(0);
    transition-delay: 0ms;
}

#screen-setup .score-fieldset.setup-panel {
    position: relative;
    padding: clamp(7px, 1.2vh, 9px) var(--setup-panel-padding-inline) clamp(5px, 1vh, 7px);
}

#screen-setup .score-fieldset.setup-panel > legend {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 1;
    white-space: nowrap;
}

#screen-setup .setup-section:nth-of-type(2) .legacy-difficulty {
    margin-top: 0;
}

#screen-setup .setup-section .input-group {
    margin: 0 !important;
    width: 100%;
}

#screen-setup .setup-section > label {
    margin: 0 0 8px 0 !important;
}

#screen-setup .setup-footer,
#screen-setup-categories .setup-footer {
    margin: 0 !important;
    margin-top: auto !important;
    width: 100%;

    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: clamp(10px, 2vh, 12px);
}

#screen-setup .setup-footer button {
    margin: 0 !important;
}

#screen-setup .btn-primary {
    margin-top: 0 !important;
}

#screen-setup-categories {
    --setup-stack-gap: clamp(12px, 2.2vh, 16px);
    --setup-screen-gap: var(--setup-stack-gap);
    --setup-section-gap: var(--setup-stack-gap);
    --setup-panel-padding-block: clamp(8px, 1.8vh, 12px);
    --setup-panel-padding-inline: clamp(10px, 2.4vw, 14px);
    --setup-grid-padding: clamp(6px, 1.6vh, 10px);
    --setup-grid-gap: clamp(6px, 1.4vh, 8px);
    --setup-grid-max-height: clamp(180px, 48vh, 420px);
    --setup-categories-panel-max-height: 75dvh;
    --setup-category-label-font: 0.86rem;
    --setup-category-label-min-height: 46px;
    --setup-container-radius: var(--radius-md);

    justify-content: flex-start;
    gap: var(--setup-screen-gap);
    overflow-y: hidden;
}

#screen-setup-categories .setup-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(28px, 4.8vh, 42px);
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

#screen-setup-categories .setup-section {
    margin: 0 !important;
    width: 100%;
    min-height: 0;
    flex: 0 1 auto;
    position: relative;
    z-index: 0;
}

#screen-setup-categories .setup-section-categories {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    gap: var(--setup-section-gap);
}

#screen-setup-categories .setup-group {
    display: flex;
    flex-direction: column;
    gap: var(--setup-section-gap);
    flex: 0 1 auto;
    min-height: 0;
}

#screen-setup-categories .setup-group-categories {
    gap: clamp(6px, 1.1vh, 8px);
}

#screen-setup-categories .setup-cat-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#screen-setup-categories .setup-cat-heading-row .setup-title {
    width: auto;
    flex: 1 1 auto;
}

#screen-setup-categories .setup-cat-bulk-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin: clamp(2px, 0.5vh, 4px) 0 0 0;
    flex: 0 0 auto;
}

#screen-setup-categories .setup-cat-bulk-btn {
    border: 2px solid color-mix(in srgb, var(--border-color) 82%, white 18%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--card) 96%, var(--surface-muted) 4%);
    color: var(--muted-text);
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast), transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#screen-setup-categories .setup-cat-bulk-btn i {
    font-size: 1.06rem;
    line-height: 1;
}

#screen-setup-categories .setup-cat-bulk-btn:hover {
    border-color: color-mix(in srgb, var(--primary) 52%, var(--border-color) 48%);
    color: var(--primary);
}

#screen-setup-categories .setup-cat-bulk-btn:active {
    transform: scale(0.98);
}

#screen-setup-categories .setup-cat-bulk-btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

#screen-setup-categories .categories-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    flex-grow: 0;
    min-height: 0;
    max-height: 75vh;
    max-height: var(--setup-categories-panel-max-height);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    box-shadow: inset 0 0 0 0 rgba(15, 23, 42, 0);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

#screen-setup-categories .setup-panel {
    width: 100%;
    min-width: 0;
    margin: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 0;
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, white 16%);
    border-radius: var(--setup-container-radius);
    background: color-mix(in srgb, var(--card) 95%, var(--surface-muted) 5%);
    padding: var(--setup-grid-padding) var(--setup-panel-padding-inline);
}

#screen-setup-categories .setup-panel > legend {
    width: auto;
    margin: 0 auto;
    padding: clamp(1px, 0.3vh, 2px) clamp(8px, 2.6vw, 12px);
    text-align: center;
    color: var(--text);
    font-size: clamp(0.83rem, 1.7vh, 0.92rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    background: var(--bg-color);
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, white 16%);
    border-radius: var(--setup-container-radius);
}

#screen-setup .segmented-control {
    margin: 0 !important;
    height: auto;
    min-height: var(--setup-segmented-height);
}

/* ==========================================================================
   Segmented Control
   ========================================================================== */

.segmented-control {
    display: flex;
    position: relative;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    width: 100%;
    height: auto;
    min-height: var(--setup-segmented-height, 36px);
    box-shadow: none;
    align-items: stretch;
}

#screen-setup .score-fieldset .segmented-control {
    height: var(--setup-segmented-height);
    min-height: var(--setup-segmented-height);
}

.segmented-control input[type="radio"] {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

#screen-setup .segmented-control label {
    flex: 1;
    z-index: 2;
    position: relative;

    cursor: pointer;

    font-size: var(--setup-segmented-font);
    font-weight: 700;
    color: var(--muted-text);

    margin: 0 !important;
    padding: 0 !important;

    text-align: center;
    transition: color var(--transition-fast);

    -webkit-tap-highlight-color: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    height: 100%;
    min-height: 0;
    border-radius: 8px;
    line-height: 1.2;
}

#screen-setup .score-fieldset .segmented-control label > span[aria-hidden="true"] {
    display: block;
    line-height: 1;
}

#screen-setup .score-fieldset .segmented-control label > i {
    display: block;
    line-height: 1;
    font-size: 0.95em;
}

#screen-setup .segmented-control label:not(:first-of-type)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 18px;
    margin: 0 4px;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--border, var(--border-color)) 78%, transparent 22%);
    pointer-events: none;
}

.segmented-control input[type="radio"]:focus-visible + label {
    outline: 3px solid var(--focus-ring);
    outline-offset: -3px;
    border-radius: 8px;
}

#screen-setup #score-1:checked + label,
#screen-setup #score-2:checked + label,
#screen-setup #score-3:checked + label,
#screen-setup #score-4:checked + label,
#screen-setup #score-5:checked + label {
    color: var(--primary);
    opacity: 1;
    font-weight: 700;
    font-size: calc(var(--setup-segmented-font) + 0.25rem);
}

#screen-setup #legacy-level-1:checked + label,
#screen-setup #legacy-level-2:checked + label,
#screen-setup #legacy-level-3:checked + label,
#screen-setup #legacy-level-4:checked + label,
#screen-setup #legacy-level-5:checked + label,
#screen-setup #legacy-level-all:checked + label,
#screen-setup #answer-time-30:checked + label,
#screen-setup #answer-time-45:checked + label,
#screen-setup #answer-time-60:checked + label {
    color: var(--primary);
    opacity: 1;
    font-weight: 700;
    font-size: calc(var(--setup-segmented-font) + 0.25rem);
}

/* ==========================================================================
   Setup Categories Grid
   ========================================================================== */

/* --- Setup Categories Grid --- */
.setup-cats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--setup-grid-gap, 8px);
    align-content: start;
    width: 100%;
    max-height: var(--setup-grid-max-height, clamp(180px, 34vh, 300px));
    padding: var(--setup-grid-padding, 8px);
    margin: 0;
    position: relative;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, white 18%);
    border-radius: 14px;
    background: color-mix(in srgb, var(--card) 94%, var(--surface-muted) 6%);
    box-shadow: inset 0 0 0 0 rgba(15, 23, 42, 0);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

#screen-setup .setup-cats-grid,
#screen-setup-categories .setup-cats-grid {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: var(--setup-container-radius);
    background: transparent;
    overflow: visible;
}

#screen-setup .setup-cats-grid.grid-fit-content,
#screen-setup-categories .setup-cats-grid.grid-fit-content {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    max-height: 100%;
    overflow: visible;
}

#screen-setup-categories .categories-panel.show-top-fade {
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border-color) 64%);
    box-shadow: inset 0 16px 14px -12px rgba(15, 23, 42, 0.44);
}

#screen-setup-categories .categories-panel.show-bottom-fade {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border-color) 60%);
    box-shadow: inset 0 -18px 14px -12px rgba(15, 23, 42, 0.46);
}

#screen-setup-categories .categories-panel.show-top-fade.show-bottom-fade {
    box-shadow:
        inset 0 16px 14px -12px rgba(15, 23, 42, 0.44),
        inset 0 -18px 14px -12px rgba(15, 23, 42, 0.46);
}

.setup-cats-grid input[type="checkbox"] {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

#screen-setup .setup-cats-grid label,
#screen-setup-categories .setup-cats-grid label {
    position: relative;
    width: 100%;
    min-height: var(--setup-category-label-min-height);
    border-radius: 14px;
    padding: 8px 10px;

    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--muted-text);

    font-size: var(--setup-category-label-font);
    font-weight: 700;
    letter-spacing: 0.02em;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;

    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    text-align: left;
}

#screen-setup .setup-cats-grid label::after,
#screen-setup-categories .setup-cats-grid label::after {
    content: attr(data-cat);
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.setup-cats-grid input:focus-visible + label {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

#screen-setup .setup-cats-grid label i,
#screen-setup-categories .setup-cats-grid label i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    line-height: 1;
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
}

#screen-setup .setup-cats-grid input:checked + label,
#screen-setup-categories .setup-cats-grid input:checked + label {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

#screen-setup .setup-cats-grid input:checked + label i,
#screen-setup-categories .setup-cats-grid input:checked + label i {
    color: var(--primary);
}

/* ==========================================================================
   Screen: Handover
   ========================================================================== */

.handover-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 28px;

    height: 100%;
    width: 100%;
    padding-bottom: 0;
}

.handover-intro {
    margin-top: auto;
    margin-bottom: auto;
}


.handover-content .fa-rotate {
    color: var(--primary);
    animation: spin 3s infinite linear;
}

.handover-icon {
    font-size: 4rem;
    color: var(--muted-text);
}

.handover-icon-play {
    width: 4rem;
    height: 4rem;
    stroke: var(--primary);
    stroke-width: 2px;
}

.handover-title {
    margin: 35px 0 0 0;
    color: var(--muted-text);
}

.handover-score-badge {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    height: var(--control-round-size);
    min-width: var(--score-pill-min-width, 116px);
    min-height: var(--control-round-size);
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: var(--card);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    justify-self: center;
}

#handover-next-btn {
    border: 2px solid var(--primary);
}

#handover-score-badge {
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-color) 65%);
}

.handover-score-badge i {
    color: var(--text);
    font-size: 0.92rem;
}

.handover-score-badge:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.handover-footer #handover-score-badge.hidden {
    display: inline-flex !important;
    visibility: hidden;
    pointer-events: none;
}

.handover-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.highlight-team {
    font-size: 2.2rem;
    margin: 0;
    font-weight: 900;
    overflow-wrap: anywhere;
    text-align: center;
}

.highlight-team-success {
    color: var(--success);
}

.highlight-team-primary {
    color: var(--primary);
}

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

/* ==========================================================================
   Sudden Death Mode UI
   ========================================================================== */

.sudden-death-active {
    background-color: var(--sudden-death-bg) !important;
}

.sudden-death-active h2,
.sudden-death-active span,
.sudden-death-active p {
    color: var(--sudden-death-text) !important;
}

.sudden-death-active .card {
    background-color: var(--sudden-death-surface) !important;
    border: 2px solid var(--sudden-death-accent-border) !important;
    color: var(--sudden-death-text) !important;
}

.sudden-death-active #timer-bar {
    background-color: transparent !important;
    color: var(--sudden-death-accent) !important;
}

.sudden-death-active #timer-bar .timer-ring-progress {
    stroke: var(--sudden-death-accent) !important;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--sudden-death-accent) 45%, transparent));
}

.sudden-death-active #timer-bar .timer-ring-track {
    stroke: color-mix(in srgb, var(--sudden-death-accent) 16%, transparent) !important;
}

.sudden-death-active #timer-bar .timer-center {
    background: color-mix(in srgb, var(--sudden-death-surface) 78%, transparent) !important;
    border-color: var(--sudden-death-accent-border) !important;
}

.sudden-death-active #timer-bar #timer-text,
.sudden-death-active #timer-bar #timer-icon,
.sudden-death-active #timer-bar #timer-pause-icon {
    color: var(--sudden-death-text) !important;
}

.sudden-death-active #timer-bar.paused {
    color: var(--sudden-death-muted) !important;
}

.sudden-death-active #timer-bar.paused .timer-ring-progress {
    stroke: color-mix(in srgb, var(--sudden-death-muted) 58%, var(--sudden-death-accent) 42%) !important;
}

.sudden-death-active #timer-bar.urgent {
    color: var(--sudden-death-accent-strong) !important;
    filter: drop-shadow(0 2px 10px color-mix(in srgb, var(--sudden-death-accent-strong) 36%, transparent));
}

.sudden-death-active #timer-bar.urgent .timer-ring-progress {
    stroke: var(--sudden-death-accent-strong) !important;
}

.sudden-death-active .q-badge {
    background-color: rgba(248, 250, 252, 0.1) !important;
    color: var(--sudden-death-accent) !important;
    border: 1px solid var(--sudden-death-accent-border);
}

.sudden-death-active #q-category-icon i {
    color: white !important;
}

.sudden-death-active .fa-rotate {
    color: var(--sudden-death-accent) !important;
    animation: spin 3s infinite linear;
}

.sudden-death-active .highlight-team {
    color: var(--sudden-death-text) !important;
    text-shadow: 0 0 10px var(--sudden-death-accent-glow);
}

.sudden-death-active .judge-label {
    color: var(--sudden-death-muted) !important;
}

.sudden-death-active .btn-primary,
.sudden-death-active .btn-danger {
    background-color: var(--sudden-death-accent-strong) !important;
    color: var(--sudden-death-text) !important;
    border: none;
}

.sudden-death-active .btn-nav-round.primary {
    background: var(--sudden-death-accent-strong) !important;
    color: var(--sudden-death-text) !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.28);
}

.sudden-death-active .handover-score-badge {
    background: var(--sudden-death-accent-strong) !important;
    color: var(--sudden-death-text) !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.28);
}

.sudden-death-active .handover-score-badge i {
    color: var(--text) !important;
}

.sudden-death-active #handover-back-btn.btn-nav-round.secondary {
    background: var(--sudden-death-bg) !important;
    color: var(--sudden-death-accent) !important;
    border: 2px solid var(--sudden-death-accent) !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.24);
}

/* ==========================================================================
   Screen: Category Selection
   ========================================================================== */

#screen-category {
    --category-grid-gap: 15px;
    --score-pill-min-width: 116px;
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--category-grid-gap);
    width: 100%;
    min-width: 0;
}

.cat-btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(155deg, color-mix(in srgb, var(--card) 97%, white 3%) 0%, color-mix(in srgb, var(--card) 90%, var(--primary) 10%) 135%);
    padding: 20px 22px;
    border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, white 18%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    min-height: 132px;
    padding-right: 96px;
    color: var(--text);
}

.cat-btn.is-loading {
    cursor: progress;
    opacity: 0.82;
    transform: scale(0.995);
}

.cat-btn.is-dimmed {
    opacity: 0.52;
}

#screen-category.is-loading-question .cat-btn:not(.is-loading) {
    pointer-events: none;
}

.cat-btn::before {
    content: "";
    position: absolute;
    right: -48px;
    top: 50%;
    width: 190px;
    height: 190px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 74%, transparent 26%);
    opacity: 0.1;
    filter: blur(26px);
    z-index: 0;
    pointer-events: none;
}

.cat-btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.cat-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.cat-btn-icon i {
    margin: 0;
    font-size: 1.55rem;
    color: color-mix(in srgb, var(--primary) 82%, #1f2937 18%);
}

.cat-btn-icon .ntina-cat-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    background: url('assets/images/ui/lizard-icon.png') center / contain no-repeat;
}

.cat-btn-label {
    font-size: 1.07rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    word-break: break-word;
}

.cat-btn-watermark {
    position: absolute;
    z-index: 1;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    opacity: 0.08;
    pointer-events: none;
}

.cat-btn-watermark.fa-solid {
    font-size: clamp(4.6rem, 15vw, 5.8rem);
}

.cat-btn-watermark.maria-cat-icon {
    width: 102px;
    height: 102px;
    object-fit: cover;
    border-radius: 999px;
}

.cat-btn-watermark.ntina-cat-icon {
    width: 102px;
    height: 102px;
    flex: 0 0 102px;
    background: url('assets/images/ui/lizard-icon.png') center / contain no-repeat;
}

/* ==========================================================================
   Screen: Question
   ========================================================================== */

.q-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;

    width: 100%;
    margin-bottom: 25px;
    padding: 0 5px;
    gap: 8px;
}

.q-badge {
    background: var(--card);

    height: 55px;
    min-width: 0;
    max-width: 100%;
    padding: 0 10px;
    flex: 1 1 0;

    border-radius: var(--radius-pill);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    box-shadow: var(--shadow-sm);

    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
}

@media (max-width: 400px) {
    .q-badge {
        padding: 0 8px;
        gap: 6px;
    }
}

#q-category-icon i {
    color: var(--primary);
    font-size: 1em;
    line-height: 1;
    margin: 0;
}

#q-difficulty-badge {
    cursor: pointer;
}

#q-difficulty-icon {
    font-size: 1em;
    line-height: 1;
}

#q-difficulty-badge.difficulty-easy  { color: var(--success); }
#q-difficulty-badge.difficulty-medium { color: var(--warning); }
#q-difficulty-badge.difficulty-hard  { color: var(--danger); }

/* ==========================================================================
   Category Badge Expand
   ========================================================================== */

body[data-secret-accent="maria"] .maria-cat-icon-sm {
    width: 1.1em;
    height: 1.1em;
    flex: 0 0 1.1em;
}

#q-category-badge {
    cursor: pointer;
    transition: flex-grow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#q-category-badge.expanded {
    flex-grow: 3;
}

.cat-label {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--primary);
    opacity: 0;
    font-size: 1em;
    line-height: 1.1;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease 0.12s;
}

#q-category-badge.expanded .cat-label {
    max-width: min(44vw, 260px);
    opacity: 1;
}

#q-difficulty-badge {
    transition: flex-grow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#q-difficulty-badge.expanded {
    flex-grow: 3;
}

.diff-label {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 0;
    font-size: 1em;
    line-height: 1.1;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease 0.12s;
}

#q-difficulty-badge.expanded .diff-label {
    max-width: min(32vw, 180px);
    opacity: 1;
}

#q-category-icon,
#q-difficulty-icon {
    flex: 0 0 auto;
}

#q-category-badge,
#q-difficulty-badge {
    padding-inline: 8px;
}

#timer-bar {
    background: transparent;
    margin: 0;
    width: 58px;
    min-width: 58px;
    height: 58px;
    padding: 0;
    flex: 0 0 auto;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    display: grid;
    place-items: center;
    --timer-progress: 1;
    --timer-ring-circumference: 157.08;
    box-shadow: none;
    border: none;
    color: color-mix(in srgb, var(--text) 92%, var(--primary) 8%);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    transition: transform var(--transition-fast), filter var(--transition-medium), color var(--transition-fast);
}

#timer-bar:focus-visible {
    outline: none;
    filter: drop-shadow(0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent));
}

.timer-ring {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.timer-ring-svg {
    width: 100%;
    height: 100%;
}

.timer-ring-track,
.timer-ring-progress {
    fill: none;
    stroke-width: 4;
}

.timer-ring-track {
    stroke: color-mix(in srgb, var(--primary) 14%, transparent);
}

.timer-ring-progress {
    stroke: var(--primary);
    stroke-linecap: round;
    stroke-dasharray: var(--timer-ring-circumference);
    stroke-dashoffset: calc((1 - var(--timer-progress)) * var(--timer-ring-circumference));
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s linear, stroke var(--transition-fast);
    filter: drop-shadow(0 0 2px color-mix(in srgb, var(--primary) 35%, transparent));
}

.timer-center {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--card) 72%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-color) 50%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 6px rgba(15, 23, 42, 0.08);
}

#timer-text {
    min-width: 2ch;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

#timer-icon {
    font-size: 0.82rem;
}

#timer-pause-icon {
    font-size: 0.88rem;
}

#timer-bar.paused {
    color: color-mix(in srgb, var(--muted-text) 85%, var(--text) 15%);
}

#timer-bar.paused .timer-ring-progress {
    stroke: color-mix(in srgb, var(--muted-text) 60%, var(--primary) 40%);
}

#timer-bar.paused .timer-center {
    background: color-mix(in srgb, var(--surface-muted) 58%, transparent);
}

#timer-bar.urgent {
    color: var(--danger);
    background: transparent;
    border: none;
    animation: pulse 1s infinite;
    filter: drop-shadow(0 2px 8px rgba(185, 28, 28, 0.2));
}

#timer-bar.urgent .timer-ring-progress {
    stroke: var(--danger);
    filter: drop-shadow(0 0 3px rgba(185, 28, 28, 0.34));
}

#timer-bar.urgent .timer-ring-track {
    stroke: color-mix(in srgb, var(--danger) 12%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    #timer-bar:hover {
        transform: translateY(-1px) scale(1.02);
        filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.12));
    }
}

#timer-bar:active {
    transform: scale(0.97);
}

.card {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, white 18%);

    width: 100%;
    max-width: 100%;
    min-height: 200px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.q-bank-source-debug {
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    transform: translateY(-12px);
    color: var(--muted-text);
    font-size: 0.6rem;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    pointer-events: none;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.question-text.q-text--md {
    font-size: 1.15rem;
}

.question-text.q-text--lg {
    font-size: 0.95rem;
}

.answer-section {
    width: 100%;
    max-width: 100%;
    margin-top: clamp(10px, 2vh, 20px);
    padding: clamp(10px, 2vh, 15px);

    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);

    text-align: center;
}

#a-text {
    font-weight: 900;
}

.q-options {
    width: 100%;
    max-width: 100%;
    margin-top: clamp(10px, 2vh, 20px);
}

.q-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.q-option-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 104px;
    padding: 14px 12px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    text-align: center;
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.3;
    overflow: hidden;
}

.q-option-card-text {
    width: 100%;
    display: block;
    white-space: normal;
    overflow-wrap: normal;
    word-break: keep-all;
    font-size: calc(1em * var(--qok-option-font-multiplier, 0.84));
    font-weight: 700;
    line-height: 1.3;
}

.q-option-card.is-correct {
    border-color: var(--success);
}

#screen-question.qok-fit-active {
    --qok-fit-scale: 1;
    overflow-y: hidden;
}

#screen-question.qok-fit-active .q-top-row {
    margin-bottom: calc(25px * var(--qok-fit-scale));
    gap: calc(8px * var(--qok-fit-scale));
    padding: 0 calc(5px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .q-badge {
    height: calc(55px * var(--qok-fit-scale));
    padding: 0 calc(10px * var(--qok-fit-scale));
    gap: calc(8px * var(--qok-fit-scale));
    font-size: calc(1.3rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active #q-category-icon i,
#screen-question.qok-fit-active #q-difficulty-icon {
    font-size: 1em;
}

#screen-question.qok-fit-active #timer-bar {
    font-size: calc(1.3rem * var(--qok-fit-scale));
    width: calc(58px * var(--qok-fit-scale));
    min-width: calc(58px * var(--qok-fit-scale));
    height: calc(58px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .timer-ring-svg {
    width: 100%;
    height: 100%;
}

#screen-question.qok-fit-active .timer-center {
    width: calc(42px * var(--qok-fit-scale));
    height: calc(42px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active #timer-text {
    font-size: calc(1.3rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .card {
    padding: calc(30px * var(--qok-fit-scale));
    min-height: calc(200px * var(--qok-fit-scale));
    margin-bottom: calc(20px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .question-text {
    font-size: calc(1.4rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .question-text.q-text--md {
    font-size: calc(1.15rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .question-text.q-text--lg {
    font-size: calc(0.95rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .q-options {
    margin-top: calc(20px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .q-options-grid {
    gap: calc(10px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .q-option-card {
    min-height: calc(104px * var(--qok-fit-scale));
    height: calc(104px * var(--qok-fit-scale));
    padding: calc(14px * var(--qok-fit-scale)) calc(12px * var(--qok-fit-scale));
    font-size: calc(1rem * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .report-error-section {
    margin-top: calc(2px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .btn-text-muted {
    font-size: calc(0.85rem * var(--qok-fit-scale));
    padding: calc(8px * var(--qok-fit-scale)) calc(16px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .judge-actions {
    margin-top: calc(22px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .action-row {
    gap: calc(16px * var(--qok-fit-scale));
}

#screen-question.qok-fit-active .btn-circle {
    width: clamp(calc(58px * var(--qok-fit-scale)), min(26vw, 13.5vh), calc(102px * var(--qok-fit-scale)));
    height: clamp(calc(58px * var(--qok-fit-scale)), min(26vw, 13.5vh), calc(102px * var(--qok-fit-scale)));
    font-size: calc(2rem * var(--qok-fit-scale));
}

.judge-actions {
    margin-top: clamp(15px, 4vh, 50px);
    width: 100%;
    animation: slideUp 0.3s ease-out;
}

.action-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.judge-label {
    font-size: 0.9rem;
    color: var(--muted-text);

    margin-bottom: 5px;

    font-weight: bold;
}

/* ==========================================================================
   Screen: Scoreboard
   ========================================================================== */

.score-header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.score-titles {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) minmax(120px, 0.9fr) minmax(72px, 1fr);
    width: 100%;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--muted-text);
    margin-bottom: 8px;
    text-align: center;
    align-items: center;
}

.score-title-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.t-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
    min-width: 0;
}

.t-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.scoreboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px;
}

.score-row {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) minmax(120px, 0.9fr) minmax(72px, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--border-color) 90%, white 10%);
    background: color-mix(in srgb, var(--card) 92%, white 8%);
    box-shadow: var(--shadow-sm);
}

.score-cat-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.score-cat-name {
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--muted-text);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.cat-icon-wrapper {
    width: 38px;
    height: 38px;
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1rem;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.score-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 15px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: transparent;
}

.dot.filled {
    background: var(--primary);
    border-color: var(--primary);
}

.score-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent 28%);
}

.score-actions button {
    margin: 0;
    min-height: 44px;
}

#screen-score h2,
#screen-rules h2 {
    margin-bottom: 12px;
}

#screen-score,
#screen-rules,
#screen-handover {
    gap: 0;
}

#screen-score {
    justify-content: flex-start;
    overflow: hidden;
}

#screen-score.sudden-death-theme {
    background: var(--sudden-death-bg);
    color: var(--sudden-death-text);
}

#screen-score.sudden-death-theme h2 {
    color: var(--sudden-death-text);
}

#screen-score.sudden-death-theme .score-titles {
    color: var(--sudden-death-muted);
}

#screen-score.sudden-death-theme .t-total {
    color: var(--sudden-death-accent);
}

#screen-score.sudden-death-theme .score-row {
    border-color: var(--sudden-death-accent-border);
    background: color-mix(in srgb, var(--sudden-death-surface) 90%, white 10%);
    box-shadow: 0 8px 20px rgba(7, 5, 8, 0.28);
}

#screen-score.sudden-death-theme .score-cat-name {
    color: var(--sudden-death-muted);
}

#screen-score.sudden-death-theme .cat-icon-wrapper {
    background: color-mix(in srgb, var(--sudden-death-surface) 84%, white 16%);
    border-color: var(--sudden-death-accent-border);
    color: var(--sudden-death-accent);
}

#screen-score.sudden-death-theme .dot {
    border-color: color-mix(in srgb, var(--sudden-death-accent-border) 78%, transparent);
}

#screen-score.sudden-death-theme .dot.filled {
    background: var(--sudden-death-accent);
    border-color: var(--sudden-death-accent);
}

#screen-score.sudden-death-theme .score-actions {
    border-top-color: color-mix(in srgb, var(--sudden-death-accent-border) 70%, transparent);
}

#screen-score.sudden-death-theme #score-back-btn.btn-secondary {
    background: var(--sudden-death-surface);
    color: var(--sudden-death-text);
    border-color: var(--sudden-death-accent-border);
}

#screen-category {
    padding-top: max(88px, calc(env(safe-area-inset-top) + 72px));
}

#screen-category .instruction {
    margin: 0 0 24px 0;
    color: var(--muted-text);
}

#screen-category .turn-header,
#screen-score .score-header-row {
    width: 100%;
}



/* ==========================================================================
   Screen: Rules
   ========================================================================== */

/* --- Screen: Rules (Responsive Fit) --- */
#screen-rules {
    /* Use the full height of the viewport */
    height: 100vh; 
    height: 100dvh;
    
    /* Layout: Header Top, Content Middle, Footer Bottom */
    justify-content: space-between; 
    
    /* Breathing room for the notch and bottom bar */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    
    /* Prevent the whole page from scrolling */
    overflow: hidden; 
}

.rules-content {
    /* "flex: 1" makes this take up all available vertical space */
    flex: 1; 
    
    display: flex;
    flex-direction: column;
    
    /* Spreads the boxes out nicely */
    justify-content: space-evenly; 
    
    width: 100%;
    margin: 10px 0;
    
    /* If content is taller than space, scroll ONLY inside this middle part */
    overflow-y: auto; 
    min-height: 0; 
}

.rule-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    font-size: 1.1rem;

    background: var(--card);
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, white 15%);
    box-shadow: var(--shadow-sm);

    flex-shrink: 0;
    margin-bottom: 10px;
}

.rule-item i {
    font-size: 1.8rem;
    color: var(--primary);
    min-width: 50px;
    text-align: center;
}

.handover-first-team-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: handoverFirstTeamEnter 280ms ease-out both;
}

.handover-first-team-roll-btn {
    width: clamp(112px, 24vw, 152px);
    height: clamp(112px, 24vw, 152px);
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--primary) 45%, var(--border-color) 55%);
    background: linear-gradient(165deg, color-mix(in srgb, var(--card) 94%, white 6%) 0%, color-mix(in srgb, var(--card) 84%, var(--primary) 16%) 130%);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    margin: 0;
}

.handover-dice-frozen,
.handover-dice-gif {
    display: block;
    width: clamp(52px, 11vw, 74px);
    height: clamp(52px, 11vw, 74px);
    object-fit: contain;
    pointer-events: none;
}

.handover-dice-gif {
    display: none;
}

.handover-first-team-roll-btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.handover-first-team-roll-btn:active {
    transform: scale(0.95);
}

.handover-first-team-result {
    margin: 0;
    min-height: 1.7em;
    font-size: clamp(1.06rem, 2.6vw, 1.32rem);
    font-weight: 700;
    color: var(--muted-text);
}

.handover-first-team-name {
    color: var(--primary);
}

.handover-first-team-decided .handover-first-team-name {
    color: var(--primary);
}

.handover-first-team-roll-btn.is-rolling {
    animation: handoverDicePress 320ms ease-out;
    box-shadow: var(--shadow-interactive);
}

.handover-first-team-roll-btn.is-rolling .handover-dice-frozen {
    display: none;
}

.handover-first-team-roll-btn.is-rolling .handover-dice-gif {
    display: block;
}

@keyframes handoverDicePress {
    0% { transform: scale(1); }
    45% { transform: scale(0.88); }
    100% { transform: scale(1); }
}

@keyframes handoverFirstTeamEnter {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .handover-first-team-panel,
    .handover-first-team-roll-btn,
    .handover-first-team-roll-btn.is-rolling,
    .handover-first-team-roll-btn.is-rolling .handover-dice-gif {
        animation: none;
        transition: none;
    }
}

/* --- Rules Footer --- */
.rules-footer {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    padding: 0 5px;
    
    /* CRITICAL: Prevents the footer container from being squashed */
    flex-shrink: 0; 
    margin-top: 10px;
}

/* Explicitly force the button to stay perfect */
.rules-footer .btn-nav-round {
    width: var(--control-round-size) !important;
    height: var(--control-round-size) !important;
    min-width: var(--control-round-size) !important; /* Forces width */
    min-height: var(--control-round-size) !important; /* Forces height */
    flex-shrink: 0; /* Prevents flexbox from squashing it */
    border-radius: 50%;
}

/* --- SHORT SCREEN MODE (Only shrinks text/boxes, NOT the button) --- */
@media (max-height: 700px) {
    /* Shrink the Header */
    #screen-rules h2 {
        margin-bottom: 5px;
        font-size: 1.3rem;
    }

    /* Shrink the boxes */
    .rule-item {
        padding: 10px 12px;
        font-size: 0.95rem;
        border-radius: 12px;
        margin-bottom: 5px;
        gap: 10px;
    }

    /* Shrink the icons inside boxes */
    .rule-item i {
        font-size: 1.4rem;
        min-width: 40px;
    }
    
    /* NOTE: We removed the button resizing code here. 
       The button will remain 60px. */
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer-egg {
    position: absolute;
    bottom: 20px;
    left: 0;

    width: 100%;
    text-align: center;

    font-size: 0.8rem;
    color: var(--muted-text);

    pointer-events: none;
}

.author-link {
    pointer-events: auto;
    color: inherit;
    text-decoration: none;
    font-weight: normal;
    transition: color var(--transition-fast);
}

.author-link:hover {
    color: var(--text);
}

#screen-win {
    justify-content: center;
    background:
        radial-gradient(130% 86% at 12% 10%, color-mix(in srgb, var(--primary) 16%, transparent 84%) 0%, transparent 55%),
        radial-gradient(120% 82% at 88% 0%, color-mix(in srgb, var(--warning) 12%, transparent 88%) 0%, transparent 50%),
        var(--bg-color);
}

.win-hero-card {
    position: relative;
    width: min(100%, 560px);
    padding: 26px 20px 20px 20px;
    border-radius: 30px;
    border: 1px solid color-mix(in srgb, var(--border-color) 76%, white 24%);
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--card) 96%, white 4%) 0%, color-mix(in srgb, var(--card) 86%, var(--primary) 14%) 130%);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.win-crown-ring {
    width: 94px;
    height: 94px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border-color) 55%);
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.45) 48%, rgba(255, 255, 255, 0.14) 100%),
        color-mix(in srgb, var(--warning) 18%, white 82%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 10px 24px rgba(245, 158, 11, 0.2);
    margin-bottom: 4px;
}

.win-crown-ring .big-icon {
    margin: 0;
    font-size: 2.5rem;
}

.win-title {
    margin: 0;
}

.win-winner-name {
    margin: 0;
    font-size: clamp(1.45rem, 3.8vw, 2rem);
    line-height: 1.08;
    color: color-mix(in srgb, var(--text) 85%, var(--primary) 15%);
    letter-spacing: 0.01em;
}

.final-score-text {
    margin: 2px 0 6px 0;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border-color) 60%);
    background: color-mix(in srgb, var(--primary) 13%, white 87%);
    color: color-mix(in srgb, var(--primary) 72%, #1f2937 28%);
    font-size: 1rem;
    font-weight: 800;
}

.post-game-recap {
    width: 100%;
    margin: 2px 0 2px 0;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, white 20%);
    background: color-mix(in srgb, var(--card) 90%, white 10%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    text-align: center;
}

.recap-label {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-text);
    font-weight: 700;
}

.recap-value-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, white 16%);
    background: color-mix(in srgb, var(--card) 84%, white 16%);
    color: var(--text);
    font-size: 0.96rem;
    line-height: 1.2;
    font-weight: 700;
}

.recap-value-category {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    border: none;
}

.recap-value-category > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.recap-center-item {
    align-self: center;
}

.recap-category-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--border-color) 75%, white 25%);
    background: color-mix(in srgb, var(--primary) 10%, white 90%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.recap-category-glyph {
    color: color-mix(in srgb, var(--primary) 78%, #1f2937 22%);
}

.recap-category-glyph.fa-solid {
    font-size: 1rem;
}

.recap-category-glyph.maria-cat-icon {
    width: 23px;
    height: 23px;
    object-fit: cover;
    border-radius: 50%;
}

.recap-category-glyph.ntina-cat-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    background: url('assets/images/ui/lizard-icon.png') center / contain no-repeat;
}

.recap-sudden-death-row {
    margin: 10px 2px 2px 2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--sudden-death-accent-border);
    background: color-mix(in srgb, var(--sudden-death-surface) 90%, white 10%);
    color: var(--sudden-death-accent-strong);
    font-size: 0.88rem;
    font-weight: 700;
}

#win-new-game-btn {
    width: min(100%, 320px);
    margin-top: 8px;
}

.screen-sudden-death {
    background: var(--sudden-death-bg);
    color: var(--sudden-death-accent);
}

.sudden-death-icon {
    color: var(--sudden-death-accent);
    animation: pulse 0.5s infinite;
}

.sudden-death-title {
    margin: 0;
    font-size: clamp(2.8rem, 6vw, 3.5rem);
    line-height: 0.95;
    color: var(--sudden-death-accent);
}

.sudden-death-subtitle {
    margin-top: 10px;
    color: var(--sudden-death-text);
}

.sudden-death-card {
    width: 100%;
    margin: 40px 0;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--sudden-death-accent-border);
    background: var(--sudden-death-surface);
    text-align: left;
    box-shadow: var(--shadow-md);
}

.sudden-death-label {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--sudden-death-text);
}

.sudden-death-rules {
    margin: 0;
    padding-left: 20px;
    color: var(--sudden-death-muted);
    line-height: 1.6;
}

.screen-sudden-death .btn-danger {
    background: var(--sudden-death-accent-strong);
    color: var(--sudden-death-text);
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.22);
}

.btn-score-trigger {
    margin-top: var(--category-grid-gap);
}

#category-score-btn.btn-score-trigger {
    width: auto;
    min-width: var(--score-pill-min-width, 116px);
    height: var(--control-round-size);
    min-height: var(--control-round-size);
    margin: calc(var(--category-grid-gap) + 10px) auto 0;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-color) 65%);
    background: var(--card);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    gap: 8px;
}

#category-score-btn.btn-score-trigger i {
    color: var(--text);
}

#category-score-btn.btn-score-trigger:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.btn-small-top-left,
.btn-nav-round,
.cat-btn,
.setup-cats-grid label {
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-medium),
        background-color var(--transition-medium),
        border-color var(--transition-medium),
        color var(--transition-medium);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover,
    .btn-danger:hover,
    .btn-nav-round.primary:hover,
    .btn-nav-round.secondary:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-interactive);
    }

    .btn-secondary:hover,
    .btn-small-top-left:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        border-color: color-mix(in srgb, var(--primary) 30%, var(--border-color) 70%);
    }

    .cat-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border-color) 68%);
    }

    .setup-cats-grid label:hover {
        transform: translateY(-1px);
    }

    .setup-cats-grid input:checked + label:hover {
        transform: translateY(-2px);
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

.hidden {
    display: none !important;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Liquid Animation */
.liquid-fill {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;

    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
    will-change: transform, opacity;
}

.liquid-animate {
    animation: expandFill 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.liquid-fadeout {
    animation: fadeOutFill 0.4s ease-out forwards;
}

@keyframes expandFill {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(var(--liquid-scale, 180));
    }
}

@keyframes fadeOutFill {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ==========================================================================
   Setup Footer (Bottom Corners)
   ========================================================================== */

#screen-setup .setup-footer,
#screen-setup-categories .setup-footer {
    width: 100%;

    display: flex;
    flex-direction: row;            /* Side-by-side layout */
    justify-content: space-between; /* Push items to far left and right */
    align-items: center;
    flex-wrap: wrap;
    row-gap: 12px;

    margin-top: auto;               /* Push footer to the bottom */
    padding: 0 5px;                 /* Slight alignment adjustment */
    transition: transform var(--transition-fast);
}

#screen-setup.setup-footer-thumb-reach .setup-footer,
#screen-setup-categories.setup-footer-thumb-reach .setup-footer {
    transform: translateY(clamp(-16px, -2.4vh, -10px));
}

/* ==========================================================================
   Round Navigation Buttons
   ========================================================================== */

.btn-nav-round {
    width: var(--control-round-size);
    height: var(--control-round-size);
    min-width: var(--control-round-size);
    min-height: var(--control-round-size);
    padding: 0;
    border-radius: 50%;
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: var(--control-round-icon-size);
    line-height: 1;
    cursor: pointer;

    box-shadow: var(--shadow-md);
    transition: transform 0.1s;

    margin: 0 !important; /* Override global button margins */
}

.btn-nav-round:active {
    transform: scale(0.9);
}

.btn-nav-round.primary {
    background: var(--card);
    color: var(--text);
    border: 2px solid var(--primary);
}

.btn-nav-round.secondary {
    background: var(--card);
    color: var(--text);
    border: 2px solid var(--primary);
}

/* ==========================================================================
   Handover Footer Styling
   ========================================================================== */

.handover-footer {
    width: 100%;

    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 12px;

    margin-top: auto; /* Push footer to the bottom */
    padding: 0 5px;
}

.category-footer {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 0 5px;
}

.category-footer #category-score-btn.btn-score-trigger {
    grid-column: 2;
    justify-self: center;
    margin: 0;
}

#handover-back-btn {
    justify-self: start;
}

#handover-next-btn {
    justify-self: end;
}


#current-team-name,
#winner-name,
#handover-team-playing,
#handover-team-reading {
    max-width: 100%;
    overflow-wrap: anywhere;
}

@media (min-width: 768px) {
    body {
        align-items: center;
    }

    #screen-menu {
        --menu-main-max-width: 440px;
        justify-content: center;
        gap: 12px;
    }

    .screen {
        max-width: 880px;
        padding-inline: clamp(30px, 4vw, 44px);
        padding-top: max(34px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    #screen-setup,
    #screen-setup-categories,
    #screen-category,
    #screen-question,
    #screen-score,
    #screen-rules,
    #screen-handover,
    #screen-win,
    #screen-sudden-death {
        justify-content: center;
    }

    #screen-setup,
    #screen-setup-categories,
    #screen-rules,
    #screen-score {
        overflow-y: auto;
    }

    #screen-setup,
    #screen-setup-categories,
    #screen-category,
    #screen-rules,
    #screen-score,
    #screen-handover {
        padding-bottom: max(110px, calc(env(safe-area-inset-bottom) + 92px));
    }

    .home-screen-logo {
        width: min(100%, 340px);
        max-width: 340px;
        margin-bottom: 1.5rem;
    }

    #screen-menu button,
    #retry-load-btn,
    #app-status {
        max-width: var(--menu-main-max-width);
    }

    #screen-menu .secret-code-form,
    #screen-menu .resume-banner {
        max-width: var(--menu-main-max-width);
    }

    .resume-actions {
        justify-content: center;
    }

    .resume-btn {
        max-width: 180px;
    }

    #screen-setup.screen.active,
    #screen-setup-categories.screen.active {
        max-width: 760px;
        margin-inline: auto;
    }

    #screen-setup .setup-main,
    #screen-setup-categories .setup-main {
        max-width: 720px;
        margin-inline: auto;
    }

    #screen-setup .setup-footer,
    #screen-setup-categories .setup-footer {
        padding: 10px 0 0 0;
        margin-top: 0 !important;
    }

    .setup-cats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 10px;
        max-height: none;
    }

    #screen-rules h2 {
        margin-top: 0;
        margin-bottom: 12px;
    }

    #screen-rules {
        justify-content: center;
        overflow-y: auto;
    }

    .rules-content {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        gap: 16px;
        max-width: 760px;
        margin-inline: auto;
        padding-inline: 2px;
        flex: 0 1 auto;
        max-height: min(60vh, 620px);
    }

    .rule-item {
        margin-bottom: 0;
        min-height: 100%;
    }

    #screen-category {
        --category-grid-gap: 18px;
    }

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--category-grid-gap);
        max-width: 760px;
        margin-inline: auto;
    }

    .cat-btn {
        min-height: 148px;
        padding-right: 84px;
    }

    .score-row {
        grid-template-columns: minmax(90px, 1fr) minmax(140px, 0.9fr) minmax(90px, 1fr);
    }

    .score-cat-name {
        font-size: 0.72rem;
    }

    .q-top-row,
    .card,
    .q-options,
    .answer-section,
    .judge-actions,
    .score-titles,
    .scoreboard,
    .score-actions,
    .rules-content,
    .sudden-death-card {
        max-width: 760px;
    }

    .q-top-row,
    .score-titles,
    .scoreboard,
    .score-actions,
    .rules-content,
    .sudden-death-card {
        margin-inline: auto;
    }

    .q-option-card {
        min-height: 120px;
    }

    .scoreboard {
        flex: 0 1 auto;
        max-height: min(56vh, 560px);
    }

    #screen-category {
        padding-top: max(34px, env(safe-area-inset-top));
    }

    #screen-setup .setup-footer,
    #screen-setup-categories .setup-footer,
    #screen-category .category-footer,
    #screen-rules .rules-footer,
    #screen-score .score-actions {
        position: absolute;
        left: 50%;
        bottom: max(24px, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        width: calc(100% - 2 * clamp(30px, 4vw, 44px));
        max-width: 760px;
        margin: 0 !important;
        z-index: 4;
    }

    #screen-category .category-footer {
        margin-top: 0 !important;
    }

    #screen-score {
        justify-content: center;
    }

    .action-row {
        justify-content: center;
        gap: 48px;
    }

    #screen-handover .handover-content {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "intro intro"
            "first first"
            "playing reading"
            "spacer spacer";
        align-content: center;
        justify-items: center;
        gap: 24px;
        max-width: 760px;
        height: 100%;
        justify-content: center;
    }

    #screen-handover .handover-intro {
        grid-area: intro;
        margin: 0;
    }

    #screen-handover .handover-first-team-panel {
        grid-area: first;
        width: 100%;
    }

    #screen-handover #handover-group-playing {
        grid-area: playing;
        width: 100%;
    }

    #screen-handover #handover-group-reading {
        grid-area: reading;
        width: 100%;
    }

    #screen-handover .handover-content::after {
        content: "";
        grid-area: spacer;
    }

    #screen-handover .handover-footer {
        position: absolute;
        left: 50%;
        bottom: max(24px, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        width: calc(100% - 2 * clamp(30px, 4vw, 44px));
        max-width: 760px;
        margin: 0 !important;
        z-index: 4;
        padding: 8px 0 0 0;
    }

    .handover-group {
        width: 100%;
        min-width: 0;
    }

}

@media (min-width: 1024px) {
    .screen {
        max-width: 1080px;
        padding-inline: clamp(36px, 4vw, 52px);
    }

    #screen-setup.screen.active {
        max-width: 920px;
    }

    #screen-setup .setup-main {
        max-width: 760px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: clamp(28px, 4.8vh, 42px);
        align-items: stretch;
    }

    #screen-setup .setup-group-teams,
    #screen-setup .setup-section:nth-of-type(2) {
        height: auto;
    }

    #screen-setup .setup-section:nth-of-type(2) {
        gap: 24px;
    }

    #screen-setup-categories.screen.active {
        max-width: 920px;
    }

    #screen-setup-categories .setup-main {
        max-width: 860px;
    }

    #screen-setup-categories .setup-cats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #screen-setup .setup-cats-grid label,
    #screen-setup-categories .setup-cats-grid label {
        min-height: 46px;
        font-size: 0.86rem;
    }

    .category-grid,
    .score-titles,
    .scoreboard,
    .score-actions,
    .handover-content,
    .rules-content,
    .sudden-death-card {
        max-width: 860px;
    }

    .card,
    .q-options,
    .answer-section,
    .q-top-row {
        max-width: 840px;
    }

    #screen-setup .setup-footer,
    #screen-setup-categories .setup-footer,
    #screen-category .category-footer,
    #screen-handover .handover-footer,
    #screen-rules .rules-footer,
    #screen-score .score-actions {
        width: calc(100% - 2 * clamp(36px, 4vw, 52px));
        max-width: 860px;
    }
}

@media (min-width: 1200px) {
    .screen {
        max-width: 1220px;
        padding-inline: clamp(40px, 4vw, 60px);
    }

    #screen-menu {
        --menu-main-max-width: 460px;
    }

    #screen-setup .setup-main {
        max-width: 760px;
        gap: clamp(28px, 4.8vh, 42px);
    }

    #screen-setup-categories .setup-main {
        max-width: 980px;
    }

    #screen-setup-categories .setup-cats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .category-grid {
        max-width: 840px;
    }

    .score-titles,
    .scoreboard,
    .score-actions,
    .rules-content,
    .handover-content,
    .sudden-death-card {
        max-width: 900px;
    }

    .q-top-row,
    .card,
    .q-options,
    .answer-section,
    .judge-actions {
        max-width: 880px;
    }

    #screen-setup .setup-footer,
    #screen-setup-categories .setup-footer,
    #screen-category .category-footer,
    #screen-handover .handover-footer,
    #screen-rules .rules-footer,
    #screen-score .score-actions {
        width: calc(100% - 2 * clamp(40px, 4vw, 60px));
        max-width: 900px;
    }
}

@media (max-width: 767px) and (max-height: 760px) {
    #screen-setup {
        --setup-input-font: 1rem;
        --setup-input-placeholder-font: var(--setup-input-font);
        --setup-segmented-font: 0.88rem;
        --setup-panel-legend-size: 0.8rem;
        --setup-category-label-font: 0.82rem;
        --setup-category-label-min-height: 44px;
        --setup-grid-max-height: clamp(132px, 30vh, 220px);
        --setup-grid-padding: 6px;
    }

    #screen-setup-categories {
        --setup-category-label-font: 0.82rem;
        --setup-category-label-min-height: 44px;
        --setup-grid-max-height: clamp(156px, 44vh, 280px);
        --setup-grid-padding: 6px;
    }

    body[data-secret-accent="maria"] #screen-menu {
        --menu-main-max-width: 360px;
        padding-top: max(76px, calc(env(safe-area-inset-top) + 56px));
        padding-bottom: calc(env(safe-area-inset-bottom) + 160px);
    }

    body[data-secret-accent="maria"] .maria-bottom-img {
        left: 16px;
        right: 16px;
        width: calc(100% - 32px);
        max-width: 360px;
        height: 150px;
    }

    body[data-secret-accent="maria"] #screen-menu .maria-subtitle {
        margin-bottom: 24px;
        font-size: 0.95rem;
    }

    body[data-secret-accent="maria"] #screen-menu .menu-primary-action {
        max-width: 360px;
    }

    body[data-secret-accent="maria"] #screen-menu .btn-primary,
    body[data-secret-accent="maria"] #screen-menu .btn-secondary {
        max-width: 360px;
        font-size: 0.98rem;
        padding: 12px 18px;
        margin: 6px 0;
    }

    body[data-secret-accent="maria"] #screen-menu #add-question-trigger {
        margin-top: 6px !important;
    }

    body[data-secret-accent="maria"] #screen-menu .secret-code-form {
        width: min(100%, 300px);
        margin-top: 6px;
    }
}

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

/* ==========================================================================
   Accent Picker
   ========================================================================== */

.accent-picker {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

body.game-active .accent-picker {
    display: none;
}

.accent-trigger {
    width: var(--control-round-size);
    height: var(--control-round-size);
    min-width: var(--control-round-size);
    min-height: var(--control-round-size);
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text);
    font-size: var(--control-round-icon-size);
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-medium),
        border-color var(--transition-medium);
}

.accent-trigger:active {
    transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
    .accent-trigger:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }
}

.accent-dropdown-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.accent-dropdown-wrap.open {
    grid-template-rows: 1fr;
}

.accent-dropdown-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 9px 6px 4px;
}

.accent-swatch {
    width: 28px;
    height: 28px;
    min-width: unset;
    min-height: unset;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: var(--swatch);
    border: none;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(-10px) scale(0.7);
    transition:
        opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow var(--transition-medium);
}

.accent-dropdown-wrap.open .accent-swatch {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.accent-dropdown-wrap.open .accent-swatch:nth-child(1) { transition-delay: 30ms; }
.accent-dropdown-wrap.open .accent-swatch:nth-child(2) { transition-delay: 70ms; }
.accent-dropdown-wrap.open .accent-swatch:nth-child(3) { transition-delay: 110ms; }
.accent-dropdown-wrap.open .accent-swatch:nth-child(4) { transition-delay: 150ms; }
.accent-dropdown-wrap.open .accent-swatch:nth-child(5) { transition-delay: 190ms; }

.accent-swatch:active {
    transform: scale(0.88) !important;
}

.accent-swatch.active {
    box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--swatch);
}

/* ── Add Question button (top-right, symmetric to accent-picker) ── */

.top-actions-right {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

body.game-active .top-actions-right {
    display: none;
}

.top-action-btn {
    width: var(--control-round-size);
    height: var(--control-round-size);
    min-width: var(--control-round-size);
    min-height: var(--control-round-size);
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text);
    font-size: var(--control-round-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-medium),
        border-color var(--transition-medium);
}

.top-action-btn:active {
    transform: scale(0.98);
}

.top-action-btn.secondary-action {
    background: var(--card);
    border: 2px solid var(--primary);
    color: var(--text);
}
.top-action-btn.secondary-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

@media (hover: hover) and (pointer: fine) {
    .top-action-btn:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }
}

.top-tip-action {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    height: var(--control-round-size);
    display: flex;
    align-items: center;
}

body.game-active .top-tip-action {
    display: none;
}

.tip-trigger-btn {
    width: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--primary);
    box-shadow: none;
    font-family: 'Elves Delight', var(--font-stack);
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

.tip-trigger-btn:active {
    transform: none;
    opacity: 0.7;
}

@media (hover: hover) and (pointer: fine) {
    .tip-trigger-btn:hover {
        color: var(--primary-dark);
        opacity: 0.88;
    }
}

.pwa-install-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pwa-install-modal.hidden {
    display: none;
}

.pwa-install-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeInBg 0.3s ease;
}

.pwa-install-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: 88dvh;
    overflow: auto;
    border-radius: var(--radius-lg);
    padding: 20px;
    background: var(--card);
    border: 1px solid color-mix(in srgb, var(--border-color) 75%, transparent);
    box-shadow: var(--shadow-interactive);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pwa-install-content button {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: var(--radius-pill);
    box-shadow: none;
}

.pwa-install-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
    line-height: 1.25;
    color: var(--text);
    text-align: center;
}

.pwa-install-subtitle {
    margin: 0 0 20px;
    color: var(--muted-text);
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
}

.pwa-install-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.pwa-install-tab {
    flex: 1;
    min-height: 38px;
    border: 2px solid color-mix(in srgb, var(--border-color) 84%, transparent);
    border-radius: 999px;
    padding: 8px 14px;
    background: transparent;
    color: var(--muted-text);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.pwa-install-tab:active {
    transform: none;
}

.pwa-install-tab.is-active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, transparent);
    color: var(--primary);
}

.pwa-install-panel {
    display: none;
}

.pwa-install-panel.is-active {
    display: block;
    animation: pwaPanelIn 220ms ease;
}

.pwa-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-step-card {
    border: 1px solid color-mix(in srgb, var(--border-color) 68%, transparent);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-step-shot {
    width: 94px;
    min-width: 94px;
    margin: 0;
    padding: 6px;
    aspect-ratio: 10 / 18;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border-color) 82%);
    background: linear-gradient(160deg, #f7f9fc 0%, #e6edf7 100%);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    cursor: zoom-in;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.pwa-step-shot.has-image {
    width: 98px;
    min-width: 98px;
    height: auto;
    aspect-ratio: auto;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: transparent;
    text-transform: none;
}

.pwa-step-thumb {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: inherit;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
}

.pwa-step-shot:hover {
    border-color: color-mix(in srgb, var(--primary) 58%, var(--border-color) 42%);
    box-shadow: var(--shadow-md);
}

.pwa-step-shot:active {
    transform: scale(0.98);
}

.pwa-shot-viewer {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pwa-shot-viewer.hidden {
    display: none;
}

.pwa-shot-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 20, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: pwaShotBackdropIn 240ms ease forwards;
}

.pwa-shot-viewer.is-closing .pwa-shot-viewer-backdrop {
    animation: pwaShotBackdropOut 200ms ease forwards;
}

.pwa-shot-viewer.is-closing .pwa-shot-viewer-image {
    animation: pwaShotViewerOut 220ms ease forwards;
}

.pwa-shot-viewer-image {
    position: relative;
    z-index: 1;
    width: min(88vw, 420px);
    max-height: 84vh;
    aspect-ratio: 10 / 18;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border-color) 80%);
    background: linear-gradient(160deg, #f7f9fc 0%, #e6edf7 100%);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 14px;
    box-shadow: 0 24px 44px rgba(15, 23, 42, 0.22);
    animation: pwaShotViewerIn 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    touch-action: pan-y;
}

.pwa-shot-viewer-image.has-image {
    width: min(92vw, 460px);
    max-height: 88vh;
    height: auto;
    aspect-ratio: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    color: transparent;
    text-transform: none;
}

.pwa-shot-viewer-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 44px rgba(15, 23, 42, 0.24);
    will-change: auto;
}

.pwa-shot-viewer-placeholder {
    display: inline;
}

.pwa-step-text {
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

@keyframes pwaPanelIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pwaShotBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pwaShotBackdropOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes pwaShotViewerIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pwaShotViewerOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
}

@media (max-width: 640px) {
    .pwa-install-modal {
        padding: 12px;
    }

    .pwa-install-content {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .pwa-install-subtitle {
        font-size: 0.9rem;
    }
}

/* ── Add Question modal ── */

.add-question-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.add-question-modal[hidden] {
    display: none;
}

.add-question-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.add-question-modal-card {
    position: relative;
    background: var(--card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 640px;
    height: auto;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-interactive);
    padding-bottom: env(safe-area-inset-bottom);
}

.add-question-form-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 20px;
}

.add-question-form-wrap #add-q-q,
.add-question-form-wrap #add-q-a,
.add-question-form-wrap #add-q-source {
    font-size: 1rem;
    line-height: 1.35;
}

.add-question-form-wrap #add-q-q::placeholder,
.add-question-form-wrap #add-q-a::placeholder,
.add-question-form-wrap #add-q-source::placeholder {
    font-size: 1rem;
}

.add-question-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.add-question-actions button {
    width: auto;
    margin: 0;
}

.add-question-form-wrap .report-send-btn {
    font-size: 1rem;
}

/* ==========================================================================
   Custom Select Modals
   ========================================================================== */

.custom-select-trigger {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--muted-text);
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.custom-select-trigger.selected {
    color: var(--text);
}

.custom-select-trigger.selected > span {
    font-weight: 700;
}

.custom-select-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-select-modal.hidden {
    display: none;
}

.custom-select-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.custom-select-card {
    position: relative;
    background: color-mix(in srgb, var(--card) 85%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
    width: 100%;
    max-width: 320px;
    border-radius: 16px;
    padding: 24px 20px 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    opacity: 0;
    transform: scale(0.9);
}

.custom-select-card h3 {
    margin: 0 0 16px 0;
    font-size: 1.15rem;
    text-align: center;
}

.custom-select-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 45vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

.custom-select-option {
    width: 100%;
    text-align: center;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    transition: background var(--transition-fast);
}

.custom-select-option:active {
    background: var(--border-color);
}

.custom-select-close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 38px;
    height: 38px;
    background: transparent;
    color: var(--muted-text);
    border: none;
    font-size: 1.2rem;
    padding: 0;
    min-width: unset;
    border-radius: 50%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Report Error Section
   ========================================================================== */

.report-error-section {
    margin-top: 0;
    width: 100%;
}

.btn-text-muted {
    background: transparent;
    border: none;
    color: var(--muted-text);
    font-size: 0.85rem;
    font-weight: normal;
    padding: 8px 16px;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.8;
}

.btn-text-muted:hover {
    opacity: 1;
}

.report-error-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.report-error-modal.hidden {
    display: none;
}

.report-error-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeInBg 0.3s ease;
}

.report-error-content {
    background: var(--card);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-interactive);
    z-index: 1;
    position: relative;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.report-error-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    color: var(--text);
    text-align: center;
}

@keyframes fadeInBg {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.report-textarea {
    margin-bottom: 15px;
    font-size: 0.95rem;
    padding: 10px;
    resize: none;
    overflow: hidden;
    min-height: 44px; /* Maintain comfortable height for better tap targets */
}

.report-error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.report-error-actions button {
    margin: 0;
    width: auto;
}

.report-send-btn {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-interactive);
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 700;
}

.report-error-modal.sudden-death-theme .report-error-backdrop {
    background: rgba(8, 7, 10, 0.74);
}

.report-error-modal.sudden-death-theme .report-error-content {
    background: var(--sudden-death-surface);
    border: 1px solid var(--sudden-death-accent-border);
    box-shadow: 0 16px 32px rgba(7, 5, 8, 0.45);
}

.report-error-modal.sudden-death-theme .report-error-title {
    color: var(--sudden-death-text);
}

.report-error-modal.sudden-death-theme .form-hint {
    color: var(--sudden-death-muted);
}

.report-error-modal.sudden-death-theme .report-textarea {
    background: rgba(248, 250, 252, 0.1);
    border-color: var(--sudden-death-accent-border);
    color: var(--sudden-death-text);
}

.report-error-modal.sudden-death-theme .report-textarea::placeholder {
    color: var(--sudden-death-muted);
}

.report-error-modal.sudden-death-theme .report-textarea:focus-visible {
    border-color: var(--sudden-death-accent);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.report-error-modal.sudden-death-theme .report-send-btn {
    color: var(--sudden-death-accent);
    border-color: var(--sudden-death-accent);
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.22);
}

#leave-confirm-modal.sudden-death-theme .leave-confirm-message {
    color: var(--sudden-death-muted);
}

#leave-confirm-modal.sudden-death-theme .btn-text {
    color: var(--sudden-death-muted);
}

#leave-confirm-modal.sudden-death-theme .btn-text:hover {
    color: var(--sudden-death-text);
}

#leave-confirm-modal.sudden-death-theme .leave-confirm-leave-btn {
    color: var(--sudden-death-accent);
    border-color: var(--sudden-death-accent);
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.18);
}

.leave-confirm-content {
    max-width: 360px;
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border-color) 55%);
    box-shadow: var(--shadow-sm);
}

.leave-confirm-message {
    margin: -6px 0 16px;
    text-align: center;
    color: var(--muted-text);
    font-size: 0.95rem;
}

.leave-confirm-actions {
    justify-content: center;
}

.leave-confirm-leave-btn {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    box-shadow: none;
    padding: 8px 18px;
    font-size: 0.9rem;
}

.btn-text {
    background: transparent;
    color: var(--muted-text);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    box-shadow: none;
}

.btn-text:hover {
    color: var(--text);
}

.btn-primary-small {
    background: var(--primary);
    color: white;
    font-size: 0.9rem;
    padding: 8px 20px;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-pill);
}
