/* Per-section layout, top of the page to the bottom of the night. */

/* ── dock ───────────────────────────────────────────────────────────────── */

.dock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-dock);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) clamp(1.25rem, 4vw, 2.5rem);
  transition: background var(--dur) var(--ease-tide), border-color var(--dur) var(--ease-tide);
  border-bottom: 1px solid transparent;
}

/* Only once you have scrolled does it earn a background. */
.dock.is-stuck {
  background: rgba(7, 10, 28, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--glass-edge);
}

.dock-mark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--sand);
  text-decoration: none;
  white-space: nowrap;
}

.dock-mark em {
  color: var(--green);
  font-style: italic;
}

.dock-nav {
  display: flex;
  gap: var(--space-1);
  margin-inline: auto;
}

.dock-nav a {
  font-size: var(--text-sm);
  color: var(--sand-dim);
  text-decoration: none;
  padding: 0.4em 0.8em;
  border-radius: 999px;
  white-space: nowrap;
  transition: color var(--dur-quick) var(--ease-tide), background var(--dur-quick) var(--ease-tide);
}

.dock-nav a:hover {
  color: var(--sand);
  background: rgba(243, 233, 220, 0.07);
}

.dock-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  border: 1px solid var(--glass-edge-lit);
  background: transparent;
  color: var(--sand-dim);
  cursor: pointer;
  transition: color var(--dur-quick) var(--ease-tide), border-color var(--dur-quick) var(--ease-tide);
}

.icon-btn:hover {
  color: var(--sand);
  border-color: var(--sand-dim);
}

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

@media (max-width: 900px) {
  .dock-nav {
    display: none;
  }

  .dock {
    justify-content: space-between;
  }
}

/* ── hero ───────────────────────────────────────────────────────────────── */

.hero {
  /* the scroll cue is absolutely positioned against this */
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: end;
  text-align: right;
  padding: var(--space-9) 0 var(--space-8);
}

/* The figure lives in the canvas on the left, so the words sit to the right
   of him, the way the caption does in the meme itself. */
.hero-inner {
  width: 100%;
  max-width: 34rem;
  /* Grid items default to min-width:auto, so the nowrap contract line sets a
     floor the column cannot go below and the whole hero grows past the
     viewport. Letting it shrink is what allows the text to wrap. */
  min-width: 0;
}

.hero h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-hero);
  line-height: 1.02;
  color: var(--sand);
  text-shadow: 0 2px 30px rgba(7, 10, 28, 0.55);
}

.hero h1 .q {
  color: var(--sand-soft);
}

.hero-sub {
  margin-top: var(--space-5);
  margin-left: auto;
  font-size: var(--text-lg);
  color: var(--sand-dim);
  max-width: min(26rem, 100%);
  text-shadow: 0 1px 20px rgba(7, 10, 28, 0.7);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.hero-chip {
  margin-top: var(--space-5);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--sand-dim);
  max-width: 100%;
}

.hero-chip .addr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0; /* required for the ellipsis to engage inside the flex row */
}

.hero-chip button {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.45em 0.9em;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(61, 220, 132, 0.16);
  color: #d6ffe8;
  cursor: pointer;
}

.hero-chip button:hover {
  background: rgba(61, 220, 132, 0.28);
}

/* A slow breathing line that invites the scroll. */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--sand-soft);
}

.scroll-cue::after {
  content: '';
  width: 1px;
  height: 3.5rem;
  background: linear-gradient(var(--sand-faint), transparent);
  animation: cue 3.6s var(--ease-tide) infinite;
  transform-origin: top;
}

@keyframes cue {
  0%,
  100% {
    transform: scaleY(0.35);
    opacity: 0.3;
  }
  50% {
    transform: scaleY(1);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue::after {
    animation: none;
  }
}

@media (max-width: 780px) {
  .hero {
    justify-items: center;
    text-align: center;
    /* the figure is centred low on phones, so the words sit above him */
    align-content: start;
    padding-top: 22vh;
  }

  .hero-sub,
  .hero-actions {
    justify-content: center;
    margin-inline: auto;
  }
}

/* ── generic section rhythm ─────────────────────────────────────────────── */

.section {
  padding-block: var(--space-9);
  scroll-margin-top: 5rem;
}

.section-head {
  max-width: var(--narrow);
  margin-bottom: var(--space-7);
}

.section-head p {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
}

/* ── the feeling: three states ──────────────────────────────────────────── */

.states {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-4);
}

