/* Day 5: The second run.
   The Workshop bench at first light. A tall window of dawn, two pages, a seal
   that closes in four doors. Values come from house.values.css. */

.hp {
  --d5-night: var(--house-color-ground-night);
  --d5-navy: var(--house-color-ground-navy);
  --d5-win: var(--house-color-ground-chapter-win);
  --d5-gold: var(--house-color-gold-base);
  --d5-gold-base: var(--house-color-gold-base);
  --d5-gold-hi: var(--house-color-gold-hi);
  --d5-gold-light: var(--house-color-gold-light);
  --d5-gold-mid: var(--house-color-gold-mid);
  --d5-gold-deep: var(--house-color-gold-deep);
  --d5-ice: var(--house-color-scene-ice);
  --d5-ink: var(--house-color-text-ink);
  --d5-ink-2: var(--house-color-text-secondary);
  --d5-ink-3: var(--house-color-text-tertiary);
  --d5-line: var(--house-color-line-quiet);
  --d5-line-2: var(--house-color-line-strong);
  --d5-paper: var(--house-color-dawn-paper);
  --d5-paper-deep: var(--house-color-dawn-paper-deep);
  --d5-on-paper: var(--house-color-dawn-ink);
  --d5-ease: var(--house-motion-easing-standard);
  position: relative;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--d5-night);
  color: var(--d5-ink);
  font-family: var(--house-type-family-body);
  font-size: var(--house-type-size-body);
  line-height: var(--house-type-line-height-body);
  -webkit-font-smoothing: antialiased;
}

.hp *, .hp *::before, .hp *::after { box-sizing: border-box; }

.d5-skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 30;
  background: var(--d5-paper);
  color: var(--d5-on-paper);
  padding: 12px 16px;
  border-radius: 8px;
  font: 600 14px/1 var(--house-type-family-body);
  text-decoration: none;
  transition: top 200ms var(--d5-ease);
}
.d5-skip:focus { top: 12px; outline: 2px solid var(--d5-gold-hi); outline-offset: 3px; }

/* The scene. One painted night, one window, one bench. */
.hp-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 118%, rgba(176,138,69,.26) 0%, rgba(11,20,32,0) 64%),
    radial-gradient(80% 60% at 16% 18%, rgba(17,58,99,.36) 0%, rgba(11,20,32,0) 70%),
    linear-gradient(180deg, #050308 0%, #0a1220 30%, #171324 58%, #2a1a08 82%, #3a2408 100%);
}
.hp-scene::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 48%;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10,7,4,0) 0%, rgba(10,7,4,.46) 38%, rgba(10,7,4,.86) 78%, #0a0704 100%);
}
.d5-sky { position: absolute; inset: 0; }
.d5-top-scrim {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 48%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6,10,18,.96) 0%, rgba(6,10,18,.84) 44%, rgba(6,10,18,.28) 78%, rgba(6,10,18,0) 100%);
}
.d5-haze {
  position: absolute;
  border-radius: 50%;
  filter: blur(26px);
  opacity: .55;
}
.d5-haze-a {
  width: 76vw; height: 46vh; left: -18vw; top: 4vh;
  background: radial-gradient(circle, rgba(17,58,99,.34), rgba(17,58,99,0) 70%);
}
.d5-haze-b {
  width: 70vw; height: 40vh; right: -20vw; top: 28vh;
  background: radial-gradient(circle, rgba(176,138,69,.16), rgba(176,138,69,0) 70%);
}
.d5-mote {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: var(--d5-gold-light);
  opacity: var(--o, .25);
  animation: d5-drift var(--dur, 9s) var(--ease) infinite alternate;
}
.d5-mote:nth-child(3n) { background: var(--d5-ice); }

