/* Accompanist: paper, ink and pencil. The app's palette (shared/theme/Color_Theme.dart),
   square-cut, with the practice marks as the only colour. */
:root {
  --paper: #FFFCF4;
  --ivory: #F5EFE2;
  --ink: #1E1A16;
  --brown: #30271F;
  --muted: #6F6354;
  --rule: #D8C58D;
  --gold: #9A7A2C;
  --good: #6DBE8C;
  --good-ink: #3F8A5C;
  --close: #E0B43A;
  --bad: #C8473F;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --pencil: 'Nanum Pen Script', 'Bradley Hand', cursive;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1120px;
  /* The text column, which the wide blocks (score, legend) line up with. */
  --column: min(calc(100% - 2 * var(--gutter)), calc(var(--max) - 2 * var(--gutter)));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--brown);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; margin: 0; }
p { margin: 0; }

/* ── Header ─────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--ivory) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.wordmark { font: 700 22px/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.wordmark.small { font-size: 18px; }
.top nav { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 28px); font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }
.top nav .nav-cta { color: var(--ink); border-bottom: 2px solid var(--ink); padding-bottom: 1px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 2px; border: 1.5px solid var(--ink);
  font: 600 16px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--brown); }
.btn-ink:disabled { opacity: .45; cursor: default; }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--paper); }
.btn.wide { width: 100%; }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(32px, 6vw, 72px);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center;
}
.kicker { font: 600 12px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: 18px; }
.hero h1 { font-size: clamp(40px, 6.2vw, 72px); line-height: 1.02; letter-spacing: -0.025em; }
.hero h1 em { font-style: italic; font-weight: 400; color: var(--good-ink); }
.lede { margin-top: 22px; max-width: 34em; color: var(--muted); font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-sheet {
  margin: 0; background: var(--paper); border: 1px solid var(--rule);
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--rule) 55%, transparent);
  padding: 8px 4px; transform: rotate(-0.8deg);
}
.hero-sheet svg { display: block; width: 100%; height: auto; }

/* The practice marks, drawn as the score draws them. */
.staff line { stroke: var(--ink); stroke-width: 1.2; opacity: .55; }
.note ellipse { fill: var(--ink); }
.note line { stroke: var(--ink); stroke-width: 1.6; }
.note.good ellipse { fill: var(--good); } .note.good line { stroke: var(--good); }
.note.close ellipse { fill: var(--close); } .note.close line { stroke: var(--close); }
.note.due { animation: hop 900ms cubic-bezier(.3, .7, .35, 1) infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes hop { 0%, 55%, 100% { transform: translateY(0); } 20% { transform: translateY(-6px); } 40% { transform: translateY(1px); } }
.pencil path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pencil text { font: 26px/1 var(--pencil); paint-order: stroke; stroke: var(--paper); stroke-width: 5px; }
.pencil text.big { font-size: 40px; }
.pencil text.mid { font-size: 22px; }
.pencil.red path { stroke: var(--bad); } .pencil.red text { fill: var(--bad); }
.pencil.green text { fill: var(--good-ink); }
.pencil.ink path { stroke: var(--muted); } .pencil.ink text { fill: var(--muted); }

/* ── Sections ───────────────────────────────────────────── */
section { scroll-margin-top: 64px; }
.section-head { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section-head h2 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.02em; }
.section-head p { margin-top: 10px; max-width: 40em; color: var(--muted); }
.demo, .marks, .download { padding: clamp(48px, 7vw, 88px) 0; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }

/* ── Demo ───────────────────────────────────────────────── */
.demo-controls, .demo-used-note {
  max-width: var(--max); margin: 24px auto 16px; padding: 0 var(--gutter);
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px;
}
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field select {
  font: 500 15px var(--sans); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 2px; padding: 10px 12px; min-width: 200px;
}
.demo-status { align-self: center; color: var(--muted); font-size: 15px; }
.demo-used-note { display: none; align-items: center; justify-content: space-between; background: var(--paper);
  border: 1px solid var(--rule); width: var(--column); padding: 18px 20px; }
.demo-used-note p { max-width: 36em; }
body.demo-used .demo-controls { display: none; }
body.demo-used .demo-used-note { display: flex; }

.score-card {
  position: relative; width: var(--column); height: min(76vh, 760px); margin: 0 auto;
  background: var(--paper); border: 1px solid var(--rule);
}
.score-card iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--paper); }

.countin {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font: 700 clamp(96px, 16vw, 180px)/1 var(--serif); color: var(--gold);
}
.countin:empty { display: none; }
.countin.beat { animation: beat 420ms ease-out; }
@keyframes beat { from { transform: scale(1.25); opacity: .2; } to { transform: scale(1); opacity: 1; } }

