/* Percentages — game-specific styles.
 * Mirrors Quick Math structure; the problem card holds a word-problem
 * question instead of a flat arithmetic expression, so the current-problem
 * row stacks the question above the answer instead of sitting on one line.
 */

.game-page {
    padding: 1.5rem 0 2rem;
    --jump-accent: var(--cat-math);
}

.game-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 0.25rem;
}

.game-head h1 {
    margin: 0;
    font-family: var(--font-hand);
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.05;
}

.game-head .category {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--cat-math-bg);
    color: var(--cat-math);
}

.game-lede {
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
    font-family: var(--font-hand);
    font-size: 1.25rem;
    line-height: 1.5;
}

/* Start panel */
.start-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1.4rem;
    margin: 1rem 0 1.5rem;
    overflow: hidden;
}

.start-panel h2 {
    font-family: var(--font-hand);
    margin: 0 0 0.25rem;
    font-size: 1.8rem;
    color: var(--cat-math);
    transform: rotate(-1deg);
    display: inline-block;
}
.start-panel h2::after { display: none; }

.panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 1.25rem;
    margin: 0.25rem 0 1rem;
    align-items: start;
}
.panel-col { min-width: 0; }
@media (max-width: 640px) {
    .panel-grid { grid-template-columns: 1fr; gap: 0.5rem 1rem; }
}

.start-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}
.start-footer .untimed-row { margin: 0; }

/* Circle pickers */
.circle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.3rem 0 0;
}
.circle-pick { position: relative; cursor: pointer; }
.circle-pick input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.circle-pick > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg);
    border: 1.5px dashed var(--border-strong);
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.05;
    color: var(--text);
    transition: all 0.18s ease;
    transform: rotate(var(--rot, 0));
    user-select: none;
    text-align: center;
    padding: 0.1rem 0.2rem;
}
.op-row .circle-pick > span { font-size: 0.95rem; }

.circle-pick:nth-child(1) > span { --rot: -5deg; }
.circle-pick:nth-child(2) > span { --rot: 4deg; }
.circle-pick:nth-child(3) > span { --rot: -3deg; }
.circle-pick:nth-child(4) > span { --rot: 6deg; }

.circle-pick-oval > span {
    width: auto;
    height: auto;
    min-width: 68px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-family: var(--font-hand);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.circle-pick:hover > span {
    transform: rotate(0) scale(1.06);
    color: var(--cat-math);
    border-color: var(--cat-math);
}
.circle-pick input:checked + span {
    border-style: solid;
    border-color: var(--cat-math);
    background: var(--cat-math-bg);
    color: var(--cat-math);
    box-shadow: 0 2px 0 rgba(58, 123, 184, 0.12);
}
.circle-pick input:focus-visible + span {
    outline: 2px solid var(--cat-math);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .circle-pick > span { transform: none; transition: none; }
    .circle-pick:hover > span { transform: scale(1.06); }
}

/* Length circles */
.length-row .circle-pick > span { font-size: 1.2rem; }
.length-row .circle-pick > span strong {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1;
}
.length-row .circle-pick > span small {
    font-family: var(--font-sans);
    font-size: 0.54rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 0.1rem;
    opacity: 0.7;
}

/* Op circle label + icon stack */
.op-row .circle-pick > span .op-icon {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1;
    margin-bottom: 0.05rem;
}
.op-row .circle-pick > span .op-name {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.75;
    font-family: var(--font-sans);
}
.op-row .circle-pick input:checked + span .op-name { opacity: 1; }

.untimed-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
    font-family: var(--font-hand);
    font-size: 1.05rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1.4rem;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 2px solid var(--cat-math);
    border-radius: 999px;
    background: var(--cat-math);
    color: #fff;
    cursor: pointer;
    box-shadow: 3px 4px 0 rgba(58, 123, 184, 0.28);
    transform: rotate(-0.8deg);
    transition: transform 0.18s, box-shadow 0.15s, filter 0.15s;
}
.btn-primary:hover {
    filter: brightness(0.96);
    transform: rotate(0) translate(-1px, -1px);
    box-shadow: 4px 5px 0 rgba(58, 123, 184, 0.32);
}
.btn-primary:active {
    transform: rotate(0) translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(58, 123, 184, 0.25);
}
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    font-family: var(--font-hand);
    font-size: 1.15rem;
    font-weight: 600;
    border: 1.5px dashed var(--border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transform: rotate(var(--btn-rot, 0.8deg));
    transition: transform 0.18s, border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover {
    transform: rotate(0) scale(1.03);
    border-style: solid;
    border-color: var(--cat-math);
    color: var(--cat-math);
    background: var(--cat-math-bg);
}
.btn-ghost:focus-visible { outline: 2px solid var(--cat-math); outline-offset: 3px; }
.btn-ghost:nth-of-type(odd)  { --btn-rot: -0.8deg; }
.btn-ghost:nth-of-type(even) { --btn-rot: 1deg; }

@media (prefers-reduced-motion: reduce) {
    .btn-primary,
    .btn-ghost { transform: none; }
}

/* Game area */
.game-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.08s;
}