.d5-window {
  position: absolute;
  left: 50%;
  top: 14%;
  width: min(88vw, 510px);
  height: min(38vh, 360px);
  transform: translateX(-50%);
  z-index: 1;
}
.d5-arch {
  position: absolute;
  inset: 0;
  border-radius: 999px 999px 12px 12px;
  overflow: hidden;
  background:
    radial-gradient(66% 58% at 50% 54%, #fffaf0 0%, var(--d5-gold-hi) 10%, var(--d5-gold-base) 24%, var(--d5-gold-mid) 48%, var(--d5-gold-deep) 78%, #7a5a1c 100%);
  box-shadow:
    0 0 0 1px rgba(255,243,214,.38),
    0 0 110px -6px rgba(243,217,160,.48),
    inset 0 0 90px rgba(255,243,214,.4);
  animation: d5-breathe 9s var(--house-motion-easing-breathe) infinite;
}
.d5-light {
  position: absolute;
  inset: -12% -18% auto;
  height: 60%;
  background: radial-gradient(60% 60% at 50% 18%, rgba(255,243,214,.5), rgba(255,243,214,0) 72%);
  mix-blend-mode: screen;
}
.d5-panes { position: absolute; inset: 0; opacity: .3; }
.d5-arch::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(30% 24% at 50% 50%, rgba(255,255,255,.82), rgba(255,255,255,0) 72%),
    radial-gradient(88% 46% at 50% 100%, rgba(255,250,240,.45), rgba(255,250,240,0) 70%),
    linear-gradient(90deg, rgba(122,90,28,.5) 0%, rgba(122,90,28,0) 18%, rgba(122,90,28,0) 82%, rgba(122,90,28,.5) 100%);
  pointer-events: none;
}
.d5-arch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,3,8,.4) 0%, rgba(5,3,8,0) 24%, rgba(5,3,8,0) 76%, rgba(122,90,28,.16) 100%);
  pointer-events: none;
}
.d5-mullion, .d5-transom { position: absolute; display: block; background: rgba(42,33,16,.55); }
.d5-mullion { top: 0; bottom: 0; width: 2px; }
.d5-mullion-a { left: 33.33%; }
.d5-mullion-b { left: 66.66%; }
.d5-transom { left: 0; right: 0; height: 2px; }
.d5-transom-a { top: 38%; }
.d5-transom-b { top: 68%; }
.d5-sill {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -10px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,243,214,.6), rgba(176,138,69,.1));
  box-shadow: 0 2px 18px rgba(243,217,160,.35);
}

.d5-pages {
  position: absolute;
  left: 50%;
  bottom: 8%;
  z-index: 2;
  width: min(54vw, 300px);
  height: clamp(44px, 8vh, 76px);
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.d5-page {
  position: relative;
  width: 50%;
  height: 92%;
  border-radius: 2px;
  background: linear-gradient(152deg, rgba(255,243,214,.96), rgba(230,207,154,.76));
  box-shadow: 0 12px 26px -14px rgba(0,0,0,.8), 0 0 18px rgba(243,217,160,.18);
  padding: 10px 9px;
  overflow: hidden;
  animation: d5-float 11s var(--house-motion-easing-breathe) infinite alternate;
}
.d5-page-two { height: 100%; animation-duration: 13s; animation-delay: -3s; }
.d5-page-fold {
  position: absolute;
  right: 0; top: 0;
  width: 18px; height: 18px;
  background: linear-gradient(225deg, rgba(11,20,32,.22), rgba(255,243,214,0) 70%);
}
.d5-page-line {
  display: block;
  height: 2px;
  margin: 0 0 7px;
  border-radius: 2px;
  background: rgba(42,33,16,.38);
}
.d5-page-line:nth-child(2) { width: 82%; }
.d5-page-line:nth-child(3) { width: 92%; }
.d5-page-line:nth-child(4) { width: 64%; }
.d5-page-line:nth-child(5) { width: 86%; }
.d5-page-two .d5-page-line:nth-child(2) { width: 88%; }
.d5-page-two .d5-page-line:nth-child(3) { width: 70%; }
.d5-page-two .d5-page-line:nth-child(4) { width: 94%; }
.d5-page-two .d5-page-line:nth-child(5) { width: 58%; }
.d5-page-two .d5-page-line:nth-child(6) { width: 80%; }

.d5-bench {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22%;
  z-index: 1;
  background:
    radial-gradient(80% 80% at 50% 0%, rgba(243,217,160,.34), rgba(243,217,160,0) 62%),
    linear-gradient(180deg, rgba(176,138,69,.2) 0%, rgba(42,33,16,.88) 24%, #120d06 74%, #080604 100%);
}
.d5-bench-edge {
  position: absolute;
  left: 0; right: 0; top: 20%;
  height: 1px;
  background: linear-gradient(90deg, rgba(243,217,160,0), rgba(243,217,160,.65) 24%, rgba(255,243,214,.8) 50%, rgba(243,217,160,.65) 76%, rgba(243,217,160,0));
  box-shadow: 0 0 18px rgba(243,217,160,.3);
}

.d5-seal {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 3;
  width: clamp(84px, 20vw, 124px);
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 14px rgba(243,217,160,.35));
}
.d5-seal-rim { fill: none; stroke: rgba(255,243,214,.16); stroke-width: 1.4; }
.d5-arc {
  fill: none;
  stroke: var(--d5-gold-hi);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: .32;
  transition: stroke-dashoffset 700ms var(--d5-ease), opacity 420ms linear;
}
.d5-arc.is-lit { stroke-dashoffset: 0; opacity: 1; }
.d5-seal-core {
  fill: var(--d5-gold-light);
  opacity: .8;
  transition: opacity 500ms linear;
  filter: drop-shadow(0 0 6px rgba(255,243,214,.8));
}
.d5-seal.is-whole .d5-seal-core { opacity: 1; animation: d5-pulse 3.6s var(--house-motion-easing-breathe) infinite; }

.d5-water {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0;
  opacity: 0;
  z-index: 2;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,207,138,.22) 0%, rgba(11,26,28,.9) 18%, #06100f 70%, #030807 100%);
  transition: height 1200ms var(--d5-ease), opacity 1200ms linear;
}
.d5-water-glow {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 42%;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255,207,138,.55), rgba(255,207,138,0) 72%);
}
.d5-water-line {
  position: absolute;
  left: 0; right: 0; top: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,243,214,.85) 50%, transparent);
}
.d5-boat {
  position: absolute;
  right: 17%;
  bottom: 28%;
  width: 56px;
  height: 74px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 900ms linear, transform 1200ms var(--d5-ease);
}
.d5-hull {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--d5-gold-light);
  box-shadow: 0 0 12px rgba(255,243,214,.7);
}
.d5-sail {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-bottom: 58px solid var(--d5-gold-light);
  filter: drop-shadow(0 0 10px rgba(255,243,214,.55));
}

