/* ==========================================================
   Laura's Art Advent Calendar 2026: shared styles
   ========================================================== */

/* ---------- Design tokens ---------- */
:root {
  --yellow: #FFC800;
  --magenta: #FF2E93;
  --cobalt: #1F3FBF;
  --red: #E8332A;
  --orange: #FF8A00;
  --turquoise: #17B7C9;
  --navy: #14206B;
  --cream: #FFF4DC;
  /* Deeper shades for text: cream text on them (and them on cream) is easy to read */
  --magenta-ink: #C8146E;
  --green-ink: #1F7A37;

  --font-display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --outline: 3px solid var(--navy);
  --radius: 14px;
  --shadow: 4px 4px 0 var(--navy); /* flat pop-art shadow, no blur */
  --gutter: 16px;
  --gap: 8px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--navy);
  background-color: var(--yellow);
  /* Ben-Day dots, the classic pop-art print texture */
  background-image: radial-gradient(rgba(255, 138, 0, 0.35) 1.6px, transparent 1.8px);
  background-size: 14px 14px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px var(--gutter) 40px;
}

/* Cream card with a navy outline: the box for all text content */
.card {
  background: var(--cream);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.btn {
  display: inline-block;
  min-height: 48px;
  padding: 10px 22px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--cream);
  background: var(--magenta-ink);
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--navy);
  text-decoration: none;
  cursor: pointer;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }

:focus-visible { outline: 3px dashed var(--navy); outline-offset: 3px; }

/* ---------- Calendar header ---------- */
.cal-header { text-align: center; margin-bottom: 18px; }

.cal-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400; /* Bowlby One only has one (very bold) weight */
  line-height: 0.95;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.cal-title span { display: block; }

.cal-title__name {
  font-size: clamp(40px, 13vw, 58px);
  color: var(--magenta);
  -webkit-text-stroke: 2px var(--navy);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--navy);
  transform: rotate(-3deg);
}
.cal-title__main {
  margin-top: 8px;
  font-size: clamp(25px, 7.8vw, 35px);
  color: var(--navy);
}
.cal-title__year {
  display: inline-block !important;
  margin-top: 10px;
  padding: 2px 14px 4px;
  font-size: clamp(22px, 6.5vw, 30px);
  color: var(--cream);
  background: var(--red);
  border: var(--outline);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--navy);
  transform: rotate(2deg);
}

.cal-sub {
  display: inline-block;
  margin: 14px 0 0;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  text-wrap: balance;
  background: var(--cream);
  border: var(--outline);
  border-radius: 18px;
}

/* ---------- Mosaic grid ---------- */
.grid {
  /* Size of one square cell: a quarter of the width, at most 110 px */
  --cell: min(calc((100vw - 2 * var(--gutter) - 3 * var(--gap)) / 4), calc((480px - 2 * var(--gutter) - 3 * var(--gap)) / 4));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: var(--cell);
  gap: var(--gap);
}

/* ---------- Tiles ---------- */
.tile {
  position: relative;
  display: block;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  overflow: hidden;
  border: var(--outline);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--navy);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }

.tile--yellow    { background: var(--yellow); }
.tile--magenta   { background: var(--magenta); }
.tile--cobalt    { background: var(--cobalt); }
.tile--red       { background: var(--red); }
.tile--orange    { background: var(--orange); }
.tile--turquoise { background: var(--turquoise); }
.tile--cream     { background: var(--cream); }

.tile__art {
  position: absolute;
  inset: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile__art .motif { width: 100%; height: 100%; display: block; }

/* Chunky door number in the top-left corner */
.tile__num {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
  color: var(--navy);
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  z-index: 2;
}
.tile--big .tile__num { min-width: 40px; height: 40px; font-size: 24px; top: 7px; left: 7px; }

/* Small round badges in the bottom-right corner (lock, check) */
.tile__badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 28px;
  height: 28px;
  padding: 3px;
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  z-index: 2;
}
.tile__badge svg { display: block; width: 100%; height: 100%; }
.tile__badge--check { background: var(--turquoise); }

.tile__sticker {
  position: absolute;
  right: 3px;
  bottom: 5px;
  padding: 0 4px 1px;
  font-family: var(--font-display);
  font-size: 9px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--yellow);
  border: 2px solid var(--navy);
  border-radius: 6px;
  transform: rotate(-8deg);
  z-index: 2;
}