.play-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 720px) {
    .play-grid {
        grid-template-columns: 1fr minmax(260px, 320px);
        gap: 1.75rem;
        align-items: start;
    }
}
.play-col { min-width: 0; }
.play-col-card { display: flex; flex-direction: column; gap: 0.5rem; }
.play-col-pad  { display: flex; flex-direction: column; gap: 1rem; }

.game-area.shake { animation: shake 0.35s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
    .game-area.shake { animation: none; }
}

/* HUD */
.hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border);
    flex-wrap: wrap;
}
.hud-group {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}
.hud-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.hud-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}
.timer-low {
    color: var(--danger);
    animation: pulse 0.8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
    .timer-low { animation: none; }
}
.score-bump { animation: scoreBump 0.35s ease-out; }
@keyframes scoreBump {
    0%   { transform: scale(1); color: var(--cat-math); }
    40%  { transform: scale(1.35); color: var(--cat-math); }
    100% { transform: scale(1); color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
    .score-bump { animation: none; }
}
.score-pop {
    position: absolute;
    top: -0.5em;
    left: 100%;
    margin-left: 0.2em;
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--cat-math);
    opacity: 0;
    pointer-events: none;
}
.score-pop.pop-run { animation: popUp 0.9s ease-out forwards; }
@keyframes popUp {
    0%   { opacity: 0; transform: translateY(0); }
    25%  { opacity: 1; transform: translateY(-6px); }
    100% { opacity: 0; transform: translateY(-28px); }
}
@media (prefers-reduced-motion: reduce) {
    .score-pop.pop-run { animation: none; opacity: 0; }
}

.hud-streak .streak-value {
    color: var(--accent);
    font-family: var(--font-hand);
    font-size: 1.5rem;
    line-height: 1;
}
.hud-streak.streak-hot .streak-value {
    color: var(--cat-car);
    text-shadow: 0 0 8px rgba(212, 122, 60, 0.4);
}

.btn-end {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-end:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--bg-soft);
}
.btn-end:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }

/* Problem card */
.problem-wrap {
    display: flex;
    justify-content: center;
    padding: 0.75rem 0.25rem 1.25rem;
}
.problem-card {
    --card-bg: #fdf8ea;
    --card-ink: #1f2a3a;
    --card-rule: #d7cbaa;
    --rule-gap: 2rem;
    position: relative;
    width: min(440px, 100%);
    min-height: calc(var(--rule-gap) * 9);
    background:
        radial-gradient(circle at 5% 0%, rgba(139, 90, 43, 0.05) 0%, transparent 38%),
        radial-gradient(circle at 95% 100%, rgba(139, 90, 43, 0.05) 0%, transparent 38%),
        radial-gradient(circle at 80% 15%, rgba(0, 0, 0, 0.025) 0%, transparent 25%),
        linear-gradient(135deg, #fdf8ea 0%, #f5ecd4 100%);
    color: var(--card-ink);
    padding: 1.2rem 1.4rem 1.2rem;
    border-radius: 4px;
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.04),
        0 12px 28px -14px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    transform: rotate(-0.6deg);
    transition: transform 0.25s;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.problem-card:hover { transform: rotate(0); }
@media (prefers-reduced-motion: reduce) {
    .problem-card { transform: none; }
    .problem-card:hover { transform: none; }
}

:root[data-theme="dark"] .problem-card {
    --card-bg: #f3ead5;
    --card-ink: #1f2a3a;
    --card-rule: #c7b890;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) .problem-card {
        --card-bg: #f3ead5;
        --card-ink: #1f2a3a;
        --card-rule: #c7b890;
    }
}

