:root {
    --ink: #1d1d1f;
    --ink-soft: #6e6e73;
    --ink-faint: #86868b;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --green: #34c759;
    --green-deep: #1d7a35;
    --orange: #ff9500;
    --red: #ff3b30;
    --bg: #f5f5f7;
    --fill: #f5f5f7;
    --fill-hover: #e8e8ed;
    --hairline: rgba(0, 0, 0, 0.08);
    --ease: cubic-bezier(.25, .1, .25, 1);
    --shadow-card:
        0 24px 48px -12px rgba(0, 0, 0, .08),
        0 2px 8px rgba(0, 0, 0, .04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        Inter,
        "Segoe UI",
        Roboto,
        sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button {
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 125, 250, .35);
}

[hidden] {
    display: none !important;
}

/* =========================================================
   APP SHELL
   ========================================================= */

.stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg);
}

.phone {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--bg);
}

.viewport {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.viewport::-webkit-scrollbar {
    display: none;
}

/* =========================================================
   DESKTOP PREVIEW STATUS BAR
   ========================================================= */

.statusbar {
    display: none;
}

/* =========================================================
   HEADER
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    background: rgba(245, 245, 247, .82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.topbar-row {
    width: min(1040px, 100%);
    min-height: 58px;
    margin: 0 auto;
    padding: 8px 18px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.topbar-spacer {
    grid-column: 1;
}

.brand {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: white;
    background: linear-gradient(180deg, #ffd60a, #ff9f0a);
    box-shadow:
        0 2px 8px rgba(255, 159, 10, .45),
        inset 0 1px 0 rgba(255, 255, 255, .45);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.brand-name {
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.02em;
    white-space: nowrap;
}

.brand-tag {
    margin-top: 3px;
    color: var(--ink-faint);
    font-size: 8.5px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.quit-btn {
    grid-column: 3;
    justify-self: end;
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--ink-faint);
    background: rgba(255, 255, 255, .55);
    transition:
        color 180ms var(--ease),
        background 180ms var(--ease),
        border-color 180ms var(--ease),
        transform 180ms var(--ease);
}

.quit-btn svg {
    width: 17px;
    height: 17px;
}

.quit-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.quit-btn:hover {
    color: var(--red);
    background: rgba(255, 59, 48, .06);
    border-color: rgba(255, 59, 48, .25);
}

.quit-btn:active {
    transform: scale(.97);
}

/* =========================================================
   MAIN / CARD
   ========================================================= */

main {
    width: 100%;
    display: flex;
    justify-content: center;
}

.card {
    width: min(720px, calc(100% - 28px));
    margin: 14px 14px 0;
    padding: 22px 18px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .04);
    border-radius: 26px;
    box-shadow: var(--shadow-card);
}

#gameUI {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================================
   STAT BAR
   ========================================================= */

.statbar {
    width: min(340px, 100%);
    height: 62px;
    margin: 0 auto;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    background: var(--fill);
    border-radius: 18px;
}