.hp.is-closing .hp-body { opacity: 0; transition: opacity 400ms linear; }
.d5-close-caption { position: fixed; left: 0; right: 0; bottom: 20%; z-index: 15; margin: 0; padding: 0 24px; text-align: center; color: var(--d5-gold-light); font-family: var(--house-type-family-display); font-size: clamp(26px, 6vw, 46px); font-weight: 600; line-height: 1.05; letter-spacing: -.02em; text-shadow: 0 2px 26px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.9); pointer-events: none; animation: d5-caption 600ms var(--d5-ease) both; }
.hp.is-closing .hp-scene::after { opacity: .35; }
.hp.is-closing .d5-window { opacity: 1; }
.hp.is-closing .d5-seal { opacity: 1; }
.hp.is-closing .d5-water { height: 34%; opacity: 1; }
.hp.is-closing .d5-boat { opacity: 1; transform: translateY(0); bottom: 40%; }
.hp.is-closing .d5-pages { opacity: 0; }
.hp.is-closing .d5-arch { animation: d5-dawn 1.8s var(--d5-ease) both; }
.hp.is-closing .d5-seal { opacity: 1; }
.hp[data-ending="checked"] .hp-scene::after { opacity: .35; }
.hp[data-ending="checked"] .d5-water { height: 34%; opacity: 1; }
.hp[data-ending="checked"] .d5-boat { opacity: 1; transform: translateY(0); bottom: 40%; }
.hp[data-ending="checked"] .d5-pages { opacity: 0; transform: translateX(-50%) translateY(16px); transition: opacity 600ms linear, transform 900ms var(--d5-ease); }
.hp[data-phase="intro"] .d5-seal { opacity: .92; top: 38%; }
.hp[data-phase="intro"] .d5-pages { opacity: 0; }
.d5-seal, .d5-pages { transition: opacity 700ms linear; }
.hp[data-ending="checked"] .d5-panes { opacity: .18; }
.hp[data-ending="checked"] .d5-arch { animation: d5-dawn 2.2s var(--d5-ease) both; }
.hp[data-ending="trust"] .d5-arc[data-door="2"],
.hp[data-ending="trust"] .d5-arc[data-door="3"] { opacity: .12; stroke: var(--d5-ice); }
.hp[data-ending="all-held"] .d5-arc[data-door="1"],
.hp[data-ending="all-held"] .d5-arc[data-door="3"] { opacity: .12; stroke: var(--d5-ice); }
.hp[data-ending="stopped"] .d5-arch { animation: none; }

/* Once the piece begins, the room steps back and the work comes forward. */
.hp[data-phase="play"] .d5-window,
.hp[data-phase="choice"] .d5-window,
.hp[data-phase="check"] .d5-window { opacity: .26; }
.hp[data-phase="play"] .d5-pages,
.hp[data-phase="choice"] .d5-pages,
.hp[data-phase="check"] .d5-pages { opacity: .16; }
.hp[data-phase="play"] .d5-seal,
.hp[data-phase="choice"] .d5-seal,
.hp[data-phase="check"] .d5-seal { opacity: .62; }
.hp[data-phase="play"].is-closing .d5-window,
.hp[data-phase="choice"].is-closing .d5-window,
.hp[data-phase="check"].is-closing .d5-window { opacity: 1; }
.hp[data-phase="play"].is-closing .d5-seal,
.hp[data-phase="choice"].is-closing .d5-seal,
.hp[data-phase="check"].is-closing .d5-seal { opacity: 1; }
.hp[data-phase="play"] .hp-title,
.hp[data-phase="choice"] .hp-title,
.hp[data-phase="check"] .hp-title { font-size: clamp(26px, 6vw, 40px); max-width: none; }
.hp[data-phase="play"] .hp-sub,
.hp[data-phase="play"] .hp-eyebrow,
.hp[data-phase="choice"] .hp-sub,
.hp[data-phase="choice"] .hp-eyebrow,
.hp[data-phase="check"] .hp-sub,
.hp[data-phase="check"] .hp-eyebrow { display: none; }
.hp[data-phase="play"] .hp-head,
.hp[data-phase="choice"] .hp-head,
.hp[data-phase="check"] .hp-head { padding-top: 2px; }
.hp[data-phase="done"] .hp-head { display: none; }
.hp[data-phase="done"] .d5-top-scrim { height: 58%; background: linear-gradient(180deg, rgba(5,3,8,.96) 0%, rgba(5,3,8,.88) 46%, rgba(5,3,8,.44) 76%, rgba(5,3,8,0) 100%); }
.hp[data-phase="done"] .hp-main { min-height: calc(100svh - 56px); }

