:root {
  --ink: #1d2925;
  --muted: #6f756f;
  --soft: #9ca099;
  --paper: #fffdf8;
  --canvas: #f5f0e7;
  --line: #ded9ce;
  --green: #174c3b;
  --green-2: #24664f;
  --green-soft: #e4eee8;
  --coral: #e9633f;
  --coral-dark: #c94829;
  --coral-soft: #fae7df;
  --yellow: #e5b84b;
  --danger: #b54236;
  --shadow: 0 22px 60px rgba(46, 53, 48, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, select:focus-visible { outline: 3px solid rgba(233, 99, 63, .28); outline-offset: 2px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
[hidden] { display: none !important; }

.app-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.03em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 8px; letter-spacing: .15em; }
.brand-mark { width: 40px; height: 40px; position: relative; display: block; border-radius: 50%; background: var(--green); transform: rotate(-10deg); }
.brand-mark::before, .brand-mark::after, .brand-mark i { content: ""; position: absolute; left: 8px; right: 8px; height: 1px; background: rgba(255,255,255,.78); }
.brand-mark::before { top: 13px; }.brand-mark i:first-child { top: 18px; }.brand-mark i:last-child { top: 23px; }.brand-mark::after { top: 28px; }
.local-badge { padding: 8px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.34); font-size: 11px; }
.local-badge i { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #4f9c6d; box-shadow: 0 0 0 3px rgba(79,156,109,.13); }

.view { padding: 64px 0 58px; }
.view:not(.is-active) { display: none; }
.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 70px; align-items: end; margin-bottom: 44px; }
.eyebrow { margin: 0 0 10px; color: var(--coral); font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.hero h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(45px, 7vw, 78px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.hero h1 em { color: var(--coral); font-weight: 500; }
.hero > p { max-width: 400px; margin: 0 0 7px; color: var(--muted); font-size: 15px; line-height: 1.85; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mode-card { min-height: 420px; position: relative; padding: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.mode-card::after { content: ""; width: 160px; height: 160px; position: absolute; top: -60px; right: -48px; border: 1px solid rgba(29,41,37,.08); border-radius: 50%; box-shadow: 0 0 0 25px rgba(29,41,37,.025), 0 0 0 50px rgba(29,41,37,.018); pointer-events: none; }
.mode-number { position: absolute; top: 26px; right: 30px; color: var(--soft); font: 700 11px/1 ui-monospace, monospace; letter-spacing: .13em; }
.mode-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 25px; color: var(--paper); border-radius: 50%; background: var(--coral); font: 500 25px/1 Georgia, serif; }
.identify-card .mode-icon { background: var(--green); }
.mode-card h2 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 32px; font-weight: 500; letter-spacing: -.03em; }
.mode-card > p:not(.eyebrow) { max-width: 360px; min-height: 46px; margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.compact-setting { margin-top: 18px; }
.compact-setting legend, .setting-block legend { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: var(--ink); font-size: 10px; font-weight: 750; }
.compact-setting legend { color: var(--muted); }
.segmented { display: flex; gap: 5px; padding: 4px; border-radius: 11px; background: var(--canvas); }
.segmented button { min-width: 0; flex: 1; min-height: 35px; padding: 6px 9px; color: var(--muted); border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 10px; font-weight: 700; white-space: nowrap; }
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { color: var(--ink); border-color: var(--line); background: var(--paper); box-shadow: 0 3px 9px rgba(38,45,40,.06); }
.primary-button { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 0 20px; color: #fff; border: 0; border-radius: 11px; background: var(--coral); font-size: 12px; font-weight: 800; box-shadow: 0 10px 22px rgba(233,99,63,.18); }
.primary-button:hover { background: var(--coral-dark); transform: translateY(-1px); }
.primary-button.dark { background: var(--green); box-shadow: 0 10px 22px rgba(23,76,59,.18); }
.primary-button.dark:hover { background: var(--green-2); }
.shortcut-preview { height: 49px; display: flex; align-items: center; gap: 5px; margin-top: 18px; color: var(--soft); font-size: 9px; }
kbd { min-width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0 6px; color: var(--ink); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--paper); font: 700 9px/1 ui-monospace, monospace; }
.shortcut-preview span { margin-left: 4px; }

.settings-card { margin-top: 18px; padding: 30px 32px 32px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,248,.7); }
.settings-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.settings-heading h2 { margin: 0; font: 500 25px/1.1 Georgia, "Songti SC", serif; }
.settings-heading > p { margin: 0; color: var(--soft); font-size: 10px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 34px; }
.setting-block small { color: var(--soft); font-size: 8px; font-weight: 500; }
.note-setting { grid-column: 1 / -1; }
.note-choices { display: flex; gap: 7px; }
.note-choices button { min-width: 48px; height: 43px; padding: 0 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-size: 11px; font-weight: 800; }
.note-choices button:hover { border-color: var(--green); }
.note-choices button.is-active { color: #fff; border-color: var(--green); background: var(--green); box-shadow: 0 5px 12px rgba(23,76,59,.15); }
.accidental-row { margin-top: 7px; }
.accidental-row button { flex: 1; }
.range-fields { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.range-fields label span { display: block; margin-bottom: 5px; color: var(--soft); font-size: 8px; }
.range-fields select { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-size: 11px; }
.range-fields i { margin-bottom: 12px; color: var(--soft); font-style: normal; }
.settings-error { margin: 22px 0 0; padding: 12px 14px; color: var(--danger); border: 1px solid rgba(181,66,54,.2); border-radius: 9px; background: rgba(181,66,54,.06); font-size: 11px; }

.training-topline { min-height: 48px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; margin-bottom: 22px; }
.back-button { justify-self: start; padding: 8px 0; color: var(--muted); border: 0; background: transparent; font-size: 11px; font-weight: 700; }
.back-button:hover { color: var(--ink); }
.mode-badge { justify-self: end; padding: 8px 11px; color: var(--green); border-radius: 999px; background: var(--green-soft); font-size: 9px; font-weight: 800; }
.question-progress { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.question-progress > div { width: 150px; height: 4px; overflow: hidden; border-radius: 3px; background: var(--line); }
.question-progress i { width: 5%; height: 100%; display: block; border-radius: inherit; background: var(--coral); transition: width .25s ease; }
.training-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.question-card, .session-card, .finish-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.question-card { min-height: 670px; padding: 27px 48px 32px; text-align: center; }
.question-meta { display: flex; justify-content: space-between; color: var(--soft); font-size: 9px; font-weight: 700; }
.question-meta span { padding: 6px 9px; border-radius: 6px; background: var(--canvas); }
.sound-visual { height: 154px; display: flex; align-items: center; justify-content: center; gap: clamp(20px, 6vw, 62px); margin: 14px 0 4px; }
.sound-note { min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sound-note i { width: 42px; height: 42px; position: relative; display: block; border: 9px solid var(--coral-soft); border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 1px rgba(233,99,63,.15); }
.sound-note.second i { border-color: var(--green-soft); background: var(--green); box-shadow: 0 0 0 1px rgba(23,76,59,.12); }
.sound-note.is-playing i { animation: pulse-note .65s ease; }
@keyframes pulse-note { 50% { transform: scale(1.22); box-shadow: 0 0 0 12px rgba(233,99,63,.08); } }
.sound-note b { font: 600 12px/1 Georgia, serif; }
.interval-route { min-width: 90px; color: var(--soft); font: 700 13px/1 ui-monospace, monospace; letter-spacing: .4em; }
.centered { margin-bottom: 8px; text-align: center; }
.question-card > h1 { margin: 0; font: 500 clamp(25px, 3.2vw, 36px)/1.2 Georgia, "Songti SC", serif; letter-spacing: -.035em; }
.instruction { min-height: 23px; margin: 10px 0 20px; color: var(--muted); font-size: 12px; }
.listen-button { min-width: 210px; height: 49px; display: inline-flex; align-items: center; justify-content: center; gap: 11px; color: #fff; border: 0; border-radius: 26px; background: var(--coral); font-size: 11px; font-weight: 800; box-shadow: 0 10px 22px rgba(233,99,63,.2); }
.listen-button:hover { background: var(--coral-dark); }
.listen-button.is-playing { background: var(--green); }
.play-icon { font-size: 10px; }
.answer-choices { max-width: 510px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 23px auto 0; }
.answer-choices button { min-height: 88px; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: 1fr 1fr; align-items: center; column-gap: 9px; padding: 14px 16px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.answer-choices button:hover { border-color: var(--green); transform: translateY(-1px); }
.answer-choices button > span { width: 34px; height: 34px; grid-row: 1 / 3; display: grid; place-items: center; color: var(--muted); border-radius: 7px; background: var(--canvas); font: 700 12px/1 ui-monospace, monospace; }
.answer-choices strong { align-self: end; font-size: 12px; }
.answer-choices small { align-self: start; margin-top: 3px; color: var(--soft); font-size: 8px; }
.answer-choices button.is-correct { color: var(--green); border-color: #75a68f; background: var(--green-soft); }
.answer-choices button.is-wrong { color: var(--danger); border-color: #d99a92; background: #faece9; }
.answer-choices button.is-correct > span { color: #fff; background: var(--green); }
.answer-choices button.is-wrong > span { color: #fff; background: var(--danger); }
.sing-actions { margin-top: 22px; }
.feedback { max-width: 510px; margin: 17px auto 0; padding: 13px 16px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.feedback.correct { color: var(--green); background: var(--green-soft); }
.feedback.wrong { color: var(--danger); background: #faece9; }
.feedback.answer { color: var(--green); background: var(--green-soft); }
.comparison { max-width: 510px; margin: 16px auto 0; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); text-align: left; }
.comparison > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.comparison h2 { margin: 0; font: 500 15px/1.2 Georgia, serif; }
.comparison .eyebrow { margin: 0; font-size: 7px; }
.compare-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 0 10px; }
.compare-notes span { padding: 9px 10px; border-radius: 7px; background: var(--paper); font-size: 9px; }
.compare-notes b { color: var(--coral); }
.compare-button { width: 100%; height: 36px; color: #fff; border: 0; border-radius: 8px; background: var(--green); font-size: 9px; font-weight: 800; }
.transport-row { max-width: 510px; display: flex; justify-content: center; gap: 9px; margin: 22px auto 0; padding-top: 19px; border-top: 1px solid var(--line); }
.secondary-button, .next-button { min-height: 42px; padding: 0 17px; border-radius: 9px; font-size: 10px; font-weight: 800; }
.secondary-button { color: var(--muted); border: 1px solid var(--line); background: var(--paper); }
.secondary-button:hover { color: var(--ink); border-color: var(--ink); }
.next-button { color: #fff; border: 0; background: var(--green); }
.next-button:hover { background: var(--green-2); }
.next-button span { margin-left: 12px; }

.session-card { padding: 25px; text-align: left; }
.session-card h2 { margin: 0 0 20px; font: 500 24px/1.1 Georgia, serif; }
.stats-list > div { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stats-list span { color: var(--muted); font-size: 9px; }
.stats-list strong { font-size: 13px; }
.stats-list .large-stat { display: block; padding: 17px 0; }
.stats-list .large-stat span, .stats-list .large-stat strong { display: block; }
.stats-list .large-stat strong { margin-top: 4px; color: var(--coral); font: 500 32px/1 Georgia, serif; }
.sing-tip { padding: 16px; border-radius: 10px; background: var(--green-soft); }
.sing-tip span { color: var(--green); font-size: 9px; font-weight: 800; }
.sing-tip p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.shortcut-list { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.shortcut-list p { margin: 0 0 11px; color: var(--soft); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.shortcut-list span { display: flex; align-items: center; gap: 5px; margin-top: 8px; color: var(--soft); font-size: 8px; }

.finish-card { max-width: 680px; margin: 55px auto; padding: 55px; text-align: center; }
.finish-mark { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 23px; color: #fff; border-radius: 50%; background: var(--green); font-size: 25px; box-shadow: 0 0 0 10px var(--green-soft); }
.finish-card h1 { margin: 0; font: 500 40px/1.1 Georgia, serif; }
.finish-card > p:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.finish-stats { display: flex; justify-content: center; gap: 45px; margin: 30px 0; }
.finish-stats div { min-width: 80px; }
.finish-stats strong, .finish-stats span { display: block; }
.finish-stats strong { font: 500 30px/1 Georgia, serif; }
.finish-stats span { margin-top: 7px; color: var(--soft); font-size: 8px; }
.finish-actions { max-width: 360px; display: flex; gap: 9px; margin: 0 auto; }
.finish-actions > * { flex: 1; justify-content: center; margin: 0; }

footer { min-height: 70px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--soft); border-top: 1px solid var(--line); font-size: 8px; letter-spacing: .08em; }
footer i { width: 3px; height: 3px; border-radius: 50%; background: var(--soft); }
.toast { max-width: calc(100% - 30px); position: fixed; left: 50%; bottom: 24px; z-index: 10; padding: 11px 16px; color: #fff; border-radius: 8px; background: var(--ink); box-shadow: var(--shadow); font-size: 10px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 0; }
  .training-layout { grid-template-columns: 1fr; }
  .session-card { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .session-card > .eyebrow, .session-card > h2 { grid-column: 1 / -1; }
  .shortcut-list { margin: 0; padding: 0 0 0 20px; border: 0; border-left: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 24px, 1120px); }
  .topbar { height: 70px; }
  .local-badge { padding: 7px; font-size: 0; }
  .local-badge i { margin: 0; }
  .view { padding-top: 40px; }
  .hero h1 { font-size: 46px; }
  .mode-card, .settings-card { padding: 24px 20px; }
  .settings-grid { grid-template-columns: 1fr; gap: 22px; }
  .note-setting { grid-column: auto; }
  .note-choices { flex-wrap: wrap; }
  .note-choices button { flex: 1 0 19%; }
  .accidental-row button { flex-basis: 43%; }
  .settings-heading { align-items: start; }
  .settings-heading > p { display: none; }
  .training-topline { grid-template-columns: 1fr 1fr; }
  .question-progress { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .question-progress > div { width: min(78vw, 280px); }
  .question-card { min-height: 0; padding: 22px 16px 25px; }
  .sound-visual { height: 132px; gap: 19px; }
  .interval-route { min-width: 55px; }
  .answer-choices { grid-template-columns: 1fr; }
  .comparison > div:first-child { display: block; }
  .comparison h2 { margin-top: 5px; }
  .transport-row { flex-wrap: wrap; }
  .session-card { display: block; }
  .shortcut-list { margin-top: 20px; padding: 18px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .finish-card { margin-top: 25px; padding: 42px 20px; }
  .finish-stats { gap: 20px; }
  .finish-actions { flex-direction: column; }
  footer { flex-wrap: wrap; padding: 18px 0; }
}

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