:root {
  --bg: #f5f2ec;            /* warm paper */
  --panel: #ffffff;
  --line: #e6e1d6;          /* warm hairline */
  --line-soft: #efebe2;
  --ink: #20242c;           /* near-black slate */
  --dim: #74706a;           /* warm grey */
  --accent: #b07b3a;        /* muted brass for links/marks */
  --rwkv: #E07A2E; --pixelgen: #3F7FD6; --musecoco: #3E9E5C; --amt: #9A63D6;
  --ok: #a9d8b2; --part: #f3d36b; --bad: #ef9a9a; --spell: #a8403a; --ex: #ebe6db; --ref: #e9e2d2;
  --shadow: 0 1px 2px rgba(40,34,22,.05), 0 6px 20px rgba(40,34,22,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Hoefler Text", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 var(--sans);
  background-image: radial-gradient(circle at 1px 1px, rgba(120,110,92,.05) 1px, transparent 0);
  background-size: 22px 22px;
}
.wrap { max-width: 1500px; margin: 0 auto; padding: 0 16px 96px; }

header.hero { padding: 52px 0 26px; }
header.hero .accent-rule {
  height: 3px; width: 84px; border-radius: 3px; margin-bottom: 20px;
  background: linear-gradient(90deg, var(--rwkv), var(--pixelgen) 40%, var(--musecoco) 70%, var(--amt));
}
header.hero .kicker { font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
header.hero h1 { font-family: var(--serif); font-weight: 600; font-size: 2.5rem; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 14px; }
header.hero p { color: var(--dim); margin: 0 0 6px; max-width: 74ch; font-size: 15.5px; }
header.hero p.hint { font-size: 14px; }

h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.55rem; letter-spacing: -0.01em;
  margin: 54px 0 6px; padding-bottom: 0; border: 0;
}
.section-rule { height: 1px; background: var(--line); margin: 10px 0 22px; }
h3.sub { font-family: var(--sans); font-size: .96rem; font-weight: 700; margin: 22px 0 4px; color: var(--ink); letter-spacing: .01em; }
.wrap p { max-width: 80ch; color: #3b3f47; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(176,123,58,.35); }
a:hover { border-bottom-color: var(--accent); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 6px 0 2px; color: var(--dim); font-size: 13.5px; }
.legend span.item { display: inline-flex; align-items: center; }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 8px; box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
.hint { color: var(--dim); font-size: 13px; }

footer { color: var(--dim); font-size: 12.5px; margin-top: 52px; padding-top: 18px; border-top: 1px solid var(--line); }

.legend .sw-ex { background: repeating-linear-gradient(135deg, #ebe6db 0 3px, #f7f4ee 3px 6px); }

.song-card {
  display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; margin: 0 0 16px;
  color: var(--dim); font-size: 14px;
}
.song-card .title { font: 600 1.25rem/1.2 var(--serif); color: var(--ink); }

.player {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px 16px 12px;
}
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.controls .spacer { flex: 1; }
button.play {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid #2a2e36; background: #2a2e36; color: #fff;
  font-size: 15px; cursor: pointer; padding-left: 3px; flex: none;
}
button.play.on { padding-left: 0; }
button.play:disabled { background: #b9b3a7; border-color: #b9b3a7; cursor: wait; }
.clock { font: 500 14px/1 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink); min-width: 96px; }
.levels, .zoom { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.levels button, .zoom button {
  font: 600 12px/1 var(--sans); color: #3b3f47; background: #fbf9f4; border: 0; border-right: 1px solid var(--line);
  padding: 8px 10px; cursor: pointer;
}
.levels button:last-child, .zoom button:last-child { border-right: 0; }
.levels button.on, .zoom button.on { background: #2a2e36; color: #fff; }
.vol { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; }
.vol input { width: 84px; accent-color: #2a2e36; }

canvas.overview { display: block; width: 100%; height: 56px; cursor: pointer; margin-bottom: 8px; }
.detail-wrap { position: relative; }
canvas.detail { display: block; width: 100%; cursor: default; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: #2a2e36; color: #fff; font-size: 12.5px;
  padding: 6px 9px; border-radius: 7px; white-space: nowrap; box-shadow: 0 4px 14px rgba(40,34,22,.2);
}
.tip b { font-weight: 600; }
.player .legend { margin-top: 10px; }
.player p.hint { margin: 8px 0 0; max-width: none; }

@media (max-width: 760px) {
  header.hero h1 { font-size: 2rem; }
  .vol input { width: 64px; }
  .controls .spacer { display: none; }
}

.legend .spell-mark { font: 600 12.5px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--spell);
  border-bottom: 1.5px solid var(--spell); line-height: 1.1; }

.song-card .wip { color: var(--accent); font-style: italic; }

.globalbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); margin: 6px 0 8px;
}
.globalbar .spacer { flex: 1; }
.legend { margin-bottom: 18px; }
section.song { margin: 0 0 40px; }
section.song .song-card { margin-top: 8px; }

canvas.detail { touch-action: pan-y; }
canvas.overview { touch-action: none; }
.mobile-note { display: none; }
@media (max-width: 760px), (pointer: coarse) {
  .mobile-note {
    display: block; margin: 0 0 8px; padding: 10px 12px; border: 1px solid #ead9bd; border-radius: 10px;
    background: #fbf3e4; color: #6d5530; font-size: 13.5px;
  }
}
@media (max-width: 760px) {
  header.hero { padding: 32px 0 14px; }
  .globalbar { gap: 8px 12px; }
  .globalbar .levels { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .globalbar .levels button { flex: none; padding: 8px 9px; }
  .player { padding: 10px 10px 8px; }
  .controls { gap: 8px 10px; }
  .zoom button { padding: 8px 8px; }
  .song-card { gap: 2px 14px; font-size: 13px; }
  .legend { font-size: 12.5px; gap: 6px 14px; }
}