.seg {
    min-width: 0;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.seg-div {
    display: none;
}

.seg + .seg {
    border-left: 1px solid var(--hairline);
}

/* Timer */

.timer {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 44px;
}

.timer-ring {
    position: absolute;
    inset: 0;
    width: 44px;
    height: 44px;
    transform: rotate(-90deg);
}

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

.timer-track {
    stroke: rgba(0, 0, 0, .08);
}

.timer-progress {
    stroke: var(--green);
    stroke-linecap: round;
    stroke-dasharray: 119.38;
    stroke-dashoffset: 0;
    transition:
        stroke-dashoffset 1s linear,
        stroke 180ms var(--ease);
}

.timer.warn .timer-progress {
    stroke: var(--orange);
}

.timer.urgent .timer-progress {
    stroke: var(--red);
    animation: timer-pulse 1.2s var(--ease) infinite;
}

.timer-value {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.timer-value strong {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.03em;
}

.timer-value span {
    font-size: 6.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
}

/* Score + puzzle */

.seg-stat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.seg-stat strong {
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.seg-stat span {
    margin-top: 5px;
    color: var(--ink-soft);
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .9px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* =========================================================
   CATEGORY
   ========================================================= */

.chip {
    margin-top: 26px;
    min-height: 30px;
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--ink-soft);
    background: var(--fill);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.chip svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
}

/* =========================================================
   QUESTION
   ========================================================= */

.question {
    width: min(100%, 21ch);
    margin-top: 16px;
    color: var(--ink);
    text-align: center;
    font-size: clamp(21px, 6vw, 25px);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -.02em;
    text-wrap: balance;
}

/* =========================================================
   SECTION LABELS
   ========================================================= */

.answer-section,
.bank-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.answer-section {
    margin-top: 26px;
}

.bank-section {
    margin-top: 26px;
}

.section-label {
    width: min(100%, 340px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
}

.section-label span {
    height: 1px;
    flex: 1;
    max-width: 90px;
}

.section-label strong {
    flex: 0 0 auto;
    font-weight: 600;
}

.grad-answer {
    --g1: var(--accent);
    --g2: #af52de;
}

.grad-answer span {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 113, 227, .45)
    );
}

.grad-answer span:last-child {
    background: linear-gradient(
        90deg,
        rgba(175, 82, 222, .45),
        transparent
    );
}

.grad-bank {
    --g1: var(--green);
    --g2: #32ade6;
}

.grad-bank span {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(52, 199, 89, .45)
    );
}

.grad-bank span:last-child {
    background: linear-gradient(
        90deg,
        rgba(50, 173, 230, .45),
        transparent
    );
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .grad-answer strong,
    .grad-bank strong {
        background: linear-gradient(90deg, var(--g1), var(--g2));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
}

/* =========================================================
   ANSWER SLOTS
   ========================================================= */

.slots {
    width: min(100%, 340px);
    margin-top: 11px;
    display: grid;
    grid-template-columns: repeat(var(--answer-length, 5), minmax(0, 1fr));
    gap: 8px;
}

.slot {
    position: relative;
    height: 54px;
    min-width: 0;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: #fff;
    border: 1.5px solid #d2d2d7;
    border-radius: 13px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition:
        background 180ms var(--ease),
        border-color 180ms var(--ease),
        box-shadow 180ms var(--ease),
        transform 180ms var(--ease);
}

.slot::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 13px;
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: #d2d2d7;
    transform: translateX(-50%);
}

.slot.filled {
    background: #f0f6ff;
    border-color: #b7d7f8;
    color: var(--accent);
}

.slot.filled::after,
.slot.locked::after,
.slot.win::after {
    display: none;
}

.slot.locked {
    background: #e8f8ee;
    border-color: #c3ecd2;
    color: var(--green-deep);
}

.slot.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .15);
}

.slot.active::after {
    background: var(--accent);
    animation: cursor-blink 1.1s var(--ease) infinite;
}

.slot.win {
    background: #e9f9ef;
    border-color: #a9e8c0;
    color: var(--green-deep);
}

.slots.shake {
    animation: answer-shake 450ms var(--ease);
}

/* =========================================================
   LETTER BANK
   ========================================================= */

.bank {
    width: min(100%, 340px);
    margin-top: 11px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 9px;
}

.tile {
    min-width: 0;
    height: clamp(52px, 14vw, 58px);
    display: grid;
    place-items: center;
    color: var(--ink);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .05);
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .06),
        0 4px 10px rgba(0, 0, 0, .05);
    font-size: 21px;
    font-weight: 600;
    line-height: 1;
    user-select: none;
    transition:
        transform 180ms var(--ease),
        box-shadow 180ms var(--ease),
        opacity 180ms var(--ease);
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, .07),
        0 7px 14px rgba(0, 0, 0, .07);
}

.tile:active {
    transform: scale(.94);
}

