/* Day 3: Build a brief that holds.
   Art direction: the bench at blue hour. Gold is the frame's line, the lamp's
   wick and the seams; never a filled surface. Values are read from
   values/house.css (the House design package). */

.hp-d3 {
  --d3-night: #03070c;
  --d3-deep: #04101a;
  --d3-bench: #071620;
  --d3-ink: var(--house-color-text-ink, #e9edf2);
  --d3-ink-2: var(--house-color-text-secondary, rgba(233, 237, 242, 0.76));
  --d3-ink-3: var(--house-color-text-tertiary, rgba(233, 237, 242, 0.56));
  --d3-gold: var(--house-color-gold-hi, #f3d9a0);
  --d3-gold-light: var(--house-color-gold-light, #fff3d6);
  --d3-gold-deep: var(--house-color-gold-deep, #b08a45);
  --d3-ice: var(--house-color-scene-ice, #8fcfff);
  --d3-pond: var(--house-color-scene-pond, #3fd0d9);
  --d3-paper: var(--house-color-dawn-paper, #f6f1e7);
  --d3-paper-deep: var(--house-color-dawn-paper-deep, #efe6d3);
  --d3-paper-ink: var(--house-color-dawn-ink, #16101e);
  --d3-paper-muted: rgba(22, 16, 30, 0.66);
  --d3-ease: var(--house-motion-easing-standard, cubic-bezier(0.2, 0.6, 0.2, 1));
  --d3-silk: var(--house-motion-easing-silk, cubic-bezier(0.25, 1, 0.5, 1));
  --d3-grace: var(--house-motion-easing-grace, cubic-bezier(0.65, 0, 0.35, 1));
  --d3-r: var(--house-radius-l, 20px);
  --d3-rs: var(--house-radius-m, 16px);
  --d3-lamp: 0.18;
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow-x: clip;
  color: var(--d3-ink);
  font-family: var(--house-type-family-body, Inter, system-ui, sans-serif);
  background: var(--d3-night);
}

.hp-d3 * { box-sizing: border-box; }
.hp-d3 [hidden] { display: none !important; }
.hp-d3 .d3-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- the night and the shore ------------------------------------------------------------ */

.d3-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(96% 60% at 84% 4%, rgba(255, 243, 214, 0.2) 0%, rgba(243, 217, 160, 0.08) 34%, transparent 64%),
    radial-gradient(130% 64% at 50% 106%, rgba(63, 208, 217, 0.5) 0%, rgba(31, 140, 150, 0.28) 34%, transparent 70%),
    linear-gradient(180deg, #03070c 0%, #06141e 38%, #0a2630 70%, #0d3038 100%);
}

.d3-shore {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -16%;
  height: 46%;
  background: radial-gradient(70% 70% at 50% 100%, rgba(0, 220, 200, 0.5) 0%, rgba(20, 120, 110, 0.3) 42%, transparent 76%);
  filter: blur(22px);
  opacity: 0.95;
}

.d3-aurora {
  position: absolute;
  left: -14%;
  right: -14%;
  top: 8%;
  height: 38%;
  background: linear-gradient(100deg, transparent 0%, rgba(63, 208, 217, 0.44) 20%, rgba(0, 190, 210, 0.3) 40%, rgba(143, 207, 255, 0.2) 58%, rgba(243, 217, 160, 0.14) 78%, transparent 100%);
  filter: blur(42px);
  transform: rotate(-7deg);
  animation: d3-breathe 22s ease-in-out infinite alternate;
}

.d3-lampglow {
  position: absolute;
  right: 4%;
  top: 2%;
  width: 66vw;
  height: 56vh;
  background: radial-gradient(circle at 72% 26%, rgba(255, 243, 214, 0.24) 0%, rgba(243, 217, 160, 0.1) 36%, transparent 64%);
  filter: blur(22px);
  animation: d3-breathe 18s ease-in-out infinite alternate;
}

.d3-blank {
  position: absolute;
  right: 3%;
  bottom: 7%;
  width: 34%;
  height: 30%;
  border-radius: 10px;
  background:
    linear-gradient(102deg, rgba(255, 255, 255, 0.5) 0%, transparent 34%),
    linear-gradient(168deg, #f8f3e8 0%, #ece2cf 74%, #e2d5be 100%);
  box-shadow: 0 26px 50px -28px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 243, 214, 0.3);
  transform: rotate(-2.6deg);
  opacity: 0.94;
  pointer-events: none;
  display: block;
  position: relative;
  right: auto;
  bottom: auto;
  width: auto;
  height: 40px;
  margin: 6px 4px 0;
  border-radius: 8px;
  transform: rotate(-1.2deg);
  transition: opacity 500ms var(--d3-grace);
}
/* The blank card stays on the bench during play, so Begin does not shift the page. */
.d3-stage.is-closed .d3-blank { opacity: 0; }
.d3-blank::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 26%;
  height: 1px;
  background: rgba(22, 16, 30, 0.16);
  box-shadow: 0 18px 0 rgba(22, 16, 30, 0.12), 0 36px 0 rgba(22, 16, 30, 0.1), 0 54px 0 rgba(22, 16, 30, 0.08);
}
.d3-blank::after {
  content: "";
  position: absolute;
  left: 12%;
  top: 16%;
  width: 30px;
  height: 30px;
  border-left: 1px solid rgba(184, 134, 47, 0.8);
  border-top: 1px solid rgba(184, 134, 47, 0.8);
  border-top-left-radius: 4px;
}
.d3-bench.is-playing .d3-blank { opacity: 0; }
@media (min-width: 720px) {
  .d3-blank {
    position: absolute;
    right: 3%;
    bottom: 7%;
    width: 34%;
    height: 30%;
    margin: 0;
    border-radius: 10px;
    transform: rotate(-2.6deg);
  }
  .d3-bench.is-playing .d3-blank { display: block; opacity: 0; }
}

.d3-motes { position: absolute; inset: 0; }
.d3-mote {
  position: absolute;
  width: var(--s, 2px);
  height: var(--s, 2px);
  margin: calc(var(--s, 2px) / -2);
  border-radius: 50%;
  background: #fff;
  opacity: var(--o, 0.3);
  box-shadow: 0 0 6px rgba(255, 243, 214, 0.55);
  animation: d3-drift var(--d, 18s) ease-in-out infinite alternate;
}

/* ---- top, head, foot ------------------------------------------------------------------- */

.d3-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px var(--house-space-gutter, 20px) 0;
  min-height: 44px;
}

.d3-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--d3-ink-2);
  text-decoration: none;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}
.d3-back:hover { color: var(--d3-gold-light); }
.d3-back-arrow { font-size: 17px; line-height: 1; color: var(--d3-gold); }
.d3-back-quiet { pointer-events: none; }
.d3-kicker {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--d3-gold);
  text-align: right;
}

.d3-main {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 10px var(--house-space-gutter, 20px) 40px;
  flex: 1;
}

.d3-head { margin: 4px 0 10px; max-width: 720px; }
.d3-eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--d3-gold-deep);
  margin-bottom: 10px;
}
.d3-title {
  margin: 0;
  font-family: var(--house-type-family-display, Satoshi, Inter, system-ui, sans-serif);
  font-weight: 700;
  font-size: clamp(31px, 8.2vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.028em;
  color: var(--house-color-text-strong, #fff);
  text-wrap: balance;
}
.d3-sub {
  margin: 8px 0 0;
  max-width: 34ch;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--d3-ink-2);
}
.d3-head-layer { margin: 0 0 14px; }
.d3-head-layer .d3-title { font-size: clamp(26px, 6vw, 40px); }

.d3-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 0 var(--house-space-gutter, 20px) 22px;
  font-size: 11.5px;
  color: var(--d3-ink-3);
}

/* ---- the bench ------------------------------------------------------------------------- */

.d3-stage { position: relative; }

.d3-bench {
  position: relative;
  padding: 12px 12px 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(46% 52% at 84% 0%, rgba(255, 248, 230, 0.28) 0%, rgba(243, 217, 160, 0.12) 36%, transparent 66%),
    radial-gradient(80% 90% at 0% 100%, rgba(0, 210, 195, 0.3) 0%, rgba(20, 120, 110, 0.16) 40%, transparent 68%),
    linear-gradient(180deg, rgba(13, 36, 46, 0.62) 0%, rgba(6, 18, 26, 0.82) 62%, rgba(4, 12, 18, 0.9) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -24px 60px -40px rgba(0, 0, 0, 0.9),
    0 0 70px -30px rgba(63, 208, 217, 0.5),
    0 40px 90px -60px rgba(0, 0, 0, 0.9);
}
.d3-bench::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243, 217, 160, 0.3), transparent);
}
.d3-bench::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -10px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 0%, rgba(63, 208, 217, 0.16), transparent 72%);
  filter: blur(8px);
  pointer-events: none;
}

