:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #666;
  --bg: #f7f6f2;
  --rule: #ddd;
  --panel: #fff;
  --accent: #2a4b7c;
  --reviewer-band: 50vh;
  --option-min: 200px;
  /* Compile-time pageWidth uses this design viewport height (see build.mjs). */
  --reviewer-design-vh: 900px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

body.reviewer-body {
  height: 100vh;
  overflow: hidden;
}

.top {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
  background: var(--panel);
}

.top a { color: inherit; }

.doc {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.25rem;
}

/* Full-bleed two-band shell — zero chrome padding */
.doc.reviewer {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.doc .intermo-embed {
  max-width: min(960px, 100%);
}

.doc.reviewer .intermo-embed {
  --intermo-embed-w: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.doc h1, .doc h2 { line-height: 1.2; }
.doc p { max-width: 42rem; color: var(--muted); }

/* Kill embed / player padding so systems use the full Y of each pane. */
.doc.reviewer .intermo-score-cell .notation-content-area,
.doc.reviewer .intermo-notation-player .notation-content-area,
.doc.reviewer .notation-content-area {
  padding: 0 !important;
  padding-bottom: 0 !important;
}

.doc.reviewer .notation-content-area #notation {
  padding: 0 !important;
  padding-left: 0 !important;
}

.doc.reviewer .intermo-score-cell,
.doc.reviewer .intermo-notation-player.intermo-embed {
  border-radius: 0;
  box-shadow: none;
  /* markdown.css defaults to #0e0e10 — that made selection look “super dark”. */
  background: transparent !important;
}

/*
 * Panels stay transparent so a light selection wash on the card shows through
 * the SVG paper areas. Glow remains the panel overlay behind content.
 */
.doc.reviewer .notation-panel,
.doc.reviewer .intermo-embed > .notation-panel,
.doc.reviewer .intermo-notation-player > .notation-panel {
  background: transparent !important;
}

.doc.reviewer .notation-content-area {
  background: transparent !important;
}

/* ── Stage: two equal bands ─────────────────────────────────────── */

.reviewer-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.reviewer-panel-title {
  margin: 0;
  padding: 0.2rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

/* ── Top ~50vh: nav | question+video (½) | reference (½) ─────────── */

.reviewer-question {
  flex: 0 0 50%;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0;
  padding: 0;
  align-items: stretch;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.reviewer-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.25rem;
  min-width: 3.25rem;
  border-right: 1px solid var(--rule);
  position: relative;
}

.reviewer-nav-home {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  text-align: center;
  max-width: 4.5rem;
  line-height: 1.15;
}

.reviewer-nav-home:hover {
  color: var(--ink);
}

.reviewer-nav-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

a.reviewer-nav-btn:hover,
.reviewer-nav-btn:hover:not(:disabled) {
  background: #eee;
}

.reviewer-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.reviewer-nav-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--muted);
}

.reviewer-nav-x {
  color: var(--ink);
  font-weight: 600;
}

.reviewer-nav-votes {
  font-size: 0.95rem;
  font-weight: 600;
}

.reviewer-nav-help {
  font-size: 0.95rem;
  line-height: 1;
}

.reviewer-nav-votes[aria-expanded="true"] {
  background: #eee;
}

/* Votes leaderboard — systems ranked with bars + sample lists. */
.reviewer-votes-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.reviewer-votes-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.reviewer-votes-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(36rem, 94vw);
  max-height: min(88vh, 40rem);
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  padding: 1rem 1.15rem 1.25rem;
  overflow: hidden;
}

