/* Riddle Up — 10-Second Riddle
   Endless, free-text, rapid-fire game (see TenSecondRiddleController,
   ten-second-riddle.js). Deliberately compact — the active game screen
   is sized to fit a mobile viewport without scrolling, since the timer
   is the whole point of the game. Uses the `--surface-*` dark-theme-safe
   tokens defined in ../site.css (loaded sitewide). Loaded only on this
   page via TenSecondRiddleController (see \Assets::add). */

.tsr-app {
    max-width: 32rem;
    margin: 0 auto;
    padding: .75rem 0 2rem;
}

.tsr-screen { width: 100%; }

/* ---- Start screen ---- */
.tsr-start-card {
    max-width: 26rem;
    margin: .5rem auto 0;
    padding: 2rem 1.5rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    background: var(--surface-bg);
    box-shadow: var(--surface-hover-shadow);
}

.tsr-start-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: .5rem;
}

.tsr-start-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .02em;
    margin-bottom: .25rem;
}

.tsr-start-tagline {
    opacity: .7;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tsr-timer-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .8125rem;
    letter-spacing: .04em;
    padding: .35rem 1rem;
    border-radius: 50rem;
    background: rgba(var(--indigo-rgb), .14);
    color: var(--indigo);
    margin-bottom: 1rem;
}

.tsr-start-desc {
    font-size: .9rem;
    opacity: .8;
    margin-bottom: 1rem;
}

.tsr-start-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-size: .875rem;
    padding: .3rem 0;
}

.tsr-best {
    margin-top: 1rem;
    font-size: .875rem;
    opacity: .75;
}

.tsr-start-btn {
    width: 100%;
    margin-top: 1.25rem;
    font-weight: 800;
    min-height: 3rem;
    letter-spacing: .02em;
}

.tsr-unavailable {
    margin-top: 1.25rem;
    font-size: .875rem;
    opacity: .7;
}

.tsr-howto {
    margin-top: 1.25rem;
    text-align: left;
    font-size: .8125rem;
}

.tsr-howto summary {
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    color: var(--indigo);
    list-style: none;
}

.tsr-howto summary::-webkit-details-marker { display: none; }

.tsr-howto ol {
    margin: .75rem 0 0;
    padding-left: 1.25rem;
    opacity: .8;
    line-height: 1.6;
}

/* ---- Active game screen (compact — must fit one viewport) ---- */
.tsr-header { margin-bottom: .5rem; }

.tsr-exit-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: none;
    border: none;
    padding: .3rem .25rem;
    min-height: 2.5rem;
    font-weight: 600;
    font-size: .8125rem;
    color: var(--body-color);
    opacity: .75;
}

.tsr-header-score {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-weight: 800;
    font-size: 1rem;
    color: var(--indigo);
}

.tsr-streak-row { margin-bottom: .25rem; }

.tsr-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-weight: 700;
    font-size: .8125rem;
    color: rgb(var(--warning-rgb));
    background: rgba(var(--warning-rgb), .12);
    padding: .25rem .75rem;
    border-radius: 50rem;
}

.tsr-timer-wrap { margin: .25rem 0; }

.tsr-timer {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.tsr-timer-value {
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--body-color);
}

.tsr-timer--warning .tsr-timer-value { color: rgb(var(--warning-rgb)); }
.tsr-timer--critical .tsr-timer-value { color: rgb(var(--danger-rgb)); }

@media (prefers-reduced-motion: no-preference) {
    .tsr-timer--critical .tsr-timer-value {
        animation: tsr-pulse 1s ease-in-out infinite;
    }
}

@keyframes tsr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.tsr-badge {
    display: inline-block;
    padding: .25rem .8rem;
    border-radius: 50rem;
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .05em;
}

.tsr-badge--easy { background: rgba(var(--success-rgb), .14); color: rgb(var(--success-rgb)); }
.tsr-badge--medium { background: rgba(var(--warning-rgb), .16); color: rgb(var(--warning-rgb)); }
.tsr-badge--hard { background: rgb(var(--danger-rgb)); color: var(--white); }
.tsr-badge--expert { background: linear-gradient(135deg, rgb(var(--danger-rgb)), var(--indigo)); color: var(--white); }

.tsr-error {
    text-align: center;
    padding: .75rem 1rem;
    border-radius: .8rem;
    background: rgba(var(--danger-rgb), .1);
    border: 1px solid rgba(var(--danger-rgb), .3);
    margin-bottom: .75rem;
}

.tsr-error p { margin-bottom: .5rem; font-size: .875rem; }

