/* CajonLab — warm palette: teal ground, sand cards, ink outlines, brick for the note being played. */
:root {
  --bg: #5DBFBF;
  --surface: #F7E9D0;
  --ink: #1F2C33;
  --muted: #2E3C44;
  --line: rgba(31, 44, 51, .28);
  --hit: #B94622;
  --hit-soft: rgba(185, 70, 34, .2);
  --chip: rgba(31, 44, 51, .12);
  --ok: #2F6F5C;
  --font-ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-ui);
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--hit); outline-offset: 2px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--hit); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .88rem; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }

main { max-width: 900px; margin: 0 auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; outline: none; }
h1 { font-size: 1.4rem; line-height: 1.25; margin: 0; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: .88rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.muted { color: var(--muted); }
.back { font-size: .88rem; color: var(--muted); text-decoration: none; }
.back::before { content: "← "; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- home ---------- */
.today { display: grid; grid-template-columns: auto 1fr; gap: 16px 20px; align-items: center; }
.goalring { width: 108px; height: 108px; }
.goalring circle { fill: none; stroke-width: 10; }
.goalring .track { stroke: var(--chip); }
.goalring .val { stroke: var(--ink); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .4s; }
.goalring text { fill: var(--ink); font-family: var(--font-num); font-weight: 600; font-size: 22px; text-anchor: middle; }
.goalring text.small { font-size: 11px; fill: var(--muted); font-family: var(--font-ui); font-weight: 400; }
.week-dots { display: flex; gap: 6px; margin-top: 6px; }
.week-dots span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--chip); color: var(--muted); }
.week-dots span.on { background: var(--ink); color: var(--surface); }
.week-dots span.goal { background: var(--ok); color: var(--surface); }
.week-dots span.future { opacity: .45; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; min-height: 56px;
}
.row:hover { border-color: var(--ink); }
.row .badge { flex: none; min-width: 44px; height: 32px; padding: 0 8px; border-radius: 8px; background: var(--chip); display: grid; place-items: center; font-family: var(--font-num); font-weight: 600; font-size: .85rem; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-weight: 600; }
.row .main span { color: var(--muted); font-size: .82rem; }
.row .end { flex: none; font-size: .8rem; color: var(--muted); font-family: var(--font-num); text-align: right; }
.row.done .badge { background: var(--ok); color: var(--surface); }
.row.current { border: 2px solid var(--hit); }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--hit); }
.minibar { height: 4px; border-radius: 2px; background: var(--chip); overflow: hidden; margin-top: 6px; }
.minibar i { display: block; height: 100%; background: var(--ink); }