.state {
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  /* Darker than the default glass: these sit over the brightest part of the
     sunset, where a red hairline on a red sky disappears entirely. */
  background: var(--glass-strong);
}

.state h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.state p {
  font-size: var(--text-base);
  max-width: none;
}

/* A hairline of the state's own colour along the top edge. */
.state::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--state, var(--sand-faint));
}

.state--red {
  --state: var(--red-candle);
}

.state--flat {
  --state: var(--sand-faint);
}

.state--green {
  --state: var(--green);
}

.state--green h3 {
  color: var(--green);
}

/* ── numbers ────────────────────────────────────────────────────────────── */

.numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-4);
}

.number {
  padding: var(--space-6) var(--space-5);
}

.number .value {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--sand);
}

.number .label {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--sand-soft);
}

.number p {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  max-width: none;
}

.fine-print {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--sand-soft);
  max-width: var(--narrow);
}

/* ── the breathing game ─────────────────────────────────────────────────── */

/* One column: the stage takes the full content width and the notes sit under
   it as a strip. A 22rem sidebar was costing the playfield a third of its
   width for four lines of text. */
.calm {
  display: grid;
  gap: var(--space-4);
}

.calm-stage {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Stretching in the grid row squashed the canvas and drew circles as
     ellipses; align to the top and let the canvas set its own height. */
  align-self: start;
}

.calm-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: pointer;
}

/* Live readout during a run. */
.hold-live {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: grid;
  justify-items: end;
  gap: var(--space-2);
  pointer-events: none;
}

.hold-dist {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2rem;
  line-height: 1;
  color: var(--sand);
  text-shadow: 0 2px 14px rgba(4, 6, 16, 0.8);
}

.hold-calm {
  display: block;
  width: 9rem;
  height: 5px;
  border-radius: 999px;
  background: rgba(243, 233, 220, 0.18);
  overflow: hidden;
}

.hold-calm::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--calm, 70%);
  border-radius: 999px;
  background: var(--green);
  transition: width 120ms linear;
}

.calm-hud {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  text-align: center;
  background: rgba(7, 10, 28, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.calm-hud h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
}

.calm-hud p {
  max-width: 30rem;
}

.calm-hud .verdict {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  color: var(--green);
  line-height: 1.05;
}

.calm-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
}

.calm-side h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
}

.calm-side ol {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  color: var(--sand-dim);
  font-size: var(--text-sm);
  max-width: 52rem;
}

.calm-side li b {
  color: var(--sand);
  font-weight: 600;
}

.calm-side li::marker {
  color: var(--sand-soft);
}

.calm-stats {
  display: grid;
  gap: var(--space-2);
  min-width: 13rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--sand-soft);
  border-left: 1px solid var(--glass-edge);
  padding-left: var(--space-5);
}

@media (max-width: 760px) {
  .calm-stats {
    border-left: 0;
    border-top: 1px solid var(--glass-edge);
    padding-left: 0;
    padding-top: var(--space-4);
    width: 100%;
  }
}

.calm-stats div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.calm-stats b {
  font-weight: 500;
  color: var(--sand);
}

/* ── gallery ────────────────────────────────────────────────────────────── */

.moments {
  columns: 3 17rem;
  column-gap: var(--space-4);
}

@media (max-width: 620px) {
  .moments {
    columns: 2 9rem;
    column-gap: var(--space-3);
  }
}

.moment {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: var(--space-4);
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass);
  cursor: zoom-in;
  position: relative;
  transition: border-color var(--dur) var(--ease-tide), transform var(--dur) var(--ease-tide);
}

.moment:hover {
  border-color: var(--glass-edge-lit);
  transform: translateY(-3px);
}

.moment img {
  width: 100%;
  height: auto;
  background-size: cover;
  background-position: center;
}

.moment figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.2rem 0.9rem 0.7rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--sand);
  text-align: left;
  background: linear-gradient(transparent, rgba(7, 10, 28, 0.88));
  pointer-events: none;
}

/* ── lightbox ───────────────────────────────────────────────────────────── */

.veil {
  position: fixed;
  inset: 0;
  z-index: var(--z-veil);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: rgba(4, 6, 16, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.veil img {
  max-height: min(74vh, 54rem);
  max-width: min(94vw, 54rem);
  width: auto;
  border-radius: var(--radius);
  border: 1px solid var(--glass-edge);
}

.veil figcaption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--sand);
}

.veil-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.veil-close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
}

/* ── meme lab ───────────────────────────────────────────────────────────── */