.tsr-riddle-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.1rem;
    box-shadow: var(--surface-hover-shadow);
    padding: 1.1rem 1.1rem;
    margin-bottom: .75rem;
    text-align: center;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsr-riddle-text {
    margin: 0;
    font-size: clamp(1.05rem, 1rem + .8vw, 1.35rem);
    font-weight: 700;
    line-height: 1.4;
    white-space: pre-line;
}

.tsr-answer-form {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}

.tsr-answer-input {
    flex: 1;
    min-width: 0;
    padding: .75rem 1rem;
    font-size: 1rem;
    border-radius: .8rem;
    border: 1px solid var(--border-color);
    background: var(--surface-bg);
    color: var(--body-color);
}

.tsr-answer-input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 .2rem rgba(var(--indigo-rgb), .2);
}

.tsr-answer-input:disabled { opacity: .6; }

.tsr-submit-btn {
    flex-shrink: 0;
    font-weight: 700;
    padding: 0 1.25rem;
    min-height: 2.9rem;
}

.tsr-hint-btn {
    background: none;
    border: none;
    padding: .3rem .5rem;
    min-height: 2.5rem;
    font-weight: 600;
    font-size: .8125rem;
    color: var(--indigo);
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.tsr-hint-btn:disabled { opacity: .5; }

.tsr-hint-panel {
    background: rgba(var(--warning-rgb), .1);
    border: 1px dashed rgba(var(--warning-rgb), .4);
    border-radius: .8rem;
    padding: .7rem 1rem;
    margin-top: .5rem;
    font-size: .875rem;
    text-align: center;
}

/* ---- Result overlay (auto-dismisses) ---- */
.tsr-result {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, .45);
    cursor: pointer;
}

.tsr-result-inner {
    width: 100%;
    max-width: 22rem;
    background: var(--surface-bg);
    border-radius: 1.25rem;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .25);
}

@media (prefers-reduced-motion: no-preference) {
    .tsr-result-inner { animation: tsr-pop-in .2s ease both; }
}

@keyframes tsr-pop-in {
    from { opacity: 0; transform: scale(.92); }
    to { opacity: 1; transform: scale(1); }
}

.tsr-result-icon { font-size: 2.75rem; line-height: 1; margin-bottom: .5rem; }

.tsr-result-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .02em;
    margin-bottom: .5rem;
}

.tsr-result--correct .tsr-result-title { color: rgb(var(--success-rgb)); }
.tsr-result--incorrect .tsr-result-title { color: rgb(var(--danger-rgb)); }
.tsr-result--timeout .tsr-result-title { color: rgb(var(--warning-rgb)); }

.tsr-result-answer {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: .5rem;
}

.tsr-breakdown {
    margin-bottom: .5rem;
}

.tsr-breakdown span[data-el="bd-total"] {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--indigo);
}

.tsr-breakdown-detail {
    display: block;
    font-size: .75rem;
    opacity: .65;
    margin-top: .15rem;
}

.tsr-result-streak,
.tsr-result-milestone,
.tsr-result-level {
    display: inline-block;
    font-weight: 700;
    font-size: .8125rem;
    padding: .25rem .75rem;
    border-radius: 50rem;
    background: var(--surface-muted-bg);
    margin: .2rem .15rem 0;
}

.tsr-result-milestone {
    color: rgb(var(--warning-rgb));
    background: rgba(var(--warning-rgb), .14);
}

/* ---- Results / session summary screen ---- */
.tsr-score-card {
    max-width: 28rem;
    margin: 1rem auto 0;
    padding: 2.25rem 1.75rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    background: var(--surface-bg);
    box-shadow: var(--surface-hover-shadow);
}

.tsr-score-icon { font-size: 2.25rem; display: block; margin-bottom: .5rem; }

.tsr-score-title {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: .5rem;
}

.tsr-best-banner {
    font-weight: 700;
    color: rgb(var(--warning-rgb));
    margin-bottom: .5rem;
}

.tsr-score-points {
    font-size: 2rem;
    font-weight: 800;
    color: var(--indigo);
    margin-bottom: .1rem;
}

.tsr-score-sub {
    opacity: .75;
    margin-bottom: 1.25rem;
}

.tsr-stats { margin-bottom: .5rem; }

.tsr-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .9rem .5rem;
    border-radius: .9rem;
    background: var(--surface-muted-bg);
}

.tsr-stat-value { font-size: 1.15rem; font-weight: 700; }

.tsr-stat-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .6;
    text-align: center;
}

@media (min-width: 576px) {
    .tsr-app { padding-top: 1.25rem; }
    .tsr-riddle-card { padding: 1.5rem; }
}