/* Tape strip along the top */
.problem-card-tape {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 80px;
    height: 20px;
    background: rgba(113, 166, 208, 0.35);
    border: 1px solid rgba(113, 166, 208, 0.55);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* History list */
.problem-history {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.15rem;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    color: var(--card-ink);
    mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 100%);
}
.problem-history li {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3em;
    opacity: 0.6;
    font-family: var(--font-hand);
    font-size: 1.2rem;
    line-height: 1.5;
    animation: historyIn 0.28s ease-out;
    flex-wrap: wrap;
}
@keyframes historyIn {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 0.55; }
}
.problem-history .h-expr  { color: inherit; }
.problem-history .h-eq    { opacity: 0.7; }
.problem-history .h-ans   { font-weight: 700; }
.problem-history li.correct .h-ans { color: #2a7a52; }
.problem-history li.wrong  .h-ans { color: #b04141; text-decoration: line-through; }
.problem-history li.wrong  .h-correct { color: #2a7a52; font-size: 0.9em; margin-left: 0.15em; }
.problem-history li.skip   .h-ans { color: #7a7668; font-style: italic; }
.problem-history li .h-mark { font-size: 0.9em; margin-left: 0.15em; }
@media (prefers-reduced-motion: reduce) {
    .problem-history li { animation: none; }
}

/* Current problem — stacked question over answer row */
.problem-current {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding-top: 0.45rem;
    border-top: 1.5px dashed var(--card-rule);
    margin-top: auto;
    min-height: calc(var(--rule-gap) * 3);
}
.problem-label {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--card-ink);
    opacity: 0.6;
    text-align: center;
}
.problem-question {
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 1.55rem;
    line-height: 1.25;
    color: var(--card-ink);
    text-align: center;
    padding: 0.1rem 0.25rem;
    word-break: normal;
}
.problem-answer-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    padding-top: 0.2rem;
}
.problem-equals {
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--card-ink);
    opacity: 0.75;
}
.dollar-prefix {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 2rem;
    color: var(--cat-math);
    line-height: 1;
    padding-right: 0.05em;
}
.problem-answer {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 2rem;
    color: var(--cat-math);
    min-width: 3ch;
    border-bottom: 2px solid var(--cat-math);
    padding: 0 0.25em 0.05em;
    white-space: nowrap;
    position: relative;
    line-height: 1.05;
}
.problem-answer.is-empty::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--cat-math);
    margin-left: 0.1em;
    animation: caretBlink 1s steps(1) infinite;
    opacity: 0.8;
    align-self: center;
}
@keyframes caretBlink {
    50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .problem-answer.is-empty::after { animation: none; }
}

/* Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
    max-width: 320px;
    margin: 0 auto;
    width: 100%;
}
.key {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.08s, background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.key:hover { background: var(--surface); border-color: var(--cat-math); }
.key:active { transform: translateY(1px) scale(0.97); }
.key:focus-visible { outline: 2px solid var(--cat-math); outline-offset: 2px; }

.key-back { color: var(--text-muted); font-size: 1.3rem; }
.key-back:hover { color: var(--danger); border-color: var(--danger); }
.key-dot { font-size: 1.6rem; color: var(--cat-math); font-weight: 800; }
.key-enter {
    grid-column: 1 / -1;
    aspect-ratio: auto;
    height: 52px;
    color: #fff;
    background: var(--cat-math);
    border-color: var(--cat-math);
    font-family: var(--font-hand);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.key-enter:hover { filter: brightness(0.92); background: var(--cat-math); color: #fff; }

/* Action row / feedback */
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 0;
    justify-content: center;
}
.feedback {
    min-height: 1.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    margin: 0.25rem 0 0.5rem;
    color: transparent;
    transition: color 0.2s;
}
.feedback-right { color: var(--success); font-size: 1.4rem; }
.feedback-wrong { color: var(--danger); }
.feedback-skip  { color: var(--text-muted); }

/* Countdown */
.countdown {
    text-align: center;
    font-family: var(--font-hand);
    font-size: 4rem;
    font-weight: 600;
    color: var(--cat-math);
    padding: 2rem 0;
    line-height: 1;
}

/* Handle dialog */
.handle-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.handle-dialog[hidden] { display: none; }
.handle-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.4);
}
.handle-card h3 {
    margin: 0 0 0.35rem;
    font-family: var(--font-hand);
    font-size: 1.6rem;
}
.handle-card p {
    margin: 0 0 1rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}
