:root {
  color-scheme: dark;
  --bg: #090b0d;
  --surface: #111519;
  --surface-raised: #171c21;
  --line: #283038;
  --text: #f0f3f5;
  --muted: #8f9ba5;
  --control: #d6dee5;
  --control-soft: rgba(214, 222, 229, 0.1);
  --speech: #ffb454;
  --speech-soft: rgba(255, 180, 84, 0.16);
  --piano: #7fa7ff;
  --piano-soft: rgba(127, 167, 255, 0.14);
  --playhead-position: 28%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 20% -10%, rgba(214, 222, 229, 0.05), transparent 28rem),
    var(--bg);
}

button, input { font: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.page-header,
.panel-header,
.sample-meta,
.transport {
  display: flex;
  align-items: center;
}

.page-header {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -0.04em;
}

.eyebrow,
.track-label {
  margin-bottom: 4px;
  color: var(--piano);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow { color: var(--control); }

.sample-nav { display: flex; gap: 8px; }

.sample-nav button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
}

.sample-nav button:hover:not(:disabled) { border-color: var(--muted); }
.sample-nav button:disabled { opacity: 0.4; cursor: default; }

.video-panel {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: #000;
}

.video-panel iframe,
#youtube-player {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.transport {
  align-items: center;
  gap: 14px;
  min-height: 90px;
  padding: 12px 14px 10px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--surface);
}

.transport-action {
  display: flex;
  width: 48px;
  flex: 0 0 48px;
  align-items: center;
  flex-direction: column;
  gap: 6px;
}

.transport-timeline {
  min-width: 0;
  flex: 1;
}

.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--control);
  border-radius: 50%;
  background: transparent;
  color: var(--control);
  padding: 0;
  cursor: pointer;
}

.play-icon {
  position: relative;
  display: block;
  width: 12px;
  height: 14px;
}

.play-icon::before {
  position: absolute;
  top: 1px;
  left: 2px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  content: "";
}

.play-button.is-playing .play-icon::before {
  top: 1px;
  left: 1px;
  width: 3px;
  height: 12px;
  border: 0;
  background: currentColor;
  box-shadow: 7px 0 0 currentColor;
}

.play-button:disabled { opacity: 0.35; cursor: wait; }
.play-button:not(:disabled):hover { background: var(--control-soft); }
.play-button:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }

.time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.timeline-panel {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.activity-overview {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 82px;
  grid-template-rows: 24px 24px;
  align-items: center;
  gap: 6px 10px;
}

.activity-overview:has(.activity-seek:focus-visible) {
  outline: 1px solid var(--text);
  outline-offset: 4px;
  border-radius: 4px;
}

.activity-name {
  position: relative;
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.activity-name::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  transform: translateY(-50%);
}

.speech-activity-name { grid-column: 1; grid-row: 1; color: var(--speech); }
.piano-activity-name { grid-column: 1; grid-row: 2; color: var(--piano); }

.activity-map-wrap {
  position: relative;
  grid-column: 2;
  grid-row: 1 / 3;
  width: 100%;
  height: 54px;
}

#activity-map,
.activity-seek {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 54px;
  margin: 0;
}

#activity-map {
  border-radius: 4px;
  background: #0b0e11;
}

.activity-seek {
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  cursor: crosshair;
  opacity: 0.001;
  touch-action: none;
}

.activity-seek::-webkit-slider-runnable-track { height: 54px; background: transparent; }
.activity-seek::-webkit-slider-thumb { width: 1px; height: 54px; appearance: none; }
.activity-seek::-moz-range-track { height: 54px; background: transparent; }
.activity-seek::-moz-range-thumb { width: 1px; height: 54px; border: 0; background: transparent; }

