/* Day 1: One door in a wall of windows.
   Own art direction: a harbour wall, a field of windows, one door of light.
   Colours, type, spacing, radii and motion come from the House design values.
   Every value has a fallback so the piece also mounts inside the lesson adapter. */

.hp {
  --night: var(--house-color-ground-night, #050308);
  --navy: var(--house-color-ground-navy, #0b1420);
  --ink: var(--house-color-text-ink, #e9edf2);
  --ink-2: var(--house-color-text-secondary, #e9edf2c2);
  --ink-3: var(--house-color-text-tertiary, #e9edf28f);
  --gold-light: var(--house-color-gold-light, #fff3d6);
  --gold-hi: var(--house-color-gold-hi, #f3d9a0);
  --gold: var(--house-color-gold-base, #e6cf9a);
  --gold-mid: var(--house-color-gold-mid, #d9b46a);
  --gold-deep: var(--house-color-gold-deep, #b08a45);
  --ice: var(--house-color-scene-ice, #8fcfff);
  --pond: var(--house-color-scene-pond, #3fd0d9);
  /* The living night of the harbour: cyan and green life, magenta and violet
     bloom, gold kept for the House's own door and windows (R37c). */
  --cyan: #39e6ea;
  --teal: #1ec9d6;
  --magenta: #ff6fd0;
  --pink: #ffa8dc;
  --violet: #9b7bff;
  --paper: var(--house-color-dawn-paper, #f6f1e7);
  --paper-deep: var(--house-color-dawn-paper-deep, #efe6d3);
  --paper-ink: var(--house-color-dawn-ink, #16101e);
  --paper-gold: var(--house-color-dawn-gold-deep, #7a5a1c);
  --line: var(--house-color-line-quiet, rgba(255,255,255,.1));
  --line-2: var(--house-color-line-strong, rgba(255,255,255,.18));
  --font-display: Satoshi, Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --r-s: var(--house-radius-s, 10px);
  --r-m: var(--house-radius-m, 16px);
  --r-l: var(--house-radius-l, 20px);
  --r-pill: var(--house-radius-pill, 999px);
  --s-1: var(--house-space-1, 4px);
  --s-2: var(--house-space-2, 8px);
  --s-3: var(--house-space-3, 12px);
  --s-4: var(--house-space-4, 16px);
  --s-5: var(--house-space-5, 24px);
  --s-6: var(--house-space-6, 32px);
  --s-7: var(--house-space-7, 48px);
  --ease: var(--house-motion-easing-standard, cubic-bezier(.2,.6,.2,1));
  --silk: var(--house-motion-easing-silk, cubic-bezier(.25,1,.5,1));
  --dur: var(--house-motion-duration-base, 420ms);
  --dur-slow: var(--house-motion-duration-slow, 1200ms);
  --focus: var(--gold-light);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #03060e;
  color: var(--ink, #e9edf2);
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

[hidden] { display: none !important; }

.hp {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow-x: clip;
  background: var(--night);
}

.hp-layer { min-height: 0; background: transparent; }

/* ---- the harbour ------------------------------------------------------------------------------------- */

.harbour {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 86% 16%, rgba(155, 123, 255, .34) 0%, transparent 52%),
    radial-gradient(ellipse at 8% 30%, rgba(255, 111, 208, .24) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 78%, rgba(30, 201, 214, .2) 0%, transparent 62%),
    linear-gradient(180deg, #060a1e 0%, #0a1838 28%, #0c2a48 54%, #0d3d54 74%, #092a3c 100%);
}

.dawn {
  position: absolute;
  left: 50%;
  top: 6%;
  width: 130%;
  height: 76%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 50% 54%, rgba(255, 246, 220, .6) 0%, rgba(255, 214, 150, .38) 22%, transparent 56%),
    radial-gradient(ellipse at 50% 56%,
      rgba(255, 168, 220, .34) 0%,
      rgba(155, 123, 255, .3) 26%,
      rgba(57, 230, 234, .26) 46%,
      rgba(30, 201, 214, .16) 60%,
      transparent 78%);
  filter: blur(26px);
  opacity: .98;
}

.aurora {
  position: absolute;
  left: -12%;
  right: -12%;
  top: 16%;
  height: 28%;
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(255, 111, 208, .34) 18%,
    rgba(155, 123, 255, .38) 38%,
    rgba(57, 230, 234, .34) 58%,
    rgba(120, 255, 200, .24) 74%,
    transparent 100%);
  filter: blur(22px);
  transform: rotate(-4deg);
  animation: aurora 28s ease-in-out infinite alternate;
}

.aurora::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  top: 52%;
  height: 92%;
  background: linear-gradient(80deg,
    transparent 0%,
    rgba(255, 111, 208, .26) 28%,
    rgba(57, 230, 234, .22) 60%,
    rgba(155, 123, 255, .2) 82%,
    transparent 100%);
  filter: blur(26px);
  transform: rotate(3deg);
}

.stars { position: absolute; inset: 0; }

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 243, 214, .6);
  animation: twinkle var(--dur-star, 7s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.sea {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(180deg, #0d4a5c 0%, #0a3346 30%, #06202e 68%, #04121c 100%);
}

.sea::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 244, 210, .48) 0%, rgba(57, 230, 234, .3) 30%, rgba(255, 111, 208, .18) 52%, transparent 72%),
    linear-gradient(90deg, rgba(57, 230, 234, .16) 0%, transparent 34%, rgba(255, 111, 208, .14) 72%, transparent 100%);
  mix-blend-mode: screen;
}

.sea-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 243, 214, .55), transparent);
  box-shadow: 0 0 18px rgba(243, 217, 160, .35);
}

.wall {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  z-index: 2;
  background: linear-gradient(180deg, #0a2637 0%, #061827 46%, #03101a 100%);
  box-shadow: inset 0 1px 0 rgba(120, 255, 240, .24);
}

.wall::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(120, 255, 240, .42), transparent);
  box-shadow: 0 0 16px rgba(57, 230, 234, .28);
}

/* The living shore: cyan and magenta light in the water at the wall's foot.
   It sits above the wall's stone and below the door, and never takes a click. */
.wall::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 8% 100%, rgba(255, 111, 208, .38) 0%, transparent 46%),
    radial-gradient(ellipse at 92% 100%, rgba(57, 230, 234, .4) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 100%, rgba(155, 123, 255, .3) 0%, transparent 58%);
  filter: blur(16px);
  mix-blend-mode: screen;
}

.window {
  position: absolute;
  width: 3px;
  height: 5px;
  border-radius: 1px;
  background: rgba(255, 243, 214, .7);
  box-shadow: 0 0 8px rgba(243, 217, 160, .65);
  opacity: var(--o, .5);
  animation: window 6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.window.is-awake {
  background: var(--gold-hi);
  box-shadow: 0 0 10px rgba(243, 217, 160, .85), 0 0 22px rgba(243, 217, 160, .3);
  opacity: .9;
}

/* A few windows carry the island's other life: ice, cyan and rose (R37c).
   Gold stays the House's own light and the door's. */
.window.is-cool {
  background: rgba(176, 246, 255, .92);
  box-shadow: 0 0 9px rgba(57, 230, 234, .8), 0 0 20px rgba(57, 230, 234, .3);
}

.window.is-rose {
  background: rgba(255, 190, 238, .92);
  box-shadow: 0 0 9px rgba(255, 111, 208, .8), 0 0 20px rgba(255, 111, 208, .3);
}

.window.is-lit {
  background: var(--gold-hi);
  box-shadow: 0 0 14px rgba(243, 217, 160, .95), 0 0 30px rgba(243, 217, 160, .35);
  opacity: 1;
}

.door {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 4;
  width: clamp(128px, 20vw, 224px);
  height: clamp(188px, 30vw, 304px);
  transform: translateX(-50%);
  border-radius: 50% 50% 6px 6px / 42% 42% 6px 6px;
  border: 1px solid rgba(255, 238, 188, .62);
  background: linear-gradient(180deg, rgba(255, 248, 228, .62), rgba(255, 226, 166, .4) 38%, rgba(243, 199, 120, .64) 72%, rgba(204, 158, 82, .72));
  box-shadow: 0 0 84px -10px rgba(255, 231, 170, .7), 0 0 160px -30px rgba(255, 170, 90, .4), inset 0 0 46px rgba(255, 248, 228, .38);
  overflow: hidden;
  transition: background 600ms var(--ease), box-shadow 600ms var(--ease), border-color 600ms var(--ease);
}

.door-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 243, 214, .38), rgba(243, 217, 160, .1) 42%, transparent 70%);
  filter: blur(18px);
  animation: breathe 9s ease-in-out infinite;
}

.door-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 243, 214, .52);
}

.door-light {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 58%;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, rgba(255, 243, 214, .9), rgba(243, 217, 160, .18));
  box-shadow: 0 0 26px rgba(243, 217, 160, .8);
  opacity: .55;
  transition: width var(--dur) var(--ease), opacity var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.door[data-open="true"] {
  border-color: rgba(255, 243, 214, .85);
  background: linear-gradient(180deg, rgba(255, 243, 214, .58), rgba(243, 217, 160, .3) 44%, rgba(255, 243, 214, .92));
  box-shadow: 0 0 110px -8px rgba(243, 217, 160, .85), inset 0 0 70px rgba(255, 243, 214, .6);
}

.door[data-open="true"] .door-light {
  width: 12px;
  opacity: 1;
  box-shadow: 0 0 70px rgba(255, 243, 214, .95);
}

.door-step {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 128%;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 243, 214, .85), transparent);
  box-shadow: 0 0 22px rgba(243, 217, 160, .7);
}

/* The light the door throws on the water at its foot. */
.door-pool {
  position: absolute;
  left: 50%;
  bottom: 3.2%;
  z-index: 3;
  width: min(82vw, 460px);
  height: 54px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(255, 244, 212, .7) 0%,
    rgba(255, 202, 136, .36) 42%,
    rgba(57, 230, 234, .16) 66%,
    transparent 80%);
  filter: blur(10px);
  pointer-events: none;
}