.tap-hint, .pause-bar, .review-bar {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px;
  background: var(--ink); color: var(--paper); border-radius: 2px; font-size: 14px; white-space: nowrap;
}
.tap-hint { bottom: 20px; padding: 10px 16px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.tap-hint.show { opacity: .92; }
.pause-bar, .review-bar { top: 16px; display: none; }
.pause-bar button, .review-bar button {
  background: none; border: 0; color: var(--rule); font: 600 14px var(--sans); padding: 8px 12px; cursor: pointer;
}
.pause-bar button:hover, .review-bar button:hover { color: var(--paper); }
.pause-bar span, .review-title { font-weight: 600; margin-right: 6px; }
body.demo-paused .pause-bar { display: flex; }
body.demo-reviewing .review-bar { display: flex; flex-wrap: wrap; max-width: calc(100% - 24px); white-space: normal; }
.review-times { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.review-group { display: inline-flex; align-items: center; gap: 6px; }
.review-label { color: var(--rule); font-size: 13px; }
.chip {
  background: transparent; color: var(--paper); border: 1px solid color-mix(in srgb, var(--rule) 60%, transparent) !important;
  border-radius: 2px; padding: 4px 9px !important; font-size: 12px !important;
}
.chip.on { background: var(--rule); color: var(--ink) !important; }

.zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 6px; }
.zoom button {
  width: 36px; height: 36px; border-radius: 2px; border: 1px solid var(--rule); background: var(--paper);
  color: var(--gold); font: 500 20px/1 var(--sans); cursor: pointer;
}

/* Playing: only the music (the app's immersive mode). */
body.demo-playing { overflow: hidden; }
body.demo-playing .top { display: none; }
body.demo-playing .score-card { position: fixed; inset: 0; z-index: 50; width: auto; height: auto; margin: 0; border: 0; }
body.demo-playing .zoom { display: none; }

/* ── Marks & flow ───────────────────────────────────────── */
.legend {
  list-style: none; width: var(--column); margin: 32px auto 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1px;
  background: color-mix(in srgb, var(--rule) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.legend li { display: flex; gap: 14px; align-items: center; background: var(--paper); padding: 18px 20px; }
.legend svg { flex: none; width: 60px; height: 60px; overflow: visible; }
.legend .pencil text { font-size: 17px; stroke-width: 3px; }
.legend h3 { font-size: 18px; }
.legend p { font-size: 15px; color: var(--muted); margin-top: 2px; }
.flow {
  max-width: var(--max); margin: 48px auto 0; padding: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(20px, 4vw, 48px);
}
.step { display: inline-block; font: 34px/1 var(--pencil); color: var(--gold); margin-bottom: 4px; }
.flow h3 { font-size: 21px; margin-bottom: 6px; }
.flow p { color: var(--muted); font-size: 16px; }

/* ── Download ───────────────────────────────────────────── */
.platforms {
  max-width: var(--max); margin: 28px auto 0; padding: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px;
}
.platform {
  display: grid; align-content: start; gap: 6px; min-height: 150px; padding: 20px;
  border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 2px;
  text-decoration: none; color: var(--muted);
}
.platform-name { font: 600 24px/1.1 var(--serif); color: var(--muted); }
.platform-note { font-size: 14px; }
.platform.ready { border: 1.5px solid var(--ink); background: var(--paper); color: var(--brown);
  box-shadow: 5px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.platform.ready .platform-name { color: var(--ink); }
.platform.ready:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.platform-go { margin-top: auto; padding-top: 18px; font-weight: 600; color: var(--ink); }
.fine { max-width: var(--max); margin: 22px auto 0; padding: 0 var(--gutter); font-size: 14px; color: var(--muted); }

/* ── Footer ─────────────────────────────────────────────── */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 28px var(--gutter) 40px; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  font-size: 14px; color: var(--muted);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { text-decoration: none; } .foot a:hover { color: var(--ink); text-decoration: underline; }

/* ── Summary ────────────────────────────────────────────── */
.summary {
  width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 820px); overflow: auto;
  padding: 28px 28px 24px; border: 1.5px solid var(--ink); border-radius: 2px;
  background: var(--paper); color: var(--brown); box-shadow: 8px 8px 0 var(--ink);
}
.summary::backdrop { background: rgba(30, 26, 22, .45); }
.summary .kicker { margin-bottom: 8px; }
.sum-head { display: flex; align-items: baseline; gap: 12px; }
.sum-score { font: 700 64px/1 var(--serif); color: var(--ink); }
.sum-right { color: var(--muted); }
.sum-counts { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 0; margin: 14px 0 20px; font-size: 15px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.dot.good { background: var(--good); } .dot.close { background: var(--close); } .dot.bad { background: var(--bad); }
.sum-list { margin-top: 18px; }
.sum-list h4 { font: 600 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 16px 0 6px; }
.sum-clean { color: var(--muted); font-size: 15px; padding: 4px 0; }
.mistake {
  display: flex; gap: 14px; width: 100%; text-align: left; padding: 9px 0; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--rule) 45%, transparent); font: inherit; color: inherit;
}
.mistake:hover .mistake-text { color: var(--ink); text-decoration: underline; }
.mistake-bar { flex: none; width: 56px; color: var(--muted); font-size: 13px; font-weight: 600; padding-top: 2px; }
.mistake-text { font-size: 15px; }
.sum-repeat { border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); padding: 10px 0; }
.sum-repeat summary { cursor: pointer; display: grid; gap: 2px; list-style: none; }
.sum-repeat summary::-webkit-details-marker { display: none; }
.sum-repeat summary::after { content: '+'; position: absolute; right: 28px; color: var(--gold); font-size: 20px; }
.sum-repeat[open] summary::after { content: '−'; }
.sum-repeat-title { font-weight: 600; color: var(--ink); }
.sum-repeat-sub { font-size: 13px; color: var(--muted); }
.sum-install { margin-top: 24px; padding: 18px; background: var(--ivory); border: 1px solid var(--rule); display: grid; gap: 12px; }
.sum-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 26px; color: var(--muted); cursor: pointer; }

/* ── Small screens ──────────────────────────────────────── */
@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-sheet { transform: none; }
  .top nav a:not(.nav-cta) { display: none; }
  .score-card { height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .note.due, .countin.beat { animation: none; }
}
.legend .pencil text.mid { font-size: 24px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:has(input:disabled) { opacity: .45; }
.file-btn:has(input:disabled) input { cursor: default; }
.field[hidden] { display: none; }
