/* Ottava — Edition design system */
@font-face { font-family: 'Bravura'; src: url('../fonts/Bravura.woff2') format('woff2'); font-display: block; }

:root {
  --paper: #F4F1EA; --ink: #1D1B17; --mu: #8B8577; --rule: #D8D2C3; --ac: #C8402A; --ghost: #B9B3A5; --soft: #ECE8DE;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
}
:root[data-theme="dark"] { --paper: #1B1917; --ink: #EDE7DA; --mu: #8E877A; --rule: #35312B; --ac: #E2583F; --ghost: #6A645A; --soft: #242220; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { --paper: #1B1917; --ink: #EDE7DA; --mu: #8E877A; --rule: #35312B; --ac: #E2583F; --ghost: #6A645A; --soft: #242220; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.serif { font-family: var(--serif); font-weight: 400; }
.caps { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--mu); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.ac { color: var(--ac); }
.mu { color: var(--mu); }

#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; position: relative; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.head { padding: calc(10px + env(safe-area-inset-top)) 20px 0; flex: none; }
.head .top { display: flex; justify-content: space-between; align-items: baseline; }
.head .top button.caps { color: var(--mu); }
.title { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin: 2px 0 8px; font-weight: 400; }
.modes { display: flex; gap: 16px; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.modes button { padding: 7px 0 8px; color: var(--mu); position: relative; }
.modes button.on { color: var(--ink); }
.modes button.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--ink); }
.modes button.lock::after { content: none; }
.modes button .pro { color: var(--ac); font-size: 10px; vertical-align: top; margin-left: 2px; }
.marking { display: flex; gap: 11px; flex-wrap: wrap; align-items: baseline; padding: 9px 0 0; font-family: var(--serif); font-size: 14.5px; }
.marking button { font-family: var(--serif); font-size: 14.5px; }
.marking button.on::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ac); margin-right: 6px; vertical-align: 2px; }
.marking button.off { color: var(--mu); }
.marking .bravura { font-family: Bravura; font-size: 22px; line-height: 0; vertical-align: -0.1em; }

.body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 8px; min-height: 0; }
.staff svg { width: 100%; height: auto; display: block; }
.fb { text-align: center; margin-top: 2px; min-height: 58px; }
.fb .note { font-family: var(--serif); font-size: 32px; line-height: 1.1; }
.fb .note sub { font-size: 15px; vertical-align: baseline; position: relative; top: 2px; }
.fb .note i { font-size: 16px; color: var(--mu); font-style: italic; }
.fb .note .wrong { color: var(--ac); }
.fb .heard { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mu); margin-top: 4px; }

.foot { flex: none; border-top: 1px solid var(--rule); margin: 0 20px; padding: 10px 0 0; display: flex; justify-content: space-between; }
.foot div { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--mu); }
.foot b { display: block; font-family: var(--serif); font-size: 24px; line-height: 1; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 400; margin-bottom: 3px; }
.foot b small { font-size: 13px; color: var(--mu); }
.nav { flex: none; display: flex; justify-content: space-around; padding: 14px 0 calc(18px + env(safe-area-inset-bottom)); font-size: 12.5px; color: var(--mu); }
.nav button { color: var(--mu); }
.nav button.on { color: var(--ink); }
.nav button.on::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ac); margin-right: 6px; vertical-align: 1px; }

/* buttons, lists */
.btn { display: block; width: calc(100% - 40px); text-align: center; background: var(--ink); color: var(--paper); font-weight: 500; padding: 14px; margin: 0 20px; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--ink); }
.btn.ac { background: var(--ac); color: #fff; }
.link { display: block; width: 100%; text-align: center; font-size: 12.5px; color: var(--mu); text-decoration: underline; text-underline-offset: 3px; margin: 14px 0 0; }
.list { padding: 0 20px; overflow-y: auto; flex: 1; }
.rowi { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 14px; min-height: 48px; gap: 10px; }
.rowi .v { font-family: var(--serif); font-size: 16px; text-align: right; }
.rowi .v.mu { color: var(--mu); font-family: var(--sans); font-size: 12.5px; }
.rowi .v button { font-family: var(--serif); font-size: 16px; color: var(--mu); }
.rowi .v button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.rowi .v button + button { margin-left: 10px; }
.sect { padding: 16px 0 4px; }
.tg { width: 32px; height: 19px; border-radius: 10px; border: 1px solid var(--ink); position: relative; flex: none; }
.tg::after { content: ''; position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--ink); transition: left .12s; }
.tg.on { background: var(--ink); }
.tg.on::after { left: 16px; background: var(--paper); }
.letters { display: flex; gap: 6px; }
.letters button { font-family: var(--serif); font-size: 17px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--rule); }
.letters button.on { border-color: var(--ink); }
.letters button.off { color: var(--ghost); }
.stepper { display: flex; align-items: center; gap: 14px; font-family: var(--serif); font-size: 16px; }
.stepper button { font-family: var(--serif); font-size: 22px; color: var(--mu); width: 28px; }
input[type=range] { accent-color: var(--ac); width: 130px; }