/* Chrome */
.hp-top {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: var(--house-space-4);
  min-height: 56px;
  padding: 10px var(--house-space-gutter) 0;
}
.hp-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--d5-ink-2);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 220ms linear;
}
.hp-back:hover { color: var(--d5-gold-light); }
.hp-back:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: 3px; border-radius: 4px; }
.hp-back-arrow { font-size: 16px; letter-spacing: 0; }
.hp-back-quiet { color: var(--d5-ink-3); }
.hp-brand { margin: 0 0 0 auto; color: var(--d5-ink-3); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.hp-day { margin: 0; color: var(--d5-gold); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
@media (max-width: 520px) { .hp-brand { display: none; } .hp-day { margin-left: auto; } }

.hp-main {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 56px);
  padding: 0 var(--house-space-gutter) var(--house-space-5);
}
.hp-head {
  position: relative;
  z-index: 6;
  max-width: 640px;
  padding: clamp(8px, 3vh, 30px) 0 0;
}
.hp-numeral {
  position: absolute;
  right: -8px;
  top: -26px;
  z-index: -1;
  font-family: var(--house-type-family-display);
  font-size: clamp(120px, 32vw, 280px);
  font-weight: 700;
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,.07);
  pointer-events: none;
  user-select: none;
}
.hp-eyebrow {
  margin: 0 0 var(--house-space-3);
  color: var(--d5-gold);
  font-size: var(--house-type-size-eyebrow);
  letter-spacing: var(--house-type-tracking-eyebrow);
  text-transform: uppercase;
}
.hp-title {
  margin: 0;
  max-width: 11ch;
  color: var(--d5-ink);
  font-family: var(--house-type-family-display);
  font-size: clamp(40px, 10.4vw, 92px);
  font-weight: 700;
  line-height: .94;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hp-sub {
  margin: var(--house-space-4) 0 0;
  max-width: 46ch;
  color: var(--d5-ink-2);
  font-size: var(--house-type-size-lede);
  line-height: 1.45;
}

.hp-stage {
  position: relative;
  z-index: 6;
  display: flex;
  flex: 1;
  align-items: flex-start;
  padding: var(--house-space-2) 0 var(--house-space-3);
}
.hp[data-phase="intro"] .hp-stage { align-items: flex-end; }
.hp-panel {
  position: relative;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}
.hp-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--house-space-4);
  min-height: 44px;
  border-top: 1px solid var(--d5-line);
}
.hp-progress-label { margin: 0; color: var(--d5-ink-3); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.hp-lights { display: flex; gap: 7px; }
.hp-light { display: block; width: 20px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.16); transition: background 300ms linear, box-shadow 300ms linear; }
.hp-light[data-state="lit"] { background: var(--d5-gold); box-shadow: 0 0 10px rgba(243,217,160,.45); }
.hp-light[data-state="now"] { background: var(--d5-gold-light); animation: d5-now 2.6s var(--house-motion-easing-breathe) infinite; }
.hp-body { position: relative; transition: opacity 180ms linear, transform 180ms var(--d5-ease); }
.hp-body.is-swap { opacity: 0; transform: translateY(6px); }
.hp-note { min-height: 24px; margin: 4px 0 0; color: var(--d5-ink-3); font-size: 13.5px; line-height: 1.45; }
.hp-note[data-tone="good"] { color: var(--d5-gold-light); }
.hp-note[data-tone="wait"] { color: var(--d5-ice); }
.hp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp-foot {
  position: relative;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--house-space-4);
  justify-content: space-between;
  padding: var(--house-space-3) var(--house-space-gutter) var(--house-space-4);
  color: var(--d5-ink-3);
  font-size: 11px;
  letter-spacing: .04em;
}
.hp-foot-care { color: var(--d5-ink-2); }

/* Intro */
.hp-intro { max-width: 560px; padding: var(--house-space-5) 0 var(--house-space-3); }
.hp-ornament {
  display: block;
  width: 42px; height: 1px;
  margin-bottom: var(--house-space-4);
  background: linear-gradient(90deg, var(--d5-gold), rgba(243,217,160,0));
}
.hp-intro-line { margin: 0 0 var(--house-space-2); color: var(--d5-ink); font-size: var(--house-type-size-lede); line-height: 1.45; max-width: 42ch; }
.hp-intro-line:first-of-type { color: var(--d5-ink); font-size: clamp(19px, 2.4vw, 23px); }
.hp-hint { margin: var(--house-space-4) 0 0; max-width: 44ch; color: var(--d5-ink-3); font-size: 13px; line-height: 1.5; }
.hp-care { margin: 6px 0 0; color: var(--d5-ink-3); font-size: 12px; letter-spacing: .02em; }
.hp-care::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: var(--d5-gold); vertical-align: 1px; }

