@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/cormorant-garamond-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('fonts/cormorant-garamond-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('fonts/inter-opsz-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: italic; font-weight: 100 900; font-display: swap; src: url('fonts/inter-opsz-italic.woff2') format('woff2'); }

/* ==========================================================================
   Theme tokens
   Dark (night) is the default. Light (dawn) follows the phone's setting,
   and a manual choice sets data-theme on <html>.
   ========================================================================== */

:root {
  color-scheme: dark;

  --sky-top: #050823;
  --sky-mid: #0b1240;
  --sky-late: #141248;
  --sky-bottom: #0a0d2c;
  --glow-gold: rgba(243, 196, 108, 0.22);
  --glow-indigo: rgba(106, 63, 176, 0.22);
  --glow-cyan: rgba(31, 181, 201, 0.16);
  --star: #ffffff;
  --grain-opacity: 0.035;
  --vignette: rgba(2, 3, 12, 0.5);

  --gold: #f3c46c;
  --gold-light: #f8d58a;
  --amber: #e29a45;
  --on-gold: #1a1130;
  --gold-text: #f3c46c;
  --compass-line: #f3c46c;
  --gold-glow: rgba(226, 154, 69, 0.35);
  --cyan: #7fe0f0;

  --text: #f6ecd8;
  --text-dim: rgba(236, 239, 255, 0.78);
  --text-faint: rgba(236, 239, 255, 0.62);

  --glass: rgba(20, 28, 78, 0.6);
  --glass-edge: rgba(127, 224, 240, 0.28);
  --nav-bg: rgba(12, 16, 50, 0.78);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-home-quote: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --font-label: "Inter", var(--font-sans);
  --font-serif: "Inter", var(--font-sans);

  --nav-height: 64px;
  --radius: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --sky-top: #d9e2f5;
    --sky-mid: #eceff9;
    --sky-late: #f1ecf6;
    --sky-bottom: #f8e8da;
    --glow-gold: rgba(246, 178, 84, 0.42);
    --glow-indigo: rgba(140, 150, 232, 0.32);
    --glow-cyan: rgba(110, 205, 232, 0.28);
    --star: transparent;
    --grain-opacity: 0.035;
    --vignette: rgba(110, 100, 160, 0.16);

    --gold: #efb04a;
    --amber: #e3913a;
    --on-gold: #1d1433;
    --gold-text: #7d4e06;
    --gold-light: #8a5708;
    --card-chosen-text: #1b1d3a;
    --card-chosen-bg: radial-gradient(circle at 50% 0%, rgba(239, 176, 74, 0.6), rgba(255, 255, 255, 0.7) 70%);
  --compass-line: #c4841c;
    --gold-glow: rgba(239, 176, 74, 0.45);
    --cyan: #0b6d86;

    --text: #1b1d3a;
    --text-dim: rgba(27, 29, 58, 0.76);
    --text-faint: rgba(27, 29, 58, 0.68);

    --glass: rgba(255, 255, 255, 0.55);
    --glass-edge: rgba(11, 109, 134, 0.24);
    --nav-bg: rgba(246, 247, 253, 0.8);
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --sky-top: #d9e2f5;
  --sky-mid: #eceff9;
  --sky-late: #f1ecf6;
  --sky-bottom: #f8e8da;
  --glow-gold: rgba(246, 178, 84, 0.42);
  --glow-indigo: rgba(140, 150, 232, 0.32);
  --glow-cyan: rgba(110, 205, 232, 0.28);
  --star: transparent;
  --grain-opacity: 0.035;
  --vignette: rgba(110, 100, 160, 0.16);

  --gold: #efb04a;
  --amber: #e3913a;
  --on-gold: #1d1433;
  --gold-text: #7d4e06;
  --gold-light: #8a5708;
  --card-chosen-text: #1b1d3a;
  --card-chosen-bg: radial-gradient(circle at 50% 0%, rgba(239, 176, 74, 0.6), rgba(255, 255, 255, 0.7) 70%);
  --compass-line: #c4841c;
  --gold-glow: rgba(239, 176, 74, 0.45);
  --cyan: #0b6d86;

  --text: #1b1d3a;
  --text-dim: rgba(27, 29, 58, 0.76);
  --text-faint: rgba(27, 29, 58, 0.68);

  --glass: rgba(255, 255, 255, 0.55);
  --glass-edge: rgba(11, 109, 134, 0.24);
  --nav-bg: rgba(246, 247, 253, 0.8);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--sky-top);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
p {
  margin: 0;
}

a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

h1:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Night sky
   ========================================================================== */

.sky {
  position: fixed;
  top: 8px;
  left: 0;
  right: 0;
  height: calc(var(--sky-height, var(--app-height, 100dvh)) - 8px);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-late) 80%, var(--sky-bottom) 100%);
}

.sky-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  animation: drift 60s ease-in-out infinite;
  will-change: transform;
}

.sky-glow--gold {
  left: 50%;
  top: 38%;
  width: 72vmin;
  height: 72vmin;
  margin: -36vmin 0 0 -36vmin;
  background: radial-gradient(circle, var(--glow-gold) 0%, transparent 68%);
}

.sky-glow--indigo {
  right: -30vmin;
  top: 25%;
  width: 80vmin;
  height: 80vmin;
  background: radial-gradient(circle, var(--glow-indigo) 0%, transparent 70%);
  animation-delay: -20s;
}

.sky-glow--cyan {
  left: -30vmin;
  top: 35%;
  width: 75vmin;
  height: 75vmin;
  background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 70%);
  animation-delay: -40s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(3vmin, -4vmin) scale(1.06); }
  66% { transform: translate(-3vmin, 2vmin) scale(0.96); }
}

.sky-stars {
  position: absolute;
  inset: 0;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: var(--star);
}

.star--twinkle {
  animation: twinkle 6s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(0.4); filter: brightness(0.4); }
}

.sky-grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
}

.sky-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, transparent 45%, var(--vignette) 100%);
}

