:root {
  color-scheme: dark;
  --bg: #111411;
  --surface: #1a1f1b;
  --surface-2: #222823;
  --line: #343b35;
  --text: #f2efe4;
  --muted: #a7aea5;
  --green: #9bea86;
  --green-dark: #244a2a;
  --amber: #f6b967;
  --danger: #ff8275;
  --radius: 20px;
  --shadow: 0 18px 50px rgb(0 0 0 / 22%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 80% 0%, rgb(57 91 58 / 24%), transparent 35rem), var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgb(155 234 134 / 40%); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(20px, env(safe-area-inset-left)); }
.app-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; position: relative; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.brand-mark { width: 37px; height: 37px; display: grid; align-content: center; gap: 3px; padding: 7px 5px; border-radius: 11px; background: var(--green); transform: rotate(-5deg); }
.brand-mark i { height: 1px; display: block; background: #142016; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.practice-counter { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid rgb(155 234 134 / 28%); border-radius: 99px; color: var(--green); background: rgb(155 234 134 / 7%); font-variant-numeric: tabular-nums; }
.practice-counter i { color: var(--muted); font-size: .67rem; font-style: normal; }
.practice-counter strong { font-size: .75rem; letter-spacing: .03em; }
.main-nav { display: flex; gap: 4px; position: absolute; left: 50%; padding: 4px; border: 1px solid var(--line); border-radius: 99px; background: rgb(26 31 27 / 82%); transform: translateX(-50%); }
.main-nav button { min-height: 34px; padding: 0 15px; border: 0; border-radius: 99px; color: var(--muted); background: transparent; cursor: pointer; font-size: .76rem; }
.main-nav button.active { color: #142016; background: var(--green); font-weight: 800; }
.overall-progress { padding: 9px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .78rem; }
.icon-button { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: 1.1rem; }

.view { padding: 62px 0 54px; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 60px; align-items: end; }
.eyebrow { margin: 0 0 15px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 20px; font-size: clamp(2.8rem, 7vw, 6rem); line-height: .93; letter-spacing: -.07em; }
h1 em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }
.hero-copy { max-width: 620px; margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.hero-score { min-width: 160px; text-align: center; }
.hero-score p { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.hero-score strong { color: var(--text); }
.progress-ring { --progress: 0deg; width: 118px; height: 118px; display: grid; place-items: center; margin: auto; border-radius: 50%; background: conic-gradient(var(--green) var(--progress), var(--line) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 8px; border-radius: inherit; background: var(--bg); }
.progress-ring span { position: relative; z-index: 1; font-size: 1.2rem; font-weight: 800; }

.learning-switch { margin-top: 58px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.learning-switch button { min-height: 66px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background: var(--surface); cursor: pointer; font-weight: 750; }
.learning-switch button span { color: #626b63; font-size: .64rem; letter-spacing: .08em; }
.learning-switch button.active { color: var(--text); border-color: rgb(155 234 134 / 60%); background: linear-gradient(145deg, rgb(155 234 134 / 11%), var(--surface)); }
.learning-switch button.active span { color: var(--green); }
.course-toolbar { margin: 20px 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.course-summary { display: flex; align-items: baseline; gap: 10px; padding: 10px 2px; }
.course-summary strong { font-family: Georgia, serif; font-size: 1.25rem; }
.course-summary span { color: var(--muted); font-size: .75rem; }
.segmented { display: inline-flex; padding: 5px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.segmented button { padding: 10px 18px; border: 0; border-radius: 99px; color: var(--muted); background: transparent; cursor: pointer; }
.segmented button.active { color: #142016; background: var(--green); font-weight: 750; }
.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .75rem; }
.legend .dot { width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--green); }
.legend .done { background: var(--amber); }
.lock-symbol { margin-left: 8px; }

.stage-list { display: grid; gap: 18px; }
.string-row { display: grid; grid-template-columns: 175px repeat(3, 1fr); gap: 12px; align-items: stretch; }
.string-label { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgb(26 31 27 / 72%); }
.string-number { min-width: 42px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--green); font-size: .78rem; font-weight: 800; }
.string-label strong, .string-label small { display: block; }
.string-label small { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.stage-card { min-height: 104px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.stage-card:not(:disabled):hover { transform: translateY(-2px); border-color: #566158; background: var(--surface-2); }
.stage-card:disabled { color: #70766f; cursor: not-allowed; opacity: .7; }
.stage-card.done { border-color: rgb(246 185 103 / 48%); background: linear-gradient(145deg, rgb(246 185 103 / 10%), var(--surface)); }
.stage-card.current { border-color: rgb(155 234 134 / 62%); }
.stage-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stage-card strong { font-size: .9rem; }
.stage-state { color: var(--green); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.stage-card.done .stage-state { color: var(--amber); }
.stage-card-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--muted); font-size: .72rem; }
.stage-card-meta span:last-child { text-align: right; }
.special-stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.special-stage-card { min-height: 145px; position: relative; padding-top: 58px; overflow: hidden; }
.stage-badge { position: absolute; left: 16px; top: 12px; color: rgb(155 234 134 / 28%); font-family: Georgia, serif; font-size: 2.7rem; font-weight: 700; line-height: 1; }
.course-stage-group + .course-stage-group { margin-top: 34px; }
.course-stage-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.course-stage-heading h3 { margin: 0; font-family: Georgia, serif; font-size: 1.55rem; }
.course-stage-heading span { color: var(--muted); font-size: .7rem; }
.info-card { margin-top: 24px; display: flex; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgb(34 40 35 / 60%); }
.info-card p { margin: 4px 0 0; color: var(--muted); font-size: .83rem; line-height: 1.5; }
.info-icon { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 50%; color: #142016; background: var(--green); font-weight: 900; }

.tools-view { padding-bottom: 70px; }
.tools-intro h1 { margin-bottom: 18px; font-size: clamp(2.8rem, 6vw, 5rem); }
.tools-intro > p:last-child { max-width: 570px; color: var(--muted); line-height: 1.6; }
.tool-card { margin-top: 48px; display: grid; grid-template-columns: .8fr 1.2fr; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tool-copy { min-height: 540px; padding: clamp(28px, 5vw, 52px); position: relative; border-right: 1px solid var(--line); background: radial-gradient(circle at 0 100%, rgb(155 234 134 / 12%), transparent 22rem); }
.tool-number { position: absolute; right: 28px; top: 25px; color: #454d46; font-family: Georgia, serif; font-size: 3.5rem; }
.tool-copy h2 { margin: 0 0 16px; font-family: Georgia, serif; font-size: clamp(2.6rem, 5vw, 4.5rem); }
.tool-copy > p:not(.eyebrow) { max-width: 380px; color: var(--muted); line-height: 1.6; }
.standard-tuning { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 38px; }
.standard-tuning span { min-width: 49px; height: 49px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); transition: .15s ease; }
.standard-tuning span.active { color: #142016; border-color: var(--green); background: var(--green); transform: translateY(-2px); }
.standard-tuning i { font-size: .55rem; font-style: normal; opacity: .65; }
.tool-tuner-panel { min-height: 540px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: clamp(26px, 5vw, 54px); background: #161a17; }
.tool-tuner-status { width: 100%; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .76rem; }
.tool-tuner-status > span { display: flex; align-items: center; gap: 8px; }
.tool-tuner-status output { font-variant-numeric: tabular-nums; }
.tool-tuner-note { margin-top: 35px; font-family: Georgia, serif; font-size: clamp(7rem, 18vw, 12rem); line-height: .72; letter-spacing: -.08em; }
.tool-tuner-octave { min-height: 20px; margin-top: 20px; color: var(--muted); font-size: .78rem; }
.tool-cents-scale { width: min(430px, 100%); display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: start; position: relative; margin-top: 42px; padding-top: 19px; border-top: 2px solid var(--line); color: var(--muted); font-size: .61rem; }
.tool-cents-scale span:nth-child(2), .tool-cents-scale span:nth-child(4) { text-align: center; }
.tool-cents-scale span:last-of-type { text-align: right; }
.tool-cents-scale::before { content: ""; width: 2px; height: 16px; position: absolute; left: 50%; top: -9px; background: var(--green); }
.tool-cents-scale > i { --tool-cents: 0; width: 4px; height: 24px; position: absolute; left: calc(50% + (var(--tool-cents) * 1%)); top: -13px; border-radius: 3px; background: var(--amber); box-shadow: 0 0 16px rgb(246 185 103 / 50%); transform: translateX(-50%); transition: left .12s linear, background .12s ease; }
.tool-cents-scale > i.tuned { background: var(--green); box-shadow: 0 0 16px rgb(155 234 134 / 55%); }
.tool-tuning-message { min-height: 22px; margin: 22px 0 16px; color: var(--muted); font-size: .82rem; }
.tool-tuning-message.tuned { color: var(--green); font-weight: 800; }
.tool-level { width: min(430px, 100%); display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin-bottom: 28px; color: var(--muted); font-size: .65rem; }
.tool-level > div { height: 4px; overflow: hidden; border-radius: 99px; background: var(--line); }
.tool-level i { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--green); transition: width .08s linear; }

.training-view { padding-top: 26px; position: relative; }
.countdown-overlay { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: var(--text); background: rgb(10 13 10 / 92%); backdrop-filter: blur(12px); text-align: center; }
.countdown-overlay p { margin-bottom: 10px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.countdown-overlay strong { min-width: 1.2em; font-family: Georgia, serif; font-size: clamp(8rem, 30vw, 16rem); line-height: .9; }
.countdown-overlay strong.go { color: var(--green); font-size: clamp(5rem, 20vw, 10rem); }
.countdown-overlay small { margin-top: 20px; color: var(--muted); }
.training-topbar { display: grid; grid-template-columns: 1fr minmax(180px, 350px) 1fr; align-items: center; gap: 18px; }
.training-topbar > :last-child { justify-self: end; }
.text-button { width: max-content; padding: 10px 0; border: 0; color: var(--muted); background: none; cursor: pointer; }
.session-progress { text-align: center; color: var(--muted); font-size: .76rem; }
.session-progress div { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: var(--line); }
.session-progress i { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--green); transition: width .25s ease; }
.training-layout { min-height: calc(100vh - 180px); display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: stretch; padding-top: 24px; }
.target-card, .listen-card, .result-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.target-card { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 570px; padding: 42px; text-align: center; }
.target-card.has-pattern { justify-content: flex-start; padding-block: 32px; }
.target-card h2 { color: var(--muted); font-size: 1rem; font-weight: 500; }
.target-note { margin: 18px 0 30px; font-family: Georgia, serif; font-size: clamp(8rem, 22vw, 15rem); line-height: .72; letter-spacing: -.08em; }
.target-card.has-pattern .target-note { margin: 8px 0 16px; font-size: clamp(5rem, 11vw, 7.5rem); }
.target-context { color: var(--muted); }
.hint-button, .skip-button { padding: 9px 0; border: 0; border-bottom: 1px solid currentColor; color: var(--green); background: none; cursor: pointer; font-size: .8rem; }
.hint { margin-top: 16px; padding: 10px 16px; border-radius: 99px; color: var(--amber); background: rgb(246 185 103 / 10%); font-weight: 750; }
.pattern-preview { width: min(520px, 100%); margin: 10px 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #141815; }
.fretboard-grid { display: grid; grid-template-columns: 22px repeat(var(--fret-count), minmax(25px, 1fr)); overflow-x: auto; }
.fretboard-grid > span { min-width: 0; }
.fret-number { padding-bottom: 5px; color: var(--muted); font-size: .55rem; text-align: center; }
.diagram-string-label { display: grid; place-items: center; color: var(--muted); font-size: .58rem; }
.fret-cell { min-height: 25px; display: grid; place-items: center; position: relative; border-left: 1px solid #596059; border-bottom: 1px solid #555c55; }
.fret-cell:nth-last-child(-n + 7) { border-bottom-color: #777f78; }
.pattern-dot { width: 13px; height: 13px; display: inline-grid; place-items: center; position: relative; z-index: 1; border: 2px solid #d3d7d1; border-radius: 50%; background: #5d655e; color: var(--text); font-size: .55rem; font-style: normal; }
.pattern-dot.root { border-color: var(--green); background: var(--green); }
.pattern-dot.target { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 0 4px rgb(246 185 103 / 18%); }
.muted-string { color: var(--danger); font-size: .9rem; font-style: normal; }
.pattern-legend { display: flex; justify-content: center; gap: 18px; margin-top: 10px; color: var(--muted); font-size: .6rem; }
.pattern-legend span { display: flex; align-items: center; gap: 5px; }
.pattern-legend .pattern-dot { width: 9px; height: 9px; border-width: 1px; }
.listen-card { min-height: 570px; display: flex; flex-direction: column; padding: 22px; }
.listen-head { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.listen-head span { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--muted); }
.status-dot.active { background: var(--green); box-shadow: 0 0 0 5px rgb(155 234 134 / 10%); }
.status-dot.error { background: var(--danger); }
.mic-start, .tuner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.mic-symbol { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); background: radial-gradient(circle, rgb(155 234 134 / 25%) 0 12%, transparent 13%); font-size: .9rem; }
.mic-start h3 { margin-bottom: 9px; }
.mic-start p { max-width: 330px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.mic-start small { margin-top: 14px; color: var(--muted); font-size: .68rem; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 22px; border-radius: 99px; cursor: pointer; font-weight: 800; }
.primary-button { border: 0; color: #142016; background: var(--green); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); color: var(--text); background: transparent; }
.detected-label { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.detected-note { margin: 12px 0 25px; font-family: Georgia, serif; font-size: 6rem; line-height: 1; }
.cents-scale { width: min(290px, 90%); display: flex; justify-content: space-between; position: relative; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .65rem; }
.cents-scale::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 12px; background: var(--green); }
.cents-scale i { --cents: 0; position: absolute; left: calc(50% + (var(--cents) * 1%)); top: -6px; width: 3px; height: 13px; border-radius: 2px; background: var(--amber); transform: translateX(-50%); transition: left .12s linear; }
.level-meter { width: min(290px, 90%); height: 4px; margin-top: 27px; overflow: hidden; border-radius: 99px; background: var(--line); }
.level-meter i { width: 0; height: 100%; display: block; background: var(--green); transition: width .1s linear; }
.listen-help { min-height: 24px; margin: 18px 0; color: var(--muted); font-size: .82rem; }
.listen-help.correct { color: var(--green); font-weight: 800; }
.listen-help.wrong { color: var(--danger); }
.skip-button { margin-top: 12px; color: var(--muted); }

.result-view { min-height: calc(100vh - 84px); display: grid; place-items: center; }
.result-card { width: min(680px, 100%); padding: clamp(28px, 7vw, 64px); text-align: center; }
.result-badge { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 50%; color: #142016; background: var(--green); font-size: 2rem; font-weight: 900; }
.result-card h2 { margin-bottom: 12px; font-family: Georgia, serif; font-size: clamp(2.4rem, 7vw, 4.4rem); }
.result-card > p:not(.eyebrow) { color: var(--muted); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 34px 0; border-block: 1px solid var(--line); }
.result-stats div { padding: 22px 8px; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats strong, .result-stats span { display: block; }
.result-stats strong { font-size: 1.45rem; }
.result-stats span { margin-top: 5px; color: var(--muted); font-size: .7rem; }
.result-actions { display: flex; justify-content: center; gap: 10px; }

.settings-dialog { width: min(620px, calc(100% - 24px)); max-height: min(800px, calc(100vh - 24px)); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: rgb(0 0 0 / 72%); backdrop-filter: blur(5px); }
.settings-dialog form { padding: 28px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; }
.dialog-head h2 { margin: 0; font-size: 1.8rem; }
.unlock-settings { margin-bottom: 26px; padding: 18px; border: 1px solid rgb(155 234 134 / 28%); border-radius: 14px; background: rgb(155 234 134 / 6%); }
.settings-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.settings-section-head small { color: var(--muted); font-size: .68rem; }
.number-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.number-settings label > span:first-child { display: block; margin-bottom: 7px; color: var(--muted); font-size: .7rem; }
.number-settings input { width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font-weight: 750; }
.number-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
.number-with-unit i { color: var(--muted); font-size: .68rem; font-style: normal; }
.unlock-settings > p { margin: 13px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-top: 22px; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small, .toggle-row small { margin-top: 4px; color: var(--muted); font-size: .72rem; font-weight: 400; line-height: 1.4; }
.setting-row output { flex: 0 0 auto; color: var(--green); font-size: .78rem; }
input[type="range"] { width: 100%; accent-color: var(--green); }
.mic-calibration { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgb(17 20 17 / 45%); }
.calibration-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.calibration-head strong, .calibration-head small { display: block; }
.calibration-head small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.calibration-head output { flex: 0 0 auto; color: var(--green); font-size: .78rem; font-variant-numeric: tabular-nums; }
.calibration-track { height: 12px; margin-top: 16px; position: relative; overflow: hidden; border-radius: 99px; background: var(--line); }
.calibration-track > i { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #619658, var(--green) 72%, var(--amber)); transition: width .08s linear; }
.calibration-track > b { --threshold-position: 35%; width: 3px; height: 18px; position: absolute; left: var(--threshold-position); top: -3px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px rgb(17 20 17 / 70%); transform: translateX(-50%); }
.calibration-legend { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0 14px; color: var(--muted); font-size: .62rem; }
.calibration-legend span:nth-child(2) { display: flex; align-items: center; gap: 5px; }
.calibration-legend i { width: 2px; height: 10px; display: inline-block; background: var(--text); }
.secondary-button.compact { min-height: 38px; padding-inline: 16px; font-size: .76rem; }
fieldset { display: flex; gap: 20px; margin: 26px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: .78rem; }
fieldset label { font-size: .86rem; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--green); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row input { width: 21px; height: 21px; }
.privacy-note { margin-top: 24px; padding: 16px; border-radius: 14px; color: var(--muted); background: var(--surface-2); font-size: .78rem; }
.privacy-note strong { color: var(--text); }
.privacy-note p { margin: 4px 0 0; line-height: 1.5; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; }
.danger-link { padding: 8px 0; border: 0; color: var(--danger); background: none; cursor: pointer; font-size: .78rem; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 10; max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid var(--line); border-radius: 99px; background: #272d28; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .2s ease; font-size: .82rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 800px) {
  .view { padding-top: 42px; }
  .hero { grid-template-columns: 1fr; gap: 32px; align-items: start; }
  .hero-score { display: flex; align-items: center; gap: 16px; text-align: left; }
  .progress-ring { width: 80px; height: 80px; margin: 0; }
  .progress-ring::before { inset: 6px; }
  .course-toolbar { align-items: flex-start; flex-direction: column; }
  .legend { display: none; }
  .string-row { grid-template-columns: repeat(3, 1fr); }
  .string-label { grid-column: 1 / -1; padding: 10px 14px; }
  .training-layout { grid-template-columns: 1fr; min-height: auto; }
  .target-card, .listen-card { min-height: 440px; }
  .special-stage-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-card { grid-template-columns: 1fr; }
  .tool-copy { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-tuner-panel { min-height: 500px; }
}

@media (max-width: 520px) {
  .app-shell { padding-inline: 14px; }
  .app-header { min-height: 70px; }
  .brand > span:last-child { display: none; }
  .main-nav { position: static; margin-left: auto; margin-right: 8px; transform: none; }
  .main-nav button { padding-inline: 11px; }
  .practice-counter { min-height: 34px; padding-inline: 8px; }
  .practice-counter i { display: none; }
  .practice-counter strong { font-size: .66rem; }
  .overall-progress { display: none; }
  .view { padding-top: 30px; }
  h1 { font-size: 3.25rem; }
  .hero-copy { font-size: .9rem; }
  .hero-score { display: none; }
  .learning-switch { margin-top: 36px; gap: 6px; }
  .learning-switch button { min-height: 55px; flex-direction: column; gap: 2px; font-size: .76rem; }
  .course-toolbar { margin-top: 14px; }
  .course-summary { align-items: flex-start; flex-direction: column; gap: 3px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding-inline: 7px; font-size: .78rem; }
  .string-row { gap: 8px; }
  .stage-card { min-height: 100px; padding: 12px; }
  .special-stage-grid { grid-template-columns: 1fr; }
  .special-stage-card { min-height: 120px; padding-top: 52px; }
  .stage-card-top { align-items: flex-start; flex-direction: column; }
  .stage-card-meta { display: block; margin-top: 12px; }
  .stage-card-meta span { display: block; margin-top: 3px; text-align: left !important; }
  .training-topbar { grid-template-columns: auto 1fr auto; }
  .training-topbar .text-button { font-size: 0; }
  .training-topbar .text-button::first-letter { font-size: 1rem; }
  .target-card, .listen-card { min-height: 410px; padding: 24px 18px; }
  .target-note { font-size: 8.2rem; }
  .target-card.has-pattern .target-note { font-size: 5.3rem; }
  .pattern-preview { padding-inline: 8px; }
  .result-stats strong { font-size: 1.05rem; }
  .result-stats span { font-size: .62rem; }
  .result-actions { flex-direction: column-reverse; }
  .result-actions button { width: 100%; }
  .settings-dialog form { padding: 22px 18px; }
  .tools-view { padding-top: 36px; }
  .tool-card { margin-top: 30px; }
  .tool-copy { padding: 28px 22px; }
  .tool-tuner-panel { min-height: 450px; padding: 30px 20px; }
  .tool-tuner-note { font-size: 8.5rem; }
  .number-settings { grid-template-columns: 1fr; }
  .settings-section-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  fieldset { align-items: flex-start; flex-direction: column; gap: 12px; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
}

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