:root {
    color-scheme: dark;
    --bg: #0d1013;
    --panel: #151a1e;
    --line: #2b3339;
    --text: #f0f3ee;
    --muted: #9aa7ad;
    --lime: #c4f878;
    --cyan: #87d5df;
    --bad: #ffad91;
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select { font: inherit; }
button, summary { cursor: pointer; }
button, a, summary, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible { outline: 3px solid var(--cyan); outline-offset: 5px; }
button:disabled { cursor: default; }
.page { width: min(100% - 48px, 1060px); margin: auto; padding-bottom: 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.brand, .back-link { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; font-size: .95rem; font-weight: 600; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--lime); color: var(--bg); font-size: 1.4rem; letter-spacing: 2px; }
.back-link { color: var(--muted); font-size: .8rem; }
.back-link span { margin-left: 14px; color: var(--lime); }
.intro { padding: 38px 0 30px; text-align: center; }
.eyebrow, .panel-label, .stat-label, .field label, .sound-label, .round-progress, .spectrum-ticks, .keyboard-hint, .answer-key, .answer-description {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.eyebrow { color: var(--lime); }
h1 { margin: 10px 0 8px; font-size: clamp(2.5rem, 6vw, 4.1rem); font-weight: 500; line-height: 1.05; letter-spacing: -.055em; }
.intro p { color: var(--muted); margin: 0; font-size: .95rem; }
.tool-shell { overflow: hidden; border: 1px solid #354038; border-radius: 16px; background: var(--panel); }
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 16px 25px; }
.panel-label { color: var(--muted); }
.round-progress { display: flex; gap: 13px; align-items: center; color: var(--muted); white-space: nowrap; }
.progress-dots { display: flex; gap: 5px; }
.progress-dots i { width: 7px; height: 7px; border-radius: 50%; background: #3a4448; }
.progress-dots i.correct { background: var(--lime); }
.progress-dots i.incorrect { background: var(--bad); }
.quiz-panel { padding: 24px 40px 16px; text-align: center; }
.steps { display: flex; justify-content: center; gap: 32px; padding: 0; margin: 0 0 20px; list-style: none; }
.steps li { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: .78rem; }
.steps span { font-size: 1.1rem; }
.steps [aria-current] { color: var(--lime); }
h2 { font-size: clamp(1.15rem, 3vw, 1.7rem); margin: 0; font-weight: 500; letter-spacing: -.03em; }
.listening-stage { display: grid; grid-template-columns: 1fr 160px 1fr; align-items: center; gap: 28px; padding: 28px 0 10px; }
.sound-card { display: grid; justify-items: center; gap: 12px; padding: 16px 0; color: var(--muted); transition: color .2s; }
.sound-badge { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #424e52; border-radius: 50%; font-size: .8rem; }
.sound-wave { display: flex; width: 100%; height: 64px; gap: 4px; align-items: center; justify-content: center; }
.sound-wave i { display: block; width: 4px; height: 20%; border-radius: 3px; background: #455358; transform-origin: center; }
.sound-wave i:nth-child(3n) { height: 65%; }
.sound-wave i:nth-child(3n + 1) { height: 40%; }
.sound-wave i:nth-child(5n) { height: 90%; }
.sound-wave i:nth-child(7n) { height: 30%; }
.play-controls { display: grid; place-items: center; }
.play-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 148px; height: 148px; border-radius: 50%; border: 1px solid #dcffae; background: var(--lime); color: #18220e; box-shadow: 0 0 0 10px #c4f87808, 0 0 50px #c4f8780c; font-weight: 600; font-size: .85rem; transition: box-shadow .2s, transform .2s; }
.play-button:hover { transform: scale(1.035); box-shadow: 0 0 0 14px #c4f8780d, 0 0 50px #c4f87812; }
.play-button svg { width: 40px; height: 40px; fill: currentColor; }
.replay-button { width: 112px; height: 112px; background: transparent; border-color: #667d4b; color: var(--lime); font-size: .72rem; gap: 6px; }
.replay-button svg { width: 28px; height: 28px; }
.stop-button { width: 112px; height: 112px; border-radius: 50%; background: #202b24; border: 1px solid var(--lime); color: var(--lime); display: flex; flex-direction: column; gap: 8px; justify-content: center; align-items: center; }
.stop-button span { font-size: 1.6rem; }
[data-phase='a'] #soundA, [data-phase='b'] #soundB { color: var(--lime); }
[data-phase='a'] #soundA .sound-badge, [data-phase='b'] #soundB .sound-badge { border-color: var(--lime); background: #c4f87812; }
[data-phase='a'] #soundA i, [data-phase='b'] #soundB i { background: var(--lime); animation: wave .6s ease-in-out infinite alternate; }
.sound-wave i:nth-child(2n) { animation-delay: -.3s !important; }
.sound-wave i:nth-child(3n) { animation-delay: -.5s !important; }
@keyframes wave { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
.audio-status { min-height: 1.5em; color: var(--muted); font-size: .8rem; margin: 8px 0 20px; }
.answers-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.answer-btn { position: relative; display: grid; justify-items: center; gap: 10px; min-height: 120px; border: 1px solid #3c484e; border-radius: 9px; padding: 15px 10px; background: #1c2428; transition: border-color .15s, background .15s; }
.answer-btn:hover:not(:disabled) { background: #27332a; border-color: var(--lime); }
.answer-key { position: absolute; left: 9px; top: 8px; color: var(--muted); font-size: .6rem; }
.answer-label { font-size: 1.15rem; font-weight: 600; }
.answer-description { color: var(--muted); font-size: .57rem; letter-spacing: .03em; }
.answer-curve { width: 72px; height: 28px; color: var(--cyan); }
.answer-curve path { fill: none; stroke: currentColor; stroke-width: 2; }
.answer-btn.correct { color: var(--lime); border-color: var(--lime); background: #27351d; }
.answer-btn.incorrect { color: var(--bad); border-color: var(--bad); background: #352821; }
.answer-btn:disabled:not(.correct):not(.incorrect) { opacity: .48; }
.answer-btn.correct::after, .answer-btn.incorrect::after { position: absolute; top: 6px; right: 9px; content: '✓'; font-size: 1rem; }
.answer-btn.incorrect::after { content: '×'; }
.feedback { display: flex; text-align: left; align-items: center; gap: 14px; padding: 18px 0 0; }
.feedback-icon { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 50%; background: #c4f87815; color: var(--lime); font-size: 1.2rem; }
.feedback h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 500; }
.feedback p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.spectrum { position: relative; margin: 32px 16px 14px; }
.spectrum-line { height: 3px; border-radius: 2px; background: linear-gradient(90deg, #d2ac7e, var(--lime), var(--cyan)); }
.spectrum-ticks { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: .56rem; }
.frequency-marker { position: absolute; top: -7px; height: 16px; width: 2px; background: white; transform: translateX(-50%); }
.frequency-marker span { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .65rem; }
.action-row { display: flex; justify-content: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.btn { min-height: 44px; padding: 10px 18px; border: 1px solid var(--line); background: #1d2529; border-radius: 7px; font-size: .8rem; }
.btn:hover { border-color: var(--cyan); }
.btn.primary { background: var(--lime); color: #18220e; border-color: var(--lime); font-weight: 600; min-width: 200px; }
.btn.primary span { margin-left: 24px; }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: .75rem; min-height: 44px; }
.text-button:hover { color: var(--text); }
.keyboard-hint { margin: 16px 0 0; color: var(--muted); font-size: .55rem; text-transform: none; }
kbd { font: inherit; border: 1px solid #3c4549; border-radius: 3px; padding: 2px 4px; }
.round-result { padding: 18px; margin-top: 20px; border: 1px solid #526b3d; background: #c4f87808; border-radius: 8px; color: var(--lime); line-height: 1.7; }
.round-result strong { display: block; font-size: 1.4rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 22px 0; }
.stat { text-align: center; padding: 4px 12px; border-right: 1px solid var(--line); }
.stat:last-child { border: 0; }
.stat-label { color: var(--muted); font-size: .58rem; }
.stat strong { display: block; margin-top: 7px; font-size: 1.25rem; font-weight: 500; }
.settings-panel, .learning-guide { border-top: 1px solid var(--line); }
summary { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 10px; list-style: none; font-size: .85rem; }
summary::-webkit-details-marker { display: none; }
.settings-panel summary > span:first-child::after { content: ' +'; margin-left: 8px; color: var(--lime); }
.settings-panel[open] summary > span:first-child::after { content: ' −'; }
.summary-hint { font-size: .7rem; color: var(--muted); }
.settings-content { display: flex; flex-wrap: wrap; gap: 16px; padding: 4px 0 24px; }
.field { flex: 1 1 200px; display: grid; gap: 9px; }
.field label { color: var(--muted); }
select { min-height: 44px; width: 100%; background: var(--panel); border: 1px solid #445158; border-radius: 6px; color: var(--text); padding: 0 12px; font-size: .8rem; }
.mode-summary, .privacy-note, .share-status { width: 100%; color: var(--muted); font-size: .8rem; line-height: 1.6; margin: 0; }
.share-status:empty { display: none; }
.learning-guide > summary { color: var(--muted); }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 20px 0 32px; }
.content-card.wide { grid-column: 1 / -1; }
.content-card h2 { font-size: 1.2rem; }
.content-card p, .content-card li { color: var(--muted); font-size: .88rem; line-height: 1.8; }
.content-card ol { padding-left: 20px; }
.content-card a { color: var(--cyan); }
.frequency-list { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0; list-style: none; gap: 12px; }
.frequency-list li { background: var(--panel); padding: 12px; border-radius: 6px; }
.frequency-list strong { display: block; color: var(--text); }
footer, .footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
footer { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; font-size: .7rem; color: var(--muted); }
.footer-links a { text-decoration: none; }
[hidden] { display: none !important; }
@media (max-width: 640px) {
    .page { width: calc(100% - 28px); }
    .topbar { padding: 17px 0; }
    .brand { font-size: .8rem; gap: 8px; }
    .back-link { font-size: .65rem; }
    .back-link span { margin-left: 3px; }
    .intro { padding: 28px 0 24px; }
    .session-bar { padding: 14px; }
    .panel-label { font-size: .57rem; letter-spacing: .03em; }
    .progress-dots { gap: 3px; }
    .progress-dots i { width: 5px; height: 5px; }
    .round-progress { font-size: .6rem; gap: 8px; }
    .quiz-panel { padding: 20px 16px 18px; }
    .steps { gap: 24px; margin-bottom: 18px; }
    .listening-stage { grid-template-columns: 1fr 112px 1fr; gap: 10px; padding: 20px 0 6px; }
    .play-button { width: 110px; height: 110px; font-size: .7rem; gap: 8px; }
    .replay-button, .stop-button { width: 92px; height: 92px; }
    .sound-wave { gap: 3px; height: 48px; }
    .sound-wave i { width: 3px; }
    .sound-wave i:nth-child(n + 14) { display: none; }
    .sound-label { font-size: .55rem; }
    .audio-status { font-size: .7rem; margin: 8px 0 16px; }
    .answers-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .answer-btn { min-height: 98px; gap: 6px; padding: 10px; }
    .answer-label { font-size: 1rem; }
    .answer-curve { height: 23px; }
    .keyboard-hint { display: none; }
    .summary-hint { display: none; }
    .content-grid { grid-template-columns: 1fr; }
    .frequency-list { grid-template-columns: 1fr 1fr; }
    .stat { padding: 2px 6px; }
    .stat-label { font-size: .5rem; letter-spacing: .03em; }
    .stat strong { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
