:root {
  --ink: #10243f;
  --ink-2: #203b5c;
  --paper: #f7fafc;
  --white: #ffffff;
  --line: #d9e3ec;
  --muted: #61758a;
  --teal: #18a999;
  --teal-dark: #087f76;
  --teal-pale: #dff8f3;
  --gold: #f4c95d;
  --red: #e85757;
  --blue: #2e6fd8;
  --shadow: 0 18px 50px rgba(16, 36, 63, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 "DM Sans", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(46, 111, 216, .35); outline-offset: 2px; }

.topbar { min-height: 76px; padding: 12px max(24px, calc((100vw - 1180px) / 2)); background: var(--ink); color: white; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: white; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: var(--ink); background: var(--gold); font: 800 27px/1 Manrope, sans-serif; transform: rotate(-3deg); }
.brand strong, .brand small { display: block; }
.brand strong { font: 800 18px/1.15 Manrope, sans-serif; }
.brand small { margin-top: 3px; color: #b9c9d8; font-size: 12px; letter-spacing: .11em; text-transform: uppercase; }
.privacy-pill { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); border-radius: 999px; padding: 9px 14px; font-size: 14px; color: #dce7ef; display: flex; align-items: center; gap: 8px; }
.privacy-pill span { width: 8px; height: 8px; border-radius: 50%; background: #5de0cf; box-shadow: 0 0 0 4px rgba(93,224,207,.14); }

main { overflow: hidden; }
.workspace { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 48px; }
.lead-row { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(0, 1.28fr); gap: 22px; align-items: stretch; margin-bottom: 22px; }
.intro-block { display: flex; flex-direction: column; justify-content: center; padding: 18px 4px; }
.eyebrow { margin: 0 0 6px; color: var(--teal-dark); letter-spacing: .13em; font-size: 12px; font-weight: 800; }
h1, h2, h3 { margin: 0; font-family: Manrope, sans-serif; line-height: 1.13; }
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.035em; }
h2 { font-size: clamp(22px, 2.7vw, 30px); letter-spacing: -.025em; }
h3 { font-size: 22px; }
.intro-copy { max-width: 380px; margin: 14px 0 0; color: var(--muted); }

.recording-layout { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 22px; align-items: stretch; }
.card { background: var(--white); border: 1px solid rgba(16,36,63,.09); border-radius: var(--radius); box-shadow: var(--shadow); }
.setup-card, .recorder-card { padding: 26px; }
.card-heading { display: flex; gap: 13px; align-items: center; }
.card-heading { margin-bottom: 22px; }
.card-heading h2 { font-size: 21px; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.step-number { flex: 0 0 auto; width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font: 800 15px Manrope, sans-serif; }
.step-number.complete { color: var(--ink); background: var(--gold); }

label { display: grid; gap: 7px; color: var(--ink-2); font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); border: 1px solid #cbd8e3; border-radius: 10px; background: white; }
input::placeholder { color: #9aaabb; }
input:focus, select:focus { border-color: var(--blue); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 14px; }
.setup-card > label { margin-bottom: 14px; }
.compact-fields { grid-template-columns: .5fr 1.5fr; margin-bottom: 0; }
.filename-box { margin-top: 19px; padding: 13px 15px; border-radius: 12px; background: #eef4f8; overflow: hidden; }
.filename-box span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; }
.filename-box output { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font: 600 13px/1.4 monospace; white-space: nowrap; }

.recorder-card { display: flex; flex-direction: column; }
.recording-mode { display: flex; align-self: center; gap: 4px; margin: -5px 0 16px; padding: 4px; border: 1px solid #cbd8e3; border-radius: 12px; background: #eef4f8; }
.recording-mode legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.recording-mode label { display: block; cursor: pointer; }
.recording-mode input { position: absolute; opacity: 0; pointer-events: none; }
.recording-mode span { min-width: 100px; min-height: 40px; padding: 9px 18px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.recording-mode input:checked + span { color: white; background: var(--ink); box-shadow: 0 4px 12px rgba(16,36,63,.18); }
.recording-mode input:focus-visible + span { outline: 3px solid rgba(57,125,194,.35); outline-offset: 2px; }
.recording-mode input:disabled + span { cursor: not-allowed; opacity: .6; }
.recorder-stage { position: relative; isolation: isolate; flex: 1; min-height: 360px; padding: 28px; border-radius: 17px; overflow: hidden; background: linear-gradient(145deg, #112943, #0d2037); color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.recorder-stage.video-mode::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(5,14,25,.18), rgba(5,14,25,.42) 55%, rgba(5,14,25,.78)); }
.live-video { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; background: #071421; transform: scaleX(-1); }
.live-video[hidden] { display: none; }
.timer { font: 800 clamp(48px, 7vw, 76px)/1 Manrope, sans-serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.level-wrap { width: min(100%, 360px); margin: 28px 0 30px; }
.level-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,255,255,.12) 0 66%, rgba(232,87,87,.23) 66%); overflow: hidden; }
.level-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5de0cf 0 70%, var(--gold) 82%, var(--red) 100%); transition: width 80ms linear; }
.level-labels { display: flex; justify-content: space-between; margin-top: 6px; color: #96adc1; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.record-button { min-width: 210px; min-height: 54px; border: 0; border-radius: 999px; color: var(--ink); background: var(--gold); cursor: pointer; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 8px 25px rgba(244,201,93,.18); transition: transform .15s, background .15s; }
.record-button:hover { transform: translateY(-2px); background: #ffda78; }
.record-button:disabled { cursor: wait; opacity: .72; transform: none; }
.record-icon { width: 15px; height: 15px; border-radius: 50%; background: var(--red); }
.record-button.recording { color: white; background: var(--red); }
.record-button.recording .record-icon { border-radius: 2px; background: white; }
.mic-help { min-height: 21px; margin: 14px 0 0; color: #b6c6d5; font-size: 13px; }
.recorder-stage.is-recording { box-shadow: inset 0 0 0 2px rgba(232,87,87,.65); }
.playback-panel { padding-top: 18px; }
.playback-panel audio { width: 100%; height: 42px; }
.playback-panel video { width: 100%; max-height: 430px; border-radius: 14px; background: #071421; }
.playback-panel video[hidden], .playback-panel audio[hidden] { display: none; }
.playback-actions { display: flex; gap: 12px; margin-top: 14px; }
.secondary-button, .download-button, .save-drive-button, .tool-button { min-height: 46px; padding: 10px 18px; border-radius: 11px; border: 1px solid #cbd8e3; cursor: pointer; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.secondary-button { background: white; color: var(--ink); }
.download-button { flex: 1; color: white; background: var(--teal-dark); border-color: var(--teal-dark); }
.save-drive-button { flex: 1; color: #fff; background: #246fdb; border-color: #246fdb; }
.save-help { margin: 10px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.report-card { margin-top: 22px; padding: 26px; }
.report-heading-wrap { margin-bottom: 19px; }
.report-heading-wrap .eyebrow { margin-bottom: 3px; }
.report-badge { margin-left: auto; padding: 7px 12px; border-radius: 999px; background: var(--teal-pale); color: var(--teal-dark); font-size: 13px; font-weight: 800; }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.feedback-item { min-height: 116px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; }
.feedback-item .feedback-icon { display: inline-grid; place-items: center; width: 29px; height: 29px; margin-bottom: 9px; border-radius: 9px; background: var(--teal-pale); color: var(--teal-dark); font-weight: 800; }
.feedback-item h3 { font-size: 16px; }
.feedback-item p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.report-note { margin: 17px 0 0; color: var(--muted); font-size: 13px; }

.practice-toolbox { min-width: 0; overflow: hidden; border-radius: 18px; }
.toolbox-heading { min-height: 66px; padding: 11px 13px 11px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toolbox-heading h2 { font-size: 18px; }
.toolbox-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.toolbox-readout { min-width: 108px; display: flex; align-items: baseline; justify-content: center; gap: 7px; text-align: center; }
.toolbox-readout[hidden] { display: none; }
.toolbox-readout strong { color: var(--ink); font: 800 34px/1 Manrope, sans-serif; letter-spacing: -.04em; }
.toolbox-readout span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.toolbox-readout .pitch-hz { margin: 0; }
.toolbox-readout .note-name { font-size: 38px; }
.tool-tabs { flex: 0 0 auto; display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: #eef4f8; }
.tool-tab { min-height: 36px; padding: 7px 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.tool-tab[aria-selected="true"] { color: white; background: var(--ink); box-shadow: 0 4px 10px rgba(16,36,63,.16); }
.compact-tool-panel { min-height: 124px; padding: 13px 16px; display: grid; align-items: center; gap: 14px; }
.compact-tool-panel[hidden] { display: none; }
.tuner-panel { grid-template-columns: minmax(180px, .8fr) minmax(340px, 1.5fr); }
.note-name { font: 800 42px/1 Manrope, sans-serif; letter-spacing: -.05em; }
.pitch-hz { min-height: 18px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.tuner-gauge { position: relative; display: grid; grid-template-columns: 1fr .72fr 1fr; height: 34px; border-radius: 9px; overflow: hidden; background: #edf2f6; }
.gauge-zone { display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .07em; color: #7e91a3; }
.gauge-zone.center { background: var(--teal-pale); color: var(--teal-dark); }
.gauge-needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; background: var(--ink); transform: translateX(-50%); transition: left 100ms ease-out; }
.cents-row { display: flex; justify-content: space-between; margin: 5px 2px 0; color: var(--muted); font-size: 11px; }
.cents-row strong { color: var(--ink-2); }
.compact-tool-controls { display: grid; align-items: end; gap: 8px; }
.compact-tool-controls label { gap: 4px; color: var(--muted); font-size: 11px; }
.compact-tool-controls select { min-height: 38px; padding: 7px 9px; }
.tuner-options { grid-template-columns: minmax(130px, 1.45fr) minmax(108px, .9fr) auto; }
.tool-button { width: auto; min-height: 38px; padding: 7px 13px; color: white; background: var(--ink); border-color: var(--ink); white-space: nowrap; }
.tool-button.active { background: var(--red); border-color: var(--red); }
.tool-button.accent { color: var(--ink); background: var(--gold); border-color: var(--gold); }
.tool-button.accent.active { color: white; background: var(--red); border-color: var(--red); }
.metronome-panel { grid-template-columns: minmax(260px, 1.4fr) minmax(200px, .9fr); }
.tempo-adjust-row { display: grid; grid-template-columns: 38px minmax(120px, 1fr) 38px; align-items: center; gap: 10px; }
.tempo-adjust-row button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: white; cursor: pointer; font-size: 22px; }
.tempo-slider { min-height: 24px; padding: 0; accent-color: var(--teal-dark); cursor: pointer; }
.compact-metronome-center .beat-dots { height: 24px; margin: 5px 0 0; }
.beat-dots { display: flex; justify-content: center; align-items: center; gap: 10px; }
.beat-dot { width: 11px; height: 11px; border-radius: 50%; background: #cbd8e3; transition: transform 80ms, background 80ms; }
.beat-dot.downbeat { box-shadow: 0 0 0 3px rgba(244,201,93,.28); }
.beat-dot.active { background: var(--teal); transform: scale(1.35); }
.beat-dot.downbeat.active { background: var(--gold); }
.metro-options { grid-template-columns: minmax(120px, 1fr) auto; }

footer { min-height: 74px; padding: 20px max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #c3d1dd; background: var(--ink); font-size: 14px; }
footer strong { color: white; font-family: Manrope, sans-serif; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; max-width: min(440px, calc(100% - 28px)); padding: 12px 18px; color: white; background: #8c2f39; border-radius: 11px; box-shadow: 0 12px 35px rgba(16,36,63,.25); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1020px) {
  .lead-row { grid-template-columns: 1fr; }
  .intro-block { padding: 4px 2px; }
}

@media (max-width: 850px) {
  .recording-layout { grid-template-columns: 1fr; }
  .recorder-stage { min-height: 330px; }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { min-height: 68px; padding: 10px 18px; }
  .privacy-pill { width: 10px; height: 10px; padding: 0; border: 0; background: transparent; overflow: hidden; }
  .privacy-pill span { flex: 0 0 auto; }
  .workspace { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .toolbox-heading { align-items: flex-start; flex-direction: column; }
  .toolbox-readout { width: 100%; justify-content: flex-start; }
  .tool-tabs { width: 100%; }
  .tool-tab { flex: 1; }
  .compact-tool-panel, .tuner-panel, .metronome-panel, .tuner-options, .metro-options { grid-template-columns: 1fr; }
  .compact-tool-controls { grid-column: auto; }
  .setup-card, .recorder-card, .report-card { padding: 19px; border-radius: 17px; }
  .practice-toolbox { border-radius: 17px; }
  .field-grid, .compact-fields { grid-template-columns: 1fr; }
  .recorder-stage { min-height: 300px; padding: 22px 16px; }
  .playback-actions { flex-direction: column; }
  .download-button { flex: none; }
  .report-heading-wrap { align-items: start; flex-wrap: wrap; }
  .report-badge { margin-left: 50px; }
  footer { align-items: start; flex-direction: column; }
}

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