.lanterns {
  position: absolute;
  left: 50%;
  bottom: 14.5%;
  z-index: 5;
  display: flex;
  gap: clamp(6px, 1.4vw, 14px);
  transform: translateX(-50%);
}

.lantern-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.lantern-dot.is-on {
  background: var(--gold-hi);
  box-shadow: 0 0 16px rgba(243, 217, 160, .95);
}

.stone {
  position: absolute;
  left: 50%;
  bottom: 15.2%;
  width: 12px;
  height: 7px;
  margin-left: 26px;
  z-index: 6;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background 600ms var(--ease), box-shadow 600ms var(--ease);
}

.stone.is-lit {
  background: var(--gold-hi);
  box-shadow: 0 0 18px rgba(243, 217, 160, .95), 0 0 40px rgba(243, 217, 160, .35);
}

.pearl {
  position: absolute;
  left: 50%;
  top: 13%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #fff3d6 30%, #d9b46a 70%, #8f6d31);
  box-shadow: 0 0 26px rgba(243, 217, 160, .75), 0 0 100px rgba(243, 217, 160, .32);
  animation: breathe 9s ease-in-out infinite;
}

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

.hd {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-5) 0;
}

.back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-1);
  color: var(--ink-2);
  font: 500 13px/1 var(--font-body);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.back:hover { color: var(--gold-hi); }