/* --- States --- */
.tile.is-locked .tile__art { opacity: 0.45; filter: saturate(0.35); }
.tile.is-locked::after {
  /* a navy veil over the colour, so locked tiles look dimmed */
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 32, 107, 0.35);
  z-index: 1;
}
.tile.is-opened .tile__art { opacity: 0.9; }
.tile.is-available { animation: invite 3.2s ease-in-out infinite; }

/* ---------- Animations ---------- */
@keyframes wobble {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-5deg) scale(1.04); }
  45% { transform: rotate(4deg) scale(1.04); }
  70% { transform: rotate(-2deg) scale(1.02); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}
/* a little nudge every few seconds on doors that are ready to open */
@keyframes invite {
  0%, 88%, 100% { transform: rotate(0); }
  92% { transform: rotate(-2.5deg); }
  96% { transform: rotate(2deg); }
}
.anim-wobble { animation: wobble 0.45s ease both !important; z-index: 3; }
.anim-shake  { animation: shake 0.4s ease both !important; }

/* ---------- Toast message ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  padding: 12px 16px;
  font-weight: 800;
  font-size: 17px;
  text-align: center;
  background: var(--cream);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 20;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Door 24 surprise card ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(20, 32, 107, 0.6);
  z-index: 30;
}
.modal[hidden] { display: none; }
.modal__card {
  width: min(380px, 100%);
  text-align: center;
  animation: pop-in 0.3s ease both;
}
.modal__kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--magenta-ink);
  text-transform: uppercase;
}
.modal__title {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
}
@keyframes pop-in {
  from { transform: scale(0.85) rotate(-3deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

/* ==========================================================
   Door page
   ========================================================== */
.door-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  background: var(--yellow);
}
.door-top__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--navy);
  background: var(--cream);
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--navy);
}
.door-top__back svg { width: 22px; height: 22px; }
.door-top__title { font-family: var(--font-display); font-size: 22px; }

.door { padding-top: 6px; }
/* Leave room for the sticky "Door N" bar when the page scrolls to something */
.after, .door-sec, .painting-wrap, .spot-question { scroll-margin-top: 76px; }

.game-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}
.game-intro { margin: 0 0 10px; font-weight: 700; }

/* Things to find */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.chip {
  padding: 4px 12px;
  font-weight: 800;
  font-size: 16px;
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  transition: background-color 0.25s ease, transform 0.25s ease;
}
.chip.is-found { background: var(--green-ink); color: var(--cream); transform: scale(1.06); }
.chip.is-found::before { content: "\2713\00a0"; }

/* ---------- The painting ---------- */
.painting-wrap { position: relative; }
.painting {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.painting__inner { position: relative; margin: 0 auto; }
.painting__img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.painting.is-game { touch-action: none; cursor: crosshair; }
.painting.is-explore { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.painting.is-explore::-webkit-scrollbar { display: none; }

/* Little bar under a wide painting showing which part is visible */
.painting__pan {
  position: relative;
  height: 8px;
  margin: 10px 24px 0;
  background: rgba(20, 32, 107, 0.2);
  border-radius: 999px;
}
.painting__pan span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--navy);
  border-radius: 999px;
}

.painting__tip { margin: 8px 0 0; font-size: 16px; font-weight: 700; text-align: center; }

/* Phone held sideways: the painting uses the whole screen width,
   so a wide painting like the Lascaux cave fits without sliding. */
@media (orientation: landscape) and (max-height: 540px) {
  .painting-wrap {
    width: calc(100vw - 2 * var(--gutter));
    margin-left: calc(50% - 50vw + var(--gutter));
  }
  .painting__tip { display: none; }
}

/* Reveal game */
.reveal-dark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 1.2s ease;
}
.reveal-dark.is-fading { opacity: 0; }
.reveal-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--navy);
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  pointer-events: none;
  transition: opacity 0.4s ease;
  animation: bob 1.6s ease-in-out infinite;
}
.reveal-hint.is-gone { opacity: 0; }
@keyframes bob { 50% { transform: translate(-50%, -5px); } }

