/* Layout: one column. The week as a row of seven, the chosen envelope large, its letter below. */
.week { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(6px, 1.8vw, 14px); align-items: end; margin-top: 6px; }
.cell { display: grid; gap: 7px; justify-items: center; align-content: end; background: none; border: 0; padding: 0; cursor: pointer; }
.cell .env { width: 100%; }
.cell .env img { width: 100%; display: block; }
.cell .env.closed img { margin-bottom: -5.3%; }
.cell .env.open img { margin-bottom: -8.6%; }
.cell .env.later { opacity: .45; }
.cell .cap { font-size: 9.5px; color: var(--ink-soft); text-align: center; line-height: 1.3; }
.cell.today .cap { color: var(--red); }
.cell[aria-current="true"] .cap { text-decoration: underline; text-underline-offset: 3px; }

/* The stage (static/stage.css has the layers and the opening). While sealed, the empty top tucks
   up behind the week row (negative margin, a share of the width), then the stage grows as the flap turns. */
.stage-wrap { width: min(100%, 440px); margin: 28px auto 0; }
.stage-wrap .stage { margin-top: -43%; transition: margin-top .75s cubic-bezier(.3,.7,.2,1); }
.stage-wrap .stage.is-open { margin-top: 0; z-index: 3; }
/* Writing on the card, in the part that comes out of the pocket. */
.stage .cardface { position: absolute; left: 10.7%; top: 43%; width: 78.6%; height: 35.5%; opacity: 0; transition: opacity .5s linear .35s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .1em; container-type: inline-size; }
.stage.is-out .cardface { opacity: 1; }
.stage .cardface .mono { font-size: max(9px, 3.6cqw); color: var(--ink-soft); }
.stage .cardface .num { font-size: 17cqw; line-height: 1.05; font-weight: 400; font-style: italic; font-variation-settings: "opsz" 144, "SOFT" 100; }
.stage .cardface .for { font-size: max(13px, 5.4cqw); color: var(--ink-soft); font-style: italic; }
.stage .cardface .pm { position: absolute; right: 2%; bottom: 4%; width: 30%; transform: rotate(-8deg); }
.stage-note { text-align: center; margin: 14px 0 0; color: var(--ink-soft); font-size: 16px; }
.stage-note.red { color: var(--red); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.keptline { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.keptline img { height: 34px; width: auto; }
.keptline img.wide { height: auto; width: 74px; }
.keptline .mono { font-size: 11px; color: var(--ink-soft); }
.keptline img.square { height: 44px; width: 44px; }
.keptline.given img { opacity: .45; filter: grayscale(.6); }
.lastcard { margin-top: 18px; padding: 18px 18px 16px; border: 1.5px dashed var(--red); background: rgba(255, 255, 255, .4); display: grid; gap: 10px; justify-items: start; }
.lastcard .mono { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.lastcard p { margin: 0; font-style: normal; font-size: 17px; }
.lastcard .hidden-obj { height: 88px; width: auto; }
.lastcard .hidden-obj.square { width: 88px; }
.lastcard .score { display: flex; gap: 6px; }
.lastcard .score span { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--red); }
.lastcard .score span.hit { background: var(--red); }
.lastcard .closing { font-style: italic; font-size: 19px; }
.lastcard .sign { font-size: 15px; color: var(--ink-soft); }

.letter {
  margin: 26px 0 0; padding: clamp(22px, 6vw, 40px) clamp(20px, 6vw, 44px) clamp(24px, 6vw, 36px);
  background: linear-gradient(140deg, var(--card-lit), var(--card) 55%, #EBE3D1);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(31,42,68,.08), 8px 14px 28px -18px rgba(31,42,68,.45), 2px 3px 0 rgba(31,42,68,.05);
  display: grid; gap: 18px;
  animation: rise .5s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.letter .mono { color: var(--ink-soft); font-size: 11.5px; }
.letter .story { display: grid; gap: .9em; font-size: clamp(18px, 4.6vw, 20px); line-height: 1.6; font-variation-settings: "opsz" 18, "SOFT" 40; }
.letter .story p { margin: 0; text-wrap: pretty; }
.letter .ask { color: var(--red); margin-top: 6px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer;
  padding: 11px 20px; font-family: var(--serif); font-size: 18px; line-height: 1.3; min-height: 48px;
}
.choice:hover { background: var(--ink); color: var(--paper); }
.choice[aria-busy="true"] { opacity: .5; }
.chosen { border-top: 1px dashed var(--rule); padding-top: 16px; display: grid; gap: 8px; }
.chosen .pick { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.chosen p { margin: 0; font-style: italic; font-size: 19px; font-variation-settings: "opsz" 18, "SOFT" 80; }
.next { margin: 0; color: var(--ink-soft); font-size: 16px; }
.remind { display: inline-block; margin-top: 8px; color: var(--red); font-size: 15px; text-underline-offset: 3px; }
.shared { margin: -6px 0 0; color: var(--ink-soft); font-size: 14px; }
.err { color: var(--red); font-size: 15px; margin: 0; }

.notice { margin: 40px 0; display: grid; gap: 10px; }
.notice h1 { margin: 0; font-weight: 450; font-size: clamp(28px, 7vw, 38px); line-height: 1.12; font-variation-settings: "opsz" 96, "SOFT" 60; text-wrap: balance; }
.notice p { margin: 0; color: var(--ink-soft); }
.foot { margin: 44px 0 28px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; border-top: 1px solid var(--rule); padding-top: 14px; }
.foot a { color: var(--red); text-underline-offset: 3px; }

/* Sample page: the giver's evening email under each choice. */
.givernote { margin-top: 6px; padding: 10px 12px; border-left: 2px solid var(--red); background: rgba(255, 255, 255, .35); }
.givernote .mono { font-size: 11px; color: var(--red); }
.givernote p { margin: 4px 0 0; font-size: 15px; }

/* Opening scene (static/intro.js): a dark screen before envelope 1, one look per kind of story. */
.intro { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: center; gap: 28px;
  padding: max(28px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(28px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  color: #F3ECDD; background: #0E1219; cursor: pointer; outline: none; transition: opacity .7s ease; }
.intro.out { opacity: 0; }
.intro.theme-mystery { background: radial-gradient(120% 60% at 50% 105%, #3A3324 0%, rgba(58,51,36,0) 55%), linear-gradient(#0B0F16, #141B26); }
.intro.theme-adventure { background: linear-gradient(#1C1828, #3B2626 70%, #5A3423); }
.intro.theme-cosy { background: radial-gradient(90% 55% at 50% 100%, #6B4220 0%, rgba(107,66,32,0) 70%), linear-gradient(#17120F, #241A14); }
.intro.theme-sci-fi { background: radial-gradient(70% 50% at 50% 50%, #0F1A33, #04060C); }
.intro.theme-fairy-tale { background: linear-gradient(#120F24, #13201B 75%); }
.intro.theme-time-travel { background: radial-gradient(80% 60% at 50% 42%, #2E2416, #120E09); }
.intro .fx { position: absolute; inset: 0; pointer-events: none; }
.intro .lines, .intro .note { position: relative; width: 100%; max-width: 30rem; margin: 0 auto; }
.intro .lines { display: flex; flex-direction: column; gap: 14px; transition: opacity .8s ease; }
.intro .lines.dim { opacity: .55; }
.intro .lines p { margin: 0; font-size: clamp(20px, 5.4vw, 28px); line-height: 1.32; font-variation-settings: "opsz" 36, "SOFT" 60;
  text-wrap: pretty; opacity: 0; transform: translateY(8px); filter: blur(4px); transition: opacity 1.1s ease, transform 1.1s ease, filter 1.1s ease; }
.intro .lines p.in { opacity: 1; transform: none; filter: none; }
.intro .note { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 18px; border-top: 1px solid rgba(243,236,221,.22);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .9s ease, transform .9s ease; cursor: auto; }
.intro .note.in { opacity: 1; transform: none; pointer-events: auto; }
.intro .note .mono { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #E9B97A; }
.intro .note p { margin: 0; font-size: 17px; line-height: 1.45; color: rgba(243,236,221,.86); }
.intro .go { margin-top: 6px; padding: 12px 18px; border: 0; border-radius: 3px; background: #F3ECDD; color: #1A1712; font: inherit; font-size: 16px; cursor: pointer; }
.intro .go:hover { background: #fff; }
.intro .skip { position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); padding: 8px 10px;
  border: 0; background: none; color: rgba(243,236,221,.6); font-size: 12px; letter-spacing: .08em; cursor: pointer; }
.intro .skip:hover { color: #F3ECDD; }
.intro .hint { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 11px;
  letter-spacing: .1em; color: rgba(243,236,221,.42); transition: opacity .6s ease; }
.intro .hint.gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .intro, .intro * { transition: none !important; } }
