/* Advent 2026: Filzkalender auf Leinen */

:root {
  --linen: #f3e6d3;
  --linen-2: #e9d5bb;
  --cream: #fcf5ea;
  --cream-2: #f6ead8;
  --ink: #4b2a20;
  --ink-soft: #7a5546;

  --red: #a9323b;
  --green: #2f5b4d;
  --mustard: #d7a23f;
  --blush: #e9aca2;
  --cocoa: #7c4b35;
  --sage: #93aa8d;
  --gold: #e6b450;

  --thread: #c9a27a;
  --r: 14px;
  --gap: 10px;
  --cols: 4;
  --pad: 16px;

  --serif: "Fraunces", "Georgia", serif;
  --sans: "Nunito", system-ui, sans-serif;

  --felt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (min-width: 720px) {
  :root { --cols: 6; --gap: 16px; --r: 18px; --pad: 32px; }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--linen);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255, 214, 150, .55), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(169, 50, 59, .12), transparent 60%),
    repeating-linear-gradient(0deg, rgba(120, 80, 40, .035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(120, 80, 40, .035) 0 1px, transparent 1px 4px);
  overflow-x: hidden;
}

body.has-modal { overflow: hidden; }

/* ---------- snow ---------- */

/* Two tiled layers behind everything. Each layer only moves by exactly one
   tile period (x: one tile, y: three tiles), so the loop is seamless, and only
   transform is animated: the GPU moves a finished picture, nothing repaints. */