/* ---------- video ---------- */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--chip); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.soon { display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); background: transparent; }
.video.soon .ph { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); padding: 16px; }
.video.soon .ph svg { width: 44px; height: 44px; fill: var(--muted); opacity: .6; }
.song-audio { width: 100%; }
.video-label { font-weight: 600; margin: 0 0 8px; }
.videos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ---------- score ---------- */
.sheet { padding: 12px 8px 8px; overflow: hidden; }
:is(#score, .score-static) { display: block; width: 100%; height: auto; margin: 0 auto; color: var(--ink); }
:is(#score, .score-static) .fill { fill: currentColor; }
:is(#score, .score-static) .stroke { stroke: currentColor; }
:is(#score, .score-static) .sig { font-family: var(--font-ui); font-weight: 700; fill: var(--ink); text-anchor: middle; }
:is(#score, .score-static) .barno { font-size: 11px; fill: var(--muted); }
:is(#score, .score-static) .barlabel { font-size: 12px; font-weight: 700; fill: var(--ink); }
:is(#score, .score-static) .bass { font-family: var(--font-ui); font-weight: 700; fill: currentColor; }
:is(#score, .score-static) .n { color: var(--ink); }
:is(#score, .score-static) .hand { font-family: var(--font-ui); font-size: 12px; fill: var(--muted); font-weight: 400; }
:is(#score, .score-static) .hand.acc { fill: var(--ink); font-weight: 700; font-size: 13px; }
:is(#score, .score-static) .hand.grace { font-size: 9px; }
:is(#score, .score-static) .halo { fill: var(--hit-soft); opacity: 0; transition: opacity .06s linear; }
:is(#score, .score-static) .ring { fill: none; stroke: var(--hit); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0; }
:is(#score, .score-static) .n.next .ring { opacity: .55; }
:is(#score, .score-static) .n.lit { color: var(--hit); }
:is(#score, .score-static) .n.lit .hand { fill: var(--hit); }
:is(#score, .score-static) .n.lit .halo { opacity: 1; }
:is(#score, .score-static) .n.k-ghost.lit .halo, #score .n.k-rest.lit .halo { opacity: .45; }
:is(#score, .score-static) .n.k-ghost.lit { color: var(--ink); }
:is(#score, .score-static) .n.k-ghost.lit .fill { fill: var(--hit); opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 8px 2px; color: var(--muted); font-size: .8rem; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sym { width: 18px; height: 18px; color: var(--ink); }
.sym .fill { fill: currentColor; }
.sym .stroke { stroke: currentColor; }
.sym .bass { font-weight: 700; fill: currentColor; font-family: var(--font-ui); }
.sym[viewBox^="0 -22"] { width: 26px; }
.hint { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 6px 8px 0; }

/* ---------- transport ---------- */
.transport { display: grid; grid-template-columns: auto 1fr; gap: 16px 20px; align-items: center; }
.playrow { display: flex; gap: 10px; align-items: center; }
.play {
  font-weight: 700; font-size: 1rem; min-width: 128px; height: 56px; border: 0; border-radius: 28px;
  background: var(--ink); color: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play.on { background: var(--hit); color: #fff; }
.round {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip);
  font-size: 1.3rem; cursor: pointer; flex: none; display: grid; place-items: center;
}
.round svg { width: 16px; height: 16px; fill: currentColor; }
.tempo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bpm { font-family: var(--font-num); font-weight: 600; text-align: center; flex: none; min-width: 5.2ch; }
.bpm output { font-size: 2.1rem; line-height: 1; display: block; font-variant-numeric: tabular-nums; }
.bpm small { color: var(--muted); font-size: .7rem; letter-spacing: .1em; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--ink); height: 28px; }
.ends { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; font-family: var(--font-num); margin-top: -8px; }
.comfort { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.comfort .msg { font-size: .85rem; color: var(--ok); font-weight: 600; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.chip {
  font-size: .85rem; background: var(--chip); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.reps { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reps[hidden] { display: none; }
.reps > span { font-size: .85rem; color: var(--muted); margin-right: 2px; }
.reps .chip { min-width: 44px; padding: 8px 12px; font-family: var(--font-num); }
.status { grid-column: 1 / -1; font-size: .85rem; color: var(--hit); font-weight: 600; min-height: 1.3em; margin: -6px 0; }
details.more { grid-column: 1 / -1; }
details.more summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.slider-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: .85rem; flex-wrap: wrap; }
.slider-row label { min-width: 9em; }
.slider-row output { font-family: var(--font-num); min-width: 5ch; text-align: right; }

.practice { display: flex; flex-direction: column; gap: 8px; }
.practice .head { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; flex-wrap: wrap; }
.practice .time { font-family: var(--font-num); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 4px; transition: width .4s; }
.bar i.goal { background: var(--ok); }
.pager { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- method / progress ---------- */
.prose p { margin: 0 0 10px; max-width: 68ch; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-family: var(--font-num); font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .82rem; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.chart div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.chart i { width: 100%; max-width: 26px; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart i.goal { background: var(--ok); }
.chart small { font-size: .62rem; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-family: var(--font-num); }

@media (max-width: 560px) {
  .transport { grid-template-columns: 1fr; }
  .play { flex: 1; }
  .today { grid-template-columns: 1fr; justify-items: start; }
  .nav a { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- warm theme: display font, chunky outlines, hero ---------- */
h1, h2, .brand, .btn, .play, .tag, .bpm output { font-family: var(--font-display); }
h1 { font-weight: 800; letter-spacing: -.01em; }
:focus-visible { outline-color: var(--ink); outline-offset: 3px; }
.sub, .hint, .muted { color: var(--muted); }
.logo { border-radius: 8px 8px 14px 14px; background: var(--hit); }
.logo::after { background: var(--surface); }
.card { border: 0; border-radius: 28px; padding: 20px; box-shadow: 0 6px 0 var(--ink); }
.btn { background: var(--hit); border-color: var(--hit); color: #fff; font-weight: 800; box-shadow: 0 5px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.play { background: var(--hit); color: #fff; box-shadow: 0 5px 0 var(--ink); }
.play.on { background: var(--ink); color: var(--surface); }
.row { background: #FFF8EA; border: 2px solid var(--ink); border-radius: 20px; }
.row.current { border-color: var(--hit); box-shadow: 0 0 0 2px var(--hit); }
.row .badge { background: var(--chip); border-radius: 14px; }
.stat { background: #FFF8EA; border: 2px solid var(--ink); border-radius: 20px; }
.chip { border: 2px solid var(--ink); background: #FFF8EA; }
.week-dots span.goal, .row.done .badge, .chart i.goal, .bar i.goal { background: var(--ok); }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px 24px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.05; }
.hero .sub { font-size: 1.15rem; margin-top: 10px; max-width: 34ch; color: var(--ink); }
.hero img { width: 100%; height: auto; display: block; border-radius: 28px; aspect-ratio: 1021 / 1043; max-width: 460px; justify-self: center; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } }
main:focus-visible { outline: none; }