/* sheet */
.dim { position: absolute; inset: 0; background: rgba(29,27,23,.32); z-index: 10; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--ink); padding: 14px 20px calc(24px + env(safe-area-inset-bottom)); z-index: 11; max-height: 80%; overflow-y: auto; }
.sheet .title { font-size: 24px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.sheet .title button { font-family: var(--sans); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--mu); }
.bpm { font-family: var(--serif); font-size: 64px; line-height: 1; text-align: center; margin: 8px 0 0; }
.bpm .bravura { font-family: Bravura; font-size: 42px; vertical-align: -6px; }
.pm { display: flex; justify-content: center; align-items: center; gap: 26px; margin-top: 6px; }
.pm button { font-family: var(--serif); font-size: 28px; color: var(--mu); width: 44px; height: 44px; }
.pm .tap { font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; width: auto; }
.sigs { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--serif); font-size: 16px; margin-top: 14px; }
.sigs button { font-family: var(--serif); font-size: 16px; color: var(--mu); }
.sigs button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.beats { display: flex; gap: 10px; justify-content: center; margin: 14px 0 6px; }
.beats i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink); }
.beats i.on { background: var(--ac); border-color: var(--ac); }
.beats i.first { border-color: var(--ac); }

/* toast */
.toast { position: absolute; left: 14px; right: 14px; bottom: 76px; background: var(--paper); border: 1px solid var(--ink); padding: 11px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(29,27,23,.14); z-index: 9; animation: up .25s ease-out; }
.toast .serif { font-size: 17px; }
.toast .share { margin-left: auto; color: var(--ac); font-weight: 600; }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }

/* cards */
.keys { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 20px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.keys button { font-family: var(--serif); font-size: 24px; height: 58px; border-right: 1px solid var(--rule); }
.keys button:last-child { border-right: 0; }
.keys button.ok { background: var(--soft); }
.keys button.bad { color: var(--ac); text-decoration: line-through; text-decoration-thickness: 1px; }
.keys.sharps { border-top: 0; }
.keys.sharps button { font-size: 18px; height: 44px; color: var(--mu); }

/* progress */
.stat3 { display: flex; justify-content: space-between; padding: 6px 20px 0; }
.stat3 div { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--mu); }
.stat3 b { display: block; font-family: var(--serif); font-size: 32px; line-height: 1; color: var(--ink); font-weight: 400; letter-spacing: 0; text-transform: none; margin-bottom: 4px; }
.stat3 b small { font-size: 14px; color: var(--mu); }
.chart, .heat { padding: 0 20px; }
.chart svg, .heat svg { width: 100%; height: auto; display: block; }

/* tuner */
.tuner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tuner svg { width: 270px; height: auto; }
.tbig { font-family: var(--serif); font-size: 112px; line-height: .9; text-align: center; }
.tbig sub { font-size: 30px; color: var(--mu); }
.tbig.in { color: var(--ink); }

/* onboarding / states */
.ob { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 24px; }
.ob .title { font-size: 36px; margin-bottom: 14px; }
.ob p { color: var(--mu); font-size: 14.5px; margin: 0 0 10px; }
.ob .caps { margin-bottom: 10px; }
.meter { height: 1px; background: var(--rule); margin: 18px 0 6px; position: relative; }
.meter i { position: absolute; left: 0; top: 0; height: 1px; width: 0; background: var(--ink); transition: width .08s; }
.gap { height: 22px; flex: none; }

/* paywall */
.pw { margin: 0 20px; border-top: 1px solid var(--ink); }
.pw .r { display: grid; grid-template-columns: 1fr 48px 48px; align-items: center; border-bottom: 1px solid var(--rule); padding: 7px 0; font-size: 13px; }
.pw .r.h span { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--mu); }
.pw .r span:nth-child(n+2) { text-align: center; }
.pw .dot::before { content: '●'; font-size: 9px; }
.pw .no { color: var(--ghost); }

/* landscape: column on the left, staff full width, no nav */
@media (orientation: landscape) and (max-height: 520px) {
  #app { max-width: none; }
  .screen.practice { flex-direction: row; }
  .screen.practice .head { width: 190px; flex: none; border-right: 1px solid var(--rule); padding: 14px 16px; display: flex; flex-direction: column; }
  .screen.practice .title { font-size: 22px; }
  .screen.practice .modes { flex-direction: column; gap: 0; border: 0; }
  .screen.practice .modes button { padding: 3px 0; text-align: left; }
  .screen.practice .modes button.on::after { content: none; }
  .screen.practice .marking { flex-direction: column; gap: 2px; margin-top: auto; font-size: 13.5px; }
  .screen.practice .marking button { font-size: 13.5px; text-align: left; }
  .screen.practice .body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .screen.practice .foot { margin: 0 16px; }
  .screen.practice .nav { display: none; }
  .screen.practice .stage { padding: 0 16px; }
}

/* desktop: a settings column beside the staff */
.aside { display: none; }
@media (min-width: 900px) {
  #app { max-width: 1120px; }
  .screen.practice { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto minmax(0, 1fr); column-gap: 36px; padding: 0 28px; }
  .screen.practice .head { grid-column: 1; padding-left: 0; padding-right: 0; }
  .screen.practice .body { grid-column: 1; }
  .screen.practice .foot { margin: 0; }
  .screen.practice .aside { display: block; grid-column: 2; grid-row: 1 / 3; border-left: 1px solid var(--rule); padding: 40px 0 24px 28px; overflow-y: auto; }
  .aside-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 6px; }
  .aside-tabs button { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--mu); padding: 0 0 8px; position: relative; }
  .aside-tabs button.on { color: var(--ink); }
  .aside-tabs button.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
  .aside-sec { margin-bottom: 28px; transition: background .3s; }
  .aside-sec.flash { animation: flash 1.2s; }
  .aside .rowi { font-size: 13.5px; min-height: 44px; }
  .aside .bpm { font-size: 48px; }
  .aside .btn { padding: 11px; }
  .aside .mu { font-size: 13px; padding: 10px 0; }
  @keyframes flash { 0% { background: var(--soft); } 100% { background: transparent; } }
}

/* brand */
.brand-ob { width: 230px; height: auto; display: block; margin-bottom: 18px; }