.snow {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.snow__layer {
  position: absolute;
  inset: calc(-3 * var(--tile)) calc(-1 * var(--tile)) 0 0;
  background: var(--img) repeat;
  will-change: transform;
  animation: snowfall var(--dur) linear infinite;
}
.snow__layer--far  { --tile: 240px; --img: url("snow-small.svg"); --dur: 34s; }
.snow__layer--near { --tile: 420px; --img: url("snow-big.svg"); --dur: 24s; }

@keyframes snowfall {
  to { transform: translate(calc(-1 * var(--tile)), calc(3 * var(--tile))); }
}

/* rest while a door is open (and with it maybe a video), and skip for reduced motion */
body.has-modal .snow__layer { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .snow { display: none; }
}

/* ---------- header ---------- */

.top {
  position: relative;
  text-align: center;
  padding: clamp(78px, 13vw, 116px) var(--pad) clamp(18px, 4vw, 34px);
}

.garland {
  position: absolute;
  inset: 0 0 auto;
  height: clamp(58px, 9vw, 86px);
  pointer-events: none;
}

.garland__wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.garland__wire path { fill: none; stroke: #33473a; stroke-width: 1.6; }

.bulb {
  position: absolute;
  width: 10px;
  height: 15px;
  margin: -2px 0 0 -5px;
  border-radius: 50% 50% 48% 48% / 40% 40% 60% 60%;
  background: radial-gradient(circle at 35% 30%, #fff8 0 18%, transparent 30%), var(--c);
  box-shadow: 0 0 12px 3px color-mix(in srgb, var(--c) 70%, transparent);
  animation: twinkle 2.6s ease-in-out infinite;
  animation-delay: calc(var(--d) * -1);
}
.bulb::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 2px;
  width: 6px;
  height: 5px;
  border-radius: 2px;
  background: #33473a;
}
.bulb:nth-child(odd) { rotate: -10deg; }
.bulb:nth-child(even) { rotate: 8deg; }

@keyframes twinkle {
  0%, 100% { opacity: 1; filter: brightness(1.05); }
  50% { opacity: .65; filter: brightness(.85); box-shadow: 0 0 5px 1px color-mix(in srgb, var(--c) 40%, transparent); }
}

.kicker {
  margin: 0;
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--green);
}

.title {
  margin: .1em 0 .15em;
  font-family: var(--serif);
  font-weight: 650;
  font-style: italic;
  font-size: clamp(2rem, 10.4vw, 5.4rem);
  line-height: .95;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  color: var(--red);
  text-shadow: 0 2px 0 rgba(255, 255, 255, .5);
}

/* ---------- calendar grid ---------- */

.calendar {
  --w: min(100vw - 2 * var(--pad), 980px);
  --cell: calc((var(--w) - (var(--cols) - 1) * var(--gap)) / var(--cols));
  width: var(--w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: var(--cell);
  grid-auto-flow: dense;
  gap: var(--gap);
}

/* From 6 columns on the grid is as high as it is wide (6 × 6 cells), so it can
   be sized to whatever room the header leaves: the whole calendar fits the
   window without scrolling. Below 400px of room the page scrolls again. */
@media (min-width: 720px) {
  body { display: flex; flex-direction: column; height: 100dvh; }
  .top { padding-top: clamp(64px, 11vh, 100px); padding-bottom: clamp(10px, 2.5vh, 22px); }
  .title { font-size: clamp(2rem, min(10.4vw, 8.5vh), 5.4rem); }
  .board { flex: 1; min-height: 400px; container-type: size; }
  .board .calendar {
    --w: min(100cqw - 2 * var(--pad), 980px, 100cqh - 72px);
    margin-bottom: 0;
  }
}

.door--w { grid-column: span 2; }
.door--t { grid-row: span 2; }
.door--b { grid-column: span 2; grid-row: span 2; }

/* ---------- a door ---------- */

.c-red     { --bg: var(--red);     --thread: #f2c9a8; --fg: #fbe6d3; --back: #8a2830; }
.c-green   { --bg: var(--green);   --thread: #e8c98a; --fg: #f6ead2; --back: #244a3e; }
.c-mustard { --bg: var(--mustard); --thread: #fff1cf; --fg: #fff7e6; --back: #b9862f; }
.c-blush   { --bg: var(--blush);   --thread: #fff; --fg: #8f2f38; --back: #d38f85; }
.c-cocoa   { --bg: var(--cocoa);   --thread: #f0c79a; --fg: #fbe8d4; --back: #623a29; }
.c-cream   { --bg: var(--cream);   --thread: #c8474f; --fg: var(--red); --back: #e8dac5; }
.c-sage    { --bg: var(--sage);    --thread: #f7efdf; --fg: #fffaf0; --back: #7a9175; }

.door {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  /* relative to the cell, so big doors don't throw their leaf far over the neighbours */
  --persp: calc(var(--cell) * 7);
  -webkit-tap-highlight-color: transparent;
  animation: drop-in .6s cubic-bezier(.2, .8, .3, 1.2) backwards;
  animation-delay: calc(var(--i) * 35ms);
}
.door.door--b { --persp: calc(var(--cell) * 12); }

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-14px) scale(.96); }
}

.door:focus-visible { outline: none; }
.door:focus-visible .door__front { outline: 3px solid var(--gold); outline-offset: 3px; }

/* what's behind the door */
.door__inside {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  background:
    radial-gradient(circle at 50% 45%, #fff3cf 0%, #f5c76a 32%, #c9792f 70%, #6e3320 100%);
  box-shadow: inset 0 3px 12px rgba(60, 20, 10, .55), inset 0 0 0 2px rgba(110, 51, 32, .35);
  display: grid;
  place-items: center;
}

.door__peek svg {
  width: clamp(22px, calc(var(--cell) * .34), 54px);
  height: clamp(22px, calc(var(--cell) * .34), 54px);
  fill: var(--cream);
  filter: drop-shadow(0 2px 3px rgba(110, 51, 32, .5));
}

.door__leaf {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transition: transform .5s ease;
}

.door__front,
.door__back {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  overflow: hidden;
}

/* Real 3D (and with it a GPU layer per door) only while a door is opening or
   open. Closed doors stay flat: two dozen composited doors with fractional
   positions gave 1px seams in Chrome whenever one of them animated. */
.door[data-state="open"] .door__leaf,
.door.is-opening .door__leaf { transform-style: preserve-3d; }

.door[data-state="open"] :is(.door__front, .door__back),
.door.is-opening :is(.door__front, .door__back) {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.door__front {
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--fg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .25) inset,
    0 -3px 0 rgba(0, 0, 0, .08) inset,
    0 3px 0 rgba(75, 42, 32, .12),
    0 8px 18px -6px rgba(75, 42, 32, .35);
}

.door__back {
  transform: rotateY(180deg);
  background: var(--back);
  visibility: hidden;
}
.door[data-state="open"] .door__back,
.door.is-opening .door__back { visibility: visible; }

/* felt texture + stitching, on both sides */
.door__front::before,
.door__back::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--felt);
  opacity: .22;
  pointer-events: none;
}
.door__front::after,
.door__back::after {
  content: "";
  position: absolute;
  inset: clamp(5px, 6%, 9px);
  border: 2px dashed var(--thread);
  border-radius: calc(var(--r) - 6px);
  opacity: .85;
  pointer-events: none;
}

.door__num {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72;
  font-size: clamp(1.4rem, calc(var(--cell) * .4), 3rem);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.door--b .door__num { font-size: clamp(2.6rem, calc(var(--cell) * .75), 5.6rem); }
.door--w .door__num,
.door--t .door__num { font-size: clamp(1.8rem, calc(var(--cell) * .5), 3.6rem); }

/* ---------- stickers (sprite drawn in tools/stickers.html) ---------- */

.sticker {
  position: absolute;
  width: var(--s, 48px);
  height: var(--s, 48px);
  background: url("icons.webp") calc(var(--x) * 20%) calc(var(--y) * 33.333%) / 600% 400% no-repeat;
  rotate: var(--rot, 0deg);
  pointer-events: none;
}

/* The seal: each closed door is stuck shut with its own sticker across the
   edge that opens (the hinge is on the left). It sits on the door, not the
   leaf, and pops off when the door opens. Doors have no stacking context
   (the perspective lives in the leaf's transform), so z-index lifts it over
   the neighbouring door. */
.seal {
  --s: clamp(32px, calc(var(--cell) * var(--f)), 96px);
  z-index: 5;
  top: calc(var(--t) - var(--s) / 2);
  right: calc(var(--s) * -.42);
}

/* hand-stuck clusters, overlapping each other */
.calendar { position: relative; }
.deco { z-index: 6; }
.title { position: relative; display: inline-block; }
.title .deco { z-index: 0; }
.deco--wide { display: none; }
@media (min-width: 1240px) {
  .deco--wide { display: block; }
}

.door__tag {
  position: absolute;
  bottom: 12%;
  left: 50%;
  translate: -50% 0;
  padding: .2em .7em;
  border-radius: 99px;
  background: var(--gold);
  color: #5a3313;
  font-size: clamp(.6rem, 2.2vw, .78rem);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}

/* Doors you may open glow a little. The glow is painted once and only its
   opacity is animated; animating box-shadow repaints every frame and left
   1px seams next to the doors in Chrome. */
.door::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  box-shadow: 0 0 0 5px rgba(230, 180, 80, .45), 0 0 26px 6px rgba(255, 200, 100, .45);
  opacity: 0;
  pointer-events: none;
}
.door[data-state="ready"]::before {
  animation: breathe 3.2s ease-in-out infinite;
}
.door.is-today::before { animation-duration: 2.2s; }
.door.is-today .door__front { animation: nudge 5s ease-in-out infinite 2s; }
.door.is-opening::before { animation: none; }

@keyframes breathe {
  50% { opacity: 1; }
}
@keyframes nudge {
  0%, 88%, 100% { transform: none; }
  91% { transform: rotate(-2.5deg); }
  94% { transform: rotate(2deg); }
  97% { transform: rotate(-1deg); }
}

@media (hover: hover) {
  .door[data-state="ready"]:hover .door__leaf,
  .door[data-state="locked"]:hover .door__leaf,
  .door[data-state="early"]:hover .door__leaf { transform: perspective(var(--persp)) rotateY(8deg); }
  .door[data-state="open"]:hover .door__peek svg { transform: scale(1.12); }
}
.door__peek svg { transition: transform .25s ease; }

/* Opened: the door swings inwards, into its own box, like a room door. The
   leaf stays inside its own cell, so it never covers another door. */
.door[data-state="open"] .door__leaf { transform: perspective(var(--persp)) rotateY(80deg); pointer-events: none; }
.door[data-state="open"] .door__front { animation: none; }

/* first the seal pops off, then the door swings open */
.door.is-opening .door__leaf {
  transition: none;
  animation: swing-open 1s cubic-bezier(.45, .05, .25, 1) .3s both;
}
.door.is-opening .seal { animation: seal-off .6s cubic-bezier(.3, .5, .4, 1) forwards; }
@keyframes seal-off {
  0%   { transform: none; }
  30%  { transform: translate(-3px, -8px) scale(1.2) rotate(-10deg); opacity: 1; }
  100% { transform: translate(60px, -120px) scale(.7) rotate(50deg); opacity: 0; }
}
@keyframes swing-open {
  0%   { transform: perspective(var(--persp)) rotateY(0); }
  18%  { transform: perspective(var(--persp)) rotateY(-9deg); }
  30%  { transform: perspective(var(--persp)) rotateY(-3deg); }
  100% { transform: perspective(var(--persp)) rotateY(80deg); }
}

.door.is-locked-shake { animation: shake .45s ease; }
@keyframes shake {
  20% { transform: translateX(-5px) rotate(-1.5deg); }
  40% { transform: translateX(5px) rotate(1.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* little sparkles when a door opens */
.spark {
  position: fixed;
  z-index: 40;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  pointer-events: none;
  background: var(--sc, var(--gold));
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark .9s ease-out forwards;
}
@keyframes spark {
  from { transform: translate(0, 0) scale(.4) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(160deg); opacity: 0; }
}

/* room below the calendar */
.calendar { margin-bottom: calc(56px + env(safe-area-inset-bottom)); }

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 24, 16, .55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.modal__card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background-color: var(--cream);
  background-image: radial-gradient(ellipse at 50% 0, #fff9ef, transparent 70%);
  box-shadow: 0 30px 80px -20px rgba(40, 12, 6, .6);
  transform-origin: 0 0;
}
.modal__card:focus { outline: none; }
.modal__card.is-wide { width: min(920px, 100%); }

/* the stitching stays in place while the content scrolls below it */
.modal__card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px dashed rgba(169, 50, 59, .4);
  border-radius: 16px;
  pointer-events: none;
}

.modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(75, 42, 32, .1), 0 2px 6px -2px rgba(75, 42, 32, .3);
  transition: background-color .15s, color .15s, opacity .2s;
}
.modal__close:hover,
.modal__close:focus-visible { background: var(--red); color: var(--cream); outline: none; }
.modal__close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }

.modal__content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: opacity .3s ease;
}
.modal.is-zooming .modal__content,
.modal.is-zooming .modal__close { opacity: 0; transition: none; }

/* ---------- door content ---------- */

.sheet { padding: clamp(26px, 6vw, 48px) clamp(22px, 6vw, 52px) clamp(28px, 6vw, 44px); }

.sheet__head {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 18px);
  padding-right: 44px;
  margin-bottom: 1.2rem;
}
.sheet__sticker { position: relative; flex: none; --s: clamp(72px, 21vw, 96px); margin: -12px -4px -12px -12px; }

.sheet__date {
  margin: 0;
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--red);
}

.sheet__title {
  margin: .2em 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-variation-settings: "SOFT" 100, "WONK" 0, "opsz" 96;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  line-height: 1.08;
  color: var(--ink);
}

.prose { font-size: 1.07rem; line-height: 1.65; }
.prose p { margin: 0 0 .9em; }
.prose a { color: var(--red); }
.prose .signature { font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--red); }

.media {
  position: relative;
  margin: 0 calc(clamp(22px, 6vw, 52px) * -.5) 1.4rem;
  border-radius: 16px;
  overflow: hidden;
  background: #2a1510;
  box-shadow: 0 10px 30px -12px rgba(60, 20, 10, .6);
}
.media video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

.media__missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: .4rem;
  text-align: center;
  color: #f3dcc0;
  background: repeating-linear-gradient(45deg, #3a1d15 0 14px, #43231a 14px 28px);
}
.media__missing span { font-size: 2.4rem; }
.media__missing p { margin: 0; font-weight: 700; }
.media__missing small { font-weight: 400; opacity: .7; font-family: ui-monospace, monospace; }

.sheet__image { display: block; width: 100%; border-radius: 14px; margin-bottom: 1.2rem; }

.riddle__question { font-size: 1.15rem; }

.riddle__form { display: flex; gap: .5rem; margin-top: .4rem; }
.riddle__form input {
  flex: 1;
  min-width: 0;
  padding: .75rem 1rem;
  border: 2px solid var(--linen-2);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
}
.riddle__form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(230, 180, 80, .3); }
.riddle__form button {
  padding: .75rem 1.2rem;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: var(--cream);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #1f3e34;
}
.riddle__form button:active { translate: 0 2px; box-shadow: 0 1px 0 #1f3e34; }
.riddle__form.is-wrong { animation: shake .45s ease; }
.riddle__hint { margin: .7rem 0 0; color: var(--red); font-weight: 600; }
.riddle__solution { padding: 1rem 1.2rem; border-radius: 16px; background: #fff3d6; animation: drop-in .5s ease both; }

/* crossword */
.xword { container-type: inline-size; }

.xword__grid {
  /* On small screens the grid reaches a bit into the sheet padding to give the cells more room. */
  --bleed: calc(clamp(22px, 6vw, 52px) * .4);
  --gap: 3px;
  --size: min(44px, calc((100cqw + 2 * var(--bleed) - (var(--w) - 1) * var(--gap)) / var(--w)));
  display: grid;
  grid-template-columns: repeat(var(--w), var(--size));
  grid-template-rows: repeat(var(--h), var(--size));
  gap: var(--gap);
  justify-content: center;
  margin: .4rem calc(var(--bleed) * -1) 1.2rem;
}
.xword__grid.is-wrong { animation: shake .45s ease; }
@container (max-width: 400px) { .xword__grid { --gap: 2px; } }

.xword__cell {
  position: relative;
  display: block;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--linen-2), 0 2px 0 var(--linen-2);
  transition: background-color .15s;
}
.xword__cell.is-active { background: #fff3d6; box-shadow: inset 0 0 0 1.5px var(--gold), 0 2px 0 var(--linen-2); }
.xword__cell:focus-within { background: #ffe3a3; box-shadow: inset 0 0 0 2px var(--gold), 0 2px 0 var(--linen-2); }
.xword__cell.is-wrong input { color: var(--red); }
.xword__cell.is-wrong { background: #fbe1dc; }

/* Letters of the keyword sit in a little circle. */
.xword__cell.is-key::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1.5px solid var(--red);
  border-radius: 50%;
  opacity: .55;
  pointer-events: none;
}

.xword__num {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: clamp(.4rem, calc(var(--size) * .28), .7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink-soft);
  pointer-events: none;
}

.xword__cell input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  text-transform: uppercase;
  font: 700 min(1.3rem, calc(var(--size) * .6)) / 1 var(--sans); /* no iOS focus zoom, see app.js */
  color: var(--ink);
  caret-color: transparent;
  cursor: pointer;
}
.xword__cell input:focus { outline: none; }
.xword.is-solved .xword__cell { background: #eef4e8; box-shadow: inset 0 0 0 1.5px var(--sage), 0 2px 0 var(--linen-2); }
.xword.is-solved .xword__cell input { color: var(--green); cursor: default; }

.xword__keyword {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1.4rem;
}
.xword__keyword span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px dashed var(--red);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--red);
  background: #fff;
}
.xword.is-solved .xword__keyword span { border-style: solid; background: #fff3d6; }

.xword__clues {
  display: grid;
  gap: .4rem 1.6rem;
  margin-bottom: 1rem;
}
@container (min-width: 460px) {
  .xword__clues { grid-template-columns: 1fr 1fr; }
}
.xword__clues h3 {
  margin: 0 0 .3rem;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--red);
}
.xword__clues ol { margin: 0 0 .6rem; padding: 0; list-style: none; }
.xword__clues li {
  display: grid;
  grid-template-columns: 1.5em 1fr;
  margin: 0 -.5rem;
  padding: .25rem .5rem;
  border-radius: 8px;
  line-height: 1.4;
  cursor: pointer;
}
.xword__clues li b { color: var(--ink-soft); }
.xword__clues li.is-active { background: #fff3d6; }
.xword.is-solved .xword__clues li { cursor: default; }

.xword__actions .riddle__hint { margin-top: .5rem; }
.xword__check {
  padding: .75rem 1.4rem;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: var(--cream);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #1f3e34;
}
.xword__check:active { translate: 0 2px; box-shadow: 0 1px 0 #1f3e34; }

.verse {
  margin-top: 2rem;
  text-align: center;
  color: var(--ink-soft);
}
.verse__ornament { width: 120px; height: 16px; color: var(--gold); }
.verse blockquote {
  margin: .6rem auto .4rem;
  max-width: 34ch;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.5;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  color: var(--ink);
}
.verse cite {
  font-style: normal;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--green);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 60;
  translate: -50% 0;
  max-width: calc(100vw - 32px);
  padding: .75rem 1.2rem;
  border-radius: 99px;
  background: var(--cocoa);
  color: var(--cream);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 30px -10px rgba(60, 20, 10, .6);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: none; }

/* ---------- debug ---------- */

.debug {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, .85);
  font-size: .8rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Phones widen the layout for anything that sticks out, even with overflow hidden on body. */
@media (max-width: 719px) {
  .top, .board { overflow-x: clip; }
}

/* ---------- login ---------- */
body.login-page {
  display: grid;
  /* Not wider than the screen, whatever default width the browser gives the input. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  height: auto;
  min-height: 100dvh;
  padding: 28px;
  box-sizing: border-box;
}

.login {
  position: relative;
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 2.6rem clamp(22px, 6vw, 40px) 2.2rem;
  border-radius: 26px;
  background: var(--cream);
  box-shadow: 0 0 0 7px var(--cream), 0 0 0 8.5px var(--blush), 0 24px 50px -20px rgba(75, 42, 32, .45);
  text-align: center;
  animation: drop-in .6s cubic-bezier(.2, .8, .3, 1.2) both;
}
.login__sticker { --s: clamp(72px, 21vw, 92px); top: -46px; right: -10px; }
.login__text { margin: .8rem 0 1.3rem; line-height: 1.55; color: var(--ink-soft); }
.login__text small { font-family: ui-monospace, monospace; }
.login .riddle__form { text-align: left; }
.login .riddle__hint { margin-top: .8rem; }