/* Quiz */
.quiz { margin-top: 16px; }
.quiz.is-in { animation: pop-in 0.35s ease both; }
.quiz__label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  color: var(--magenta-ink);
}
.quiz__q { margin: 2px 0 12px; font-weight: 800; font-size: 19px; line-height: 1.3; }
.quiz__options { display: grid; gap: 8px; }
.quiz__opt {
  min-height: 48px;
  padding: 10px 14px;
  font-weight: 800;
  text-align: left;
  background: var(--yellow);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: 2px 2px 0 var(--navy);
  cursor: pointer;
}
.quiz__opt:disabled { cursor: default; }
.quiz__opt.is-wrong { background: #E9E2D2; color: rgba(20, 32, 107, 0.55); text-decoration: line-through; animation: shake 0.4s ease; }
.quiz__opt.is-right { background: var(--green-ink); color: var(--cream); }
.quiz__feedback { min-height: 1.5em; margin: 10px 0 0; font-weight: 700; }

/* Restore game */
.painting.is-restoring .painting__inner { background: #E8DDC6; }
.painting.is-restoring .painting__img { opacity: 0; transition: opacity 0.9s ease; }
.painting.is-restoring.is-hinting .painting__img { opacity: var(--hint, 0.2); transition-duration: 0.4s; }
.painting.is-restored .painting__img { opacity: 1; }
.painting.is-restored .restore-piece,
.painting.is-restored .restore-slot { opacity: 0; transition: opacity 0.9s ease; }

.restore-slot {
  position: absolute;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 2px dashed rgba(20, 32, 107, 0.35);
  border-radius: 0;
  z-index: 1;
  cursor: pointer;
}
.restore-slot:disabled { border-color: transparent; cursor: default; }
.painting.is-choosing .restore-slot:not(:disabled) { background: rgba(255, 200, 0, 0.22); border-color: var(--navy); }
.restore-slot.is-wrong { animation: wrong-flash 0.5s ease; }
@keyframes wrong-flash { 30% { background: rgba(232, 51, 42, 0.45); } }

.hint-row { margin: 10px 0 0; text-align: right; }
.hint-btn {
  min-height: 44px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 16px;
  color: var(--navy);
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--navy);
  cursor: pointer;
}
.hint-btn[aria-pressed="true"] { background: var(--turquoise); color: var(--cream); }
.hint-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--navy); }

.restore-tray {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 244, 220, 0.55);
  border: 3px dashed var(--navy);
  border-radius: var(--radius);
}
.restore-cell { position: relative; height: var(--cell-h, 90px); }
.restore-cell.is-empty::after {
  content: "";
  position: absolute;
  inset: 10% 8%;
  border: 2px dotted rgba(20, 32, 107, 0.3);
  border-radius: 8px;
}

.restore-piece {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cw, 100px);
  height: var(--ch, 70px);
  transform: translate(-50%, -50%) scale(var(--s, 0.9)) rotate(var(--tilt, 0deg));
  filter: drop-shadow(2px 3px 0 rgba(20, 32, 107, 0.85));
  touch-action: none;
  cursor: grab;
  transition: transform 0.15s ease, filter 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}
.restore-piece__img { width: 100%; height: 100%; background-repeat: no-repeat; }
.restore-piece.is-selected {
  transform: translate(-50%, -50%) scale(calc(var(--s, 0.9) * 1.08)) rotate(0deg);
  filter: drop-shadow(0 0 0 var(--magenta)) drop-shadow(3px 4px 0 var(--magenta));
  z-index: 2;
}
.restore-piece.is-dragging {
  position: fixed;
  z-index: 70;
  transform: scale(1.04);
  filter: drop-shadow(4px 7px 0 rgba(20, 32, 107, 0.6));
  cursor: grabbing;
  transition: none;
}
.restore-piece.is-placed {
  position: absolute;
  transform: none;
  filter: none;
  z-index: 2;
  pointer-events: none;
  transition: none;
}
.restore-piece.is-snapping { animation: snap-in 0.28s ease; }
@keyframes snap-in {
  0% { transform: scale(1.07); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); }
}
.restore-status { margin: 10px 0 0; font-weight: 800; text-align: center; }

/* True or false game */
.painting__img { transition: filter 0.7s ease, transform 0.7s ease; }
.painting.is-tf { display: flex; align-items: center; min-height: 260px; }
.painting.is-tf .painting__img { filter: blur(var(--tf-blur, 14px)); transform: scale(1.1); }