.back-arrow { color: var(--gold-hi); font-size: 16px; }

.mark {
  margin: 0;
  font: 600 11px/1 var(--font-body);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.day {
  justify-self: end;
  margin: 0;
  font: 600 11px/1.3 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-hi);
  text-align: right;
  white-space: nowrap;
}

.main {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  flex: 1;
}

.hero {
  position: relative;
  max-width: 780px;
  padding-top: clamp(18px, 5vh, 56px);
  animation: rise .9s var(--silk) both;
}

/* A soft night behind the words, so white type stays crisp over the living sky
   without dimming the harbour around it. */
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -10%;
  right: -6%;
  top: -10%;
  bottom: -14%;
  background: radial-gradient(ellipse at 40% 44%, rgba(4, 8, 20, .86) 0%, rgba(4, 8, 20, .58) 48%, rgba(4, 8, 20, .22) 70%, transparent 86%);
  filter: blur(18px);
  pointer-events: none;
}

.kicker {
  margin: 0 0 var(--s-3);
  font: 600 11px/1 var(--font-body);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-hi);
}

.title {
  margin: 0;
  font: 700 clamp(38px, 6.4vw, 76px)/1.02 var(--font-display);
  letter-spacing: -.035em;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 2px 34px rgba(3, 6, 14, .65);
}