/* Buttons */
.hp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--d5-line-2);
  border-radius: var(--house-radius-pill);
  background: rgba(5,3,8,.48);
  color: var(--d5-ink);
  font: 600 15px/1 var(--house-type-family-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 220ms var(--d5-ease), border-color 220ms linear, background 220ms linear, color 220ms linear;
}
.hp-btn:hover { border-color: rgba(243,217,160,.62); background: rgba(243,217,160,.08); color: var(--d5-gold-light); }
.hp-btn:active { transform: translateY(1px); }
.hp-btn:focus-visible { outline: var(--house-light-focus-width) solid var(--d5-gold-hi); outline-offset: var(--house-light-focus-offset); }
.hp-primary {
  border-color: rgba(243,217,160,.58);
  background: linear-gradient(160deg, rgba(255,243,214,.16), rgba(217,180,106,.08));
  color: var(--d5-gold-light);
  box-shadow: 0 0 26px -14px rgba(243,217,160,.7);
}
.hp-ghost { color: var(--d5-ink-2); }
.d5-quiet-link { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--d5-ink-3); font: 500 13.5px/1.4 var(--house-type-family-body); text-decoration: underline; text-decoration-color: rgba(255,255,255,.28); text-underline-offset: 4px; cursor: pointer; }
.d5-quiet-link:hover { color: var(--d5-ink); }
.d5-quiet-link:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: 3px; }

/* The match board */
.d5-match {
  margin-top: var(--house-space-3);
  padding: var(--house-space-4);
  border: 1px solid var(--d5-line);
  border-radius: var(--house-radius-l);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(42,33,16,.5), rgba(5,3,8,.86) 64%),
    rgba(5,3,8,.86);
  box-shadow: var(--house-light-lift);
}
.d5-match-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--house-space-4); margin-bottom: var(--house-space-3); }
.d5-match-top .d5-hint { flex-basis: 100%; margin: 2px 0 0; }
.d5-micro { margin: 0; color: var(--d5-gold); font-size: var(--house-type-size-eyebrow); letter-spacing: var(--house-type-tracking-eyebrow); text-transform: uppercase; }
.d5-match-note { margin: 0; color: var(--d5-ink-3); font-size: 13px; }
.d5-cols { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.d5-col { display: flex; flex-direction: column; gap: 8px; }
.d5-threads { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.d5-thread { fill: none; stroke: var(--d5-gold-hi); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: d5-thread 620ms var(--d5-ease) forwards; filter: drop-shadow(0 0 4px rgba(243,217,160,.5)); }
.d5-thread-dot { fill: var(--d5-gold-light); }
.d5-slip {
  position: relative;
  z-index: 3;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--d5-line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: var(--d5-ink);
  font: 500 13px/1.36 var(--house-type-family-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 220ms linear, background 220ms linear, color 220ms linear, transform 220ms var(--d5-ease), opacity 220ms linear;
}
.d5-slip:hover { border-color: rgba(243,217,160,.5); background: rgba(243,217,160,.06); }
.d5-slip:active { transform: scale(.99); }
.d5-slip:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: 2px; }
.d5-slip.is-selected { border-color: var(--d5-gold-hi); background: rgba(243,217,160,.12); box-shadow: 0 0 20px -10px rgba(243,217,160,.7); }
.d5-slip.is-locked {
  border-color: rgba(243,217,160,.4);
  background: rgba(243,217,160,.07);
  color: var(--d5-gold-light);
  cursor: default;
}
.d5-slip.is-locked::after {
  content: "";
  position: absolute;
  right: 10px; top: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--d5-gold-light);
  box-shadow: 0 0 8px rgba(255,243,214,.8);
}
.d5-slip.is-wrong { border-color: var(--d5-ice); color: var(--d5-ice); animation: d5-wrong 360ms var(--d5-ease); }
.d5-slip:disabled { opacity: 1; }
.d5-hint { margin: var(--house-space-3) 0 0; color: var(--d5-ink-3); font-size: 12.5px; line-height: 1.45; }

/* The match close */
.d5-match-done { max-width: 620px; padding: var(--house-space-5) 0 var(--house-space-3); }
.d5-door-list { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--house-space-4) 0; padding: 0; list-style: none; }
.d5-door { padding: 7px 11px; border: 1px solid rgba(243,217,160,.32); border-radius: var(--house-radius-pill); color: var(--d5-gold-light); font-size: 12px; letter-spacing: .04em; }
.d5-door::before { content: "\2713"; margin-right: 6px; color: var(--d5-gold); }
.d5-done-line { margin: 0 0 var(--house-space-4); color: var(--d5-ink-2); font-size: var(--house-type-size-lede); line-height: 1.45; }
.d5-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--house-space-3); }