.tf-layer { position: absolute; inset: 24px 30px; z-index: 3; }
/* Cards in their own box (when the painting is shown above the game) */
.tf-box {
  position: relative;
  height: 290px;
  background: var(--cobalt);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tf-box .tf-layer { inset: 22px 20px; }
.tf-layer.has-more::before,
.tf-layer.has-more-2::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cream);
  border: var(--outline);
  border-radius: var(--radius);
}
.tf-layer.has-more::before { transform: translate(5px, 6px) rotate(2.5deg); }
.tf-layer.has-more-2::after { transform: translate(-4px, 9px) rotate(-3deg); z-index: -1; }

.tf-card { position: absolute; inset: 0; z-index: 1; perspective: 1000px; touch-action: none; }
.tf-card.is-entering { animation: card-in 0.35s ease backwards; }
.tf-card.is-leaving { animation: card-out 0.35s ease forwards; }
@keyframes card-in { from { transform: translateY(18px) scale(0.94); opacity: 0; } }
@keyframes card-out { to { transform: translateY(-30px) scale(0.9); opacity: 0; } }

.tf-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}
.tf-card.is-flipped .tf-card__inner { transform: rotateY(180deg); }
.tf-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 14px;
  text-align: center;
  background: rgba(255, 244, 220, 0.93);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.tf-front { cursor: grab; }
.tf-back { transform: rotateY(180deg); padding: 10px 14px; background: var(--cream); }
.tf-count {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--magenta-ink);
}
.tf-text { margin: 0; font-weight: 800; font-size: 19px; line-height: 1.3; }
.tf-swipe-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  opacity: 0.75;
}
.tf-stamp {
  position: absolute;
  top: 34px;
  padding: 0 10px;
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  background: var(--cream);
  border: 3px solid currentColor;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}
.tf-stamp--true { left: 12px; color: #1F7A37; transform: rotate(-12deg); }
.tf-stamp--false { right: 12px; color: var(--red); transform: rotate(12deg); }

.tf-verdict { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.tf-card.is-right .tf-verdict { color: #1F7A37; }
.tf-card.is-wrong .tf-verdict { color: var(--red); }
.tf-card.is-right .tf-back { box-shadow: 4px 4px 0 var(--green-ink); }
.tf-card.is-wrong .tf-back { box-shadow: 4px 4px 0 var(--red); }
.tf-answer { margin: 4px 0 6px; font-weight: 800; font-size: 18px; }
.tf-expl { margin: 0 0 10px; font-size: 16px; line-height: 1.35; }
.tf-next {
  align-self: center;
  min-height: 44px;
  padding: 6px 22px;
  font-weight: 800;
  font-size: 17px;
  color: var(--navy);
  background: var(--yellow);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--navy);
  cursor: pointer;
}

.tf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tf-btn {
  min-height: 58px;
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  color: var(--cream);
  border: var(--outline);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--navy);
  cursor: pointer;
}
.tf-btn--false { background: var(--red); }
.tf-btn--true { background: var(--green-ink); }
.tf-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }
.tf-btn:disabled { color: rgba(20, 32, 107, 0.35); background: #E9E2D2; border-color: rgba(20, 32, 107, 0.35); box-shadow: none; cursor: default; }

.tf-score { margin-top: 14px; text-align: center; animation: pop-in 0.35s ease both; }
.tf-score__num {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.1;
  color: var(--magenta);
  text-shadow: 2px 2px 0 var(--navy);
}
.tf-score__msg { margin: 4px 0 0; font-weight: 800; }

/* Spot the detail game */
.painting.is-spot .painting__inner { cursor: pointer; }
.spot-question { margin-bottom: 12px; padding: 12px 16px; }
.spot-question.is-in { animation: pop-in 0.3s ease both; }
.spot-question__count {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--magenta-ink);
}
.spot-question__text { margin: 2px 0 0; font-weight: 800; font-size: 20px; line-height: 1.25; }

.spot-ring, .spot-miss, .edit-area {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}
.spot-ring {
  aspect-ratio: 1;
  border: 4px solid var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--navy), inset 0 0 0 3px var(--navy);
  animation: ring-in 0.45s cubic-bezier(.3, 1.6, .6, 1) both;
}
.spot-ring.is-shown { border-color: var(--magenta); }
@keyframes ring-in {
  from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.spot-miss {
  width: 22px;
  height: 22px;
  animation: miss-fade 1.2s ease forwards;
}
.spot-miss::before, .spot-miss::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 5px;
  margin: -2.5px 0 0 -11px;
  background: var(--cream);
  border: 1.5px solid var(--navy);
  border-radius: 3px;
  transform: rotate(45deg);
}
.spot-miss::after { transform: rotate(-45deg); }
@keyframes miss-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

