/* Wayfarer — layout, components, screens.
 *
 * Phone-first (375 px). From 720 px the app becomes a centred 480 px column on a vignetted stage so a
 * desktop browser shows an intentional object, not a stretched phone page. Each screen is a flex
 * column: header → scrolling body → sticky footer with the primary action inside the thumb zone.
 * Only two screens exist in the DOM during a transition; the leaving one is absolutely positioned so
 * the entering one owns the layout. All colour comes from tokens.css; nothing here hard-codes a hue.
 */

@import url("library.css");
@import url("dungeon.css");   /* Dungeon Crawl: torch-and-iron accent, setup, dungeon cards */
@import url("dungeon-play.css");   /* Dungeon Crawl: the play screen */
@import url("story.css");   /* Zakar: Main Story: the story accent, #/story, its cards, story runs in play */
@import url("endless.css");   /* Endless Dungeon: Scripture Memorization: its card, #/endless, the run summary */
@import url("inventory.css");
@import url("notebook.css");   /* the Endless notebook: its opening, its pages */   /* item icons, the bag overlay, the endless fight's shapes */
@import url("editor.css");   /* Level Editor (#/editor) */
@import url("script-log.css");   /* Script log (#/settings/script) */
@import url("how-to-play.css");   /* How to play (#/how-to-play) */
@import url("drill.css");   /* Sword Drill: its card, #/drill, its play screen */
@import url("tabernacle.css");   /* The Tabernacle: Shekinah: its card face on Home, #/tabernacle, its play page and map */
@import url("david.css");   /* The Life of David: HaMelech: its card face on Home, #/david, its play page and the Acts */
@import url("meditate.css");     /* Meditate · Davar: the passage over the stream at dusk, the recording dot; Library › Meditations */
@import url("progress.css");   /* Achievements, the Market, the two home buttons */
@import url("social.css");     /* Friends, private messages, notifications */
@import url("coop.css");       /* Co-op Dungeon: its page and its play page */
@import url("onboarding.css");   /* the first-open welcome pages */

/* ------------------------------------------------------------------ base */

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

html {
  height: 100%;
  background: var(--bd-floor);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bd-floor);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

html.has-overlay, html.has-overlay body { overflow: hidden; }

/* Inside the iOS app (html.is-native-app, set by js/native/boot.js): no rubber-band bounce past the
   edges of the shell, no long-press callout or text selection on the game's words (inputs keep
   theirs), no double-tap zoom anywhere (main.js locks pinch zoom through the viewport meta). */
html.is-native-app, html.is-native-app body { overscroll-behavior: none; }
html.is-native-app body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
html.is-native-app :is(input, textarea, [contenteditable="true"]) { -webkit-user-select: text; user-select: text; }

img, svg { display: block; max-width: 100%; }
/* A picture squeezed by its box keeps its shape (it is fitted inside, never stretched). Any rule that sets
 * object-fit itself (cover for paintings) wins: this one has no weight. */
:where(img) { object-fit: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--accent-2); text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }
h1:focus-visible, h2:focus-visible { outline: none; }

::selection { background: var(--accent-soft); }

.noscript { padding: var(--sp-8) var(--gutter); text-align: center; color: var(--text-muted); }

/* ------------------------------------------------------------------ stage & column */

/* The full-colour backdrop behind every screen: a painted scene per mode (assets/bg, see its
   README), fixed behind .app so screens scroll over it. ::before is the painting with a very slow
   zoom (transform only, cheap on phones; off with reduced motion); ::after shades it so text stays
   readable and the bottom settles into --bd-floor, which sticky footers fade into. The gradient in
   tokens.css --backdrop shows until the image arrives. */
