/* Speech-Score tracker — shared styles for BOTH surfaces (standalone file:// HTML + Next route).
   Everything is scoped under .sse so it never collides with a host app's global styles.
   The engine sets --lanes on the .sse root from the score's lane count. */
.sse {
  --stage: #101012;
  --page: #34393b; /* Kindle dark-mode paper */
  --page-edge: #3d4244;
  --ink: #e9e6dc; /* warm cream */
  --ink-faint: rgba(233, 230, 220, 0.16);
  --ink-spoken: rgba(233, 230, 220, 0.52);
  --rule: rgba(233, 230, 220, 0.1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
    "Times New Roman", serif;
  --accent: #cdbf9a; /* warm gold — live/human lane */
  --lanes: repeat(4, minmax(0, 1fr)); /* set by the engine from the score's lane count */

  position: relative;
  width: 100%;
  height: 100%;
  background: var(--page);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.22);
  font-family: var(--serif);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.sse *,
.sse *::before,
.sse *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- title ---- */
.sse .title {
  padding: clamp(14px, 2.2vh, 30px) 24px clamp(8px, 1.2vh, 16px);
  text-align: center;
}
.sse .title .mark {
  font-family: var(--serif);
  font-size: clamp(8px, 0.9vw, 12px);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(233, 230, 220, 0.4);
}
.sse .title h1 {
  font-weight: 500;
  font-size: clamp(16px, 2.4vw, 32px);
  letter-spacing: 0.02em;
  margin-top: clamp(6px, 0.9vh, 12px);
  font-variant: small-caps;
  color: var(--ink);
}
.sse .title .by {
  font-size: clamp(10px, 1.2vw, 16px);
  font-style: italic;
  color: rgba(233, 230, 220, 0.45);
  margin-top: 4px;
}

/* ---- column headers ---- */
.sse .heads {
  display: grid;
  grid-template-columns: clamp(1.4rem, 3vw, 3rem) var(--lanes);
  padding: 6px clamp(10px, 1.4vw, 22px) 8px;
  border-bottom: 1px solid var(--rule);
  margin: 4px clamp(8px, 1vw, 18px) 0;
}
.sse .heads .h {
  font-size: clamp(8.5px, 1vw, 13px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: rgba(233, 230, 220, 0.62);
  padding-left: 4px;
  min-width: 0;
}
.sse .heads .h.gut {
  text-align: center;
}
.sse .heads .h.live {
  color: var(--accent);
}
.sse .heads .h.live::after {
  content: " ●";
  font-size: 0.7em;
  vertical-align: middle;
}
/* a muted lane (click a voice header to toggle): still illuminates, but is silent */
.sse .heads .h[data-lane] {
  cursor: pointer;
}
.sse .heads .h.muted {
  opacity: 0.32;
  text-decoration: line-through;
}
/* a soloed lane (⌥/Alt-click a header): only soloed lanes sound; the rest dim while soloing.
   placed after .muted so solo wins on equal specificity — solo overrides mute visually too. */
.sse .heads .h.solo {
  color: var(--accent);
  opacity: 1;
  text-decoration: none;
}
.sse .heads .h.solo::before {
  content: "S ";
  font-size: 0.72em;
  opacity: 0.85;
}
.sse .heads.has-solo .h[data-lane]:not(.solo) {
  opacity: 0.26;
}

/* count-in overlay (3·2·1 before a metronome performance) */
.sse .count {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  font-size: clamp(60px, 18vw, 220px);
  font-variant: small-caps;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(205, 191, 154, 0.4);
}
.sse .count.show {
  display: flex;
}

/* transport hint line */
.sse .hint {
  font-size: clamp(9px, 1vw, 12px);
  font-style: italic;
  color: rgba(233, 230, 220, 0.4);
}

/* ---- score viewport ---- */
.sse .viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  margin: 0 clamp(8px, 1vw, 18px);
}
.sse .viewport::before,
.sse .viewport::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 42px;
  pointer-events: none;
  z-index: 3;
}
.sse .viewport::before {
  top: 0;
  background: linear-gradient(var(--page), transparent);
}
.sse .viewport::after {
  bottom: 0;
  background: linear-gradient(transparent, var(--page));
}
.sse .track {
  position: absolute;
  inset: 0 0 auto 0;
  transition: transform 0.12s linear;
  will-change: transform;
}
.sse .row {
  display: grid;
  grid-template-columns: clamp(1.4rem, 3vw, 3rem) var(--lanes);
  min-height: clamp(24px, 3.4vh, 46px);
  align-items: center;
}
.sse .rownum {
  font-size: clamp(7px, 0.8vw, 11px);
  color: rgba(233, 230, 220, 0.14);
  text-align: center;
  font-family: var(--serif);
  user-select: none;
}
.sse .row.here .rownum {
  color: rgba(233, 230, 220, 0.5);
}
/* the playhead: a soft luminous band on the active row (spans the full row height) */
.sse .row.here::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * clamp(8px, 1vw, 18px));
  right: calc(-1 * clamp(8px, 1vw, 18px));
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow: 0 0 26px rgba(200, 220, 255, 0.06);
  pointer-events: none;
}
.sse .cell {
  position: relative;
  padding-left: 4px;
  min-width: 0;
}
.sse .word {
  display: inline-block;
  max-width: 100%;
  font-size: clamp(13px, 1.5vw, 23px);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink);
  opacity: 0.16; /* faint on the page until struck */
  overflow-wrap: anywhere;
  transition: opacity 0.5s ease, text-shadow 0.5s ease;
}
.sse .word.spoken {
  opacity: 0.52;
} /* already performed: stays legible */
.sse .word.now {
  opacity: 1;
  text-shadow: 0 0 16px rgba(233, 230, 220, 0.55), 0 0 3px rgba(233, 230, 220, 0.6);
  animation: sse-bloom 0.5s ease-out;
}
.sse .word.stage {
  font-style: italic;
  font-size: clamp(11px, 1.3vw, 19px);
  opacity: 0.3;
}
/* a live (human-performed) line: the engine leaves it silent; the actor speaks it */
.sse .word.live {
  color: var(--accent);
  text-decoration: underline dotted rgba(205, 191, 154, 0.4);
}
.sse .word.live.now {
  text-shadow: 0 0 16px rgba(205, 191, 154, 0.6), 0 0 3px rgba(205, 191, 154, 0.7);
}
@keyframes sse-bloom {
  0% {
    transform: translateY(0.5px);
    text-shadow: 0 0 26px rgba(233, 230, 220, 0.9);
  }
  100% {
    transform: translateY(0);
  }
}