.promise {
  margin: var(--s-3) 0 0;
  max-width: 34ch;
  font: 400 clamp(16px, 1.8vw, 20px)/1.5 var(--font-body);
  color: var(--ink-2);
  text-wrap: pretty;
}

.slip {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-4) clamp(var(--s-4), 3vw, var(--s-6));
  border-radius: var(--r-l);
  border: 1px solid rgba(243, 217, 160, .28);
  background: linear-gradient(180deg, rgba(7, 14, 22, .78) 0%, rgba(4, 8, 14, .9) 100%);
  box-shadow: 0 40px 90px -50px #000, 0 0 80px -40px rgba(243, 217, 160, .25), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: rise 1.1s var(--silk) both;
  animation-delay: .08s;
}

.slip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -58px;
  width: 1px;
  height: 58px;
  background: linear-gradient(180deg, transparent, rgba(243, 217, 160, .5));
}

.slip-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  min-height: 18px;
}

.progress-label {
  margin: 0;
  font: 500 11px/1.3 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lights {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.light {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.light[data-state="lit"] {
  background: var(--gold-hi);
  box-shadow: 0 0 9px rgba(243, 217, 160, .8);
}

.light[data-state="now"] {
  background: rgba(255, 243, 214, .55);
  box-shadow: 0 0 0 1px rgba(255, 243, 214, .35);
}

.slip-body {
  position: relative;
  z-index: 1;
  padding: var(--s-4) 0 var(--s-2);
}

.note {
  position: relative;
  z-index: 1;
  /* Two lines are always held open, so feedback never moves the card or the
     buttons under a fast thumb. */
  min-height: 46px;
  margin: 0;
  padding-top: var(--s-1);
  font: 400 14px/1.5 var(--font-body);
  color: var(--ink-2);
  text-wrap: pretty;
}

.note[data-tone="good"] { color: var(--gold-hi); }
.note[data-tone="wait"] { color: var(--ice); }

.foot {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s-1) var(--s-5) var(--s-5);
  font: 400 12px/1.5 var(--font-body);
  color: var(--ink-3);
  background: linear-gradient(180deg, transparent 0%, rgba(3, 6, 14, .72) 58%);
}

.foot-care { color: var(--ink-2); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 46px;
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .045);
  color: var(--ink);
  font: 500 15px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--silk);
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  border-color: rgba(255, 243, 214, .45);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn.primary {
  border-color: rgba(243, 217, 160, .62);
  background: linear-gradient(180deg, rgba(243, 217, 160, .18) 0%, rgba(243, 217, 160, .05) 100%);
  box-shadow: 0 0 34px -12px rgba(243, 217, 160, .65), inset 0 1px 0 rgba(255, 255, 255, .22);
  color: var(--gold-light);
  font-weight: 600;
}

.btn.primary:hover {
  border-color: rgba(255, 243, 214, .9);
  box-shadow: 0 0 48px -12px rgba(243, 217, 160, .8), inset 0 1px 0 rgba(255, 255, 255, .28);
  color: #fff;
}

.btn[disabled] {
  opacity: .42;
  cursor: default;
  transform: none;
}

.text-btn {
  min-height: 44px;
  padding: 0 var(--s-2);
  border: 0;
  background: none;
  color: var(--ink-3);
  font: 500 13px/1 var(--font-body);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, .18);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.text-btn:hover { color: var(--gold-hi); }
.text-btn[disabled] { opacity: .35; cursor: default; }

.btn:focus-visible,
.text-btn:focus-visible,
.back:focus-visible,
.card:focus-visible,
.bucket:focus-visible,
.lantern-btn:focus-visible,
.person-btn:focus-visible,
.chip:focus-visible,
.detail-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---- intro ------------------------------------------------------------------------------------------- */

.intro-line {
  margin: 0 0 var(--s-4);
  font: 400 clamp(17px, 2vw, 20px)/1.55 var(--font-body);
  color: var(--ink);
  max-width: 46ch;
  text-wrap: pretty;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.hint {
  margin: var(--s-3) 0 0;
  max-width: 48ch;
  font: 400 13px/1.6 var(--font-body);
  color: var(--ink-3);
}

.ornament {
  display: block;
  width: 54px;
  height: 1px;
  margin: 0 0 var(--s-4);
  background: linear-gradient(90deg, transparent, rgba(255, 243, 214, .75), transparent);
  box-shadow: 0 0 8px rgba(243, 217, 160, .4);
}

/* ---- sort -------------------------------------------------------------------------------------------- */

.sort {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
}

.deck {
  position: relative;
  width: min(100%, 520px);
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -4px;
  height: 40px;
  background: radial-gradient(ellipse at center, rgba(243, 217, 160, .16), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

.ghost {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90%, 470px);
  height: 174px;
  border-radius: var(--r-m);
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .022);
  transform: translate(-50%, -50%);
}

.ghost.g1 { transform: translate(-50%, -50%) translateY(9px) scale(.96); opacity: .6; }
.ghost.g2 { transform: translate(-50%, -50%) translateY(18px) scale(.92); opacity: .3; }

.card {
  position: relative;
  z-index: 2;
  width: min(100%, 490px);
  min-height: 174px;
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-radius: var(--r-m);
  border: 1px solid rgba(243, 217, 160, .3);
  background: linear-gradient(180deg, rgba(12, 22, 32, .95) 0%, rgba(5, 9, 15, .97) 100%);
  box-shadow: 0 30px 70px -40px #000, 0 0 46px -24px rgba(243, 217, 160, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-4);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  transition: transform .34s var(--silk), opacity .34s var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  left: 13%;
  right: 13%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 243, 214, .55), transparent);
}