.d3-pool {
  position: absolute;
  right: -4%;
  top: -4%;
  width: 78%;
  height: 88%;
  border-radius: 50%;
  background: radial-gradient(circle at 58% 28%, rgba(255, 252, 244, 0.95) 0%, rgba(255, 243, 214, 0.62) 24%, rgba(243, 217, 160, 0.24) 48%, transparent 70%);
  filter: blur(14px);
  pointer-events: none;
  opacity: calc(0.42 + var(--lamp, 0) * 0.58);
  transition: opacity 700ms var(--d3-grace);
}

.d3-rack {
  position: absolute;
  left: 10px;
  top: 56px;
  display: flex;
  gap: 5px;
  opacity: 0.35;
  transform: perspective(200px) rotateY(-20deg);
  transform-origin: left center;
  transition: transform 700ms var(--d3-grace), opacity 700ms var(--d3-grace);
}
.d3-slat {
  width: 5px;
  height: 42px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 243, 214, 0.32), rgba(255, 243, 214, 0.04));
  border-left: 1px solid rgba(243, 217, 160, 0.4);
}
.d3-bench.is-whole .d3-rack {
  transform: perspective(200px) rotateY(0deg);
  opacity: 0.9;
}

.d3-lamp {
  position: absolute;
  right: 18px;
  top: 10px;
  width: 46px;
  height: 46px;
  pointer-events: none;
  z-index: 3;
  opacity: calc(0.4 + var(--lamp, 0) * 0.6);
}
.d3-wick {
  position: absolute;
  right: 12px;
  top: 6px;
  width: 2px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 243, 214, 0.9), rgba(243, 217, 160, 0.1));
  box-shadow: 0 0 10px rgba(243, 217, 160, 0.55);
}
.d3-globe {
  position: absolute;
  right: 7px;
  top: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff 0%, #fff3d6 34%, #d9b46a 76%, #8f6d31 100%);
  box-shadow: 0 0 18px rgba(255, 243, 214, 0.9), 0 0 52px rgba(243, 217, 160, 0.5);
}
.d3-lamp-bloom {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 235, 0.7) 0%, rgba(243, 217, 160, 0.18) 44%, transparent 70%);
  filter: blur(8px);
  animation: d3-breathe 6s ease-in-out infinite alternate;
}