.vignette {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: var(--backdrop);
  background-color: var(--bd-floor);
}
.vignette::before {
  content: ""; position: absolute; inset: 0;
  background: url("../assets/bg/bg-home.webp") center top / cover no-repeat;
  transform-origin: 50% 30%;
  animation: backdrop-drift 42s ease-in-out infinite alternate;
  will-change: transform;
}
html[data-mode="dungeon"] .vignette::before { background-image: url("../assets/bg/bg-dungeon.webp"); }
.vignette::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, var(--bd-shade-top) 0%, var(--bd-shade-mid) 34%, var(--bd-shade-low) 62%, var(--bd-floor) 94%);
}
/* Home is the one screen without much text: let its painting show almost untouched. */
body:has(.screen-welcome) .vignette::after {
  background: linear-gradient(180deg, rgba(10, 11, 29, 0.05) 0%, rgba(10, 11, 29, 0.08) 45%, rgba(10, 11, 29, 0.55) 72%, var(--bd-floor) 96%);
}
.screen { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
@keyframes backdrop-drift {
  from { transform: scale(1); }
  to { transform: scale(1.07) translate3d(0, 1.5%, 0); }
}
@media (prefers-reduced-motion: reduce) { .vignette::before { animation: none; } }

.app {
  position: relative; z-index: 1;
  min-height: 100dvh;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 720px) {
  /* The painting belongs to the app column, not the whole window: outside it is a plain dark surround. */
  .vignette { left: 50%; right: auto; width: var(--column); transform: translateX(-50%); }
  .app {
    max-width: var(--column);
    min-height: 100dvh;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: rgba(6, 6, 16, 0.22);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 40px 120px -20px rgba(0, 0, 0, 0.8);
  }
}

/* ------------------------------------------------------------------ screen shell & transitions */

.screen {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 100dvh;
  width: 100%;
  padding-top: var(--safe-top);
  background: transparent;
}

.screen-body {
  flex: 1 1 auto;
  padding: var(--sp-4) var(--gutter) var(--sp-6);
  padding-left: calc(var(--gutter) + var(--safe-left));
  padding-right: calc(var(--gutter) + var(--safe-right));
}

.screen-footer {
  position: sticky; bottom: 0; z-index: 2;
  display: grid; gap: var(--sp-3);
  /* The fade sits ABOVE the footer's own content (the extra top padding), so a note line in the
     footer never lies over half-visible content scrolling underneath. */
  padding: calc(var(--sp-6, 24px) + var(--sp-2)) var(--gutter) calc(var(--sp-5) + var(--safe-bottom));
  background: linear-gradient(to top, var(--bd-floor) calc(100% - var(--sp-6, 24px)), transparent);
}

.screen-enter { animation: screen-in var(--dur-base) var(--ease-out) both; }
.screen-leave { position: absolute; inset: 0; animation: screen-out var(--dur-fast) var(--ease-in-out) both; }
.screen-enter[data-direction="back"] { animation-name: screen-in-back; }
.screen-leave[data-direction="back"] { animation-name: screen-out-back; }

@keyframes screen-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes screen-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-16px); } }
@keyframes screen-in-back { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes screen-out-back { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(16px); } }

/* ------------------------------------------------------------------ typography helpers */

.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  text-wrap: balance;
}
.display-sm { font-size: var(--fs-2xl); }
.lead { font-size: var(--fs-lg); line-height: 1.45; text-wrap: pretty; }
.muted { color: var(--text-muted); }
.fine { font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.4; }
.eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--accent); line-height: 1.3;
}

.stack { display: grid; gap: var(--sp-4); align-content: start; }
.center { text-align: center; justify-items: center; }

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

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-6);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: 1.2;
  letter-spacing: 0.005em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), opacity var(--dur-fast), box-shadow var(--dur-fast);
  user-select: none;
}
.btn:active { transform: scale(0.975); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; transform: none; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 64px; font-size: var(--fs-lg); padding: 0 var(--sp-7); }
.btn-label { display: grid; justify-items: center; }
.btn-hint { font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }
.btn .btn-icon-right { margin-left: auto; margin-right: calc(var(--sp-2) * -1); }
.btn .icon:first-child { margin-left: calc(var(--sp-1) * -1); }

.btn-primary {
  color: var(--on-accent);
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger { color: #1A0909; background: linear-gradient(135deg, var(--danger), #FFB3A7); border-color: transparent; }

.btn-choice {
  min-height: var(--tap-choice);
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-lg);
  font-size: var(--fs-lg);
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}
.btn-choice .btn-label { justify-items: start; }
.btn-choice:active { background: var(--accent-soft); border-color: var(--accent); }

.btn.is-busy::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  color: var(--text);
  background: transparent;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon:active { transform: scale(0.92); }
.btn-icon-lg { width: var(--tap); height: var(--tap); }

/* ------------------------------------------------------------------ cards, pills, rows */

.card {
  position: relative;
  display: block; width: 100%;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-align: left;
}
.card-raised { background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-1); }
.card-glass { background: rgba(20, 20, 44, 0.62); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.card-interactive { cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.card-interactive:hover { border-color: var(--line-strong); }
.card-interactive:active { transform: scale(0.985); }

.pill {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  min-height: 30px; padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill-accent { color: var(--accent-2); background: var(--accent-soft); border-color: transparent; }
.pill-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.rows { display: grid; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: var(--sp-4);
  min-height: 72px; padding: var(--sp-3) var(--sp-4);
  color: var(--text);
}
.row + .row { border-top: 1px solid var(--line); }
.row-link:hover { background: var(--surface-2); }
.row-icon { flex: 0 0 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); }
.row-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.row-title { font-weight: 600; font-size: var(--fs-md); }
.row-sub { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.35; }
.row-action { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }

/* switch */
.switch {
  position: relative; flex: 0 0 auto;
  width: 54px; height: 32px; border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.switch::before { content: ""; position: absolute; inset: -12px; } /* 56 px tap area */
.switch-knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: transform var(--dur-fast) var(--ease-out);
}
.switch.is-on { background: var(--accent); border-color: transparent; }
.switch.is-on .switch-knob { transform: translateX(22px); background: var(--on-accent); }
.switch.is-busy .switch-knob { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------------ chips */

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.chips-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chip {
  display: grid; align-content: center; justify-items: center; gap: 2px;
  min-height: 64px; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-lg); font-weight: 600;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}
.chips-lg .chip { min-height: 72px; font-size: var(--fs-xl); font-family: var(--font-display); font-weight: 500; }
.chips > .chip:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* an odd last chip spans the row */
.chip:hover { background: var(--surface-2); }
.chip:active { transform: scale(0.97); }
.chip.is-selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent) inset; }
.chip-hint { font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }

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