/* ==========================================================================
   App frame
   ========================================================================== */

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-height, 100dvh);
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top) + 20px)
    calc(env(safe-area-inset-right) + 20px)
    calc(env(safe-area-inset-bottom) + var(--nav-height) + 20px)
    calc(env(safe-area-inset-left) + 20px);
}

.screens {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen.is-entering {
  animation: fade-in 0.35s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.screen-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-top: 8px;
}

.screen-subtitle {
  margin-top: 6px;
  color: var(--text-dim);
}

.empty {
  margin: auto 0;
  padding: 40px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 19px;
  line-height: 1.5;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  color: var(--text-dim);
  font-size: 15px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s var(--ease), box-shadow 0.25s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--gold {
  background: linear-gradient(180deg, #f6cd78 0%, var(--amber) 100%);
  color: var(--on-gold);
  box-shadow: 0 6px 28px var(--gold-glow);
}

.btn--large {
  min-height: 60px;
  font-size: 19px;
}

.btn-round {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.btn-round svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* ==========================================================================
   Home
   ========================================================================== */

.app-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* The illustrated night scene sits behind Home's text and buttons. */
.home-scene {
  position: fixed;
  top: 8px;
  height: calc(var(--app-height, 100dvh) - 8px);
  left: 50%;
  z-index: 0;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  pointer-events: none;
}

.home-scene-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.on-home .sky-glow--gold {
  opacity: 0;
}

.scene-star {
  transform-box: fill-box;
  transform-origin: center;
  animation: star-twinkle 9s ease-in-out infinite;
}

@keyframes star-twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.scene-gold,
.scene-gold-glow {
  transition: stroke-width 0.6s var(--ease), stroke-opacity 0.6s var(--ease);
}

.home-scene.is-active .scene-gold {
  stroke-width: 3.6;
  stroke-opacity: 1;
}

.home-scene.is-active .scene-gold-glow {
  stroke-width: 16;
  stroke-opacity: 0.34;
}

/* The prompt (or the pick) floats over the sky, above the horizon. */
.home-center {
  position: fixed;
  top: calc(var(--app-height, 100dvh) * 0.268);
  left: 50%;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  padding: 0 44px;
  text-align: center;
  text-shadow: 0 0 14px #070b2e, 0 0 28px #070b2e;
}

.home-line {
  font-family: var(--font-serif);
  max-width: 16ch;
  margin: 0 auto;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 500;
  color: var(--text);
  text-wrap: balance;
  pointer-events: auto;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.home-line.is-question {
  font-style: italic;
  color: var(--gold-light);
}

#home-question-label {
  margin-bottom: 10px;
}

.home-line.is-entering {
  animation: fade-in 0.35s var(--ease);
}

.home-active-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.home-pick {
  font-family: var(--font-serif);
  margin-top: 10px;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 600;
  color: var(--gold-light);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.home-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
}

.home-actions .btn {
  flex: 1;
  min-height: 56px;
  font-size: 16px;
}

.home-actions .btn-round {
  width: 56px;
  height: 56px;
  border-color: rgba(127, 224, 240, 0.35);
}

/* ==========================================================================
   Choose
   ========================================================================== */

.choose-entry,
.compare {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.compare > :not(.threads):not(.coin-layer) {
  position: relative;
  z-index: 1;
}

.threads {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.thread {
  stroke: var(--cyan);
  stroke-width: 1;
  stroke-opacity: 0.34;
  transition: stroke 0.25s var(--ease), stroke-width 0.25s var(--ease), stroke-opacity 0.25s var(--ease);
}

.thread.is-lit {
  stroke: var(--gold-light);
  stroke-width: 2;
  stroke-opacity: 0.95;
}

.thread-glow {
  stroke: var(--gold);
  stroke-width: 10;
  stroke-opacity: 0.18;
}

.option-form {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.option-input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.option-input::placeholder {
  color: var(--text-faint);
}

.option-input:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-color: var(--cyan);
}

.option-input:disabled {
  opacity: 0.5;
}

.option-add {
  flex: none;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
}

.option-add:disabled {
  opacity: 0.4;
  cursor: default;
}

.option-add svg,
.icon-btn svg,
.chip svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.option-add svg {
  width: 24px;
  height: 24px;
}

.chips {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 48px;
  padding: 0 14px 0 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.chip span {
  overflow-wrap: anywhere;
}

.chip svg {
  flex: none;
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.chip--suggestion {
  background: transparent;
  border-style: dashed;
  color: var(--text-dim);
}

.hint {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 15px;
}

.suggestions {
  margin-top: 28px;
}

.suggestions-label {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.suggestions .chips {
  margin-top: 8px;
}

.screen-actions {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
}

.screen-actions .btn {
  flex: 1;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.compare-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  flex: none;
  width: 48px;
  height: 48px;
  margin-left: -12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.progress {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--glass-edge);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.compare-title {
  margin-top: 32px;
  text-align: center;
  text-shadow: 0 0 16px #070b2e;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 112px;
  padding: 0 0 8px;
}

.card {
  min-height: 210px;
  padding: 20px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.35s var(--ease), color 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

/* Warmth means the pull. */
.pair.has-choice .card:not(.is-chosen) {
  opacity: 0.7;
}

.card.is-chosen {
  background: var(--card-chosen-bg, radial-gradient(circle at 50% 0%, rgba(243, 196, 108, 0.34), rgba(20, 28, 78, 0.7) 70%));
  border-color: var(--gold);
  color: var(--card-chosen-text, #fff3d2);
  box-shadow: 0 0 34px rgba(243, 196, 108, 0.3);
}

@media (max-width: 359px) {
  .pair {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 96px;
  }

  .card {
    min-height: 120px;
  }
}

.link-btn {
  align-self: center;
  margin-bottom: auto;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* ==========================================================================
   Act
   ========================================================================== */

.act-center {
  position: fixed;
  top: calc(var(--app-height, 100dvh) * 0.268);
  left: 50%;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  padding: 0 30px;
  text-align: center;
  text-shadow: 0 0 14px #070b2e, 0 0 28px #070b2e;
}

.scene-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
}

.act-line {
  min-height: 1.5em;
  max-width: 24ch;
  margin: 0 auto 8px;
  color: var(--text-dim);
  text-wrap: balance;
}

.act-pick {
  margin-top: 12px;
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: 1.05;
  font-weight: 600;
  color: var(--gold-light);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.home-scene.is-strong .scene-gold {
  stroke-width: 4.4;
  stroke-opacity: 1;
}

.home-scene.is-strong .scene-gold-glow {
  stroke-width: 22;
  stroke-opacity: 0.45;
}

.act-row {
  display: flex;
  gap: 10px;
}

.act-secondary {
  flex: 1;
  min-height: 50px;
  padding: 0 12px;
  font-size: 14px;
  border-color: rgba(127, 224, 240, 0.35);
}

.act-row .act-secondary:first-child {
  flex: 1.35;
}

.act-smaller {
  color: var(--gold-light);
  border-color: rgba(243, 196, 108, 0.45);
}

/* ---- Make it smaller ---- */

.screen--smaller {
  align-items: stretch;
}

.smaller-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.smaller-title {
  margin-top: 96px;
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.12;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 0 16px #070b2e;
  text-wrap: balance;
}

.smaller-of {
  margin: 32px 0 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

.smaller-pick {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-light);
}

.smaller-form .option-input {
  width: 100%;
  flex: none;
  border-color: var(--cyan);
}

.smaller-chips {
  justify-content: center;
}

.smaller-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.smaller-actions .btn {
  width: 100%;
}

.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn--ghost {
  min-height: 52px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  font-weight: 500;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   Release
   ========================================================================== */

.release-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.release-pick {
  margin-top: 8px;
  color: var(--gold-text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.release-input {
  flex: none;
  width: 100%;
  margin-top: 20px;
}

.release-form .stack-actions {
  margin-top: auto;
  padding-top: 24px;
}

.release-closing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.release-line {
  max-width: 18ch;
  font-family: var(--font-serif);
  font-size: 32px;
  line-height: 1.25;
  text-wrap: balance;
  animation: fade-in 0.8s var(--ease);
}

.release-line:focus {
  outline: none;
}

/* ==========================================================================
   Saved
   ========================================================================== */

.tags-label {
  align-self: center;
  margin-right: 4px;
  font-size: 14px;
  color: var(--text-faint);
}

.tags--small {
  margin-top: 8px;
}

.group {
  margin-top: 28px;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.group-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.group-more {
  margin: 0 -12px 0 0;
}

.group-more svg {
  fill: currentColor;
  stroke: none;
}

.group-empty {
  font-size: 15px;
  color: var(--text-faint);
}

.saved-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.saved-list li + li {
  border-top: 1px solid var(--glass-edge);
}

.saved-item {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.new-category {
  margin-top: 28px;
}

/* A sheet that rises from the bottom, for moving, renaming and deleting. */
.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--sky-mid);
  color: var(--text);
}

.sheet[open] {
  animation: sheet-up 0.3s var(--ease);
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sheet::backdrop {
  background: rgba(2, 3, 12, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px calc(env(safe-area-inset-bottom) + 12px);
}

.sheet-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-label {
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.sheet-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn--danger {
  min-height: 52px;
  margin-top: 8px;
  border: 1px solid rgba(240, 120, 120, 0.45);
  background: transparent;
  color: #f19a9a;
  font-weight: 500;
}

:root[data-theme="light"] .btn--danger {
  color: #b23a3a;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .btn--danger {
    color: #b23a3a;
  }
}

/* ==========================================================================
   River log and Look back
   ========================================================================== */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
}

.tag[aria-pressed="true"] {
  border-color: var(--cyan);
  background: var(--glass);
  color: var(--text);
}

.river-linked {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.timeline {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline:empty {
  display: none;
}

.item {
  display: block;
  width: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow-wrap: anywhere;
}

.item--pick {
  border-left: 2px solid var(--gold);
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  color: var(--text-faint);
}

.item-tag {
  flex: none;
  white-space: nowrap;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  font-size: 13px;
  color: var(--text-dim);
}

.item-tag--live {
  border-color: var(--gold);
  color: var(--gold-text);
}

.item-text,
.item-pick,
.item-skipped,
.item-note,
.item-link {
  display: block;
}

.item-text {
  margin-top: 4px;
}

.item-pick {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--gold-text);
}

.item-skipped {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-faint);
  opacity: 0.8;
}

.item-note {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-dim);
}

.item-link {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-faint);
}

.lookback-filters {
  margin-top: 20px;
}

.search-input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.day {
  margin-top: 28px;
}

.day-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.day .timeline {
  margin-top: 10px;
}

#screen-river .empty,
#screen-lookback .empty {
  margin: 0;
  padding: 48px 12px;
}

/* ==========================================================================
   About
   ========================================================================== */

.about-lines {
  margin-top: 24px;
}

.about-lines p {
  font-family: var(--font-serif);
  font-size: 32px;
  line-height: 1.25;
  font-weight: 500;
}

.about-lines p + p {
  margin-top: 6px;
}

.about-body {
  margin-top: 36px;
  color: var(--text-dim);
}

.about-body p + p {
  margin-top: 16px;
}

.about-credit {
  margin-top: 48px;
  font-size: 14px;
  color: var(--text-faint);
}

.about-data {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.data-action {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.data-action .btn {
  width: 100%;
  margin-top: 0;
}

.data-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.data-row .btn {
  padding: 0 12px;
}

.steps {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-dim);
}

.steps li::marker {
  color: var(--gold-text);
}

.step-icon {
  width: 22px;
  height: 22px;
  margin-left: 6px;
  vertical-align: -5px;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.data-status {
  min-height: 1.4em;
  font-size: 15px;
  color: var(--text-dim);
}

.data-status:empty {
  min-height: 0;
}

.data-hint {
  font-size: 14px;
  color: var(--text-faint);
}

/* ==========================================================================
   Bottom navigation
   ========================================================================== */

.nav {
  position: fixed;
  left: 50%;
  top: calc(var(--app-height, 100dvh) - var(--nav-height) - env(safe-area-inset-bottom));
  z-index: 2;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0 calc(env(safe-area-inset-right) + 8px) env(safe-area-inset-bottom) calc(env(safe-area-inset-left) + 8px);
  background: var(--nav-bg);
  border-top: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--nav-height);
  color: var(--text-faint);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item[aria-current="page"] {
  color: var(--gold-text);
}

@media (min-width: 520px) {
  .nav {
    border-left: 1px solid var(--glass-edge);
    border-right: 1px solid var(--glass-edge);
    border-radius: 18px 18px 0 0;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Act and Make it smaller: buttons sit at the bottom, chips are plain pills. */
#screen-act .stack-actions {
  margin-top: auto;
}

.smaller-chips .chip {
  min-height: 48px;
  padding: 0 16px;
  border-style: solid;
  border-color: var(--glass-edge);
  background: var(--glass);
  font-size: 13px;
  color: var(--text-dim);
}

.smaller-chips .chip svg {
  display: none;
}

/* ---- Settle first ---- */

.screen--settle.is-entering {
  animation: none;
}

.settle-svg {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: -1;
  width: 100%;
  max-width: 480px;
  height: calc(var(--app-height, 100dvh) - 8px);
  transform: translateX(-50%);
  pointer-events: none;
}

.settle-flower,
.settle-halo,
.settle-spin {
  transform-box: view-box;
  transform-origin: 195px 330px;
}

.settle-flower,
.settle-halo {
  transition: transform 3s ease-in-out, opacity 3s ease-in-out;
}

.settle-halo {
  opacity: 0.6;
}

/* A slow turn all the way through, so it never looks stuck. */
.settle-spin {
  animation: settle-spin 5s ease-in-out forwards;
}

@keyframes settle-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(45deg); }
}

.settle-svg.is-in .settle-flower {
  transform: scale(1.35);
  transition-duration: 2s;
}

.settle-svg.is-in .settle-halo {
  transform: scale(1.3);
  opacity: 1;
  transition-duration: 2s;
}

.settle-text {
  position: fixed;
  top: calc(var(--app-height, 100dvh) * 0.664);
  left: 50%;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  padding: 0 30px;
  text-align: center;
}

.settle-title {
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 1.1;
  font-weight: 500;
  text-shadow: 0 0 16px #070b2e;
}

.settle-breath {
  margin-top: 26px;
  font-weight: 600;
  letter-spacing: 0.3em;
  min-height: 1.5em;
}

.settle-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.settle-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(236, 239, 255, 0.22);
  transition: background 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

.settle-dots span.is-filled {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(243, 196, 108, 0.7);
}

.settle-skip {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--nav-height) + 12px);
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: reduce) {
  .settle-flower,
  .settle-halo,
  .settle-spin {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ---- About: Settle before choosing ---- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  margin-top: 20px;
  color: var(--text);
}

.switch {
  flex: none;
  position: relative;
  width: 56px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.switch::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
}

.switch span {
  position: absolute;
  top: 12px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.switch[aria-checked="true"]::before {
  border-color: var(--gold);
}

.switch[aria-checked="true"] span {
  transform: translateX(20px);
  background: var(--gold);
}

/* ---- Where is this now? ---- */

.outcome-pick {
  margin-top: 28px;
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 1.08;
  font-weight: 600;
  color: var(--gold-light);
  text-align: center;
  text-shadow: 0 0 14px #070b2e;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.outcome-question {
  margin-top: 14px;
  text-align: center;
  color: var(--text-dim);
}

.outcome-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.outcome-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 88px;
  padding: 16px 20px;
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.outcome-name {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 600;
}

.outcome-hint {
  font-size: 13px;
  color: var(--text-faint);
}

.outcome-back {
  margin: 16px auto 0;
}

/* ---- Look back: the film strip ---- */

.strip {
  position: relative;
  margin-top: 20px;
  padding: 14px 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #05081f;
  overflow: hidden;
}

.strip::before,
.strip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='22'%3E%3Crect x='2' y='6' width='8' height='10' rx='3' fill='%23161c52'/%3E%3C/svg%3E") repeat-y;
  pointer-events: none;
}

.strip::before {
  left: 4px;
}

.strip::after {
  right: 4px;
}

.frames {
  list-style: none;
  margin: 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  container-type: inline-size;
}

.frame-ghost {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 66px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(127, 224, 240, 0.4);
  background: rgba(127, 224, 240, 0.04);
  text-align: center;
}

.frame-ghost-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(127, 224, 240, 0.7);
}

.frame-ghost-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  color: rgba(246, 236, 216, 0.62);
}

.item.frame {
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(236, 239, 255, 0.14);
  background: #0b1038;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  overflow: hidden;
}

.item.frame--now {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(243, 196, 108, 0.28);
}

.frame-thumb {
  position: relative;
  display: block;
  height: 96px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 45%), var(--thumb-core, #fff3d2) 0 2px, rgba(var(--glow, 243, 196, 108), 0.5) 3px 10px, rgba(var(--glow, 243, 196, 108), 0.12) 11px 38px, transparent 62px),
    linear-gradient(180deg, var(--thumb-top, #0c1240), var(--thumb-bottom, #1a1750));
}

.frame--now .frame-thumb {
  --thumb-bottom: #221a5c;
}

.frame-stars {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5px;
  height: 1.5px;
  border-radius: 50%;
}

.frame-hill {
  position: absolute;
  left: -20px;
  right: -20px;
  bottom: -34px;
  height: 56px;
  border-radius: 50%;
  background: var(--thumb-hill, #070a22);
}

.frame-body {
  display: block;
  padding: 10px 14px 12px;
}

.frame-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.frame--now .frame-label {
  color: var(--gold);
}

.frame-tag {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(236, 239, 255, 0.2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--text-faint);
}

.frame-text {
  display: block;
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--text);
}

.frame-body .item-skipped,
.frame-body .item-note,
.frame-body .item-link {
  display: block;
  margin-top: 6px;
}

.frame-sentinel {
  height: 1px;
}

#lookback-tags .tag {
  min-width: 48px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 13px;
}

/* Home and Act hold fixed-position text. A transform on their screen would
   make that text start lower and jump up, so these screens fade only. */
.screen--home.is-entering,
#screen-act.is-entering {
  animation: fade-only 0.35s var(--ease);
}

@keyframes fade-only {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Light theme: night-sky screens and the film strip stay dark ----
   The Home scene, Act, Settle and the Look back film strip are drawn on a
   dark sky, so inside them the dark theme's colours apply. */
:root[data-theme="light"] body.scene-dark {
  color-scheme: dark;
}

:root[data-theme="light"] body.scene-dark {
  --text: #f6ecd8;
  --text-dim: rgba(236, 239, 255, 0.78);
  --text-faint: rgba(236, 239, 255, 0.62);
  --glass: rgba(20, 28, 78, 0.6);
  --glass-edge: rgba(127, 224, 240, 0.28);
  --gold: #f3c46c;
  --gold-light: #f8d58a;
  --gold-text: #f3c46c;
  --cyan: #7fe0f0;
  --sky-top: #050823;
  --sky-mid: #0b1240;
  --sky-late: #141248;
  --sky-bottom: #0a0d2c;
  --glow-gold: rgba(243, 196, 108, 0.22);
  --glow-indigo: rgba(106, 63, 176, 0.22);
  --glow-cyan: rgba(31, 181, 201, 0.16);
  --star: #ffffff;
  --grain-opacity: 0.035;
  --vignette: rgba(2, 3, 12, 0.5);
  --gold-glow: rgba(226, 154, 69, 0.35);
  --nav-bg: rgba(12, 16, 50, 0.78);
  --amber: #e29a45;
  --on-gold: #1a1130;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body.scene-dark {
  --text: #f6ecd8;
  --text-dim: rgba(236, 239, 255, 0.78);
  --text-faint: rgba(236, 239, 255, 0.62);
  --glass: rgba(20, 28, 78, 0.6);
  --glass-edge: rgba(127, 224, 240, 0.28);
  --gold: #f3c46c;
  --gold-light: #f8d58a;
  --gold-text: #f3c46c;
  --cyan: #7fe0f0;
  --sky-top: #050823;
  --sky-mid: #0b1240;
  --sky-late: #141248;
  --sky-bottom: #0a0d2c;
  --glow-gold: rgba(243, 196, 108, 0.22);
  --glow-indigo: rgba(106, 63, 176, 0.22);
  --glow-cyan: rgba(31, 181, 201, 0.16);
  --star: #ffffff;
  --grain-opacity: 0.035;
  --vignette: rgba(2, 3, 12, 0.5);
  --gold-glow: rgba(226, 154, 69, 0.35);
  --nav-bg: rgba(12, 16, 50, 0.78);
  --amber: #e29a45;
  --on-gold: #1a1130;
  }

}

/* ---- Light theme: Home and Act as an early dawn ---- */
.dawn-sun {
  display: none;
}

:root[data-theme="light"] body.scene-dawn {
  color-scheme: dark;
  --text: #f6ecd8;
  --text-dim: rgba(236, 239, 255, 0.82);
  --text-faint: rgba(236, 239, 255, 0.84);
  --glass: rgba(20, 28, 78, 0.6);
  --glass-edge: rgba(127, 224, 240, 0.28);
  --nav-bg: rgba(12, 16, 50, 0.78);
  --gold-light: #f8d58a;
  --cyan: #7fe0f0;
  --gold: #f3c46c;
  --gold-text: #f3c46c;
  --vignette: rgba(4, 6, 24, 0.35);
  --sky-top: #1e2a66;
  --sky-mid: #4f4690;
  --sky-late: #cf837c;
  --sky-bottom: #e69b66;
}

:root[data-theme="light"] body.scene-dawn .dawn-sun {
  display: inline;
}

:root[data-theme="light"] body.scene-dawn #hs-horizon stop:nth-child(1) {
  stop-color: #ffb48a;
  stop-opacity: 0.05;
}

:root[data-theme="light"] body.scene-dawn #hs-horizon stop:nth-child(2) {
  stop-color: #ff9a6c;
  stop-opacity: 0.5;
}

:root[data-theme="light"] body.scene-dawn #hs-horizon stop:nth-child(3) {
  stop-color: #ff8a52;
  stop-opacity: 0.75;
}

:root[data-theme="light"] body.scene-dawn .home-center,
:root[data-theme="light"] body.scene-dawn .act-center {
  text-shadow: 0 0 14px #1a1650, 0 0 28px #1a1650;
}

:root[data-theme="light"] body.scene-dawn .sky-glow--gold {
  opacity: 0;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body.scene-dawn {
    color-scheme: dark;
    --text: #f6ecd8;
    --text-dim: rgba(236, 239, 255, 0.82);
    --text-faint: rgba(236, 239, 255, 0.84);
    --glass: rgba(20, 28, 78, 0.6);
    --glass-edge: rgba(127, 224, 240, 0.28);
    --nav-bg: rgba(12, 16, 50, 0.78);
    --gold-light: #f8d58a;
    --cyan: #7fe0f0;
    --gold: #f3c46c;
    --gold-text: #f3c46c;
    --vignette: rgba(4, 6, 24, 0.35);
    --sky-top: #1e2a66;
    --sky-mid: #4f4690;
    --sky-late: #cf837c;
    --sky-bottom: #e69b66;
  }

  :root:not([data-theme="dark"]) body.scene-dawn .dawn-sun {
    display: inline;
  }

  :root:not([data-theme="dark"]) body.scene-dawn #hs-horizon stop:nth-child(1) {
    stop-color: #ffb48a;
    stop-opacity: 0.05;
  }

  :root:not([data-theme="dark"]) body.scene-dawn #hs-horizon stop:nth-child(2) {
    stop-color: #ff9a6c;
    stop-opacity: 0.5;
  }

  :root:not([data-theme="dark"]) body.scene-dawn #hs-horizon stop:nth-child(3) {
    stop-color: #ff8a52;
    stop-opacity: 0.75;
  }

  :root:not([data-theme="dark"]) body.scene-dawn .home-center,
  :root:not([data-theme="dark"]) body.scene-dawn .act-center {
    text-shadow: 0 0 14px #1a1650, 0 0 28px #1a1650;
  }

  :root:not([data-theme="dark"]) body.scene-dawn .sky-glow--gold {
    opacity: 0;
  }
}

/* ---- Light theme: a pale film strip with dawn-sky frames ---- */
:root[data-theme="light"] .strip {
  background: #ebe6f5;
  border-color: rgba(90, 80, 150, 0.2);
}

:root[data-theme="light"] .strip::before,
:root[data-theme="light"] .strip::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='22'%3E%3Crect x='2' y='6' width='8' height='10' rx='3' fill='%23cdc5e4'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .frame-ghost {
  border-color: rgba(11, 109, 134, 0.45);
  background: rgba(11, 109, 134, 0.05);
}

:root[data-theme="light"] .frame-ghost-label {
  color: #0b6d86;
}

:root[data-theme="light"] .frame-ghost-text {
  color: rgba(27, 29, 58, 0.7);
}

:root[data-theme="light"] .item.frame {
  border-color: rgba(90, 80, 150, 0.22);
  background: #fffaf3;
}

:root[data-theme="light"] .item.frame--now {
  border-color: #d9962f;
  box-shadow: 0 0 18px rgba(239, 176, 74, 0.45);
}

:root[data-theme="light"] .frame--now .frame-label {
  color: #8a5708;
}

:root[data-theme="light"] .frame-tag {
  border-color: rgba(27, 29, 58, 0.25);
}

:root[data-theme="light"] .frame-thumb {
  --thumb-top: #98afe6;
  --thumb-bottom: #f8d2ac;
  --thumb-core: #fffbea;
  --thumb-hill: #5b5a96;
  --star-rgb: 255, 255, 255;
  --glow: 255, 186, 110 !important;
}

:root[data-theme="light"] .frame--now .frame-thumb {
  --thumb-bottom: #f6bf8a;
}

@media (prefers-color-scheme: light) {
  /* ---- Light theme: a pale film strip with dawn-sky frames ---- */
  :root:not([data-theme="dark"]) .strip {
    background: #ebe6f5;
    border-color: rgba(90, 80, 150, 0.2);
  }

  :root:not([data-theme="dark"]) .strip::before,
  :root:not([data-theme="dark"]) .strip::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='22'%3E%3Crect x='2' y='6' width='8' height='10' rx='3' fill='%23cdc5e4'/%3E%3C/svg%3E");
  }

  :root:not([data-theme="dark"]) .frame-ghost {
    border-color: rgba(11, 109, 134, 0.45);
    background: rgba(11, 109, 134, 0.05);
  }

  :root:not([data-theme="dark"]) .frame-ghost-label {
    color: #0b6d86;
  }

  :root:not([data-theme="dark"]) .frame-ghost-text {
    color: rgba(27, 29, 58, 0.7);
  }

  :root:not([data-theme="dark"]) .item.frame {
    border-color: rgba(90, 80, 150, 0.22);
    background: #fffaf3;
  }

  :root:not([data-theme="dark"]) .item.frame--now {
    border-color: #d9962f;
    box-shadow: 0 0 18px rgba(239, 176, 74, 0.45);
  }

  :root:not([data-theme="dark"]) .frame--now .frame-label {
    color: #8a5708;
  }

  :root:not([data-theme="dark"]) .frame-tag {
    border-color: rgba(27, 29, 58, 0.25);
  }

  :root:not([data-theme="dark"]) .frame-thumb {
    --thumb-top: #98afe6;
    --thumb-bottom: #f8d2ac;
    --thumb-core: #fffbea;
    --thumb-hill: #5b5a96;
    --star-rgb: 255, 255, 255;
  }

  :root:not([data-theme="dark"]) .frame--now .frame-thumb {
    --thumb-bottom: #f6bf8a;
  }
}

/* The title sits below the area the phone blurs under the status bar. */
.screen--home .app-name {
  position: fixed;
  top: calc(var(--app-height, 100dvh) * 0.215);
  left: 50%;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0;
  transform: translateX(-50%);
  color: var(--text);
  opacity: 0.9;
  text-shadow: 0 0 10px #070b2e;
  pointer-events: none;
}

/* ---- Not sure: flip a coin ---- */

.link-btn--quiet {
  margin-top: -8px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration-color: var(--glass-edge);
}

.coin-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 56px) 24px calc(env(safe-area-inset-bottom) + 24px);
  background: rgba(5, 8, 35, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #f6ecd8;
  overflow-y: auto;
}

.coin-title {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 500;
  text-align: center;
}

.coin-stage {
  margin-top: 36px;
  width: 120px;
  height: 120px;
  perspective: 600px;
}

.coin {
  position: relative;
  width: 120px;
  height: 120px;
  transform-style: preserve-3d;
}

.coin-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d2 0, #f6cd78 40%, #e29a45 100%);
  box-shadow: 0 0 36px rgba(243, 196, 108, 0.45), inset 0 0 0 5px rgba(255, 243, 210, 0.35);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.coin-face--tails {
  transform: rotateX(180deg);
}

.coin-face svg {
  width: 64px;
  height: 64px;
  fill: #8a5708;
  stroke: #8a5708;
  stroke-width: 1.2;
}

.coin-face--tails svg {
  fill: none;
}

.coin.is-heads {
  transform: rotateX(0deg);
}

.coin.is-tails {
  transform: rotateX(180deg);
}

.coin.is-flipping {
  animation: coin-flip 1.6s cubic-bezier(0.25, 0.6, 0.3, 1) forwards, coin-toss 1.6s ease-out forwards;
}

@keyframes coin-flip {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(var(--end, 1800deg)); }
}

@keyframes coin-toss {
  0%, 100% { margin-top: 0; }
  40% { margin-top: -70px; }
}

.coin-sides {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

.coin-sides li {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(127, 224, 240, 0.28);
  background: rgba(20, 28, 78, 0.6);
  text-align: center;
}

.coin-side-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(236, 239, 255, 0.7);
}

.coin-side-text {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.coin-result {
  width: 100%;
  max-width: 420px;
  margin-top: 28px;
  text-align: center;
  animation: fade-only 0.4s var(--ease);
}

.coin-landed {
  font-size: 14px;
  color: rgba(236, 239, 255, 0.78);
}

.coin-pick {
  display: block;
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 600;
  color: #f8d58a;
  overflow-wrap: anywhere;
}

.coin-notice {
  margin: 14px auto 22px;
  max-width: 30ch;
  color: rgba(236, 239, 255, 0.78);
}

.coin-layer .stack-actions {
  text-align: left;
}

.coin-layer > .link-btn {
  margin-top: auto;
  color: #7fe0f0;
}

@media (prefers-reduced-motion: reduce) {
  .coin.is-flipping {
    animation: none;
  }
  .coin-result {
    animation: none;
  }
}

/* ---- About: backup instructions ---- */

.data-guide-steps {
  margin: 0 0 8px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  color: var(--text-dim);
}



/* ---- Desktop layout (700px and wider) ----
   The bar moves to the top, the Home and Settle scenes fit the window's height
   with the ground running out past the sides, and content gets a wider,
   centred column. Phones and small tablets keep the phone layout. */

@media (min-width: 700px) {
  .sky {
    top: 0;
    height: var(--app-height);
  }

  .nav {
    top: 18px;
    bottom: auto;
    /* left: 50% would otherwise squeeze the bar to half the window's width. */
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 4px 12px;
    grid-template-columns: repeat(5, max-content);
    gap: 4px;
    border: 1px solid var(--glass-edge);
    border-radius: 999px;
  }

  .nav-item {
    flex-direction: row;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    font-size: 15px;
    white-space: nowrap;
  }

  .nav-item:hover {
    color: var(--text);
  }

  .app {
    max-width: 800px;
    padding-top: 108px;
    padding-bottom: 56px;
  }

  .home-scene,
  .settle-svg {
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    height: var(--app-height);
    transform: none;
  }

  .home-scene-svg,
  .settle-svg {
    overflow: visible;
  }

  .home-center,
  .act-center,
  .settle-text {
    max-width: 760px;
  }

  .home-line {
    max-width: 18ch;
    font-size: 44px;
  }

  .home-pick,
  .act-pick {
    font-size: 54px;
  }

  .screen--home .app-name {
    top: calc(var(--app-height) * 0.19);
  }

  .home-actions,
  #screen-act .stack-actions,
  .outcome-options,
  .smaller-form,
  .release-form,
  .choose-entry {
    width: 100%;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
  }

  .settle-skip {
    bottom: 40px;
  }

  #screen-choose .screen-title,
  .smaller-title,
  .outcome-pick {
    text-align: center;
  }

  .pair {
    gap: 28px;
    margin-top: 150px;
  }

  .card {
    min-height: 260px;
    font-size: 32px;
  }

  .strip {
    width: 100%;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
  }

  .item.frame {
    display: flex;
    align-items: stretch;
  }

  .frame-thumb {
    flex: none;
    width: 230px;
    height: auto;
    min-height: 130px;
  }

  .frame-body {
    flex: 1;
    align-self: center;
    padding: 16px 22px;
  }

  .frame-text {
    font-size: 26px;
  }

  .sheet {
    margin: auto;
    border-radius: 24px;
    border-bottom: 1px solid var(--glass-edge);
  }
}

#compare-tie {
  margin-bottom: 0;
}

#compare-coin {
  margin-bottom: auto;
}

/* ---- About: Fragments of Coherence ---- */

.credit-card {
  container-type: inline-size;
  position: relative;
  margin-top: 8px;
  min-height: 380px;
  display: flex;
  border-radius: 22px;
  border: 1px solid rgba(243, 196, 108, 0.4);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(5, 8, 35, 0.88) 0%, rgba(5, 8, 35, 0.5) 52%, rgba(5, 8, 35, 0) 78%),
    linear-gradient(0deg, rgba(5, 8, 35, 0.72) 0%, rgba(5, 8, 35, 0) 40%),
    #0b1240 url('images/fragments-banner.webp') 55% 100% / cover no-repeat;
  color: #f2e8d3;
}

.credit-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 24px 22px 22px;
}