/* ---- the frame ------------------------------------------------------------------------- */

.d3-frame {
  position: relative;
  margin: 14px 4px 0;
  padding: 8px;
  transition: transform 700ms var(--d3-grace);
}
.d3-brackets { position: absolute; inset: 0; pointer-events: none; }

.d3-shelf {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -20px;
  height: 54px;
  background: radial-gradient(62% 100% at 50% 0%, rgba(255, 252, 244, 1) 0%, rgba(255, 243, 214, 0.78) 22%, rgba(243, 217, 160, 0.24) 52%, transparent 80%);
  filter: blur(9px);
  pointer-events: none;
}

.d3-bracket {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--d3-gold);
  border-style: solid;
  border-width: 0;
  opacity: 0.3;
  transition: opacity 380ms var(--d3-ease), box-shadow 380ms var(--d3-ease), border-color 380ms var(--d3-ease);
}
.d3-bracket.tl { left: 0; top: 0; border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 10px; }
.d3-bracket.tr { right: 0; top: 0; border-right-width: 2px; border-top-width: 2px; border-top-right-radius: 10px; }
.d3-bracket.bl { left: 0; bottom: 0; border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 10px; }
.d3-bracket.br { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 10px; }
.d3-bracket.is-lit {
  opacity: 1;
  border-color: var(--d3-gold-light);
  box-shadow: 0 0 22px -4px rgba(243, 217, 160, 0.55);
}