.header { padding: var(--sp-2) var(--sp-3) 0; }
.header-row { display: flex; align-items: center; min-height: var(--tap); gap: var(--sp-2); }
.header-center { flex: 1 1 auto; min-width: 0; text-align: center; }
.header-slot { flex: 0 0 48px; display: flex; justify-content: flex-end; }
.header-title { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Back stays within reach while the page scrolls (the window scrolls, not the screen): the button is
   fixed at its own resting place (the header's top-left, below the iPhone's status bar), so nothing
   moves at the top of the page, and it floats over the content once the page scrolls, on a small dark
   glass disc so it reads over any picture. A same-size spacer keeps the header row's layout. Overlays
   and sheets (z-index 50) still cover it. */
.header-row:has(> .header-back)::before { content: ""; flex: 0 0 48px; height: 48px; order: -1; }
.header-back {
  position: fixed; z-index: 20;
  top: calc(var(--safe-top) + var(--sp-2));
  left: calc(var(--sp-3) + var(--safe-left));
  background: rgba(6, 7, 14, 0.66);
  border: 1px solid rgba(235, 211, 155, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2);
}
.header-back:hover { background: rgba(20, 20, 34, 0.7); }
@media (min-width: 720px) {
  .header-back { left: calc(50% - var(--column) / 2 + var(--sp-3)); }
}
.header-below { padding: var(--sp-2) calc(var(--gutter) - var(--sp-3)) 0; display: grid; gap: var(--sp-2); }
.header-title-large {
  font-family: var(--font-display); font-weight: 500; font-size: var(--fs-3xl); line-height: var(--lh-tight);
  letter-spacing: -0.015em; white-space: normal; overflow: visible; font-variation-settings: "opsz" 144, "SOFT" 30; text-wrap: balance;
}

/* ------------------------------------------------------------------ sheet / overlay */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 4, 8, 0.6);
  opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
}
.overlay.is-open { opacity: 1; }
.overlay.is-leaving { opacity: 0; }
.sheet {
  width: 100%; max-width: var(--column); max-height: 88dvh; overflow: auto;
  padding: var(--sp-2) var(--gutter) calc(var(--sp-6) + var(--safe-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: linear-gradient(180deg, rgba(40, 38, 80, 0.92), rgba(18, 18, 38, 0.96));
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--line); border-bottom: 0;
  box-shadow: var(--shadow-2);
  transform: translateY(24px); transition: transform var(--dur-base) var(--ease-out);
}
.overlay.is-open .sheet { transform: none; }
.overlay.is-leaving .sheet { transform: translateY(24px); }
.sheet-grip { width: 40px; height: 4px; margin: var(--sp-1) auto var(--sp-3); border-radius: 2px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.sheet-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; }
.sheet-body { display: grid; gap: var(--sp-3); }
.sheet-message { color: var(--text-muted); font-size: var(--fs-md); }
.sheet-actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); }

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

.toasts {
  position: fixed; left: 50%; bottom: calc(var(--sp-6) + var(--safe-bottom)); z-index: 60;
  transform: translateX(-50%);
  width: min(calc(100% - 2 * var(--gutter)), 440px);
  display: grid; gap: var(--sp-2); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: rgba(40, 40, 78, 0.94);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm); font-weight: 500;
  pointer-events: auto;
  animation: toast-in var(--dur-base) var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out var(--dur-fast) var(--ease-in-out) both; }