.lab {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(15rem, 1fr);
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 900px) {
  .lab {
    grid-template-columns: 1fr;
  }
}

.lab-canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--glass-edge);
  background: var(--deep);
  cursor: grab;
  /* The canvas owns its gestures. Switching this on at pointerdown was too
     late — the browser had already committed to a scroll, so a drag just
     scrolled the page. There is page above and below the canvas to scroll
     from, and the controls sit right underneath it.  */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.lab-canvas.dragging {
  cursor: grabbing;
}

.lab-hint {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sand-soft);
  text-align: center;
}

.lab-controls {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
}

.group-label {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--sand-soft);
  margin-bottom: var(--space-3);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chips button {
  border: 1px solid var(--glass-edge);
  background: transparent;
  color: var(--sand-dim);
  border-radius: 999px;
  padding: 0.45em 0.9em;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color var(--dur-quick) var(--ease-tide), color var(--dur-quick) var(--ease-tide);
}

.chips button:hover {
  color: var(--sand);
  border-color: var(--sand-soft);
}

.chips button[aria-pressed='true'] {
  color: #05130b;
  background: var(--green);
  border-color: var(--green);
}

/* The backdrop list is long now (procedural + scenes + every meme), so it
   scrolls in place instead of pushing the rest of the panel off screen. */
.chips--scroll {
  max-height: 8.5rem;
  overflow-y: auto;
  padding-right: var(--space-2);
  scrollbar-width: thin;
}

.lab-inspector {
  display: grid;
  gap: var(--space-4);
}

.lab-empty {
  font-size: var(--text-sm);
  color: var(--sand-soft);
  max-width: none;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.swatch {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 2px solid var(--glass-edge);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
}

.swatch[aria-pressed='true'] {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.25);
}

.lab-actions .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tray button {
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  padding: 0.35rem;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm);
  background: rgba(243, 233, 220, 0.04);
  cursor: pointer;
}

.tray button:hover {
  border-color: var(--sand-soft);
}

.tray img {
  max-width: 3rem;
  max-height: 3rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field > span {
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--sand-soft);
}

.field input[type='text'] {
  background: rgba(7, 10, 28, 0.6);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.9em;
  color: var(--sand);
  min-width: 0;
}

.field input[type='text']:focus {
  border-color: var(--green);
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--glass-edge-lit);
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--green);
}

input[type='range']::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 50%;
  background: var(--green);
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ── steps ──────────────────────────────────────────────────────────────── */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-4);
  counter-reset: step;
}

.step {
  padding: var(--space-6);
  counter-increment: step;
}

.step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  color: var(--green);
  margin-bottom: var(--space-4);
}

.step h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.step p {
  font-size: var(--text-sm);
  max-width: none;
}

/* ── market ─────────────────────────────────────────────────────────────── */

.market-empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
}

.market-empty .serif {
  font-size: var(--text-xl);
  color: var(--sand);
}