.d3-seam {
  position: absolute;
  background: linear-gradient(90deg, rgba(255, 243, 214, 0.05), var(--d3-gold), rgba(255, 243, 214, 0.05));
  opacity: 0;
  transition: transform 520ms var(--d3-silk), opacity 300ms linear;
}
.d3-seam.t { left: 30px; right: 30px; top: 0; height: 1px; transform: scaleX(0); transform-origin: left center; }
.d3-seam.b { left: 30px; right: 30px; bottom: 0; height: 1px; transform: scaleX(0); transform-origin: right center; }
.d3-seam.l { top: 30px; bottom: 30px; left: 0; width: 1px; transform: scaleY(0); transform-origin: top center; background: linear-gradient(180deg, rgba(255, 243, 214, 0.05), var(--d3-gold), rgba(255, 243, 214, 0.05)); }
.d3-seam.r { top: 30px; bottom: 30px; right: 0; width: 1px; transform: scaleY(0); transform-origin: bottom center; background: linear-gradient(180deg, rgba(255, 243, 214, 0.05), var(--d3-gold), rgba(255, 243, 214, 0.05)); }
.d3-seam.is-lit { opacity: 0.9; transform: scaleX(1); }
.d3-seam.l.is-lit, .d3-seam.r.is-lit { transform: scaleY(1); }

.d3-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.d3-slot {
  position: relative;
  min-height: 72px;
  padding: 8px 9px 8px 11px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(158deg, rgba(13, 34, 46, 0.5) 0%, rgba(5, 14, 20, 0.72) 100%);
  color: var(--d3-ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 260ms var(--d3-ease), background 260ms var(--d3-ease), box-shadow 260ms var(--d3-ease), transform 260ms var(--d3-ease);
}
.d3-slot:hover { border-color: rgba(243, 217, 160, 0.34); }
.d3-bench.is-selecting .d3-slot:not(.is-filled) { border-color: rgba(243, 217, 160, 0.42); box-shadow: inset 0 0 22px -18px rgba(255, 243, 214, 0.7); }
.d3-slot:active { transform: translateY(1px); }
.d3-slot.is-filled {
  border-color: rgba(243, 217, 160, 0.55);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(243, 217, 160, 0.12) 0%, transparent 60%),
    linear-gradient(158deg, rgba(18, 40, 50, 0.7) 0%, rgba(7, 20, 27, 0.86) 100%);
  box-shadow: inset 0 0 30px -18px rgba(255, 243, 214, 0.6);
}
.d3-slot.is-wrong {
  animation: d3-cool 520ms var(--d3-ease);
  border-color: rgba(143, 207, 255, 0.7);
}
.d3-slot-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--d3-gold);
}
.d3-slot-hint {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--d3-ink-3);
}
.d3-slot-value {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.38;
  color: var(--d3-ink);
  animation: d3-ink-in 420ms var(--d3-silk);
}

.d3-frame-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px 2px;
}
.d3-progress {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d3-ink-3);
}
.d3-lights { display: flex; gap: 7px; }
.d3-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background 300ms var(--d3-ease), box-shadow 300ms var(--d3-ease);
}
.d3-light[data-state="lit"] { background: var(--d3-gold); box-shadow: 0 0 10px rgba(243, 217, 160, 0.9); }
.d3-light[data-state="now"] { background: var(--d3-ice); box-shadow: 0 0 10px rgba(143, 207, 255, 0.8); animation: d3-pulse 2.2s ease-in-out infinite; }

