:root {
  color-scheme: light dark;
  --bg: #fff; --ink: #1b1b1d; --quiet: #8b8b90; --rule: #e3e3e6;
  --mark: rgba(255, 221, 51, .42); --head: #d4372c;
  --blend: multiply; --paper: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617; --ink: #ececee; --quiet: #85858b; --rule: #2e2e31;
    --mark: rgba(255, 214, 40, .3); --head: #ff6a5c;
    --blend: screen; --paper: invert(.9) hue-rotate(180deg);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 13px/1.2 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
main { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 0; }
#score { min-height: 0; padding: 12px 0 12px 12px; display: flex; }
#page { position: relative; flex: none; cursor: pointer; }
#img { display: block; width: 100%; height: 100%; filter: var(--paper); }
#mark { position: absolute; background: var(--mark); mix-blend-mode: var(--blend); border-radius: 2px; }
#head { position: absolute; width: 2px; margin-left: -1px; background: var(--head); }
#stage { min-width: 0; min-height: 0; position: relative; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; }
footer {
  display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px 14px; border-top: 1px solid var(--rule);
}
button {
  all: unset; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
button:hover { background: var(--rule); }
button:active { transform: scale(.94); }
:focus-visible { outline: 2px solid var(--head); outline-offset: 2px; }
button svg { width: 16px; height: 16px; fill: currentColor; grid-area: 1 / 1; }
nav { display: flex; }
nav button { width: auto; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 6px; text-align: center; color: var(--quiet); font-weight: 500; }
nav button[aria-current="true"] { color: var(--ink); background: var(--rule); }
.i-pause, .playing .i-play { display: none; }
.playing .i-pause { display: block; }
output { font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: right; }
#bar { font-size: 20px; font-weight: 600; min-width: 3ch; }
#time { color: var(--quiet); min-width: 4.5ch; }
#line { width: 100%; height: 34px; display: block; cursor: pointer; }
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: 42% minmax(0, 1fr); }
  #stage { order: -1; }
  #score { padding: 8px; justify-content: center; align-items: flex-start; }
  footer { gap: 6px; padding: 6px 8px; }
  #time { display: none; }
  footer { grid-template-columns: auto auto auto minmax(0, 1fr); }
}