.handle-card input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    margin-bottom: 0.5rem;
}
.handle-card input:focus { outline: 2px solid var(--cat-math); outline-offset: 1px; }
.handle-error {
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 1.2em;
    margin: 0 0 0.6rem;
}
.handle-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Summary */
.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.summary h2 {
    font-family: var(--font-hand);
    font-size: 2rem;
    margin: 0 0 0.25rem;
    padding: 0;
}
.summary h2::after { display: none; }
.summary-score {
    font-family: var(--font-mono);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--cat-math);
    line-height: 1;
    margin: 0.5rem 0 0.25rem;
}
.summary-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
}
.summary-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}
.summary-meta span strong {
    color: var(--text);
    font-family: var(--font-mono);
}
.summary-best-flag {
    color: var(--accent);
    font-family: var(--font-hand);
    font-size: 1.25rem;
    font-weight: 600;
    min-height: 1.5em;
    margin: 0.25rem 0 0.5rem;
}
.summary-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.share-note {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    min-height: 1.2em;
}

/* Leaderboard (local) */
.leaderboard {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.leaderboard-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.local-best-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.local-best-list li {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto auto 3rem;
    gap: 0.75rem;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.local-best-list li:last-child { border-bottom: none; }
.local-best-list li.empty {
    display: block;
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
}
.local-best-list .rank {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-weight: 600;
}
.local-best-list .handle { font-weight: 500; }
.local-best-list .diff,
.local-best-list .date {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.local-best-list .score {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--cat-math);
    text-align: right;
}

.game-page .section-heading .section-hint {
    font-family: var(--font-hand);
    font-size: 1rem;
}

/* Content sections */
.game-content { margin-top: 2.25rem; }
.game-content section { margin-bottom: 2rem; }
.game-content h2 { margin-top: 0; }

.game-page .section-heading h2 {
    font-family: var(--font-hand);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}
.game-content h3 {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1.15;
    margin: 1.4em 0 0.3em;
    color: var(--text);
}
.game-content p,
.game-content ul,
.game-content ol.walkthrough + p {
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-secondary);
}
.game-content p strong { color: var(--text); }

.panel-subhead {
    font-family: var(--font-hand);
    font-size: 1.1rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    font-weight: 600;
    margin: 0.9rem 0 0.2rem;
}

.start-panel::before {
    content: "%  %  %";
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-family: var(--font-hand);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cat-math);
    opacity: 0.22;
    letter-spacing: 0.15em;
    pointer-events: none;
    transform: rotate(-4deg);
}
@media (max-width: 560px) {
    .start-panel::before { display: none; }
}

/* Step walkthroughs */
.walkthrough {
    list-style: none;
    counter-reset: wstep;
    padding: 0;
    margin: 0.5rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.walkthrough li {
    counter-increment: wstep;
    position: relative;
    padding: 0.5rem 0.85rem 0.5rem 2.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    line-height: 1.5;
}
.walkthrough li::before {
    content: counter(wstep);
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--cat-math-bg);
    color: var(--cat-math);
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.05rem;
    border: 1.5px dashed var(--cat-math);
}
.walkthrough strong {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1.02em;
}

/* Callout */
.callout {
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    line-height: 1.55;
}
.callout-gotcha {
    background: #eef4fb;
    border: 1px solid #9ec3e4;
    color: #24456b;
}
:root[data-theme="dark"] .callout-gotcha {
    background: #1f2c3c;
    border-color: #3e5b7c;
    color: #bfd4ea;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) .callout-gotcha {
        background: #1f2c3c;
        border-color: #3e5b7c;
        color: #bfd4ea;
    }
}
.callout strong { font-weight: 700; }

.ftc-disclosure {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.affiliate-links {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
}
.affiliate-links li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.affiliate-links li:last-child { border-bottom: none; }
.affiliate-links a { font-weight: 500; }
.affiliate-links .blurb {
    display: block;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 0.15rem;
}

.kb-hints {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}
.kb-hints kbd {
    font-family: var(--font-mono);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

@media (max-width: 560px) {
    .kb-hints { display: none; }
    .local-best-list li {
        grid-template-columns: 2rem 1fr auto 3rem;
    }
    .local-best-list .date { display: none; }
    .key { font-size: 1.25rem; }
    .problem-question { font-size: 1.35rem; }
}