.credit-label {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(242, 232, 211, 0.78);
}

.credit-name {
  margin-top: 12px;
  max-width: 68%;
  font-family: var(--font-label);
  font-weight: 900;
  font-variation-settings: "opsz" 32;
  font-size: clamp(20px, 6.9cqw, 46px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #f2e8d3;
}

.credit-name::after {
  content: ".";
  color: #e8a850;
}

.credit-text {
  margin: 14px 0 0;
  max-width: 24ch;
  font-size: 14px;
  color: rgba(242, 232, 211, 0.82);
}

.credit-button {
  margin-top: auto;
  padding: 0 20px;
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
}

@container (min-width: 560px) {
  .credit-card {
    min-height: 0;
    aspect-ratio: 16 / 8;
    background-position: 50% 80%;
  }

  .credit-content {
    padding: 36px 38px;
  }

  .credit-name {
    max-width: 55%;
  }
}

/* ---- About: "Scroll for more" ---- */

.scroll-hint {
  position: fixed;
  left: 50%;
  /* Anchored from the top like the bottom bar, so it sits right on iPhones too. */
  top: calc(var(--app-height, 100dvh) - var(--nav-height) - env(safe-area-inset-bottom) - 14px - 48px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--nav-bg);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.scroll-hint svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: hint-bob 1.8s ease-in-out infinite;
}

@keyframes hint-bob {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}

@media (min-width: 700px) {
  .scroll-hint {
    top: calc(var(--app-height) - 76px);
  }
}

/* Windows just over 900px wide: tighter spacing so the whole bar always fits. */
@media (min-width: 700px) and (max-width: 1099px) {
  .nav-item {
    padding: 0 12px;
    gap: 6px;
  }
}

/* ---- Windows between a phone and the wide layout (481 to 699px) ----
   Still the phone layout, but the night scene, sky and bottom bar stretch
   across the whole window so there is no visible column. */
@media (min-width: 481px) and (max-width: 699px) {
  .sky {
    top: 0;
    height: var(--app-height);
  }

  .home-scene,
  .settle-svg {
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    height: var(--app-height);
    transform: none;
  }

  .home-scene-svg,
  .settle-svg {
    overflow: visible;
  }

  .nav {
    left: 0;
    width: 100%;
    max-width: none;
    transform: none;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
}

/* ---- Small uppercase labels: Inter Display Black ---- */
.app-name,
.home-active-label,
.scene-label,
.frame-ghost-label,
.frame-label,
.coin-side-label,
.credit-label {
  font-family: var(--font-label);
  font-weight: 900;
  font-variation-settings: "opsz" 32;
}

.credit-card + .about-lines {
  margin-top: 36px;
}

/* ---- Big text in Inter: medium weight, tight spacing, a touch smaller than the old serif ---- */
.screen-title,
.home-line,
.home-pick,
.card,
.act-pick,
.smaller-title,
.smaller-pick,
.release-line,
.about-lines p,
.settle-title,
.outcome-pick,
.outcome-name,
.frame-text,
.coin-title,
.coin-side-text,
.coin-pick {
  font-weight: 500;
  letter-spacing: -0.025em;
}

.screen-title {
  font-size: 32px;
}

.home-line {
  font-size: 30px;
}

.home-pick {
  font-size: 34px;
}

.card {
  font-size: 24px;
}

.act-pick {
  font-size: 38px;
}

.smaller-title {
  font-size: 32px;
}

.smaller-pick {
  font-size: 17px;
}

.release-line {
  font-size: 28px;
}

.about-lines p {
  font-size: 28px;
}

.settle-title {
  font-size: 35px;
}

.outcome-pick {
  font-size: 35px;
}

.outcome-name {
  font-size: 23px;
}

.frame-text {
  font-size: 20px;
}

.coin-title {
  font-size: 30px;
}

.coin-side-text {
  font-size: 20px;
}

.coin-pick {
  font-size: 30px;
}

.home-line.is-question {
  font-style: italic;
  font-weight: 500;
}

.frame-ghost-text {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.item-note {
  font-weight: 400;
  letter-spacing: -0.01em;
}

@media (min-width: 700px) {
  .home-line {
    font-size: 38px;
  }

  .home-pick {
    font-size: 46px;
  }

  .act-pick {
    font-size: 46px;
  }

  .card {
    font-size: 28px;
  }

  .frame-text {
    font-size: 23px;
  }
}

/* ---- Home quotes and the About text: Inter Thin Italic ---- */
.home-line,
.about-lines p,
.about-body {
  font-weight: 100;
  font-style: italic;
}

/* Thin strokes are faint, so the About paragraphs use the full text colour. */
.about-body {
  color: var(--text);
}

/* About paragraphs: Light, italic. The big lines and the Home quotes stay Thin. */
.about-body {
  font-weight: 300;
}

/* ---- Home quotes: arriving together ---- */
.home-line {
  font-family: var(--font-home-quote);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(30px, calc(var(--app-height, 100dvh) * 0.05), 42px);
  line-height: 1.08;
  letter-spacing: -0.005em;
  max-width: 13ch;
}

.home-line.is-question {
  font-style: italic;
  font-weight: 400;
  color: var(--gold-light);
}

.home-line.is-entering {
  animation: none;
}

.home-line .word {
  display: inline-block;
  /* Only opacity and a small lift: both run on the graphics chip, so it stays smooth. */
  animation: word-in 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
  will-change: opacity, transform;
}

@keyframes word-in {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.home-hint {
  margin-top: 22px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  animation: hint-in 0.7s 0.5s var(--ease) backwards;
}

@keyframes hint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 700px) {
  .home-line {
    font-size: clamp(34px, calc(var(--app-height, 100dvh) * 0.068), 54px);
    max-width: 15ch;
  }
}

/* ---- About: the three big lines in Cormorant Garamond (original size), the paragraphs in standard Inter ---- */
.about-lines p {
  font-family: var(--font-home-quote);
  font-style: normal;
  font-weight: 500;
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: 0;
}

.about-body {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: normal;
  color: var(--text-dim);
}

@media (min-width: 700px) {
  .about-lines p {
    font-size: 40px;
  }

  .about-body {
    font-size: 18px;
  }
}


/* ---- Smoothness: no always-moving blurs ----
   The big blurred glows, the twinkling stars and the star inside the scene
   were all repainting every frame, which made the quote's arrival stutter on
   phones. The glows now hold still (they are soft gradients already), the
   small stars twinkle with opacity only, and the scene's star holds still. */
.sky-glow {
  animation: none;
  filter: none;
  will-change: auto;
}

.star--twinkle {
  animation: star-fade 6s ease-in-out infinite;
  will-change: opacity;
}

@keyframes star-fade {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.25; }
}

.scene-star {
  animation: none;
}

/* The star sits in its own layer so it can breathe without repainting the
   whole picture. Only opacity and scale change, which the graphics chip does. */
.home-star {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: var(--star-x, 50%) var(--star-y, 13%);
  animation: star-breathe 4.6s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes star-breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.5; }
  50% { transform: scale(1.4); opacity: 1; }
}

/* ---- Home quotes: Cormorant Garamond at its original size (34px on a phone, 44px on desktop) ---- */
.home-line {
  font-family: var(--font-home-quote);
  font-weight: 500;
  font-size: clamp(26px, calc(var(--app-height, 100dvh) * 0.042), 34px);
  line-height: 1.15;
  letter-spacing: 0;
  max-width: 16ch;
}

.home-line.is-question {
  font-weight: 500;
}

@media (min-width: 700px) {
  .home-line {
    font-size: clamp(34px, calc(var(--app-height, 100dvh) * 0.055), 44px);
    max-width: 18ch;
  }
}

/* The tap hint sits on a soft dark pill, so it stays readable over the sunrise glow. */
.home-hint {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(9, 13, 48, 0.6);
  color: rgba(246, 236, 216, 0.95);
  text-shadow: none;
}

/* ---- About: a gentle note at the very bottom ---- */
.about-helpline {
  margin: 48px 0 0;
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-faint);
}