.toast-glyph { flex: 0 0 auto; }
.toast-error .toast-glyph { color: var(--danger); }
.toast-success .toast-glyph { color: var(--success); }
.toast-text { flex: 1 1 auto; }
.toast-action { color: var(--accent-2); font-weight: 600; min-height: 36px; padding: 0 var(--sp-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------ WELCOME */

.screen-welcome { padding-top: 0; }
/* The painted backdrop (assets/bg/bg-home.webp, .vignette) is the hero; .hero only places the brand. */
.hero { position: relative; width: 100%; overflow: hidden; }
.hero-brand {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) var(--sp-2);
  display: grid; justify-items: center; gap: var(--sp-2);
  text-align: center;
  padding-top: var(--safe-top);
}
.brand-mark { width: 120px; height: 120px; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.55)); }
.brand {
  font-family: var(--font-display); font-weight: 400; font-size: var(--fs-4xl); line-height: 1;
  letter-spacing: -0.02em; font-variation-settings: "opsz" 144, "SOFT" 50;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}
.tagline { font-size: var(--fs-lg); color: rgba(243, 240, 232, 0.88); text-wrap: balance; max-width: 26ch; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 4px 18px rgba(10, 11, 29, 0.85); }
.welcome-body { padding-top: var(--sp-6); gap: var(--sp-5); align-content: end; }

/* Three quiet links (How to play · Library · Settings): always one row, never stacked. Each stays a
   44 px target. */
.quiet-links {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: space-evenly; gap: 0 var(--sp-2);
  padding: var(--sp-1) 0 calc(var(--sp-3) + var(--safe-bottom));
}
.quiet-link {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-2);
  color: var(--text-muted); font-weight: 500; white-space: nowrap;
  transition: color var(--dur-fast);
}
.quiet-link .icon { flex: 0 0 auto; }
.quiet-link:hover { color: var(--text); }
@media (min-width: 480px) {
  .quiet-links { justify-content: center; column-gap: var(--sp-6); }
}

/* ------------------------------------------------------------------ placeholder / error */

.screen-placeholder .screen-body, .screen-error .screen-body { justify-content: center; align-content: center; gap: var(--sp-4); padding-bottom: var(--sp-10); }
.placeholder-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); margin-bottom: var(--sp-2); }

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

@media (prefers-reduced-motion: reduce) {
  .switch.is-busy .switch-knob { animation: none; }
  .screen-enter, .screen-leave, .toast { animation-duration: 1ms; }
}

/* Settings → Reminders: the kinds sit under the master switch, a little indented. */
.notify-kinds { display: contents; }
.notify-kinds .row { padding-left: calc(var(--sp-4) + 8px); }
.notify-status-row { padding-top: 0; }
.notify-status { color: var(--text-muted); font-size: var(--fs-xs); min-height: 0; }
.notify-status:empty { display: none; }
/* Settings › admin: add Shekels, Oil and Skips for testing. */
.admin-grant-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.admin-grant-btns .btn { flex: 1 1 auto; white-space: nowrap; }

/* ------------------------------------------------------------------ Achievement unlocked banner */
.ach-banner {
  position: fixed; z-index: 120; left: 50%; top: calc(var(--safe-top) + 8px);
  transform: translate(-50%, -140%); opacity: 0;
  display: flex; align-items: center; gap: 12px; width: min(calc(100vw - 24px), 440px); box-sizing: border-box;
  padding: 10px 16px 10px 10px; border-radius: 18px; cursor: pointer; text-align: left;
  color: #2a1c08; font: inherit;
  background: linear-gradient(180deg, #fbe7a6 0%, #e9c56b 55%, #c99a3e 100%);
  border: 1px solid #fff2c4;
  box-shadow: 0 0 0 3px rgba(20, 14, 8, 0.6), 0 14px 34px rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 214, 120, 0.45);
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.15), opacity 0.3s ease;
}
.ach-banner.is-in { transform: translate(-50%, 0); opacity: 1; }
.ach-banner-art { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 2px solid #fff3c9; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); background: #2a1c08; }
.ach-banner-text { display: grid; gap: 1px; min-width: 0; }
.ach-banner-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #6a4a12; }
.ach-banner-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.15; color: #24180a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ach-banner { transition: opacity 0.2s; } }

/* ------------------------------------------------------------------ Buttons: raised, and pressed down when tapped */
.btn:not(:disabled):not([aria-disabled="true"]),
.home-corner-btn, .pg-pour, .tb-item, .sh-buy, .dg-ctl, .seg-btn {
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.38)) drop-shadow(0 8px 12px rgba(0, 0, 0, 0.28));
  transition: transform 0.09s ease-out, filter 0.09s ease-out, background var(--dur-fast), opacity var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:not(:disabled):not([aria-disabled="true"]):active,