/* The choice */
.d5-choice { max-width: 680px; padding: var(--house-space-4) 0; }
.d5-h2 { margin: var(--house-space-2) 0 var(--house-space-3); color: var(--d5-ink); font-family: var(--house-type-family-display); font-size: clamp(28px, 4.6vw, 44px); font-weight: 700; line-height: 1.02; letter-spacing: -.025em; }
.d5-lede { margin: 0 0 var(--house-space-4); max-width: 56ch; color: var(--d5-ink-2); font-size: var(--house-type-size-lede); line-height: 1.5; }
.d5-choice-lead { margin: 0 0 var(--house-space-3); color: var(--d5-gold); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.d5-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--house-space-3); }
.d5-choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--d5-line-2);
  border-radius: var(--house-radius-m);
  background: rgba(5,3,8,.6);
  color: var(--d5-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 220ms linear, background 220ms linear, transform 220ms var(--d5-ease);
}
.d5-choice-card:hover { border-color: rgba(243,217,160,.55); background: rgba(243,217,160,.06); }
.d5-choice-card:active { transform: translateY(1px); }
.d5-choice-card:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: 3px; }
.d5-choice-check { border-color: rgba(243,217,160,.46); background: linear-gradient(160deg, rgba(255,243,214,.1), rgba(5,3,8,.6)); }
.d5-choice-title { font-family: var(--house-type-family-display); font-size: 20px; font-weight: 600; line-height: 1.2; }
.d5-choice-hint { color: var(--d5-ink-3); font-size: 13px; line-height: 1.4; }