.spot-feedback { min-height: 64px; margin-top: 12px; }
.spot-hint {
  margin: 0;
  padding: 10px 14px;
  font-weight: 800;
  text-align: center;
  color: var(--navy);
  background: var(--cream);
  border: 2.5px solid var(--navy);
  border-radius: 14px;
}
.spot-hint__heat { display: block; }
.spot-hint__left { display: block; font-size: 15px; font-weight: 700; opacity: 0.75; }
.spot-hint--hot      { background: var(--red); color: var(--cream); animation: shake 0.4s ease; }
.spot-hint--warm     { background: var(--orange); }
.spot-hint--cold     { background: var(--turquoise); }
.spot-hint--freezing { background: var(--cobalt); color: var(--cream); }

.spot-answer { text-align: center; animation: pop-in 0.3s ease both; }
.spot-answer__title { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 1.1; color: #1F7A37; }
.spot-answer.is-shown .spot-answer__title { color: var(--magenta); }
.spot-answer__text { margin: 6px 0 12px; }

/* #edit: the tap area of a Spot the detail round */
.edit-area {
  aspect-ratio: 1;
  border: 2px dashed var(--cream);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--red);
}

/* Timeline game */
.tl { position: relative; }
.tl-end {
  margin: 0 0 6px 4px;
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
}
.tl-end--bottom { margin: 6px 0 0 4px; }
.tl-list {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
}
/* The timeline rail on the left */
.tl-list::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 5px;
  background: var(--navy);
  border-radius: 3px;
}
.tl-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 64px;
  padding: 6px 6px 6px 0;
  background: var(--cream);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--navy);
}
/* Dot on the rail */
.tl-card::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: var(--yellow);
  border: 3px solid var(--navy);
  border-radius: 50%;
}
.tl-card.is-dragging {
  z-index: 5;
  background: #fff;
  box-shadow: 6px 8px 0 rgba(20, 32, 107, 0.45);
}
.tl-grip {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: stretch;
  width: 30px;
  min-height: 44px;
  touch-action: none;
  cursor: grab;
}
.tl-grip span { width: 18px; height: 3px; background: var(--navy); border-radius: 2px; }
.tl-card.is-dragging .tl-grip { cursor: grabbing; }
.tl-body { flex: 1; min-width: 0; }
.tl-text { margin: 0; font-weight: 700; font-size: 16px; line-height: 1.3; }
.tl-reveal { display: none; margin: 4px 0 0; }
.tl.is-solved .tl-reveal { display: flex; flex-wrap: wrap; gap: 6px; animation: pop-in 0.35s ease both; }
.tl-year {
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--cream);
  background: var(--magenta-ink);
  border-radius: 6px;
}
.tl-link {
  padding: 0 8px;
  font-size: 16px;
  font-weight: 800;
  background: var(--yellow);
  border: 1.5px solid var(--navy);
  border-radius: 6px;
}
.tl-arrows { flex: none; display: flex; gap: 4px; }
.tl-arrow {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 15px;
  color: var(--navy);
  background: var(--yellow);
  border: 2.5px solid var(--navy);
  border-radius: 10px;
  cursor: pointer;
}
.tl-arrow:disabled { opacity: 0.3; cursor: default; }
.tl.is-solved .tl-arrows { display: none; }