.card:active { cursor: grabbing; }
.card.is-flying { position: absolute; z-index: 4; pointer-events: none; }
.card.out-right { transform: translateX(118%) rotate(4deg); opacity: 0; }
.card.out-left { transform: translateX(-118%) rotate(-4deg); opacity: 0; }

.card-text {
  margin: 0;
  font: 500 clamp(19px, 2.3vw, 24px)/1.32 var(--font-display);
  letter-spacing: -.012em;
  color: #fff;
  text-wrap: pretty;
}

.card-meta {
  margin: 0;
  font: 500 11px/1.3 var(--font-body);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.buckets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  width: min(100%, 520px);
}

.bucket {
  min-height: 50px;
  padding: 10px var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .035);
  color: var(--ink);
  font: 500 14px/1.2 var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.bucket:hover { border-color: rgba(243, 217, 160, .45); background: rgba(243, 217, 160, .06); color: #fff; }

.bucket.is-hint {
  border-color: rgba(243, 217, 160, .7);
  box-shadow: 0 0 30px -12px rgba(243, 217, 160, .7), inset 0 0 0 1px rgba(243, 217, 160, .16);
  color: var(--gold-light);
}

.bucket .dir { font-size: 13px; color: var(--ink-3); }
.bucket.is-hint .dir { color: var(--gold-hi); }

.tools { display: flex; justify-content: center; }

/* ---- keep and people --------------------------------------------------------------------------------- */

.stage-title {
  margin: 0 0 var(--s-2);
  font: 700 clamp(22px, 3vw, 30px)/1.15 var(--font-display);
  letter-spacing: -.025em;
  color: #fff;
  text-wrap: balance;
}

.stage-hint {
  margin: 0 0 var(--s-4);
  font: 400 14px/1.55 var(--font-body);
  color: var(--ink-2);
  max-width: 52ch;
}

.picker {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.lantern-btn,
.person-btn {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: 48px;
  padding: var(--s-3);
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  color: var(--ink-2);
  font: 400 14px/1.4 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.lantern-btn:hover,
.person-btn:hover { border-color: rgba(255, 243, 214, .38); background: rgba(255, 255, 255, .05); color: #fff; }

.lantern-btn.is-on,
.person-btn.is-on {
  border-color: rgba(243, 217, 160, .7);
  background: rgba(243, 217, 160, .08);
  color: #fff;
  box-shadow: 0 0 26px -14px rgba(243, 217, 160, .8);
}

.lantern-btn .dot,
.person-btn .dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.lantern-btn.is-on .dot,
.person-btn.is-on .dot {
  background: var(--gold-hi);
  box-shadow: 0 0 14px rgba(243, 217, 160, .9);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.actions .text-btn { margin-left: auto; }

.counter {
  margin: 0;
  font: 500 12px/1.3 var(--font-mono);
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* ---- detail ------------------------------------------------------------------------------------------ */

.detail-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.detail-input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s-4);
  border-radius: var(--r-s);
  border: 1px solid rgba(243, 217, 160, .35);
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font: 400 16px/1.4 var(--font-body);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.detail-input::placeholder { color: var(--ink-3); }
.detail-input:focus { border-color: rgba(255, 243, 214, .7); box-shadow: 0 0 24px -12px rgba(243, 217, 160, .6); }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.chip {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .03);
  color: var(--ink-2);
  font: 400 13px/1.35 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.chip:hover { border-color: rgba(243, 217, 160, .45); background: rgba(243, 217, 160, .06); color: #fff; }

/* ---- the paper close --------------------------------------------------------------------------------- */

.paper {
  position: relative;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--r-l);
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
  color: var(--paper-ink);
  box-shadow: 0 44px 90px -50px #000, 0 0 90px -30px rgba(243, 217, 160, .35);
  animation: rise .7s var(--silk) both;
}

.paper::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 134, 47, .7), transparent);
}

.paper-kicker {
  margin: 0 0 var(--s-2);
  font: 600 11px/1 var(--font-body);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--paper-gold);
}

.paper-title {
  margin: 0;
  font: 700 clamp(26px, 4vw, 38px)/1.08 var(--font-display);
  letter-spacing: -.03em;
  color: var(--paper-ink);
  text-wrap: balance;
}

.paper-body {
  margin: var(--s-3) 0 0;
  font: 400 15.5px/1.55 var(--font-body);
  color: rgba(22, 16, 30, .8);
  max-width: 54ch;
  text-wrap: pretty;
}

.paper-label {
  margin: var(--s-4) 0 var(--s-2);
  font: 600 11px/1 var(--font-body);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--paper-gold);
}