/* ---- caption ---- */
.sse .caption {
  padding: 9px 20px 6px;
  font-size: clamp(9px, 1.1vw, 14px);
  font-style: italic;
  color: rgba(233, 230, 220, 0.4);
  text-align: center;
  border-top: 1px solid var(--rule);
  margin: 0 clamp(8px, 1vw, 18px);
}

/* ---- transport (quiet, literary) ---- */
.sse .transport {
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
}
.sse .trow {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.sse .btn {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 13px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: transparent;
  color: rgba(233, 230, 220, 0.82);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sse .btn:hover {
  background: rgba(233, 230, 220, 0.06);
  color: var(--ink);
}
.sse .btn.primary {
  border-color: rgba(233, 230, 220, 0.32);
  color: var(--ink);
}
.sse .btn.on {
  background: rgba(233, 230, 220, 0.1);
  color: var(--ink);
}
.sse .seg {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.sse .seg button {
  font-family: var(--serif);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 9px;
  background: transparent;
  color: rgba(233, 230, 220, 0.42);
  border: none;
  border-right: 1px solid var(--rule);
  cursor: pointer;
}
.sse .seg button:last-child {
  border-right: none;
}
.sse .seg button.on {
  background: rgba(233, 230, 220, 0.09);
  color: var(--ink);
}
.sse .tempo {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}
.sse .tempo label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(233, 230, 220, 0.42);
}
.sse .tempo input {
  flex: 1;
  accent-color: #cdbf9a;
  height: 2px;
}