/* ---- the hand -------------------------------------------------------------------------- */

.d3-lower { margin-top: 12px; min-height: 196px; }
.d3-handbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 8px;
}
.d3-hand-label {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d3-gold-deep);
}
.d3-aside-count {
  margin: 0;
  font-size: 11px;
  color: var(--d3-ink-3);
}

.d3-intro {
  padding: 6px 4px 4px;
}
.d3-intro-line {
  margin: 0 0 10px;
  max-width: 38ch;
  font-size: 15px;
  line-height: 1.45;
  color: var(--d3-ink-2);
}
.d3-hint {
  margin: 8px 0 0;
  max-width: 42ch;
  font-size: 11px;
  line-height: 1.4;
  color: var(--d3-ink-3);
}

.d3-deal-line {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d3-ink-3);
}

.d3-chip-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.d3-chip-grid::-webkit-scrollbar { display: none; }

.d3-chip {
  position: relative;
  flex: 0 0 78%;
  min-height: 76px;
  padding: 10px 12px 10px 16px;
  scroll-snap-align: start;
  text-align: left;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(150deg, rgba(19, 42, 54, 0.78) 0%, rgba(8, 20, 28, 0.9) 100%);
  color: var(--d3-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.38;
  cursor: pointer;
  animation: d3-deal 520ms var(--d3-silk) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: border-color 220ms var(--d3-ease), transform 220ms var(--d3-ease), box-shadow 220ms var(--d3-ease), background 220ms var(--d3-ease);
}
.d3-chip::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(243, 217, 160, 0.5), transparent);
  opacity: 0.6;
}
.d3-chip:hover { border-color: rgba(243, 217, 160, 0.34); }
.d3-chip:active { transform: translateY(1px); }
.d3-chip.is-selected {
  border-color: var(--d3-gold);
  transform: translateY(-2px);
  background: linear-gradient(150deg, rgba(34, 52, 56, 0.9) 0%, rgba(14, 26, 30, 0.94) 100%);
  box-shadow: 0 0 0 1px rgba(243, 217, 160, 0.25), 0 14px 30px -18px rgba(243, 217, 160, 0.6);
}
.d3-chip.is-fold {
  transform: rotateX(76deg) translateY(4px);
  transform-origin: top center;
  opacity: 0;
  transition: transform 380ms var(--d3-grace), opacity 380ms linear;
}
.d3-chip.is-gone { display: none; }

.d3-aside-btn { margin-top: 10px; width: 100%; }

/* ---- status, rail ---------------------------------------------------------------------- */