.reviewer-votes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.reviewer-votes-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.reviewer-votes-close {
  appearance: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  width: 2rem;
  height: 2rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.reviewer-votes-close:hover {
  background: #eee;
}

.reviewer-votes-note {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.reviewer-votes-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.reviewer-votes-progress {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.reviewer-votes-empty {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.reviewer-board {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.reviewer-board-row {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.7rem 0.85rem 0.75rem;
  background: #fafafa;
}

.reviewer-board-top {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.reviewer-board-rank {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9rem;
}

.reviewer-board-meta {
  min-width: 0;
}

.reviewer-board-name {
  font-weight: 650;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.reviewer-board-bar-track {
  height: 0.55rem;
  border-radius: 999px;
  background: #e6e6e6;
  overflow: hidden;
}

.reviewer-board-bar {
  height: 100%;
  border-radius: inherit;
  background: #2a2a2a;
  min-width: 0;
  transition: width 0.25s ease;
}

.reviewer-board-row[data-system="rubato"] .reviewer-board-bar {
  background: #1d4e89;
}
.reviewer-board-row[data-system="beat-a2s"] .reviewer-board-bar {
  background: #8b4513;
}
.reviewer-board-row[data-system="tkun-m2st"] .reviewer-board-bar {
  background: #2f6b3a;
}
.reviewer-board-row[data-system="tkun-pm2s"] .reviewer-board-bar {
  background: #6b2f5b;
}

.reviewer-board-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}

.reviewer-votes-none {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.reviewer-votes-samples {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.reviewer-votes-samples li {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink);
}

.reviewer-votes-samples a {
  color: var(--ink);
  text-decoration: none;
}

.reviewer-votes-samples a:hover {
  text-decoration: underline;
}

.reviewer-votes-as {
  color: var(--muted);
  font-size: 0.75rem;
}

.reviewer-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--rule);
  padding: 0.35rem 0.75rem 0.5rem;
  overflow: hidden;
  position: relative;
}

/* Prompt a bit wider than the 16:9 video; both centered on X. */
.reviewer-mid > .reviewer-prompt {
  width: min(100%, 34rem);
  max-width: 100%;
  box-sizing: border-box;
}

.reviewer-mid > .reviewer-yt {
  width: min(100%, 380px);
  max-width: 100%;
  box-sizing: border-box;
}

.reviewer-yt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  flex: 0 0 auto;
  padding: 0.35rem 0 0;
  margin: 0 auto;
}

.yt-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 0;
  overflow: hidden;
  background: #12141a;
}

.yt-embed-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.reviewer-prompt {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding: 0.35rem 0 0.15rem;
  margin: 0 auto;
  border: 0;
  background: transparent;
}

.reviewer-prompt-text {
  margin: 0 auto;
  width: 100%;
  color: var(--ink);
  font-size: clamp(0.92rem, 1.45vw, 1.08rem);
  line-height: 1.5;
  text-align: justify;
  text-align-last: center;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-wrap: pretty;
}

.reviewer-prompt-text strong {
  font-weight: 700;
  color: var(--ink);
}

.reviewer-mid-spacer {
  display: none;
}

.reviewer-ref {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.reviewer-ref .reviewer-panel-title {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.82);
}

.reviewer-ref .intermo-score-cell.intermo-embed,
.reviewer-ref .intermo-notation-player.intermo-embed {
  flex: 1;
  min-height: 0;
  height: 100%;
  aspect-ratio: auto;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}

.reviewer-ref .notation-content-area {
  background: transparent;
}

/* ── Bottom ~50vh: horizontal square options ────────────────────── */

.reviewer-options {
  flex: 0 0 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
  container-type: size;
}

.reviewer-options-rail {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
}

.reviewer-scroll-btn {
  position: absolute;
  top: 0;
  z-index: 6;
  height: 2rem;
  min-width: 1.75rem;
  padding: 0 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: rgba(247, 246, 242, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.reviewer-scroll-btn:hover:not(:disabled) {
  background: #fff;
}

.reviewer-scroll-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.reviewer-scroll-btn--prev { left: 0; }
.reviewer-scroll-btn--next { right: 0; }

.reviewer-candidates {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.4rem; /* tiny separation between option cards */
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scroll-snap-type: none;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
  /* No outer padding — only the gap between cards. */
  padding: 0;
}

.reviewer-candidates.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.reviewer-candidate {
  /* Square side ≈ band Y; header sits in-flow above the score. */
  flex: 0 0 auto;
  width: max(var(--option-min), 100cqh);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  padding: 0; /* no extra padding — radius clips inward only */
  position: relative;
  border-radius: 10px;
  overflow: hidden; /* round the score/header toward the inside */
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  scroll-snap-align: none;
}

.reviewer-candidate.is-selected {
  background: rgba(232, 140, 60, 0.22);
  border-color: rgba(196, 95, 18, 0.55);
  box-shadow: inset 0 0 0 2px rgba(196, 95, 18, 0.45);
  z-index: 2;
}

.reviewer-candidate-head {
  position: static;
  flex: 0 0 auto;
  z-index: 3;
  padding: 0.3rem 0.55rem;
  background: #e8e4dc;
  border-bottom: 1px solid var(--rule);
  min-height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.reviewer-candidate.is-selected .reviewer-candidate-head {
  background: #c45f12;
  border-bottom-color: #a34e0e;
}

.reviewer-choice {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  user-select: none;
  width: 100%;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.reviewer-candidate.is-selected .reviewer-choice {
  color: #fff;
  font-weight: 700;
}

.reviewer-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.reviewer-choice-status {
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0.06em;
  color: inherit;
}

.reviewer-candidate.is-selected .reviewer-choice-status {
  color: #fff;
  font-weight: 700;
}

/* Score fills remaining space under the in-flow header. */
.reviewer-candidate .intermo-score-cell.intermo-embed,
.reviewer-candidate .intermo-notation-player.intermo-embed {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  max-height: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}

.reviewer-candidate .notation-content-area {
  background: transparent;
  /* Keep horizontal scroll on the options rail, not inside each score. */
  overflow-x: hidden !important;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  /* Prefer vertical pans on the score; rail owns horizontal. */
  touch-action: pan-y;
}

/* SVGs fill their pane; density from Verovio pageWidth at compile time. */

/*
 * Turn-off-the-lights: ONE fixed hole element. Its box-shadow floods the
 * viewport with a semi-transparent black; the element’s own box is the hole
 * over the playing source. pointer-events:none so clicks still reach the page.
 */
.reviewer-spotlight {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  box-shadow: 0 0 0 999vmax rgba(0, 0, 0, 0.55);
  /* Radius set in JS from the target (cards → 10px; ref/mid → square). */
  border-radius: 0;
  background: transparent;
  opacity: 0;
  transition:
    opacity 0.35s ease,
    top 0.35s ease,
    left 0.35s ease,
    width 0.35s ease,
    height 0.35s ease,
    border-radius 0.35s ease;
}

.reviewer-spotlight.is-on {
  opacity: 1;
}

/* Coach-mark tutorial (left-nav lightbulb) */
.reviewer-tut-scrim {
  position: fixed;
  inset: 0;
  z-index: 10040;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.reviewer-tut-ring {
  position: fixed;
  z-index: 10041;
  pointer-events: none;
  border: 2px solid rgba(253, 255, 141, 0.85);
  border-radius: 8px;
  box-shadow: 0 0 0 999vmax rgba(0, 0, 0, 0.45);
  background: transparent;
}

.reviewer-tut-hint {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 10042;
  width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}

.reviewer-tut-box {
  pointer-events: auto;
  background: #1a1a1e;
  color: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 1.1rem 1.25rem 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  font-family: system-ui, -apple-system, sans-serif;
}

.reviewer-tut-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.reviewer-tut-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 1.5rem 0.4rem 0;
}

.reviewer-tut-sub {
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.85rem;
}

.reviewer-tut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.reviewer-tut-step {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.4);
}

.reviewer-tut-next {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1a1e;
  background: #fdff8d;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

@media (max-width: 820px) {
  .doc.reviewer {
    height: auto;
    overflow: auto;
  }

  .reviewer-question {
    flex: none;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .reviewer-nav {
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .reviewer-mid {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .reviewer-options {
    flex: none;
    height: auto;
  }

  .reviewer-candidates {
    overflow-x: auto;
  }

  .reviewer-ref .intermo-score-cell.intermo-embed,
  .reviewer-ref .intermo-notation-player.intermo-embed {
    min-height: 220px;
  }
}