.tile.used {
    opacity: .25;
    box-shadow: none;
    pointer-events: none;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.actions {
    width: min(100%, 340px);
    margin-top: 26px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.btn {
    min-height: 48px;
    padding: 14px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 999px;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.01em;
    transition:
        background 180ms var(--ease),
        color 180ms var(--ease),
        transform 180ms var(--ease),
        box-shadow 180ms var(--ease);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.btn:active {
    transform: scale(.97);
}

.btn-primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 20px -6px rgba(0, 113, 227, .45);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    color: var(--ink);
    background: var(--fill);
}

.btn-secondary:hover {
    background: var(--fill-hover);
}

.btn em {
    padding: 4px 7px;
    color: var(--ink-soft);
    background: rgba(0, 0, 0, .06);
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
}

.actions-note {
    margin-top: 10px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
}

/* =========================================================
   GAME OVER
   ========================================================= */

.gameover {
    min-height: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gameover-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(180deg, #ffd60a, #ff9f0a);
    border-radius: 14px;
    box-shadow:
        0 4px 12px rgba(255, 159, 10, .35),
        inset 0 1px 0 rgba(255, 255, 255, .45);
}

.gameover-icon svg {
    width: 29px;
    height: 29px;
}

.gameover-label {
    color: var(--green-deep);
    font-size: 12.5px;
    font-weight: 600;
}

.gameover h2 {
    margin-top: 8px;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.final-score {
    margin-top: 8px;
    color: var(--accent);
    font-size: clamp(48px, 12vw, 72px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
}

#finalSummary {
    margin-top: 14px;
    color: var(--ink-soft);
    font-size: 15px;
}

.gameover .btn {
    margin-top: 26px;
    width: min(100%, 220px);
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
    padding:
        26px
        18px
        calc(28px + env(safe-area-inset-bottom));
    color: #a1a1a6;
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 1.5px;
    text-align: center;
}

/* =========================================================
   QUIT MODAL
   ========================================================= */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .25);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.overlay[hidden] {
    display: none;
}

.modal {
    width: min(290px, calc(100vw - 40px));
    overflow: hidden;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border-radius: 16px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, .16),
        0 2px 8px rgba(0, 0, 0, .08);
    transform: scale(.92);
    opacity: .5;
    animation: modal-enter 280ms var(--ease) forwards;
}

.modal-body {
    padding: 20px 18px 18px;
    text-align: center;
}

.modal-body h2 {
    color: var(--ink);
    font-size: 16.5px;
    font-weight: 600;
    line-height: 1.25;
}

.modal-body p {
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.4;
}

.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-top: 1px solid var(--hairline);
}

.modal-btn {
    min-height: 48px;
    border: 0;
    background: transparent;
    font-size: 16px;
    color: var(--accent);
}

.modal-btn + .modal-btn {
    border-left: 1px solid var(--hairline);
}

.modal-btn.cancel {
    font-weight: 600;
}

.modal-btn.destructive {
    color: var(--red);
    font-weight: 400;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 110;
    max-width: calc(100vw - 40px);
    padding: 10px 15px;
    color: #fff;
    background: rgba(28, 28, 30, .8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition:
        opacity 300ms var(--ease),
        transform 300ms var(--ease);
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* =========================================================
   MOTION
   ========================================================= */

@keyframes timer-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

@keyframes cursor-blink {
    0%, 45% {
        opacity: 1;
    }

    46%, 100% {
        opacity: .25;
    }
}

@keyframes answer-shake {
    0%, 100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

@keyframes modal-enter {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 900px) {
    .stage {
        min-height: 100vh;
        padding: 32px 24px;
    }

    .phone {
        width: 100%;
        max-width: 1180px;
        min-height: 100vh;
        height: auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .statusbar,
    .homebar {
        display: none;
    }

    .viewport {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .topbar {
        position: relative;
        border-bottom: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .topbar-row {
        max-width: 1180px;
        min-height: 72px;
        padding: 8px 4px;
    }

    .card {
        width: min(720px, calc(100% - 40px));
        margin: 28px auto 0;
        padding: 30px 28px;
        border-radius: 28px;
    }

    .footer {
        padding-bottom: 28px;
    }
}

@media (min-width: 560px) and (max-width: 899px) {
    .stage {
        padding: 28px;
    }

    .phone {
        width: 390px;
        min-height: 844px;
        height: min(844px, calc(100vh - 56px));
        height: min(844px, calc(100dvh - 56px));
        overflow: hidden;
        border: 11px solid #101013;
        border-radius: 54px;
        box-shadow:
            0 35px 80px rgba(0, 0, 0, .16),
            0 8px 25px rgba(0, 0, 0, .08);
    }

    .statusbar {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 30;
        height: 29px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        color: #fff;
        background: #101013;
        font-size: 10px;
        font-weight: 600;
    }

    .viewport {
        height: 100%;
        padding-top: 29px;
    }

    .homebar {
        position: absolute;
        left: 50%;
        bottom: 7px;
        z-index: 30;
        width: 120px;
        height: 4px;
        transform: translateX(-50%);
        background: #101013;
        border-radius: 999px;
    }
}

@media (max-width: 559px) {
    .phone {
        border-radius: 0;
    }
}

@media (max-width: 370px) {
    .brand-tag {
        display: none;
    }

    .seg-stat strong {
        font-size: 14.5px;
    }

    .timer {
        width: 42px;
        height: 42px;
    }

    .timer-ring {
        width: 42px;
        height: 42px;
    }

    .timer-value strong {
        font-size: 14px;
    }

    .timer-value span {
        font-size: 7px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

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

/* =========================================================
   FINAL STAT BAR / TIMER DIMENSIONS
   ========================================================= */

.statbar {
    width: 340px !important;
    height: 62px !important;
    padding: 8px 6px !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 18px !important;
}

.statbar > .seg {
    flex: 1 1 0 !important;
    width: 0 !important;
    height: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: 0 !important;
}

.statbar > .seg-div {
    display: block !important;
    width: 1px !important;
    height: 36px !important;
    flex: 0 0 1px !important;
    margin: 5px 2px !important;
    background: var(--hairline) !important;
}

.timer {
    position: relative !important;
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 46px !important;
    display: grid !important;
    place-items: center !important;
}

.timer-ring {
    position: absolute !important;
    inset: 0 !important;
    width: 46px !important;
    height: 46px !important;
    display: block !important;
    transform: rotate(-90deg) !important;
}

.timer-track,
.timer-progress {
    fill: none !important;
    stroke-width: 7px !important;
}

.timer-value {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    width: 46px !important;
    height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

.timer-value strong {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: -.02em !important;
}

.timer-value span {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 7.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
}

.seg-stat {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.seg-stat strong {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: -.01em !important;
    font-variant-numeric: tabular-nums !important;
}

.seg-stat span {
    margin-top: 4px !important;
    padding: 0 !important;
    font-size: 8.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: .9px !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
}

/* =========================================================
   DYNAMIC TWO-LINE QUESTION
   ========================================================= */

.question {
    width: 100%;
    height: 61px;
    min-height: 61px;
    margin: 20px auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    font-size: 25px;
    line-height: 1.22;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    text-wrap: balance;
}

@media (max-width: 559px) {
    .question {
        width: 100%;
        height: 61px;
        min-height: 61px;
        font-size: 25px;
        line-height: 1.22;
        margin-top: 20px;
        margin-bottom: 24px;
    }
}

@media (max-width: 370px) {
    .question {
        height: 58px;
        min-height: 58px;
    }
}

/* Tighten question -> answer transition */
.question {
    margin-bottom: 6px !important;
}

.answer-section {
    margin-top: 6px !important;
}

/* Tighten question -> answer transition */
.question {
    margin-bottom: 6px !important;
}

.answer-section {
    margin-top: 6px !important;
}

/* =========================================================
   MOBILE QUESTION / CONTENT FIT
   ========================================================= */

@media (max-width: 559px) {
    .topbar {
        position: relative !important;
        top: auto !important;
    }

    .question {
        height: 61px !important;
        min-height: 61px !important;
        max-height: 61px !important;
        margin-top: 20px !important;
        margin-bottom: 6px !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
    }

    .answer-section {
        margin-top: 6px !important;
    }
}

/* =========================================================
   ANSWER GRID — LENGTH AWARE
   ========================================================= */

.slots {
    width: auto !important;
    max-width: 340px !important;
    justify-content: center !important;
    grid-template-columns: repeat(
        var(--answer-length),
        minmax(0, 1fr)
    ) !important;
}

@media (max-width: 559px) {
    .slots {
        gap: 7px !important;
        width: min(
            calc(100vw - 72px),
            340px
        ) !important;
    }

    .slot {
        width: 100% !important;
        min-width: 0 !important;
        height: 54px !important;
        padding: 0 !important;
    }

    .slots[style*="--answer-length: 8"] {
        gap: 6px !important;
        width: min(
            calc(100vw - 58px),
            340px
        ) !important;
    }

    .slots[style*="--answer-length: 9"] {
        gap: 5px !important;
        width: min(
            calc(100vw - 48px),
            340px
        ) !important;
    }

    .slots[style*="--answer-length: 9"] .slot {
        font-size: 18px !important;
    }
}

/* =========================================================
   FINAL ANSWER GRID WIDTH
   ========================================================= */

.slots {
    width: min(100%, 340px) !important;
    max-width: 340px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: stretch !important;
}

@media (min-width: 560px) {
    .slots {
        width: min(340px, 100%) !important;
    }
}

@media (max-width: 559px) {
    .slots {
        width: min(340px, calc(100vw - 48px)) !important;
    }
}

/* =========================================================
   SQUARE ANSWER CELLS
   ========================================================= */

.slots {
    display: grid !important;
    width: var(--slots-width, 340px) !important;
    max-width: 100% !important;
    grid-template-columns: repeat(
        var(--answer-length),
        var(--slot-size)
    ) !important;
    gap: 8px !important;
    justify-content: center !important;
}

.slot {
    width: var(--slot-size) !important;
    height: var(--slot-size) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
}

.slot.word-break {
    margin-left: 12px;
}

@media (max-width: 559px) {
    .slots {
        gap: 7px !important;
    }
}

/* =========================================================
   RESULTS SCREEN
   ========================================================= */

.results-screen {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 22px 14px 36px;
    text-align: center;
}

.results-card {
    width: 100%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 26px;
    padding: 34px 24px 30px;
    box-shadow:
        0 24px 48px -12px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04);
}

.results-eyebrow {
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.3;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.results-score {
    display: block;
    color: var(--accent);
    font-size: clamp(72px, 12vw, 104px);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 0.95;
    font-variant-numeric: tabular-nums;
}

.results-score-label {
    display: block;
    margin-top: 8px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.results-divider {
    width: 100%;
    height: 1px;
    margin: 25px 0;
    background: var(--hairline);
}

.results-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.results-stat {
    display: flex;
    min-width: 90px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.results-stat strong {
    color: var(--ink);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.results-stat:first-child strong {
    color: var(--green-deep);
}

.results-stat span {
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

.results-dot {
    color: var(--ink-faint);
    font-size: 24px;
    line-height: 1;
}

.results-time {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
}

.results-time strong {
    color: var(--ink);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}

.results-time span {
    color: var(--ink-soft);
    font-size: 15px;
    font-weight: 600;
}

.results-share-section {
    padding: 28px 4px 0;
}

.results-share-section h2 {
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

.results-share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.results-share-button {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    box-shadow:
        0 8px 20px -10px rgba(0, 0, 0, 0.16),
        0 1px 3px rgba(0, 0, 0, 0.04);
    transition:
        transform 180ms var(--ease),
        background 180ms var(--ease),
        box-shadow 180ms var(--ease);
}

.results-share-button:hover {
    background: var(--fill);
    transform: translateY(-1px);
}

.results-share-button:active {
    transform: scale(0.96);
}

.results-share-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.results-share-button:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.22);
    outline-offset: 2px;
}

.buy-coffee-button {
    width: min(100%, 320px);
    min-height: 50px;
    margin: 28px auto 0;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    box-shadow:
        0 8px 20px -10px rgba(0, 0, 0, 0.14),
        0 1px 3px rgba(0, 0, 0, 0.04);
    transition:
        transform 180ms var(--ease),
        background 180ms var(--ease);
}

.buy-coffee-button:hover {
    background: var(--fill);
    transform: translateY(-1px);
}

.buy-coffee-button:active {
    transform: scale(0.98);
}

.buy-coffee-button svg {
    width: 17px;
    height: 17px;
    color: var(--ink-soft);
}

.coffee-icon {
    font-size: 17px;
    line-height: 1;
}

/* Hide results completely until the Rush finishes. */
.results-screen[hidden] {
    display: none !important;
}

/* Desktop */
@media (min-width: 1024px) {
    .results-screen {
        padding-top: 34px;
    }

    .results-card {
        padding: 42px 54px 38px;
    }

    .results-share-section {
        padding-top: 34px;
    }

    .results-share-section h2 {
        font-size: 17px;
    }
}

/* Mobile */
@media (max-width: 559px) {
    .results-screen {
        padding: 18px 14px 32px;
    }

    .results-card {
        border-radius: 26px;
        padding: 30px 18px 27px;
    }

    .results-score {
        font-size: 78px;
    }

    .results-divider {
        margin: 22px 0;
    }

    .results-stats {
        gap: 20px;
    }

    .results-stat strong {
        font-size: 29px;
    }

    .results-share-section {
        padding-top: 25px;
    }

    .results-share-section h2 {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .results-share-buttons {
        gap: 10px;
    }

    .results-share-button {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .buy-coffee-button {
        margin-top: 25px;
    }
}

@media (max-width: 370px) {
    .results-score {
        font-size: 70px;
    }

    .results-stats {
        gap: 14px;
    }

    .results-stat {
        min-width: 78px;
    }

    .results-share-buttons {
        gap: 8px;
    }

    .results-share-button {
        width: 48px;
        height: 48px;
    }
}


/* Results screen */
.results-screen {
    grid-column: 1 / -1;
    width: 100%;
}


.brand-logo {
    display: block;
    width: 140px;
    height: auto;
    max-width: 100%;
}