.market-empty p {
  margin: var(--space-4) auto 0;
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.footer {
  position: relative;
  z-index: var(--z-content);
  padding: var(--space-8) 0 var(--space-7);
  border-top: 1px solid var(--glass-edge);
  background: rgba(4, 6, 16, 0.6);
  text-align: center;
}

.footer .serif {
  font-size: var(--text-xl);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.disclaimer {
  margin: var(--space-6) auto 0;
  max-width: 52ch;
  font-size: var(--text-xs);
  line-height: 1.75;
  color: var(--sand-soft);
}

/* ── toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--space-6);
  width: fit-content;
  margin-inline: auto;
  z-index: var(--z-toast);
  padding: 0.8em 1.4em;
  border-radius: 999px;
  background: rgba(7, 10, 28, 0.94);
  border: 1px solid var(--glass-edge-lit);
  color: var(--sand);
  font-size: var(--text-sm);
  max-width: min(92vw, 30rem);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(120%);
  transition: transform var(--dur) var(--ease-drift), opacity var(--dur) var(--ease-tide);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── phone tab bar ──────────────────────────────────────────────────────── */

.tabbar {
  display: none;
}

@media (max-width: 900px) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-dock);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(5, 7, 22, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--glass-edge);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .tabbar a {
    display: grid;
    justify-items: center;
    gap: 0.3em;
    min-height: 3.4rem;
    align-content: center;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sand-soft);
    text-decoration: none;
    transition: color var(--dur-quick) var(--ease-tide);
  }

  .tabbar a svg {
    width: 18px;
    height: 18px;
  }

  .tabbar a.is-active {
    color: var(--green);
  }

  body {
    padding-bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ── the sunline ────────────────────────────────────────────────────────── */
/* Fills as you scroll, gold to night: the page's own sunset as a progress
   indicator. Sits on the dock's bottom edge. */
.sunline {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: var(--p, 0%);
  background: linear-gradient(90deg, #f8b45c, #e8663a 40%, #6b3355 75%, #1b2048);
  transition: width 90ms linear;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .sunline {
    transition: none;
  }
}

/* On phones the cue lands on top of the figure and the tab bar already
   signals there is more page, so it stands down. */
@media (max-width: 780px) {
  .scroll-cue {
    display: none;
  }
}

/* ── backdrop picker ────────────────────────────────────────────────────── */

.bg-tabs {
  margin-bottom: var(--space-3);
}

.bg-grid {
  display: grid;
  /* Fixed tracks rather than auto-fill: inside a narrow scrolling column the
     auto-fill track could resolve to almost nothing, which is what made the
     thumbnails pile on top of each other on a phone. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  max-height: 14rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: var(--space-2);
  scrollbar-width: thin;
}

@media (max-width: 900px) {
  .bg-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: 11rem;
  }
}

@media (max-width: 460px) {
  .bg-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.bg-thumb {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(243, 233, 220, 0.04);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color var(--dur-quick) var(--ease-tide);
}

.bg-thumb:hover {
  border-color: var(--sand-faint);
}

.bg-thumb[aria-pressed='true'] {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(61, 220, 132, 0.3);
}

.bg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-thumb-label {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sand-soft);
  padding: 0.2rem;
  text-align: center;
}

/* ── the game on phones ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* The canvas sets its own ratio at mount, so let it. */
  .calm-stage canvas {
    aspect-ratio: auto;
  }

  /* An overlay HUD clips its own text inside a short canvas, so on phones it
     flows underneath instead and the canvas steps aside while it is up. */
  .calm-hud {
    position: static;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding: var(--space-5);
  }

  .calm-stage:has(.calm-hud:not([hidden])) canvas {
    display: none;
  }

  .calm-hud h3 {
    font-size: var(--text-xl);
  }
}

/* ── state cards now lead with their own chart ──────────────────────────── */

.spark {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 440 / 150;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-sm);
}

/* ── the ledger: numbers as a spare list, not four identical boxes ──────── */

.ledger {
  margin: 0;
  padding: var(--space-3) var(--space-6);
}

.ledger > div {
  display: grid;
  /* min() on the value column so a long figure can never push into its note */
  grid-template-columns: 7rem minmax(0, 9rem) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-5);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--glass-edge);
}

.ledger > div:last-child {
  border-bottom: 0;
}

.ledger dt {
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--sand-soft);
}

.ledger dd {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--sand);
  overflow-wrap: break-word;
}

.ledger dd.aside {
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--text-sm);
  color: var(--sand-dim);
}

@media (max-width: 700px) {
  .ledger > div {
    grid-template-columns: 1fr;
    gap: var(--space-1);
    padding: var(--space-4) 0;
  }
}

/* ── the notice: one panel, not a third grid of cards ───────────────────── */

.notice {
  padding: clamp(1.75rem, 4vw, 3.25rem);
  max-width: 58rem;
  margin-inline: auto;
  position: relative;
}

.notice::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(var(--green), transparent);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.notice-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  color: var(--sand);
  margin-bottom: var(--space-4);
}

.notice-lede {
  font-size: var(--text-lg);
  color: var(--sand-dim);
  max-width: 44rem;
}

.notice-list {
  list-style: none;
  padding: 0;
  margin: var(--space-6) 0 0;
  display: grid;
  gap: var(--space-4);
}

.notice-list li {
  padding-left: var(--space-5);
  position: relative;
  color: var(--sand-dim);
  font-size: var(--text-base);
  max-width: 46rem;
}

.notice-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 2px;
  background: var(--sand-faint);
}

.notice-list b {
  color: var(--sand);
  font-weight: 600;
}

.notice-fine {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--glass-edge);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--sand-soft);
  max-width: none;
}

/* Give the game real estate on a phone — it is the section, not a garnish. */
@media (max-width: 760px) {
  .calm-stage canvas {
    max-height: 68svh;
    margin-inline: auto;
  }
}

/* ── phone rhythm ───────────────────────────────────────────────────────── */
/* 9rem of air between sections is generous on a desktop and simply a lot of
   scrolling on a phone. */