.activity-rate {
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.speech-activity-rate { grid-column: 3; grid-row: 1; }
.piano-activity-rate { grid-column: 3; grid-row: 2; }

.timeline-scale {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 82px;
  gap: 10px;
  margin-top: 3px;
}

.timeline-scale-range {
  display: flex;
  grid-column: 2;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.panel-header {
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 { font-size: 1rem; }
.panel-header > p { color: var(--muted); font-size: 0.74rem; }
.speech-panel .track-label { color: var(--speech); }

.caption-readout {
  min-height: 64px;
  padding: 17px 18px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.caption-readout .current-word {
  color: var(--text);
  font-weight: 750;
}

#piano-roll {
  display: block;
  width: 100%;
  height: 240px;
  background: #0b0e11;
}

#piano-keyboard {
  display: block;
  width: 100%;
  height: 92px;
  border-top: 1px solid var(--line);
  background: #090b0d;
}

.piano-pedal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 25px;
  border-top: 1px solid #23282c;
  background: #111417;
  color: #5f686f;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}

.pedal-light {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4a5157;
  transition: background 100ms ease, box-shadow 100ms ease;
}

.piano-pedal.active {
  border-top-color: rgba(127, 167, 255, 0.7);
  background: rgba(64, 91, 153, 0.52);
  color: #dbe6ff;
}

.piano-pedal.active .pedal-light {
  background: var(--piano);
  box-shadow: 0 0 8px rgba(127, 167, 255, 0.8);
}

.sample-meta {
  align-items: flex-start;
  justify-content: space-between;
  gap: 36px;
  padding: 20px 2px 0;
}

.sample-meta h2 { font-size: 1rem; }
.sample-meta p { margin-top: 5px; color: var(--muted); line-height: 1.55; font-size: 0.8rem; }
.sample-meta > p { max-width: 560px; text-align: right; }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 18px, 1120px); padding-top: 14px; }
  .page-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .transport { gap: 9px; padding-inline: 10px; }
  .transport-action { width: 44px; flex-basis: 44px; }
  .activity-overview,
  .timeline-scale { grid-template-columns: 48px minmax(0, 1fr) 76px; gap-inline: 6px; }
  .activity-name { padding-left: 0; font-size: 0.63rem; }
  .activity-name::before { display: none; }
  .activity-rate { font-size: 0.62rem; }
  .sample-meta { flex-direction: column; gap: 8px; }
  .sample-meta > p { text-align: left; }
  #piano-roll { height: 200px; }
  #piano-keyboard { height: 76px; }
}

@media (max-width: 520px) {
  .activity-overview,
  .timeline-scale { grid-template-columns: 45px minmax(0, 1fr); }
  .activity-rate { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Plain supplementary-page presentation. */
:root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-raised: #f6f6f6; --line: #ddd; --text: #222; --muted: #666; --control: #333; --control-soft: #eee; --speech: #b86a1f; --piano: #3169ad; font-family: Arial, Helvetica, sans-serif; }
body { background: white; font-size: 16px; line-height: 1.55; }
.page-shell { width: min(960px, calc(100% - 36px)); padding-top: 32px; }
h1 { font-size: 27px; letter-spacing: normal; line-height: 1.3; margin-bottom: 12px; }
h2 { font-size: 23px; margin: 28px 0 10px; }
h3 { font-size: 18px; margin: 18px 0 12px; }
p { margin: 10px 0; }
a { color: #1766ad; }
section#dataset, section#benchmark { margin-top: 32px; border-top: 1px solid #ddd; }
button { font: inherit; padding: 5px 12px; border: 1px solid #bbb; border-radius: 3px; background: #f7f7f7; color: #222; cursor: pointer; }
button:hover:not(:disabled) { background: #eee; }
button:disabled { opacity: .45; cursor: default; }
.example-nav { display: flex; align-items: center; gap: 15px; margin: 16px 0; }
.example-nav span { color: #666; font-size: 14px; }
.video-panel { max-width: none; border-radius: 0; }
.transport, .timeline-panel { border-radius: 0; }
.transport { border-top: 1px solid var(--line); margin-top: 12px; }
.panel-header h2 { margin: 0; }
.track-label, .activity-name { text-transform: none; letter-spacing: normal; font-weight: normal; font-size: 12px; }
.track-label { display: none; }
.activity-rate { display: none; }
#activity-map, #piano-roll { background: #f8f8f8; border-radius: 0; }
#piano-roll { height: 190px; }
#piano-keyboard { height: 65px; }
.piano-pedal { background: #fafafa; color: #666; letter-spacing: normal; text-transform: none; }
.piano-pedal.active { background: #e7eff8; color: #245789; }
.piano-pedal.active .pedal-light { box-shadow: none; }
[hidden] { display: none !important; }
audio { width: 100%; max-width: 640px; display: block; margin: 12px 0; }
fieldset { border: 0; padding: 0; margin: 18px 0; }
.choice { display: flex; align-items: baseline; gap: 9px; padding: 8px 0; border-bottom: 1px solid #eee; }
.choice.correct { background: #edf5ed; }
table { width: 100%; border-collapse: collapse; margin: 16px 0; text-align: left; }
th, td { padding: 8px; border-bottom: 1px solid #ddd; }
th { background: #f7f7f7; }