.door-line {
  margin: 0;
  font: 500 clamp(18px, 2.4vw, 24px)/1.35 var(--font-display);
  letter-spacing: -.015em;
  color: var(--paper-ink);
  text-wrap: pretty;
}

.next-step {
  margin: 0;
  font: 400 14px/1.55 var(--font-body);
  color: rgba(22, 16, 30, .8);
  text-wrap: pretty;
}

.task-stem {
  margin: var(--s-3) 0 0;
  font: 400 14px/1.5 var(--font-body);
  color: rgba(22, 16, 30, .72);
}

.paper .btn.primary {
  border-color: rgba(184, 134, 47, .55);
  background: linear-gradient(180deg, rgba(184, 134, 47, .18) 0%, rgba(184, 134, 47, .06) 100%);
  color: #3a2a10;
  box-shadow: 0 0 30px -12px rgba(184, 134, 47, .5), inset 0 1px 0 rgba(255, 255, 255, .5);
  margin-top: var(--s-4);
}

.paper .btn.primary:hover { border-color: rgba(122, 90, 28, .8); color: var(--paper-ink); }

.paper .text-btn { color: rgba(22, 16, 30, .62); text-decoration-color: rgba(22, 16, 30, .24); }
.paper .text-btn:hover { color: var(--paper-ink); }

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.shortlist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.shortlist li {
  padding: var(--s-2) 0;
  border-top: 1px solid rgba(22, 16, 30, .12);
  font: 400 14px/1.45 var(--font-body);
  color: rgba(22, 16, 30, .82);
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: center;
  margin-top: var(--s-4);
}