.tl-card.is-right { background: #D8F1DE; border-color: #1F7A37; }
.tl-card.is-right::before { background: var(--green-ink); }
.tl-card.is-wrong { background: #FBD9D6; border-color: var(--red); animation: shake 0.4s ease; }
.tl-card.is-wrong::before { background: var(--red); }

.tl-check { background: var(--cobalt); }
.tl-status { min-height: 1.5em; margin: 10px 0 0; font-weight: 800; text-align: center; }

.door-painting { margin-top: 20px; }
/* Timeline doors: title card and painting above the game */
.painting-first { display: grid; gap: 16px; margin-bottom: 22px; }
.painting-first[hidden] { display: none; }
.painting-first .door-painting { margin-top: 0; }
.sec-work.is-preview .work-meta { display: none; }
.sec-work.is-preview .work-artist { margin-bottom: 0; }
.sec-work:not(.is-preview) .work-meta { animation: rise-in 0.5s ease both; }
.door-painting:not([hidden]) { animation: rise-in 0.6s ease both; }

/* Analog challenge */
.challenge { padding: 18px 16px; text-align: center; }
.challenge__kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  color: var(--magenta-ink);
}
.challenge__title {
  margin: 2px 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.05;
  color: var(--cobalt);
  text-shadow: 3px 3px 0 var(--yellow);
  transform: rotate(-2deg);
}
.challenge__text { margin: 0 0 14px; font-weight: 700; font-size: 18px; line-height: 1.4; }
.challenge__materials {
  margin: 0 0 14px;
  padding: 10px 14px;
  text-align: left;
  background: var(--yellow);
  border: 2.5px solid var(--navy);
  border-radius: 12px;
}
.challenge__materials[hidden] { display: none; }
.challenge__label { margin: 0 0 4px; font-family: var(--font-display); font-size: 14px; text-transform: uppercase; }
.challenge__materials ul { margin: 0; padding-left: 20px; }
.challenge__materials li { margin: 2px 0; }

.timer { padding-top: 4px; }
.timer[hidden] { display: none; }
.timer__time {
  margin: 0;
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.timer.is-running .timer__time { color: var(--cobalt); }
.timer.is-over .timer__time { color: var(--red); animation: wobble 0.5s ease 2; }
.timer__bar {
  height: 10px;
  margin: 10px 8px 12px;
  overflow: hidden;
  background: #E9E2D2;
  border: 2px solid var(--navy);
  border-radius: 999px;
}
.timer__bar span { display: block; height: 100%; width: 0; background: var(--orange); transition: width 0.2s linear; }
.timer__buttons { display: flex; justify-content: center; gap: 10px; }
.timer__btn {
  min-width: 110px;
  min-height: 48px;
  padding: 6px 18px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--navy);
  background: var(--turquoise);
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--navy);
  cursor: pointer;
}
.timer__reset { background: var(--cream); }
.timer__btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }
.timer__btn:disabled { opacity: 0.4; cursor: default; }
.timer__msg { min-height: 1.4em; margin: 10px 0 0; font-weight: 800; color: var(--red); }

.btn.challenge__done { margin-top: 18px; font-size: 26px; min-height: 64px; background: var(--magenta-ink); }
.btn.challenge__done.is-done { background: var(--green-ink); opacity: 1; cursor: default; }
.challenge.is-done { opacity: 0.85; }
.challenge__small { margin: 12px 0 0; font-size: 16px; text-align: center; opacity: 0.8; }

/* Analog: the painting fades in first, then sections 3 to 6 follow */
#sec-painting:not([hidden]) ~ .after.is-revealing .door-sec { animation-delay: 0.6s; }
#sec-painting:not([hidden]) ~ .after.is-revealing .door-sec:nth-child(2) { animation-delay: 0.75s; }
#sec-painting:not([hidden]) ~ .after.is-revealing .door-sec:nth-child(3) { animation-delay: 0.9s; }
#sec-painting:not([hidden]) ~ .after.is-revealing .door-sec:nth-child(4) { animation-delay: 1.05s; }

.btn--big { display: block; width: 100%; margin-top: 16px; font-size: 20px; min-height: 56px; }
.reveal-btn { background: var(--orange); color: var(--navy); animation: pop-in 0.35s ease both; }

.skip-wrap { margin: 14px 0 0; text-align: center; }
.skip-link {
  min-height: 44px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 16px;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Look closer ---------- */
.hotspot {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  z-index: 3;
}
.hotspot.is-visible { display: flex; }
.hotspot span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1;
  color: var(--navy);
  background: var(--yellow);
  border: 3px solid var(--navy);
  border-radius: 999px;
}
.hotspot span::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 3px solid var(--yellow);
  border-radius: 999px;
  animation: pulse 1.8s ease-out infinite;
}
.hotspot.is-open span { background: var(--magenta); color: var(--cream); }
@keyframes pulse {
  from { transform: scale(1); opacity: 0.9; }
  to   { transform: scale(1.9); opacity: 0; }
}