/* The check */
.d5-check { max-width: 760px; padding: var(--house-space-4) 0 var(--house-space-5); }
.d5-brief { margin: 0 0 var(--house-space-3); padding: var(--house-space-4); border: 1px solid var(--d5-line); border-radius: var(--house-radius-m); background: rgba(5,3,8,.62); }
.d5-brief-row { display: grid; grid-template-columns: 124px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.07); }
.d5-brief-row:first-of-type { border-top: 0; }
.d5-brief-part { color: var(--d5-gold); font-size: 12px; letter-spacing: .06em; }
.d5-brief-text { color: var(--d5-ink-2); font-size: 13.5px; line-height: 1.45; }
.d5-notes { margin: 0 0 var(--house-space-3); border: 1px solid var(--d5-line); border-radius: var(--house-radius-m); background: rgba(5,3,8,.55); }
.d5-notes-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 16px; color: var(--d5-ink); font-size: 13px; cursor: pointer; list-style: none; }
.d5-notes-summary::-webkit-details-marker { display: none; }
.d5-notes-summary:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: -2px; }
.d5-notes-summary::before { content: "+"; margin-right: 10px; color: var(--d5-gold); font-size: 16px; }
.d5-notes[open] .d5-notes-summary::before { content: "\2212"; }
.d5-notes-hint { margin-left: auto; color: var(--d5-ink-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.d5-note-line { margin: 0; padding: 8px 16px 12px; color: var(--d5-ink-2); font-size: 13.5px; line-height: 1.5; border-top: 1px solid rgba(255,255,255,.06); }
.d5-runs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--house-space-3); margin: 0 0 var(--house-space-4); }
.d5-run { margin: 0; padding: 14px; border: 1px solid var(--d5-line); border-radius: var(--house-radius-m); background: rgba(5,3,8,.58); }
.d5-run-two { border-color: rgba(243,217,160,.34); }
.d5-run-label { margin: 0 0 8px; color: var(--d5-gold); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.d5-run-lines { margin: 0; padding: 0 0 0 18px; color: var(--d5-ink-2); font-size: 12.5px; line-height: 1.5; }
.d5-run-lines li { margin-bottom: 6px; }
.d5-run-close { margin: 6px 0 0; color: var(--d5-ink-3); font-size: 11.5px; font-style: italic; }
.d5-checks { display: flex; flex-direction: column; gap: 10px; }
.d5-check-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--d5-line);
  border-radius: var(--house-radius-m);
  background: rgba(5,3,8,.56);
  transition: border-color 260ms linear, box-shadow 260ms linear;
}
.d5-check-row.is-hinted { border-color: rgba(159,214,255,.55); box-shadow: 0 0 0 1px rgba(159,214,255,.12) inset; }
.d5-check-part { margin: 0 0 4px; color: var(--d5-gold); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.d5-check-quote { margin: 0; color: var(--d5-ink); font-size: 14px; line-height: 1.42; }
.d5-check-actions { display: flex; gap: 8px; }
.d5-answer {
  min-height: 48px;
  min-width: 78px;
  padding: 0 14px;
  border: 1px solid var(--d5-line-2);
  border-radius: var(--house-radius-pill);
  background: rgba(255,255,255,.03);
  color: var(--d5-ink-2);
  font: 600 13px/1 var(--house-type-family-body);
  cursor: pointer;
  transition: border-color 200ms linear, background 200ms linear, color 200ms linear;
}
.d5-answer:hover { border-color: rgba(243,217,160,.5); color: var(--d5-ink); }
.d5-answer:focus-visible { outline: 2px solid var(--d5-gold-hi); outline-offset: 2px; }
.d5-answer[aria-pressed="true"][data-answer="held"] { border-color: var(--d5-gold-hi); background: rgba(243,217,160,.16); color: var(--d5-gold-light); }
.d5-answer[aria-pressed="true"][data-answer="slipped"] { border-color: var(--d5-ice); background: rgba(159,214,255,.12); color: var(--d5-ice); }
.d5-submit { margin-top: var(--house-space-4); width: 100%; }
@media (min-width: 561px) { .d5-submit { width: auto; min-width: 220px; } }

/* The ending */
.d5-end-head { max-width: 640px; padding: var(--house-space-4) 0 0; }
.d5-end-actions { display: flex; flex-wrap: wrap; gap: var(--house-space-3); margin-top: var(--house-space-4); }
.hp-done { padding-bottom: var(--house-space-5); }
.hp-ending-checked .d5-end-head { max-width: 680px; }

/* The kept card */
.d5-card {
  position: relative;
  max-width: 520px;
  margin: var(--house-space-5) 0 var(--house-space-4);
  padding: clamp(22px, 5vw, 34px);
  border-radius: 5px;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255,255,255,.62), rgba(255,255,255,0) 60%),
    linear-gradient(150deg, var(--d5-paper) 0%, var(--d5-paper-deep) 100%);
  color: var(--d5-on-paper);
  box-shadow: 0 34px 90px -44px rgba(0,0,0,.9), 0 0 0 1px rgba(255,243,214,.18);
}
.d5-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(184,134,47,.35);
  border-radius: 2px;
  pointer-events: none;
}
.d5-card-head { display: flex; align-items: center; gap: 10px; }
.d5-card-mark {
  display: block;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff, var(--house-color-gold-hi) 42%, var(--house-color-gold-deep) 100%);
  box-shadow: 0 0 0 1px rgba(122,90,28,.45), 0 0 16px rgba(184,134,47,.3);
}
.d5-card-kicker { color: var(--house-color-dawn-gold-deep); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.d5-card-title { margin: 14px 0 18px; font-family: var(--house-type-family-display); font-size: clamp(28px, 5.4vw, 38px); font-weight: 700; line-height: 1.02; letter-spacing: -.025em; }
.d5-card-doors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0 0 20px; padding: 0; list-style: none; }
.d5-card-door { position: relative; padding-left: 20px; font-size: 13px; line-height: 1.35; }
.d5-card-door::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--house-color-dawn-gold-deep); font-weight: 700; }
.d5-card-linewrap { display: block; margin: 0 0 18px; }
.d5-card-linelabel { display: block; margin-bottom: 4px; color: rgba(22,16,30,.62); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.d5-card-line {
  width: 100%;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid rgba(22,16,30,.34);
  border-radius: 0;
  background: transparent;
  color: var(--d5-on-paper);
  font: 600 clamp(17px, 3.4vw, 21px)/1.4 var(--house-type-family-display);
}
.d5-card-line::placeholder { color: rgba(22,16,30,.36); font-weight: 500; }
.d5-card-line:focus { outline: 2px solid var(--house-color-dawn-gold); outline-offset: 4px; }
.d5-card-foot { margin: 0; color: rgba(22,16,30,.62); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; }
.d5-card-keep { margin: 8px 0 0; color: rgba(22,16,30,.5); font-size: 11px; }
.d5-card-actions { display: flex; flex-wrap: wrap; gap: var(--house-space-2); max-width: 520px; }
.d5-card-actions .hp-btn { background: rgba(5,3,8,.45); }
.d5-card-actions .hp-btn.hp-primary { background: linear-gradient(160deg, rgba(255,243,214,.16), rgba(217,180,106,.08)); }

/* Responsive */
@media (max-width: 899px) {
  .hp[data-phase="play"] .d5-seal,
  .hp[data-phase="choice"] .d5-seal,
  .hp[data-phase="check"] .d5-seal { opacity: 0; }
}
@media (max-width: 720px) {
  .d5-window { top: 14%; width: min(88vw, 370px); height: min(38vh, 310px); }
  .hp[data-phase="intro"] .d5-seal { top: 36%; }
  .d5-top-scrim { height: 52%; }
  .d5-pages { bottom: 3%; width: min(52vw, 230px); }
  .d5-seal { top: 47%; }
  .hp-head { padding-top: 6px; }
  .hp-title { max-width: 10ch; }
  .hp-stage { padding-bottom: 2px; }
  .hp-panel-top { min-height: 40px; }
  .d5-choice-grid, .d5-runs { grid-template-columns: 1fr; }
  .d5-check-row { grid-template-columns: 1fr; }
  .d5-check-actions { justify-content: flex-start; }
  .d5-brief-row { grid-template-columns: 1fr; gap: 2px; }
  .d5-match { padding: 12px; }
  .d5-slip { min-height: 48px; font-size: 12.5px; padding: 9px 10px; }
}
@media (max-width: 380px) {
  .hp-title { font-size: 38px; }
  .d5-slip { font-size: 12px; }
  .d5-answer { min-width: 70px; padding: 0 10px; }
}
@media (min-width: 900px) {
  .hp-head { max-width: 58%; }
  .hp-sub { font-size: 20px; }
  .d5-top-scrim { width: 56%; height: 74%; background: linear-gradient(180deg, rgba(5,3,8,.96) 0%, rgba(5,3,8,.72) 66%, rgba(5,3,8,0) 100%); }
  .d5-window { left: 62.5%; top: 8%; width: min(37vw, 480px); height: min(78vh, 710px); }
  .d5-pages { left: 62.5%; bottom: 8%; }
  .d5-seal { left: 62.5%; top: 47%; }
  .hp[data-phase="play"] .d5-window,
  .hp[data-phase="choice"] .d5-window,
  .hp[data-phase="check"] .d5-window { opacity: .22; }
  .hp[data-phase="play"] .d5-pages,
  .hp[data-phase="choice"] .d5-pages,
  .hp[data-phase="check"] .d5-pages { opacity: .2; }
  .hp[data-phase="play"] .d5-seal,
  .hp[data-phase="choice"] .d5-seal,
  .hp[data-phase="check"] .d5-seal { opacity: .5; }
  .hp-stage { align-items: center; }
  .hp-panel { margin: 0; }
  .d5-window, .d5-pages, .d5-seal { transition: opacity 600ms linear; }
}

/* Motion */
@keyframes d5-breathe {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.05) saturate(1.04); }
}
@keyframes d5-dawn {
  0% { filter: brightness(1); }
  45% { filter: brightness(1.22) saturate(1.08); }
  100% { filter: brightness(1.1) saturate(1.04); }
}
@keyframes d5-float {
  from { transform: translateY(0) rotate(-1.4deg); }
  to { transform: translateY(-5px) rotate(.4deg); }
}
@keyframes d5-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(9px, -13px, 0); }
}
@keyframes d5-pulse {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}
@keyframes d5-now {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
@keyframes d5-thread {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes d5-caption {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes d5-wrong {
  0% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* Reduced motion: a still photograph of the same room. */
@media (prefers-reduced-motion: reduce) {
  .d5-arch, .d5-page, .d5-mote, .d5-seal-core, .hp-light[data-state="now"] { animation: none !important; }
  .d5-thread { animation: none; stroke-dashoffset: 0; }
  .d5-water, .d5-boat, .d5-pages, .d5-arch, .d5-seal, .d5-window, .d5-arc, .hp-body { transition-duration: 400ms !important; }
  .hp-body.is-swap { transform: none; }
}
.hp[data-reduced="true"] .d5-arch,
.hp[data-reduced="true"] .d5-page,
.hp[data-reduced="true"] .d5-mote,
.hp[data-reduced="true"] .d5-seal-core,
.hp[data-reduced="true"] .hp-light[data-state="now"] { animation: none !important; }
.hp[data-reduced="true"] .d5-thread { animation: none; stroke-dashoffset: 0; }

/* The same piece inside a lesson beat. The lesson owns the ground. */
.hp-layer { min-height: 0; background: radial-gradient(120% 90% at 50% 0%, rgba(176,138,69,.2), rgba(5,3,8,0) 62%); }
.hp-layer .hp-scene { display: none; }
.hp-layer .hp-main { min-height: 0; padding: 0; }
.hp-layer .hp-stage { padding: 0; }
.hp-layer .hp-panel { max-width: none; }
.hp-layer .hp-body { min-height: 0; }
.hp-layer .d5-check { padding-top: 0; }
.hp-layer .hp-foot, .hp-layer .hp-top, .hp-layer .hp-head { display: none; }

/* Print the kept card, and only the kept card. */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  .hp-scene, .hp-top, .hp-head, .hp-panel-top, .hp-progress-label, .hp-lights, .hp-note, .hp-foot,
  .d5-end-head, .d5-end-actions, .d5-card-actions, .d5-card-keep, .hp-sr, .d5-skip { display: none !important; }
  .hp, .hp-main, .hp-stage, .hp-panel, .hp-body, .hp-done { position: static !important; display: block !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; background: none !important; box-shadow: none !important; max-width: none !important; }
  .d5-card { max-width: none; width: 100%; margin: 0; box-shadow: none; border: 1px solid #b8862f; }
  .d5-card-line { border-bottom-color: #16101e; }
}