.d3-status {
  min-height: 44px;
  margin: 12px 2px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--d3-ink-2);
  transition: color 240ms linear;
}
.d3-status[data-tone="good"] { color: var(--house-color-state-ok, #8fd9b0); }
.d3-status[data-tone="wait"] { color: var(--house-color-state-wait, #bfe3ff); }

.d3-rail {
  margin: 4px 2px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.d3-rail-label {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--d3-gold-deep);
}
.d3-rail-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.d3-rail-list li { display: grid; gap: 2px; }
.d3-rail-text { font-size: 12px; color: var(--d3-ink-2); }
.d3-rail-reason { font-size: 11px; line-height: 1.4; color: var(--d3-ink-3); }

/* ---- the question ---------------------------------------------------------------------- */

.d3-choose { padding: 4px 0 0; animation: d3-rise 560ms var(--d3-silk); }
.d3-choose-kicker {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--d3-gold-deep);
}
.d3-choose-title {
  margin: 0 0 4px;
  font-family: var(--house-type-family-display, Satoshi, Inter, system-ui, sans-serif);
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--house-color-text-strong, #fff);
}
.d3-choose-hint { margin: 0 0 12px; font-size: 12.5px; color: var(--d3-ink-3); }
.d3-choose-list { display: grid; gap: 8px; }
.d3-choice {
  display: grid;
  gap: 2px;
  min-height: 56px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(150deg, rgba(18, 40, 52, 0.7), rgba(7, 18, 26, 0.86));
  color: var(--d3-ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 220ms var(--d3-ease), transform 220ms var(--d3-ease), box-shadow 220ms var(--d3-ease);
}
.d3-choice:hover, .d3-choice:focus-visible {
  border-color: var(--d3-gold);
  transform: translateY(-1px);
  box-shadow: 0 16px 34px -24px rgba(243, 217, 160, 0.7);
}
.d3-choice-title { font-size: 14px; font-weight: 600; color: var(--d3-gold-light); }
.d3-choice-hint { font-size: 11.5px; color: var(--d3-ink-3); }

/* ---- rest ------------------------------------------------------------------------------ */

.d3-rest {
  padding: 10px 4px;
  animation: d3-rise 560ms var(--d3-silk);
}
.d3-rest-kicker { margin: 0 0 6px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d3-gold-deep); }
.d3-rest-title {
  margin: 0 0 8px;
  font-family: var(--house-type-family-display, Satoshi, Inter, system-ui, sans-serif);
  font-size: clamp(24px, 5.4vw, 32px);
  letter-spacing: -0.02em;
}
.d3-rest-body { margin: 0 0 16px; max-width: 38ch; font-size: 14.5px; line-height: 1.55; color: var(--d3-ink-2); }

/* ---- the card -------------------------------------------------------------------------- */

.d3-stage.is-closed .d3-bench { padding-bottom: 16px; }
.d3-card {
  margin: 18px auto 0;
  max-width: 760px;
  padding: 22px 18px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 243, 214, 0.5);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.5) 0%, transparent 40%),
    linear-gradient(165deg, var(--d3-paper) 0%, var(--d3-paper-deep) 100%);
  color: var(--d3-paper-ink);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  animation: d3-card-rise 680ms var(--d3-silk);
}
.d3-card-kicker {
  margin: 0 0 8px;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--house-color-dawn-gold, #b8862f);
}
.d3-card-title {
  margin: 0 0 4px;
  font-family: var(--house-type-family-display, Satoshi, Inter, system-ui, sans-serif);
  font-size: clamp(26px, 6vw, 36px);
  line-height: 1.02;
  letter-spacing: -0.026em;
  color: var(--d3-paper-ink);
}
.d3-card-lead { margin: 0 0 4px; font-size: 14px; color: var(--d3-paper-muted); }
.d3-card-hint { margin: 0 0 8px; font-size: 11.5px; line-height: 1.4; color: var(--d3-paper-muted); }
.d3-card-note { margin: 0 0 16px; font-size: 12px; line-height: 1.45; color: var(--d3-paper-ink); }