/* ---- the world window (flag ?window=1) ---------------------------------------------------------------- */

.day1-window {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  pointer-events: none;
}

.day1-window .hw-stage {
  height: 100%;
  border-radius: 0;
  box-shadow: none;
}

/* The one world paints in the layer behind the host; the stage's night is only
   for a still. Same rule as the window's own proof shell. */
.day1-window[data-hw-mode="live"] .hw-stage,
.day1-window[data-hw-mode="slow"] .hw-stage { background: transparent; }

/* The page's own copy is the visible twin. The window's twin stays in the DOM,
   clipped, so a screen reader and scripts off still meet every caption and read. */
.day1-window .hw-beat,
.day1-window .hw-controls,
.day1-window .hw-dots,
.day1-window .hw-status {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body.window-live .hp { background: transparent; isolation: auto; }
body.window-live .harbour { opacity: 0; }

/* ---- screen reader ----------------------------------------------------------------------------------- */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.copy-sink {
  position: absolute;
  left: -9999px;
  top: 0;
  opacity: 0;
}

/* ---- the layer mount --------------------------------------------------------------------------------- */

.hp-layer .main { max-width: none; padding: 0; gap: 0; }
.hp-layer .hero { display: none; }
.hp-layer .slip {
  max-width: none;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}
.hp-layer .slip::before { display: none; }
.hp-layer .slip-body { padding: 0; }
.hp-layer .paper { margin: 0; }

/* ---- narrow ------------------------------------------------------------------------------------------ */

@media (max-width: 720px) {
  .mark { display: none; }
  .hd { position: relative; grid-template-columns: 1fr 1fr; padding: var(--s-3) var(--s-4) 0; }
  /* The top bar keeps its words legible when the door's light rises behind it. */
  .hd::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: -16px;
    right: -16px;
    top: -16px;
    bottom: -10px;
    background: linear-gradient(180deg, rgba(3, 6, 14, .9) 0%, rgba(3, 6, 14, .55) 62%, transparent 100%);
    pointer-events: none;
  }
  .day { grid-column: 2; font-size: 10px; letter-spacing: .1em; }
  .main { padding: 0 var(--s-4) var(--s-4); gap: var(--s-4); }
  .hero { padding-top: var(--s-3); }
  .title { font-size: clamp(34px, 10vw, 48px); letter-spacing: -.03em; }
  .promise { font-size: 15.5px; }
  .slip { padding: var(--s-4) var(--s-4) var(--s-3); border-radius: var(--r-m); }
  .slip::before { top: -40px; height: 40px; }
  /* On a phone the two named buttons and their arrows already carry the move;
     the long hint sat where the door needs to stand. */
  .intro .hint { display: none; }
  .deck { height: 200px; }
  .card { min-height: 168px; padding: var(--s-4); }
  .buckets { gap: var(--s-2); }
  .bucket { font-size: 13px; padding: 8px 8px; }
  .actions .text-btn { margin-left: 0; }
  /* Short phones keep the door at the top right, clear of the panel, and give
     it real light: the arch is the brightest thing on the screen. */
  .door {
    left: 82%;
    top: 5%;
    bottom: auto;
    width: clamp(112px, 34vw, 136px);
    height: clamp(168px, 50vw, 198px);
    opacity: 1;
    border-width: 2px;
    background: linear-gradient(180deg, rgba(255, 250, 236, .9), rgba(255, 235, 186, .74) 34%, rgba(255, 219, 140, .84) 66%, rgba(232, 184, 96, .94));
    box-shadow: 0 0 92px -8px rgba(255, 236, 178, .92), 0 0 190px -34px rgba(255, 170, 96, .55), inset 0 0 48px rgba(255, 252, 240, .7);
  }
  .lanterns { display: none; }
  .foot { padding-bottom: var(--s-4); font-size: 11.5px; }
}

