/*
 * MindSharp: the tool's own components, styled in the site's design language (7 Oct 2026, on the UltraCompress Pro
 * template, after BatteryPro). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus
 * rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool itself needs: the
 * toolbar with the streak badge and the pill tabs, the daily session card in the brand gradient, the stat tiles, the card
 * grid (a wide card beside a narrow one), the skill bars, the seven-day chart, the skill toggles and game cards, the play
 * area with its six game layouts (memory grid, pattern row and options, math and word inputs, spatial shapes, attention
 * grid), the history list, the badge grid, the settings rows, the result and confirmation windows, the toasts and the
 * information sections. Light is the default; dark applies when <html> has no data-theme.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --ok: #166534;
    --ok-soft: rgba(22, 163, 74, 0.14);
    --warn: #92400e;
    --bad: #b91c1c;
    --bad-soft: rgba(220, 38, 38, 0.14);
    --c-memory: #8B5CF6;
    --c-pattern: #3B82F6;
    --c-math: #10B981;
    --c-word: #F59E0B;
    --c-spatial: #06B6D4;
    --c-attention: #EC4899;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }

.hidden-input { display: none; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-light { background: #fff; color: #6d28d9; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); font-size: 1rem; padding: 14px 28px; }
.btn-light:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); color: #5b21b6; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }

/* ----- Toolbar: streak badge and pill tabs ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin: 0 0 1.25rem; }
.streak-badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 9999px; border: 1px solid rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.12); color: #92400e; font-weight: 700; font-size: 0.9rem; }
:root:not([data-theme="light"]) .streak-badge { color: #fbbf24; }
.streak-badge[hidden] { display: none; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; overflow-x: auto; }
.view-tabs[hidden] { display: none; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }

/* ----- Daily session card ----- */
.daily-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 32px; border-radius: 20px; background: var(--gradient-brand); color: #fff; box-shadow: 0 12px 32px rgba(139, 92, 246, 0.3); margin-bottom: 20px; }
.daily-card h2 { margin: 0 0 8px; color: #fff; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.daily-card p { margin: 0; color: rgba(255, 255, 255, 0.9); max-width: 60ch; line-height: 1.55; }
.daily-card .btn-light { flex-shrink: 0; }

/* ----- Stat tiles ----- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 20px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--surface-hover-shadow); }
.stat-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.stat-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 2.2rem; font-weight: 700; line-height: 1.1; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 0.8rem; color: var(--text-3); }

/* ----- Cards and the two-column grid ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:last-child { margin-bottom: 0; }
.card--wide { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card + .card, .card + .section-heading { margin-top: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; }
.card-text { color: var(--text-2); margin: 0 0 14px; line-height: 1.55; font-size: 0.95rem; }
.section-heading { font-size: 1.25rem; margin: 20px 0 14px; display: flex; align-items: center; gap: 8px; }
.form-hint { font-size: 0.78rem; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; }

/* ----- Skill bars ----- */
.card--wide .card-body { display: flex; flex-direction: column; justify-content: center; }
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 24px; }
.skill-item { display: flex; flex-direction: column; gap: 8px; }
.skill-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.skill-name { font-weight: 600; color: var(--text-strong); font-size: 0.92rem; display: inline-flex; align-items: center; gap: 6px; }
.skill-level { font-size: 0.8rem; font-weight: 700; color: var(--link); font-variant-numeric: tabular-nums; }
.skill-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.skill-progress { height: 100%; width: 4%; border-radius: 4px; transition: width 0.6s ease; }
.skill-memory { background: var(--c-memory); }
.skill-pattern { background: var(--c-pattern); }
.skill-math { background: var(--c-math); }
.skill-word { background: var(--c-word); }
.skill-spatial { background: var(--c-spatial); }
.skill-attention { background: var(--c-attention); }
.bests-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.best-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }

/* ----- Seven-day chart ----- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 22px; }
.chart-column { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.chart-value { font-size: 0.72rem; font-weight: 700; color: var(--link); height: 16px; line-height: 16px; font-variant-numeric: tabular-nums; }
.chart-bar { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: var(--surface-2); transition: height 0.5s ease; }
.chart-bar.has-score { background: var(--gradient-brand); }
.chart-label { margin-top: 6px; font-size: 0.72rem; color: var(--text-3); }

/* ----- Skill toggles and game cards ----- */
.skill-toggles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.skill-toggle { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--chip-border); border-radius: 14px; background: var(--chip); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease; }
.skill-toggle-icon { font-size: 1.5rem; line-height: 1; }
.skill-toggle:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.skill-toggle.selected { background: var(--tint-brand); border-color: var(--brand); color: var(--text-strong); box-shadow: 0 0 0 3px var(--ring); }
.skill-toggle:not(.selected) { opacity: 0.6; }
.skill-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.games-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.game-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; text-align: left; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); font-family: inherit; color: var(--text); cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.game-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); border-color: var(--brand); }
.game-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.game-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; }
.game-name { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.game-desc { color: var(--text-2); font-size: 0.9rem; line-height: 1.5; }
.game-meta { display: flex; gap: 14px; font-size: 0.8rem; color: var(--text-3); margin-top: auto; padding-top: 6px; }

/* ----- Play area ----- */
.game-area { min-height: 420px; }
.game-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.game-title { display: flex; align-items: center; gap: 12px; }
.game-title h2 { margin: 0; font-size: 1.15rem; }
.game-title-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; }
.session-note { font-size: 0.78rem; color: var(--text-3); }
.game-stats { display: flex; gap: 10px; }
.game-stat { display: flex; flex-direction: column; align-items: center; min-width: 70px; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); }
.game-stat-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.game-stat-value, .timer-display { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.timer-display.warning { color: var(--warn); }
.timer-display.danger { color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.game-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 20px; text-align: center; min-height: 300px; }
.game-controls { padding: 12px 20px 16px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; }
.game-prompt { margin: 0; color: var(--text-2); font-size: 0.95rem; }
.game-note { margin: 0; font-size: 0.9rem; color: var(--text-2); font-weight: 500; }
.countdown-display { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 5rem; font-weight: 700; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop 0.4s ease; }
.countdown-display.is-go { background: none; color: var(--ok); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.form-input { width: 100%; min-width: 0; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.form-input.invalid { border-color: var(--bad); }
select.form-input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
select.form-input option { color: #0a0a14; background: #fff; }
.select-sm { width: auto; min-width: 180px; flex-shrink: 0; }
.answer-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.game-input { width: 160px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.4rem; font-weight: 700; text-align: center; padding: 12px 14px; }
.game-input--word { width: 240px; text-transform: uppercase; letter-spacing: 0.1em; }
.game-input::-webkit-outer-spin-button, .game-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.game-input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* Memory */
.memory-grid { display: grid; gap: 8px; width: min(100%, 340px); }
.memory-cell { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--surface-2); cursor: pointer; transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.memory-cell:disabled { cursor: default; }
.memory-cell:not(:disabled):hover { transform: scale(1.04); border-color: var(--brand); }
.memory-cell.active { background: var(--gradient-brand); box-shadow: 0 0 0 4px var(--ring); transform: scale(1.06); }
.memory-cell.correct { background: var(--ok); }
.memory-cell.wrong { background: var(--bad); }
/* Pattern */
.pattern-sequence { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pattern-item { min-width: 60px; padding: 14px 12px; border-radius: 12px; background: var(--surface-2); font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.pattern-item.question { background: var(--gradient-brand); color: #fff; }
.pattern-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: min(100%, 420px); }
.option-btn { padding: 14px 8px; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--chip); font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--text-strong); cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease; }
.option-btn:hover { border-color: var(--brand); transform: translateY(-2px); }
.option-btn.is-right { background: var(--ok); color: #fff; border-color: transparent; }
.option-btn.is-wrong { background: var(--bad); color: #fff; border-color: transparent; }
/* Math and word */
.math-problem { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 2.4rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.word-scramble { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 2.2rem; font-weight: 700; letter-spacing: 0.12em; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Spatial */
.spatial-container { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: center; }
.spatial-reference h4 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.shape-display { width: 110px; height: 110px; border-radius: 16px; background: var(--tint-brand); border: 2px solid var(--brand); display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--link); line-height: 1; }
.spatial-options { display: grid; grid-template-columns: repeat(2, 90px); gap: 12px; }
.spatial-option { width: 90px; height: 90px; border-radius: 14px; border: 1px solid var(--chip-border); background: var(--chip); font-size: 2.4rem; color: var(--text-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease; }
.spatial-option span { display: block; line-height: 1; }
.spatial-option:hover { border-color: var(--brand); transform: translateY(-2px); }
.spatial-option.is-right { background: var(--ok-soft); border-color: var(--ok); }
.spatial-option.is-wrong { background: var(--bad-soft); border-color: var(--bad); }
/* Attention */
.target-indicator { padding: 10px 18px; border-radius: 9999px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); color: var(--text-strong); font-weight: 600; }
.target-indicator strong { font-size: 1.3rem; color: var(--link); margin: 0 4px; }
.attention-grid { display: grid; gap: 6px; width: min(100%, 420px); }
.attention-cell { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--chip-border); background: var(--chip); font-size: 1.3rem; color: var(--text-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; transition: background 0.15s ease, transform 0.15s ease; }
.attention-cell:hover { transform: scale(1.06); border-color: var(--brand); }
.attention-cell.target { background: var(--ok); color: #fff; border-color: transparent; }
.attention-cell.wrong { background: var(--bad); color: #fff; border-color: transparent; }

/* ----- History ----- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.history-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff; flex-shrink: 0; }
.history-details { flex: 1; min-width: 0; }
.history-details h4 { margin: 0; font-size: 0.95rem; }
.history-details p { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-3); }
.history-score { text-align: right; flex-shrink: 0; }
.history-score .score { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; color: var(--link); font-size: 1.1rem; }
.history-score .date { font-size: 0.75rem; color: var(--text-3); }

/* ----- Badges ----- */
.achievements-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.achievement { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 12px; border-radius: 14px; border: 1px solid var(--surface-border); background: var(--surface-2); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.achievement:hover { transform: translateY(-3px); box-shadow: var(--surface-hover-shadow); }
.achievement.unlocked { background: var(--tint-brand); border-color: var(--tint-brand-border); }
.achievement.locked { opacity: 0.55; }
.achievement.locked .achievement-icon { filter: grayscale(1); }
.achievement-icon { font-size: 2rem; line-height: 1; }
.achievement h4 { margin: 4px 0 0; font-size: 0.92rem; }
.achievement p { margin: 0; font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }
.achievement-state { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin-top: 4px; }
.achievement.unlocked .achievement-state { color: var(--link); }

/* ----- Settings rows and switches ----- */
.switch-list { display: flex; flex-direction: column; gap: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-label { font-weight: 600; font-size: 0.95rem; color: var(--text-strong); }
.switch-hint { font-size: 0.8rem; color: var(--text-3); line-height: 1.4; }
.toggle { position: relative; width: 46px; height: 26px; flex-shrink: 0; border-radius: 9999px; border: 0; padding: 0; background: var(--chip-border); cursor: pointer; transition: background 0.2s ease; }
.toggle .toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.toggle[aria-checked="true"] { background: var(--gradient-brand); }
.toggle[aria-checked="true"] .toggle-knob { transform: translateX(20px); }
.toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.modal-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); width: 100%; max-width: 520px; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; transform: translateY(12px); transition: transform 0.25s ease; }
.modal--narrow { max-width: 420px; }
.modal--result { max-width: 460px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { margin: 0; font-size: 1.15rem; }
.modal-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color 0.2s ease, color 0.2s ease; }
.modal-close:hover { border-color: var(--brand); color: var(--link); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-footer--center { justify-content: center; }
.confirm-message { margin: 0; color: var(--text); }
.result-body { text-align: center; }
.result-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 8px; animation: pop 0.4s ease; }
.result-body .modal-title { font-size: 1.5rem; margin-bottom: 6px; }
.result-message { color: var(--text-2); margin: 0 0 18px; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.result-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.result-stat-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.result-stat-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--link); font-variant-numeric: tabular-nums; }

/* ----- Toasts ----- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast { background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 400px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast-icon { font-size: 1.1rem; line-height: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: #4ade80; }
.toast.error { border-left-color: #f87171; }
.toast.warning { border-left-color: #fbbf24; }
.toast.info { border-left-color: #38bdf8; }
.toast.leaving { opacity: 0; transform: translateX(40px); }

/* ----- Information sections below the tool ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid { grid-template-columns: 1fr; }
    .card--wide { grid-column: auto; }
    .skills-grid, .bests-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skill-toggles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .achievements-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .info-section .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .view-tabs { width: 100%; }
    .view-tab { flex: 1; padding: 8px 6px; font-size: 0.78rem; text-align: center; }
    .daily-card { flex-direction: column; align-items: flex-start; padding: 22px 20px; }
    .daily-card .btn-light { width: 100%; }
    .stat-grid { gap: 12px; }
    .stat-tile { padding: 14px; }
    .stat-value { font-size: 1.8rem; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .skills-grid, .bests-grid { grid-template-columns: 1fr; }
    .skill-toggles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .skill-toggle { padding: 10px 4px; font-size: 0.78rem; }
    .games-grid { grid-template-columns: 1fr; gap: 14px; }
    .achievements-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .achievement { padding: 12px 6px; }
    .achievement p { display: none; }
    .game-header { padding: 12px 16px; }
    .game-stats { width: 100%; }
    .game-stat { flex: 1; min-width: 0; }
    .game-content { padding: 18px 12px; min-height: 260px; }
    .chart { height: 160px; }
    .math-problem { font-size: 1.8rem; }
    .word-scramble { font-size: 1.6rem; }
    .spatial-options { grid-template-columns: repeat(2, 80px); }
    .spatial-option { width: 80px; height: 80px; font-size: 2rem; }
    .switch-row { flex-wrap: wrap; }
    .select-sm { width: 100%; }
    .modal-overlay { padding: 8px; }
    .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
    .toast { min-width: 0; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .modal, .toast, .toggle .toggle-knob, .stat-tile, .game-card, .skill-toggle, .achievement, .memory-cell, .option-btn, .spatial-option, .attention-cell, .skill-progress, .chart-bar, .countdown-display, .result-icon, .timer-display.danger { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
}