.d3-card-lines { display: grid; gap: 12px; }
.d3-card-row { display: grid; gap: 3px; }
.d3-card-key {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--house-color-dawn-gold-deep, #7a5a1c);
}
.d3-card-input {
  width: 100%;
  min-height: 44px;
  resize: none;
  padding: 2px 0 6px;
  border: 0;
  border-bottom: 1px solid rgba(22, 16, 30, 0.22);
  background: transparent;
  color: var(--d3-paper-ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  overflow: hidden;
}
.d3-card-input:focus {
  outline: none;
  border-bottom-color: var(--house-color-dawn-gold, #b8862f);
  box-shadow: 0 1px 0 0 var(--house-color-dawn-gold, #b8862f);
}
.d3-card-row-plan .d3-card-key { color: var(--house-color-dawn-gold, #b8862f); }
.d3-card-value { display: none; font-size: 14.5px; line-height: 1.45; }

.d3-card-aside {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(22, 16, 30, 0.14);
}
.d3-card-aside-label {
  margin: 0 0 6px;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--house-color-dawn-gold-deep, #7a5a1c);
}
.d3-card-aside-none { margin: 0; font-size: 12.5px; color: var(--d3-paper-muted); }
.d3-card-aside-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.d3-card-aside-list li { display: grid; gap: 1px; }
.d3-card-aside-text { font-size: 12px; color: var(--d3-paper-ink); }
.d3-card-aside-reason { font-size: 11px; line-height: 1.35; color: var(--d3-paper-muted); }

.d3-copy { margin-top: 16px; }
.d3-copy-label {
  margin: 0 0 6px;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--house-color-dawn-gold-deep, #7a5a1c);
}
.d3-copy-pre {
  margin: 0;
  max-height: 230px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(22, 16, 30, 0.06);
  border: 1px solid rgba(22, 16, 30, 0.1);
  font-family: var(--house-type-family-mono, ui-monospace, Menlo, monospace);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--d3-paper-ink);
}
.d3-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.d3-card-world {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(22, 16, 30, 0.12);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--d3-paper-muted);
}
.d3-card-tomorrow { margin: 6px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--d3-paper-muted); }
.d3-card-smile { margin: 12px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--d3-paper-muted); }

/* ---- buttons --------------------------------------------------------------------------- */

.d3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 220ms var(--d3-ease), box-shadow 220ms var(--d3-ease), background 220ms var(--d3-ease), border-color 220ms var(--d3-ease), color 220ms var(--d3-ease);
}
.d3-btn:active { transform: translateY(1px); }
.d3-btn-primary {
  color: var(--d3-gold-light);
  border-color: rgba(243, 217, 160, 0.72);
  background: linear-gradient(140deg, rgba(34, 44, 42, 0.9) 0%, rgba(12, 22, 26, 0.94) 100%);
  box-shadow: 0 0 0 1px rgba(243, 217, 160, 0.12), 0 14px 32px -22px rgba(243, 217, 160, 0.8), inset 0 1px 0 rgba(255, 243, 214, 0.18);
}
.d3-btn-primary:hover {
  border-color: var(--d3-gold-light);
  box-shadow: 0 0 30px -12px rgba(243, 217, 160, 0.6), inset 0 1px 0 rgba(255, 243, 214, 0.24);
}
.d3-btn-quiet {
  color: var(--d3-ink-2);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}