/* On a short phone the door is high at the top right, so the pool at the foot
   would be a stray light. The sea keeps its own glow instead. */
@media (max-width: 720px) and (max-height: 739px) {
  .door-pool { display: none; }
}

/* Tall phones have room below the panel: the door stands in the open harbour,
   wide and fully lit, between the reading and the foot. */
@media (max-width: 720px) and (min-height: 740px) {
  .door {
    left: 50%;
    top: auto;
    bottom: 9.6%;
    width: clamp(200px, 62vw, 240px);
    height: clamp(150px, 44vw, 172px);
  }
  .door-light { width: 12px; opacity: .95; box-shadow: 0 0 84px rgba(255, 250, 232, .95); }
  .door-step { height: 3px; width: 146%; }
}

@media (min-width: 900px) {
  .main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    grid-template-rows: auto 1fr;
    column-gap: var(--s-7);
    align-items: start;
  }
  .hero { grid-column: 1 / -1; }
  .slip { grid-column: 1; grid-row: 2; max-width: 660px; margin: 0; }
  .dawn { left: 72%; width: 92%; }
  .door { left: 76%; bottom: 12%; width: clamp(190px, 17vw, 270px); height: clamp(280px, 25vw, 400px); }
  .door-pool { left: 76%; width: min(46vw, 440px); }
  .lanterns { left: 76%; bottom: 8.5%; }
}

@media (min-width: 1000px) {
  .deck { height: 220px; }
}

/* ---- motion ------------------------------------------------------------------------------------------ */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes twinkle {
  0%, 100% { opacity: var(--o, .25); transform: scale(.9); }
  50% { opacity: calc(var(--o, .25) + .35); transform: scale(1.18); }
}

@keyframes window {
  0%, 100% { opacity: var(--o, .5); }
  50% { opacity: calc(var(--o, .5) + .25); }
}

@keyframes breathe {
  0%, 100% { opacity: .62; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1.03); }
}

@keyframes aurora {
  from { transform: translate3d(-2%, 0, 0) rotate(-4deg) scale(1); opacity: .65; }
  to { transform: translate3d(2%, 1%, 0) rotate(-3deg) scale(1.05); opacity: .95; }
}

@keyframes wrong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.hp[data-reduced="true"] *,
.hp[data-reduced="true"] *::before,
.hp[data-reduced="true"] *::after {
  animation: none !important;
  transition-duration: 400ms !important;
  transition-property: opacity, background-color, border-color, color, box-shadow, transform !important;
}

@media (prefers-reduced-motion: reduce) {
  .hp *, .hp *::before, .hp *::after {
    animation: none !important;
    transition-duration: 400ms !important;
    transition-property: opacity, background-color, border-color, color, box-shadow, transform !important;
  }
}