.look-card { margin-top: 12px; }
.look-card.is-in { animation: pop-in 0.25s ease both; }
.look-card__head { display: flex; align-items: center; gap: 10px; }
.look-card__num, .look-btn__num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-family: var(--font-display);
  font-size: 15px;
  background: var(--yellow);
  border: 2.5px solid var(--navy);
  border-radius: 999px;
}
.look-card__title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.2; }
.look-card__text { margin: 8px 0 0; }

.look-hint { margin: 0 0 10px; }
.look-list { display: grid; gap: 8px; }
.look-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 12px 6px 8px;
  font-weight: 800;
  text-align: left;
  background: #fff;
  border: 2.5px solid var(--navy);
  border-radius: 12px;
  cursor: pointer;
}

/* ---------- Sections 3 to 6 ---------- */
.after { display: grid; gap: 16px; margin-top: 20px; }
.after[hidden] { display: none; }
.after.is-revealing .door-sec { animation: rise-in 0.6s ease both; }
.after.is-revealing .door-sec:nth-child(2) { animation-delay: 0.15s; }
.after.is-revealing .door-sec:nth-child(3) { animation-delay: 0.3s; }
.after.is-revealing .door-sec:nth-child(4) { animation-delay: 0.45s; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

.sec-work { background: var(--magenta-ink); color: var(--cream); }
.work-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  text-shadow: 2px 2px 0 var(--navy);
}
.work-artist { margin: 6px 0 10px; font-weight: 800; font-size: 18px; }
.work-meta { margin: 0; display: grid; gap: 6px; }
.work-meta div { display: flex; gap: 10px; }
.work-meta dt {
  flex: none;
  width: 62px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 14px;
  padding-top: 2px;
}
.work-meta dd { margin: 0; }
.work-meta div[hidden] { display: none; }

.sec-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
}
.sec-text p { margin: 0 0 10px; }
.sec-text p:last-child { margin-bottom: 0; }
.movement-chip {
  display: inline-block;
  margin: 0 0 10px;
  padding: 2px 12px;
  font-weight: 800;
  color: var(--cream);
  background: var(--cobalt);
  border-radius: 999px;
}

.door-bottom { margin: 28px 0 0; text-align: center; }

.message-card { text-align: center; margin-top: 30px; }
.message-card__title { margin: 0 0 6px; font-family: var(--font-display); font-weight: 400; font-size: 30px; }

/* ---------- Door swinging open on load ---------- */
.door-flip {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 6px solid var(--navy);
  transform-origin: left center;
  transform: perspective(1200px) rotateY(0deg);
  transition: transform 0.85s cubic-bezier(.5, 0, .3, 1) 0.15s, opacity 0.3s ease 0.7s;
  pointer-events: none;
}
.door-flip[hidden] { display: none; }
.door-flip.is-open { transform: perspective(1200px) rotateY(-100deg); opacity: 0; }
.door-flip__art { width: min(60vw, 260px); height: min(60vw, 260px); }
.door-flip__art .motif { width: 100%; height: 100%; }
.door-flip__num {
  position: absolute;
  top: 24px;
  left: 24px;
  padding: 4px 16px;
  font-family: var(--font-display);
  font-size: 40px;
  background: var(--cream);
  border: 4px solid var(--navy);
  border-radius: 999px;
}

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti span { position: absolute; display: block; border: 1.5px solid var(--navy); }

/* ---------- #edit mode ---------- */
.edit-bar {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px var(--gutter);
  font-size: 15px;
  color: var(--cream);
  background: var(--navy);
}
.edit-bar[hidden] { display: none; }
.edit-bar__label { font-weight: 800; }
.edit-bar__out { font-family: ui-monospace, Consolas, monospace; font-size: 16px; user-select: all; }
.edit-bar__copy {
  min-height: 36px;
  padding: 2px 12px;
  font-weight: 800;
  color: var(--navy);
  background: var(--yellow);
  border: 2px solid var(--cream);
  border-radius: 8px;
}
.edit-marker, .edit-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
}
.edit-marker {
  padding: 0 5px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--cream);
  background: rgba(232, 51, 42, 0.85);
  border: 1.5px solid var(--cream);
  border-radius: 6px;
}
.edit-pin {
  width: 18px;
  height: 18px;
  background: var(--turquoise);
  border: 3px solid var(--cream);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--navy);
}

/* ---------- Less motion if the phone asks for it ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