.home-corner-btn:active, .pg-pour:active, .tb-item:active, .sh-buy:active, .dg-ctl:active, .seg-btn:active {
  transform: translateY(3px) scale(0.985);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.38)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.24));
}
@media (prefers-reduced-motion: reduce) {
  .btn:active, .home-corner-btn:active, .pg-pour:active, .tb-item:active, .sh-buy:active, .dg-ctl:active, .seg-btn:active { transform: none; }
}

/* The admin passcode keypad (ui/admin-lock.js): a gold-framed tablet, four dots, a 3 × 4 pad. */
.pin-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 14, 0.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s ease; }
.pin-overlay.is-in { opacity: 1; }
.pin-box {
  position: relative; width: min(100%, 330px); padding: 26px 22px 22px; border-radius: 22px; text-align: center; color: #f6ecd2;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(246, 199, 96, 0.18), rgba(246, 199, 96, 0) 70%), linear-gradient(180deg, #172540, #0b1222);
  box-shadow: 0 0 0 1.5px #c9993f, 0 0 0 5px rgba(201, 153, 63, 0.18), 0 22px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 230, 170, 0.25);
  transform: translateY(14px) scale(0.97); transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.pin-overlay.is-in .pin-box { transform: none; }
.pin-close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #cdbf9c; font-size: 26px; line-height: 1; cursor: pointer; }
.pin-seal { width: 54px; height: 54px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; font-size: 28px; color: #3a2408; background: radial-gradient(circle at 35% 30%, #fff1b8, #f2c55a 45%, #a8742a); box-shadow: 0 0 18px rgba(246, 199, 96, 0.55), inset 0 -3px 6px rgba(90, 50, 5, 0.5); }
.pin-title { font-family: var(--font-card, serif); font-weight: 700; font-size: 22px; letter-spacing: 0.04em; background: linear-gradient(180deg, #fff1b8, #e3a944); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pin-status { margin-top: 4px; min-height: 18px; font-size: 13px; color: #b9b3a3; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 16px 0 20px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #c9993f; background: transparent; transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease; }
.pin-dot.is-on { background: radial-gradient(circle at 35% 30%, #fff1b8, #e3a944); box-shadow: 0 0 10px rgba(246, 199, 96, 0.8); transform: scale(1.1); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-key {
  height: 62px; border: 0; border-radius: 16px; cursor: pointer; font-family: var(--font-card, serif); font-size: 26px; font-weight: 700; color: #f6ecd2;
  background: linear-gradient(180deg, #24365a, #142038); box-shadow: inset 0 0 0 1px rgba(201, 153, 63, 0.55), inset 0 1px 0 rgba(255, 230, 170, 0.18), 0 4px 0 #070c18, 0 6px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.06s ease, box-shadow 0.06s ease; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
.pin-key:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px rgba(246, 199, 96, 0.9), 0 1px 0 #070c18, 0 0 14px rgba(246, 199, 96, 0.35); background: linear-gradient(180deg, #2c4270, #1a2a48); }
.pin-del { font-size: 22px; color: #e3c27a; }
.pin-gap { display: block; }
.pin-box.is-wrong { animation: pin-shake 0.42s ease; }
.pin-box.is-wrong .pin-dot.is-on { background: #e0705f; border-color: #e0705f; box-shadow: 0 0 10px rgba(224, 112, 95, 0.8); }
.pin-box.is-right .pin-dot { background: #7fd18b; border-color: #7fd18b; box-shadow: 0 0 12px rgba(127, 209, 139, 0.8); }
@keyframes pin-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .pin-box.is-wrong { animation: none; } }
.admin-slot { display: contents; }
/* Jump to a level: the Endless levels as a 10 × 10 grid. */
.aj-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.aj-cell { aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text, #eee); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); cursor: pointer; font-variant-numeric: tabular-nums; }
.aj-cell.is-demon { color: #ffb4a8; box-shadow: inset 0 0 0 1px rgba(224, 112, 95, 0.55); }
.aj-cell.is-parable { color: #f1d27a; box-shadow: inset 0 0 0 1px rgba(233, 199, 102, 0.6); }
.aj-cell.is-on { color: #1a1206; background: linear-gradient(180deg, #ffe7a0, #e0a640); box-shadow: 0 0 10px rgba(246, 199, 96, 0.6); }
.aj-grid-note { margin-top: 8px; }