@media (max-width: 760px) {
  .section {
    padding-block: var(--space-7);
  }

  .section-head {
    margin-bottom: var(--space-5);
  }

  /* The HUD already explains the game; the intro paragraph above it was
     pushing the board off the screen. */
  #game .section-head p {
    display: none;
  }
}

/* ── hero calls to action ───────────────────────────────────────────────── */
/* Three identical pills gave no hierarchy and said nothing about where they
   go. These carry an icon and a second line, so each one is legible at a
   glance and Buy is clearly the primary. */

.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem 1.15rem 0.7rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--glass-edge-lit);
  background: rgba(10, 14, 34, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--sand);
  text-decoration: none;
  transition: border-color var(--dur-quick) var(--ease-tide), background var(--dur-quick) var(--ease-tide),
    transform var(--dur-quick) var(--ease-tide);
}

.cta:hover {
  transform: translateY(-2px);
  border-color: var(--sand-dim);
  background: rgba(14, 20, 44, 0.72);
}

.cta-icon {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  flex: none;
  border-radius: 50%;
  background: rgba(243, 233, 220, 0.09);
  color: var(--sand);
}

.cta-icon svg {
  width: 18px;
  height: 18px;
}

.cta-text {
  display: grid;
  gap: 0.1rem;
  text-align: left;
  line-height: 1.15;
}

.cta-text b {
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  color: var(--sand);
}

.cta-text em {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sand-soft);
}

/* Buy is the one green thing that is not a candle. */
.cta--buy {
  background: rgba(61, 220, 132, 0.13);
  border-color: rgba(61, 220, 132, 0.45);
}

.cta--buy .cta-icon {
  background: rgba(61, 220, 132, 0.22);
  color: #d6ffe8;
}

.cta--buy:hover {
  background: rgba(61, 220, 132, 0.2);
  border-color: var(--green);
}

.cta--buy .cta-text b {
  color: #eafff3;
}

.cta[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}

.cta[aria-disabled='true']:hover {
  transform: none;
}

/* On a phone the point of the hero is the view. Full-width stacked buttons
   covered it, so they shrink to a single compact row: icon plus one label,
   with the second line dropped. */
@media (max-width: 620px) {
  .hero-actions {
    gap: var(--space-2);
    margin-top: var(--space-4);
  }

  .cta {
    padding: 0.4rem 0.8rem 0.4rem 0.4rem;
    gap: var(--space-2);
  }

  .cta-icon {
    width: 1.7rem;
    height: 1.7rem;
  }

  .cta-icon svg {
    width: 14px;
    height: 14px;
  }

  .cta-text em {
    display: none;
  }

  .cta-text b {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
  }

  /* The X mark says it on its own; the handle is too long for this row. */
  .cta[data-link='x'] .cta-text {
    display: none;
  }

  .cta[data-link='x'] {
    padding: 0.4rem;
  }
}

/* ── the pre-game screen ────────────────────────────────────────────────── */
/* It used to read as a paragraph with a button under it, which is why it was
   easy to scroll past. Now it reads as a title card. */

.hud-kicker {
  font-size: var(--text-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--green);
  margin: 0;
}

.calm-hud h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
  color: var(--sand);
}

.calm-hud #hold-copy {
  font-size: var(--text-base);
  color: var(--sand-dim);
  max-width: 30rem;
}

.hud-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
}

.hud-keys span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sand-soft);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  padding: 0.4em 0.85em;
}

.hud-keys b {
  color: var(--sand);
  font-weight: 600;
}

.hud-keys .k-green {
  border-color: rgba(61, 220, 132, 0.4);
}

.hud-keys .k-green b {
  color: var(--green);
}

.hud-keys .k-gap {
  border-color: rgba(229, 72, 77, 0.4);
}

.hud-keys .k-gap b {
  color: var(--red-candle);
}

.btn--play {
  font-size: var(--text-base);
  padding: 0.85em 2.1em;
}

.play-tri {
  width: 0;
  height: 0;
  border-left: 9px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.hud-best {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--sand-soft);
  margin: 0;
}

/* The side panel is only the stats strip now. */
.calm-side {
  justify-content: center;
}

.calm-side .calm-stats {
  border-left: 0;
  padding-left: 0;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
  gap: var(--space-6);
}

@media (max-width: 620px) {
  .calm-side .calm-stats {
    grid-auto-flow: row;
    gap: var(--space-2);
  }
}
