/* Saved & Calm · savings games: Hidden Picture, Spin the Wheel, Mystery Envelopes. */

.view-toggle { display: flex; justify-content: center; margin-top: var(--s-4); }
.picture__caption { margin-top: var(--s-3); text-align: center; color: var(--ink-soft); font-size: var(--step--1); }

/* ── Hidden Picture ────────────────────────────────── */
.picture { margin-top: var(--s-5); }
.picture__board {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px;
  max-width: var(--board-max, 560px); margin: 0 auto; padding: 8px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.pixel {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0;
  border: 0; border-radius: 4px; cursor: pointer;
  /* Unfilled: a faint, washed-out hint of the picture, so you can guess */
  background: color-mix(in srgb, var(--px) 22%, var(--surface));
  filter: saturate(.35);
  transition: background-color .35s, filter .35s, transform .15s var(--ease);
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.pixel:hover { transform: scale(1.06); z-index: 1; box-shadow: 0 0 0 2px var(--accent); }
.pixel__amt { font-size: clamp(.5rem, 1.6vw, .68rem); font-weight: 600; color: var(--ink); opacity: .75; font-variant-numeric: tabular-nums; }
.pixel.is-filled { background: var(--px); filter: none; animation: pixel-pop .45s var(--ease); }
.picture.is-revealed .picture__board { gap: 0; padding: 12px; }
.picture.is-revealed .pixel { border-radius: 0; }
@keyframes pixel-pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.reveal-img { display: block; width: min(260px, 70%); margin: 0 auto var(--s-3); border-radius: var(--r-sm); image-rendering: pixelated; box-shadow: var(--shadow-1); }

/* picker on the setup screen */
.pic-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.pic-opt { position: relative; cursor: pointer; }
.pic-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pic-opt > span {
  display: grid; justify-items: center; gap: 4px; padding: var(--s-2);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.pic-opt small { font-size: .72rem; color: var(--ink-soft); }
.pic-opt input:checked + span { border-color: var(--accent); background: var(--accent-wash); }
.pic-opt input:focus-visible + span { box-shadow: var(--ring); }
.pic-thumb { width: 52px; height: auto; border-radius: 6px; }
.pic-surprise { display: grid; place-items: center; width: 52px; height: 52px; font-size: 1.6rem; border-radius: 6px; background: var(--surface-2); }

/* ── Spin the Wheel ────────────────────────────────── */
.wheel { display: grid; justify-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.wheel__stage { position: relative; width: min(340px, 86vw); aspect-ratio: 1; }
.wheel__svg { width: 100%; height: 100%; filter: drop-shadow(0 12px 24px rgba(30, 74, 56, .22)); }
.wheel__spin { transform-origin: 0 0; transform-box: view-box; }
.wheel__slice { stroke: var(--surface); stroke-width: 2; }
.wheel__label { fill: #1D2B24; font-family: var(--font-body); font-weight: 650; }
.wheel__rim { fill: none; stroke: var(--gold); stroke-width: 6; }
.wheel__hub { fill: var(--surface); stroke: var(--gold); stroke-width: 4; }
.wheel__pointer {
  position: absolute; left: 50%; top: -6px; z-index: 2; width: 0; height: 0; transform: translateX(-50%);
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--accent-strong);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2));
}
.wheel__btn[disabled] { opacity: .6; }

/* ── Mystery Envelopes ─────────────────────────────── */
.mystery { margin-top: var(--s-5); }
.mystery__open {
  display: grid; justify-items: center; gap: var(--s-2); margin-bottom: var(--s-4); padding: var(--s-5) var(--s-4);
  border-radius: var(--r-lg); text-align: center;
  background: radial-gradient(100% 120% at 50% 0%, var(--gold-wash), var(--surface) 70%);
  border: 1.5px solid color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow-2);
  animation: pop .35s var(--ease);
}
.mystery__letter { font-size: 2.6rem; }
.mystery__amount { font-family: var(--font-display); font-variation-settings: var(--soft); font-size: clamp(2.4rem, 10vw, 3.4rem); font-weight: 700; line-height: 1; color: var(--accent-strong); }
.mystery__open .btn-row { justify-content: center; margin-top: var(--s-2); }
.mystery__grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.envelope-btn {
  position: relative; display: grid; place-items: end center; aspect-ratio: 1.4; padding: 0 0 8px;
  border: 1.5px solid color-mix(in srgb, var(--cell) 60%, var(--line-strong)); border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--cell) 55%, var(--surface)); cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s;
}
.envelope-btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: var(--shadow-1); }
.envelope-btn__flap {
  position: absolute; inset: 0 0 auto 0; height: 58%;
  background: linear-gradient(to bottom right, transparent 49%, color-mix(in srgb, var(--cell) 85%, #fff) 50%) left / 50% 100% no-repeat,
              linear-gradient(to bottom left, transparent 49%, color-mix(in srgb, var(--cell) 85%, #fff) 50%) right / 50% 100% no-repeat;
  transform: scaleY(-1);
}
.envelope-btn__label { position: relative; font-weight: 650; font-size: var(--step--1); color: #1D2B24; }
.envelope-btn.is-filled { opacity: .7; background: var(--surface-2); border-style: dashed; }
.envelope-btn.is-filled .envelope-btn__flap { display: none; }
.envelope-btn.is-filled .envelope-btn__label { color: var(--ink); align-self: center; }
.envelope-btn.is-open { box-shadow: 0 0 0 3px var(--gold); }
:root[data-theme="dark"] .envelope-btn__label, :root[data-theme="dark"] .wheel__label { fill: #F6F3EB; color: #F6F3EB; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .envelope-btn__label, :root:not([data-theme="light"]) .wheel__label { fill: #F6F3EB; color: #F6F3EB; }
}

/* ── Roll & Save ───────────────────────────────────── */
.board {
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: 3px; width: min(620px, 100%); aspect-ratio: 1; margin: var(--s-5) auto 0; padding: 6px;
  border-radius: var(--r-lg); background: color-mix(in srgb, var(--accent-wash) 70%, var(--surface));
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.sq {
  position: relative; display: grid; place-items: center; align-content: center; min-width: 0; border-radius: 7px;
  background: color-mix(in srgb, var(--cell) 60%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cell) 60%, var(--line));
  font-size: clamp(.5rem, 1.9vw, .78rem); font-weight: 650; color: #1D2B24; text-align: center;
}
.sq--special { background: var(--surface); font-size: clamp(.9rem, 3.4vw, 1.4rem); }
.sq--start { background: var(--gold-wash); }
.sq.is-done { background: var(--surface-2); color: var(--ink-faint); }
.sq__stamps { font-size: .55rem; line-height: 1; min-height: .6rem; }
.sq.is-here { box-shadow: 0 0 0 3px var(--gold); z-index: 1; }
.token { position: absolute; top: -40%; left: 50%; transform: translateX(-50%); font-size: clamp(1rem, 4vw, 1.6rem); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); z-index: 2; pointer-events: none; }
.board__middle { grid-row: 2 / 9; grid-column: 2 / 9; display: grid; place-items: center; align-content: center; gap: var(--s-2); padding: var(--s-2); text-align: center; }
.town { width: 82%; max-width: 280px; }
.board__lap { font-family: var(--font-display); font-variation-settings: var(--soft); font-weight: 650; font-size: clamp(1rem, 3.6vw, 1.4rem); }
.board__hint { font-size: var(--step--1); color: var(--ink-soft); }
.die {
  display: grid; place-items: center; width: clamp(64px, 18vw, 92px); aspect-ratio: 1; border-radius: 22px;
  border: 0; background: var(--surface); box-shadow: var(--shadow-2), inset 0 -4px 0 rgba(0, 0, 0, .08); cursor: pointer;
  font-size: clamp(2.6rem, 11vw, 4rem); line-height: 1; color: var(--accent-strong); transition: transform .15s var(--ease);
}
.die:hover { transform: rotate(-6deg) scale(1.04); }
.die.is-rolling { animation: die-tumble .2s linear infinite; }
@keyframes die-tumble { 50% { transform: rotate(14deg) translateY(-6px); } }
.lucky-card { padding: var(--s-4); border-radius: var(--r); background: var(--gold-wash); color: var(--gold-ink); font-size: var(--step-1); text-align: center; font-weight: 500; }

/* ── Savings Bingo ─────────────────────────────────── */
.bingo { width: min(460px, 100%); margin: var(--s-5) auto 0; }
.bingo__head, .bingo__card { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.bingo__head span { text-align: center; font-family: var(--font-display); font-variation-settings: var(--soft); font-size: 1.6rem; font-weight: 700; color: var(--accent-strong); }
.bingo__card { padding: 8px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.bsq {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0;
  border-radius: 10px; border: 1.5px dashed var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: clamp(.68rem, 3vw, .95rem); cursor: pointer; font-variant-numeric: tabular-nums;
}
.bsq--free { border-style: solid; background: var(--gold-wash); color: var(--gold-ink); font-size: .72rem; letter-spacing: .08em; cursor: default; }
.bsq.is-filled { border-style: solid; background: color-mix(in srgb, var(--cell) 70%, var(--surface)); }
.bsq__dab { position: absolute; inset: 14%; border-radius: 50%; background: color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; }
.bsq.is-called { border: 3px solid var(--gold); animation: glow 1.6s ease-in-out infinite; }
.bsq.in-line { box-shadow: 0 0 0 2px var(--gold); }
.bingo__actions { display: grid; justify-items: center; gap: var(--s-2); margin-top: var(--s-4); }
.bingo__call { font-size: var(--step-1); }
.bingo__call b { font-family: var(--font-display); font-variation-settings: var(--soft); font-size: 1.5em; color: var(--accent-strong); }

/* ── Scratch & Save ────────────────────────────────── */
.scratch { display: grid; justify-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.scratch__stack { position: relative; width: min(320px, 86vw); height: 10px; }
.scratch__stack span { position: absolute; left: 4%; right: 4%; height: 14px; bottom: -6px; border-radius: 14px 14px 0 0; background: var(--surface-2); border: 1px solid var(--line); }
.scratch__stack span:nth-child(2) { left: 8%; right: 8%; bottom: 0; }
.scratch__stack span:nth-child(3) { left: 12%; right: 12%; bottom: 6px; }
.scratch__card {
  position: relative; width: min(320px, 86vw); aspect-ratio: 1.6; border-radius: 20px; overflow: hidden;
  background: radial-gradient(120% 120% at 20% 10%, var(--gold-wash), var(--surface) 70%);
  border: 2px solid color-mix(in srgb, var(--gold) 55%, var(--line)); box-shadow: var(--shadow-2);
}
.scratch__prize { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 2px; }
.scratch__label { color: var(--ink-soft); font-size: var(--step--1); letter-spacing: .08em; text-transform: uppercase; }
.scratch__amount { font-family: var(--font-display); font-variation-settings: var(--soft); font-size: clamp(2.4rem, 11vw, 3.2rem); font-weight: 700; color: var(--accent-strong); }
.scratch__foil { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.scratch__tap { position: absolute; right: 10px; bottom: 10px; background: color-mix(in srgb, var(--surface) 85%, transparent); }
.scratch__card.is-revealed { animation: pop .35s var(--ease); }
.scratch__done { width: min(560px, 100%); margin-top: var(--s-2); padding-top: var(--s-3); border-top: 1px dashed var(--line); text-align: center; }
.scratch__done-title { display: inline-flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-family: var(--font-body); font-size: var(--step--1); font-weight: 600; letter-spacing: .02em; color: var(--ink-soft); }
.scratch__done-title span { min-width: 1.6em; padding: 0 .45em; border-radius: var(--r-pill); background: var(--surface-2); font-variant-numeric: tabular-nums; font-size: .85em; color: var(--ink-soft); }
.scratch__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.scratch__chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 11px 2px 9px;
  border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); border-radius: var(--r-pill);
  background: var(--gold-wash); color: var(--gold-ink); font: inherit; font-size: .8rem; font-weight: 600;
  font-variant-numeric: tabular-nums; cursor: pointer; -webkit-touch-callout: none; user-select: none;
}
.scratch__chip > span[aria-hidden] { font-size: .75em; opacity: .7; }
.scratch__chip:hover { border-color: var(--gold); }
.scratch__chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Road Trip Saver ───────────────────────────────── */
.road { display: grid; justify-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.road__map { width: min(440px, 100%); height: auto; border-radius: 22px; box-shadow: var(--shadow-2); }
.stop__dot { fill: #fff; stroke: #C9C2B0; stroke-width: 3; }
.stop.is-done .stop__dot { fill: var(--gold-wash); stroke: var(--gold); }
.stop.is-next { cursor: pointer; }
.stop.is-next .stop__dot { stroke: var(--accent); stroke-width: 4; animation: stop-pulse 1.8s ease-in-out infinite; }
.stop:focus-visible .stop__dot { stroke: var(--focus); stroke-width: 5; }
.stop__amt { font: 600 12px var(--font-body); fill: #3A4A40; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.road__car { transition: transform 1.2s var(--ease); }
.road__next { text-align: center; }
@keyframes stop-pulse { 50% { stroke-width: 7; } }

/* ── Finish ceremony ───────────────────────────────── */
.dialog--ceremony { width: min(560px, calc(100vw - 24px)); text-align: center; background: radial-gradient(120% 80% at 50% 0%, var(--gold-wash), var(--surface) 60%); }
.dialog--ceremony .dialog__title { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.dialog--ceremony .dialog__actions { justify-content: center; }
.ceremony__pip { display: flex; justify-content: center; animation: pip-bob 2.4s ease-in-out infinite; }
.ceremony__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s-2); margin: var(--s-3) 0; }
.ceremony__stats div { padding: var(--s-3); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.ceremony__stats dt { font-size: var(--step--1); color: var(--ink-soft); }
.ceremony__stats dd { margin: 2px 0 0; font-family: var(--font-display); font-variation-settings: var(--soft); font-size: 1.3rem; font-weight: 650; }
.ceremony__badges { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-bottom: var(--s-3); }

/* ── Share card dialog ─────────────────────────────── */
.share-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.share-preview { display: grid; place-items: center; padding: var(--s-3); border-radius: var(--r-lg, 18px); background: var(--surface-2, rgba(0, 0, 0, .04)); }
.share-preview img { width: min(100%, 340px); aspect-ratio: 1; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); transition: opacity .2s ease; background: #F6F3EB; }
.share-preview.is-story img { width: min(62%, 230px); aspect-ratio: 9 / 16; }
@media (prefers-reduced-motion: reduce) { .share-preview img { transition: none; } }

/* Arriving from Home's "one thing": a soft glow on the game's button */
.is-nudged { animation: nudge-glow 1.4s ease-in-out 3; border-radius: var(--r-md, 14px); }
@keyframes nudge-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold, #E8B949) 0%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--gold, #E8B949) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .is-nudged { animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold, #E8B949) 70%, transparent); }
}
.scratch__chip { position: relative; }
.scratch__chip::after { content: ""; position: absolute; inset: -6px -2px; } /* a full 44px tap target around a small chip */

/* ── A different amount ────────────────────────────── */
.alt-amount { margin-top: var(--s-2); text-align: center; }
.alt-amount__toggle, .save-other { font-size: var(--step--1); color: var(--ink-soft); min-height: 44px; }
.alt-amount__field { text-align: left; margin-top: var(--s-2); }
.alt-amount__field[hidden] { display: none; }
.save-other { display: block; margin-inline: auto; }
.edited-mark { margin-left: 2px; font-size: .8em; opacity: .75; font-weight: 400; }
.edited-mark--corner { position: absolute; top: 2px; right: 4px; font-size: .62rem; }