.d3-btn-quiet:hover { color: var(--d3-gold-light); border-color: rgba(243, 217, 160, 0.4); }
.d3-btn-ghost {
  color: var(--d3-paper-ink);
  border-color: rgba(22, 16, 30, 0.22);
  background: transparent;
}
.d3-btn-ghost:hover { border-color: var(--house-color-dawn-gold, #b8862f); }
.d3-card .d3-btn-primary {
  color: var(--d3-paper-ink);
  border-color: var(--house-color-dawn-gold, #b8862f);
  background: rgba(22, 16, 30, 0.04);
  box-shadow: none;
}

/* ---- focus, reduced motion, print ------------------------------------------------------ */

.hp-d3 :focus-visible {
  outline: var(--house-light-focus-width, 2px) solid var(--d3-gold);
  outline-offset: var(--house-light-focus-offset, 3px);
}
.d3-card :focus-visible { outline-color: var(--house-color-dawn-gold, #b8862f); }

.hp-d3[data-reduced="true"] .d3-mote,
.hp-d3[data-reduced="true"] .d3-lampglow,
.hp-d3[data-reduced="true"] .d3-lamp-bloom,
.hp-d3[data-reduced="true"] .d3-light[data-state="now"] { animation: none; }
.hp-d3[data-reduced="true"] .d3-aurora { animation: none; opacity: 0.8; transform: rotate(-7deg); }

/* The system setting is honoured even if the piece mounted before it changed. */
@media (prefers-reduced-motion: reduce) {
  .hp-d3 .d3-aurora,
  .hp-d3 .d3-mote,
  .hp-d3 .d3-lampglow,
  .hp-d3 .d3-lamp-bloom,
  .hp-d3 .d3-light[data-state="now"] { animation: none; }
  .hp-d3 .d3-aurora { opacity: 0.8; transform: rotate(-7deg); }
}
.hp-d3[data-reduced="true"] .d3-chip { animation: none; }
.hp-d3[data-reduced="true"] .d3-chip.is-fold { transform: none; opacity: 0; transition: opacity 400ms linear; }
.hp-d3[data-reduced="true"] .d3-choice,
.hp-d3[data-reduced="true"] .d3-card,
.hp-d3[data-reduced="true"] .d3-choose,
.hp-d3[data-reduced="true"] .d3-rest { animation: none; }
.hp-d3[data-reduced="true"] .d3-slot-value { animation: none; }
.hp-d3[data-reduced="true"] .d3-frame { transition: none; }
.hp-d3[data-reduced="true"] .d3-bench.is-whole .d3-frame { animation: none; }

@keyframes d3-drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(10px, -16px, 0); }
}
@keyframes d3-breathe {
  0% { opacity: 0.55; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.04); }
}
@keyframes d3-deal {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes d3-ink-in {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes d3-cool {
  0% { box-shadow: inset 0 0 0 0 rgba(143, 207, 255, 0.5); }
  40% { box-shadow: inset 0 0 28px -6px rgba(143, 207, 255, 0.75); }
  100% { box-shadow: inset 0 0 0 0 rgba(143, 207, 255, 0); }
}
@keyframes d3-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes d3-rise {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes d3-card-rise {
  0% { opacity: 0; transform: translateY(18px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- wider ----------------------------------------------------------------------------- */

@media (min-width: 720px) {
  .d3-main { padding-top: 26px; }
  .d3-head { margin-bottom: 24px; }
  .d3-bench { padding: 22px 22px 18px; border-radius: 26px; }
  .d3-slot { min-height: 112px; padding: 16px; }
  .d3-slot-label { font-size: 13.5px; }
  .d3-slot-hint, .d3-slot-value { font-size: 13px; }
  .d3-chip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
    padding: 0;
  }
  .d3-chip { min-height: 84px; font-size: 12.5px; flex: none; }
  .d3-card { padding: 30px 30px 24px; }
  .d3-card-lines { grid-template-columns: 1fr 1fr; gap: 16px 22px; }
  .d3-card-row-plan { grid-column: 1 / -1; }
  .d3-choose-list { grid-template-columns: repeat(3, 1fr); }
  .d3-choice { min-height: 84px; }
  .d3-card-actions { gap: 10px; }
}

@media (min-width: 1024px) {
  .d3-main { width: min(100%, 1040px); }
  .d3-frame { margin-top: 34px; }
  .d3-grid { gap: 14px; }
}

/* ---- layer mode inside a lesson -------------------------------------------------------- */

.hp-layer {
  min-height: 0;
  background: transparent;
}
.hp-layer .d3-main { padding: 0 0 8px; width: 100%; }
.hp-layer .d3-bench { padding: 12px 10px 10px; border-radius: 18px; }
.hp-layer .d3-frame { margin-top: 20px; }
.hp-layer .d3-slot { min-height: 84px; }
.hp-layer .d3-card { margin-top: 12px; }

/* ---- print: the card only -------------------------------------------------------------- */

@media print {
  .hp-d3 { background: #fff; color: #16101e; min-height: 0; }
  .d3-sky, .d3-top, .d3-head, .d3-foot, .d3-status, .d3-rail,
  .d3-handbar, .d3-card-actions, .d3-sr,
  .d3-frame, .d3-frame-bar, .d3-pool, .d3-rack, .d3-lamp, .d3-blank,
  .d3-intro, .d3-choose, .d3-rest, .d3-aside-btn { display: none !important; }
  .d3-main, .d3-stage, .d3-bench, .d3-lower, .d3-hand { width: 100%; padding: 0; margin: 0; min-height: 0; }
  .d3-bench { background: #fff; border: 0; box-shadow: none; }
  .d3-stage.is-closed .d3-bench { display: block; }
  .d3-card {
    margin: 0;
    max-width: none;
    border: 0;
    box-shadow: none;
    background: #fff;
    animation: none;
  }
  .d3-card-input { display: none; }
  .d3-card-value { display: block; }
  .d3-copy-pre { max-height: none; border: 1px solid #ccc; background: #faf8f2; }
  .d3-card-world, .d3-card-tomorrow, .d3-card-smile { color: #333; }
}

.d3-blank { overflow: hidden; }

@media (max-width: 340px) { .d3-lower { min-height: 232px; } }
