/* threeone — a night sky that fills up evening by evening. */

/* ── fonts (self-hosted; Fraunces, SIL Open Font License — see assets/fonts/OFL.txt) ── */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/fraunces-latin-soft-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/fraunces-latin-soft-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/fraunces-latin-ext-soft-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/fraunces-latin-ext-soft-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── tokens ── */
:root {
  color-scheme: dark;

  --ink: #f4efe4; /* primary text */
  --ink-2: #cdc9bf; /* secondary text */
  --ink-3: #9d998f; /* labels, hints */
  --cream: #f6ecd9; /* warm white for the second half of the wordmark and headline */
  --accent: #e2ad48; /* the horizon's gold: primary buttons, switches, selections */
  --night: #17130a; /* text on gold */
  --line: rgba(244, 239, 228, 0.12);
  --line-2: rgba(244, 239, 228, 0.24);
  --danger: #ff9d94;

  /* one colour per person — the same two as in js/draw.js */
  --person-a: #f5b55c;
  --person-b: #7db9f5;

  --font-display: 'Fraunces', ui-serif, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --glow-h: clamp(110px, 17vh, 170px); /* how high the horizon's light reaches */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

[data-person='0'] { --c: var(--person-a); }
[data-person='1'] { --c: var(--person-b); }

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

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: #030308;
  color: var(--ink);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

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

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

.kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.fineprint { font-size: 12.5px; color: var(--ink-3); }

.icon { display: block; flex: none; }

.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--person-a);
}
.dot--1 { background: var(--person-b); }
.dot--world { width: 6px; height: 6px; background: var(--ink); opacity: 0.8; } /* everybody else: plain starlight */

/* The marker in front of every thing said: a dot (grateful) or a sparkle (proud). */
.marker {
  flex: none;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.5;
  transition: fill 0.3s, stroke 0.3s, filter 0.3s;
}
.marker.is-lit {
  fill: var(--c, var(--ink));
  stroke: none;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c, var(--ink)) 55%, transparent));
}

/* ── the scene: a night sky with the day's last gold low on the horizon, and the canvas of stars ── */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  /* the same sky as paintScene() in js/scene.js: an ellipse of light resting on the bottom edge, over almost-black */
  background:
    radial-gradient(
      ellipse 85% var(--glow-h) at 50% 100%,
      rgb(226, 173, 72) 0%,
      rgba(192, 138, 48, 0.95) 22%,
      rgba(122, 85, 32, 0.8) 45%,
      rgba(58, 40, 16, 0.5) 70%,
      rgba(11, 10, 16, 0) 100%
    ),
    linear-gradient(to top, #0b0a10 0%, #05060d 45%, #030308 100%);
}
/* two faint hazes of blue keep the black from being flat */
.scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 45% at 20% 24%, rgba(70, 92, 170, 0.09), transparent 70%),
    radial-gradient(55% 40% at 82% 40%, rgba(60, 84, 156, 0.06), transparent 70%);
}
.sky {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

/* ── top bar ── */
.topbar {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(18px + var(--safe-l));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 400 23px/1 var(--font-display);
  font-variation-settings: 'SOFT' 100;
  letter-spacing: -0.01em;
}
.brand__name em { font-style: italic; color: var(--cream); }
.brand__mark circle { fill: var(--ink); opacity: 0.85; }
.brand__mark path { fill: var(--person-a); }

.topbar__actions { display: flex; gap: 8px; }

/* ── buttons ── */
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.13); color: var(--ink); }
.icon-btn:active { transform: scale(0.93); }
.icon-btn:disabled { opacity: 0.28; cursor: default; background: none; }
.icon-btn--large { width: 50px; height: 50px; }
.icon-btn--quiet { border-color: transparent; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s var(--ease), opacity 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }

.btn--primary { border-color: transparent; background: var(--accent); color: var(--night); font-weight: 600; }
.btn--primary:hover { background: #efc163; }
.btn--primary:disabled:hover { background: var(--accent); }

.btn--large {
  width: 100%;
  min-height: 52px;
  padding: 0 28px;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.btn--danger { border-color: transparent; background: var(--danger); color: #3d0f14; }
.btn--danger:hover { background: #ffb3ab; }
.btn--quiet-danger { border-color: transparent; background: transparent; color: var(--danger); }

/* ── dock: legend and the evening's call to action ── */
.dock {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 calc(16px + var(--safe-r)) calc(18px + var(--safe-b)) calc(16px + var(--safe-l));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  min-height: 20px;
  font-size: 13px;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.7); /* it stands at the rim of the glow */
}
.legend__group { display: inline-flex; gap: 14px; }
.legend__item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend .marker { width: 15px; height: 15px; }

.dock__row { display: flex; align-items: center; gap: 14px; }

/* the evening's one action: a dark shape standing in front of the light */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 212px;
  height: 56px;
  padding: 0 28px;
  border: 1px solid rgba(226, 173, 72, 0.65);
  border-radius: 999px;
  background: rgba(8, 8, 12, 0.94);
  color: var(--ink);
  font: 600 16.5px/1 var(--font-ui);
  letter-spacing: 0.01em;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.cta svg { fill: var(--accent); }
.cta:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(226, 173, 72, 0.14); }
.cta:active { transform: scale(0.97); }

/* the round buttons beside it share its ground */
.dock .icon-btn { background: rgba(8, 8, 12, 0.72); border-color: rgba(244, 239, 228, 0.2); color: var(--ink); }
.dock .icon-btn:hover { background: rgba(8, 8, 12, 0.9); border-color: rgba(244, 239, 228, 0.4); }

/* ── the empty sky ── */
.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 90px 28px 200px;
  pointer-events: none;
}
.empty { max-width: 30ch; text-align: center; animation: fade-in 1.4s 0.2s both; }
.empty__title {
  margin-bottom: 8px;
  font: 400 clamp(26px, 6.4vw, 38px) / 1.15 var(--font-display);
  font-variation-settings: 'SOFT' 100;
  letter-spacing: -0.012em;
}
.empty__text { color: var(--ink-2); }

.tooltip {
  position: fixed;
  z-index: 3;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 6px 11px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(24, 25, 33, 0.95);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

.toast {
  position: fixed;
  z-index: 10;
  top: calc(70px + var(--safe-t));
  left: 50%;
  transform: translate(-50%, -10px);
  width: max-content;
  max-width: min(92vw, 440px);
  padding: 11px 18px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: #1d1e27;
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  font-size: 14.5px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: fixed; inset: auto 0 40%; z-index: 5; padding: 0 24px; text-align: center; }

/* ── sheets ── */
dialog.sheet {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: hidden;
}
dialog.sheet[open] { display: grid; align-items: end; justify-items: center; }
dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.25s both;
}
dialog.sheet[data-closing]::backdrop { animation: fade-out 0.19s both; }

.sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  max-height: min(92dvh, 900px);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #1b1c24 0%, #0f1015 100%);
  box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.5);
  animation: sheet-up 0.4s var(--ease) both;
}
dialog.sheet[data-closing] .sheet__panel { animation: sheet-down 0.19s ease-in both; }
.sheet--wide .sheet__panel { width: min(100%, 880px); }

/* a small grab handle, as bottom sheets have */
.sheet__panel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--line-2);
}

.sheet__head { display: flex; align-items: flex-start; gap: 4px; padding: 22px 12px 8px 24px; }
.sheet__titles { flex: 1; min-width: 0; padding-top: 3px; }
.sheet__title {
  margin-top: 2px;
  font: 400 25px/1.15 var(--font-display);
  font-variation-settings: 'SOFT' 100;
  letter-spacing: -0.012em;
}
.sheet__tools { position: relative; display: inline-flex; }
.sheet__panel > .sheet__close { position: absolute; top: 14px; right: 12px; z-index: 1; }

.sheet__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 24px 24px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 239, 228, 0.22) transparent;
}
.sheet__foot {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px calc(16px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.sheet__foot--stack { flex-direction: column; align-items: center; gap: 12px; border-top: 0; padding-top: 4px; }
.sheet__foot--stack .fineprint { max-width: 48ch; text-align: center; }
.sheet__foot--actions .btn { flex: 1 1 auto; }
@media (max-width: 519px) {
  /* little room: the destructive action steps back to an icon */
  .sheet__foot--actions .btn--quiet-danger { flex: 0 0 auto; padding: 0 12px; }
  .sheet__foot--actions .btn--quiet-danger .btn__label { display: none; }
}

@media (min-width: 720px) {
  dialog.sheet[open] { align-items: center; padding: 24px; }
  .sheet__panel {
    max-height: min(88dvh, 860px);
    border-bottom: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
    animation-name: sheet-pop;
  }
  .sheet__panel::before { display: none; }
  .sheet__head { padding-top: 18px; }
  .sheet__foot { padding-bottom: 18px; }
  .sheet__foot--actions .btn { flex: 0 1 auto; }
  .btn--large { width: auto; min-width: 280px; }
}

/* confirmation */
dialog.sheet--alert[open] { align-items: center; padding: 20px; }
.sheet--alert .sheet__panel {
  width: min(100%, 400px);
  border-bottom: 1px solid var(--line);
  border-radius: 22px;
  animation-name: sheet-pop;
}
.sheet--alert .sheet__panel::before { display: none; }
.sheet--alert .sheet__body { padding-top: 24px; }
.sheet--alert .sheet__foot { justify-content: flex-end; border-top: 0; padding-top: 0; padding-bottom: 18px; }
.alert__text { margin-top: 8px; color: var(--ink-2); }

/* ── a constellation as SVG ── */
.glyph { display: block; width: 100%; height: 100%; overflow: visible; }
.glyph__star { --c: var(--person-a); }
.glyph__star[data-person='1'] { --c: var(--person-b); }
.glyph__shape { fill: var(--c); }
.glyph__core { fill: #fffaf0; opacity: 0.9; }
.glyph__ghost { fill: none; stroke: rgba(244, 239, 228, 0.3); stroke-width: 0.018; }
.glyph__hit { fill: transparent; cursor: pointer; }
.glyph__tint--0 { stop-color: var(--person-a); }
.glyph__tint--1 { stop-color: var(--person-b); }
.glyph__edge { fill: none; stroke-width: 0.022; stroke-linecap: round; }
.glyph__edge--tree { stroke: rgba(244, 239, 228, 0.42); }
.glyph__edge--bond { stroke-opacity: 0.85; }

.glyph__pop { transform-box: fill-box; transform-origin: center; transition: transform 0.25s var(--ease); }
.glyph__star.is-active .glyph__pop { transform: scale(1.4); }
.glyph__pop.is-fresh { animation: star-pop 0.55s var(--ease) both; }
.glyph--animate .glyph__star.is-on .glyph__pop {
  animation: star-pop 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}
.glyph--animate .glyph__edge {
  stroke-dasharray: 1 2;
  animation: edge-draw 0.5s ease-out both;
  animation-delay: calc(var(--i, 0) * 70ms + 320ms);
}

/* ── people and their words (form and evening sheet) ── */
.people { display: grid; gap: 28px; }
.person { min-width: 0; }
.person__name {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
  font: 500 19px/1.2 var(--font-display);
  font-variation-settings: 'SOFT' 100;
}
.person .kicker { margin: 14px 0 2px; }

@media (min-width: 720px) {
  .people--2 { grid-template-columns: 1fr 1fr; gap: 40px; }
}

/* writing */
.form__preview { width: 150px; height: 150px; margin: 2px auto 14px; }

.field {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  column-gap: 10px;
  border-bottom: 1px solid var(--line);
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus-within { border-bottom-color: var(--c); box-shadow: 0 1px 0 var(--c); }
.field .marker { margin-top: 10px; }
.field__input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: none;
  line-height: 1.45;
  resize: none;
  overflow: hidden;
}
.field__input::placeholder { color: var(--ink-3); opacity: 0.8; }
.field--p .field__input { font: italic 400 18px/1.4 var(--font-display); font-variation-settings: 'SOFT' 100; }

/* reading */
.evening__stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 240px) 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 16px;
}
.evening__glyph {
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(244, 239, 228, 0.07), transparent);
}

.entries { display: grid; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.entry {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 10px;
  margin: 0 -8px;
  padding: 7px 8px;
  border-radius: 10px;
  transition: background 0.2s;
}
.entry.is-active { background: rgba(255, 255, 255, 0.08); }
.entry .marker { margin-top: 1px; }
.entry__text { min-width: 0; overflow-wrap: anywhere; }
.entry--p { margin-top: 6px; }
.entry--p .marker { margin-top: 3px; }
.entry--p .entry__text { font: italic 400 19px/1.4 var(--font-display); font-variation-settings: 'SOFT' 100; }

/* ── intro ── */
.intro { padding-top: 40px; text-align: center; }
.intro__mark { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 18px; }
.intro__mark .marker { width: 14px; height: 14px; }
.intro__mark .marker--p { width: 38px; height: 38px; --c: var(--person-a); }
.intro__title {
  margin: 10px 0 14px;
  font: 400 clamp(24px, 5.8vw, 31px) / 1.2 var(--font-display);
  font-variation-settings: 'SOFT' 100;
  letter-spacing: -0.012em;
}
.intro__title span { display: block; }
.intro__title span + span { font-style: italic; color: var(--cream); }
.intro__text { max-width: 44ch; margin: 0 auto 20px; color: var(--ink-2); }
.intro__legend {
  display: grid;
  gap: 10px;
  max-width: 430px;
  margin: 0 auto 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  list-style: none;
  text-align: left;
  font-size: 14.5px;
  color: var(--ink-2);
}
.intro__legend li { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px; }
.intro__marks { display: inline-flex; justify-content: center; gap: 2px; }
.intro__marks .marker { width: 16px; height: 16px; }
.intro__marks .marker--p { width: 24px; height: 24px; --c: var(--person-a); }
.intro__marks--world { align-items: center; gap: 7px; }
.intro__marks--world .dot { width: 4px; height: 4px; }
.intro__marks--world .dot:nth-child(2) { transform: translateY(-5px); }

.setup { display: grid; justify-items: center; gap: 16px; margin-top: 6px; }
.setup .names { width: 100%; max-width: 430px; }
.intro__hint { max-width: 40ch; font-size: 14px; color: var(--ink-3); }
.intro__hint--wide { max-width: 52ch; margin: 0 auto; }
.intro__mark--world { gap: 10px; margin-bottom: 22px; }
.intro__mark--world .dot { width: 5px; height: 5px; }
.intro__mark--world .dot:nth-child(2) { transform: translateY(-7px); }
.intro__mark--world .dot:nth-child(3) { transform: translateY(4px); }
.intro__mark--world .dot:nth-child(4) { transform: translateY(-3px); }

/* a yes/no question: two buttons of equal weight */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 440px; }
.choice .btn--large { width: 100%; min-width: 0; padding: 0 12px; }

.legal-links { white-space: nowrap; }
.legal-links a { color: inherit; text-underline-offset: 3px; }
.legal-links a:hover { color: var(--ink); }

/* ── small controls ── */
.segmented {
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}
.segmented__option { position: relative; }
.segmented__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented__label {
  display: block;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: center;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.segmented__input:checked + .segmented__label { background: var(--accent); color: var(--night); }
.segmented__input:focus-visible + .segmented__label { outline: 2px solid var(--ink); outline-offset: 3px; }

.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch__label { font-size: 14.5px; color: var(--ink-2); }
.switch__input { position: absolute; opacity: 0; }
.switch__track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background 0.2s; }
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.25s var(--ease);
}
.switch__input:checked ~ .switch__track { background: var(--accent); }
.switch__input:checked ~ .switch__track::after { transform: translateX(18px); background: var(--night); }
.switch__input:focus-visible ~ .switch__track { outline: 2px solid var(--ink); outline-offset: 3px; }

.names { display: grid; gap: 10px; }
@media (min-width: 520px) {
  .names { grid-template-columns: 1fr 1fr; }
  .names > :only-child { grid-column: 1 / -1; }
}
.name-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  cursor: text;
  transition: border-color 0.2s, background 0.2s;
}
.name-field:focus-within { border-color: var(--line-2); background: rgba(255, 255, 255, 0.1); }
.name-field__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; }
.name-field__input::placeholder { color: var(--ink-3); opacity: 0.8; }

/* ── chronicle ── */
.month + .month { margin-top: 24px; }
.month__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  font: 500 18px/1.2 var(--font-display);
  font-variation-settings: 'SOFT' 100;
}
.month__count { font: 400 12.5px var(--font-ui); color: var(--ink-3); }
.rows { margin: 0; padding: 0; list-style: none; }
.row {
  display: grid;
  grid-template-columns: 40px 62px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: calc(100% + 20px);
  margin: 0 -10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 14px;
  background: none;
  text-align: left;
  transition: background 0.2s;
}
.row:hover { background: rgba(255, 255, 255, 0.07); }
.row__glyph { width: 40px; height: 40px; }
.row__date { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.row__text { display: grid; gap: 1px; min-width: 0; }
.row__line { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14.5px; }
.row__words { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chronicle__empty { padding: 30px 0 40px; text-align: center; color: var(--ink-2); }

/* ── settings ── */
.settings { display: grid; gap: 28px; padding-top: 12px; }
.settings__section { display: grid; justify-items: start; gap: 12px; }
.settings__section > .names, .settings__section > .switch { width: 100%; }
.settings__hint { font-size: 14.5px; color: var(--ink-2); }
.settings__buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── shooting star ── */
.sheet--wish .sheet__panel { text-align: center; }
.wish { padding-top: 40px; }
.wish__kicker { display: inline-flex; align-items: center; gap: 8px; }
.wish__meta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: 14.5px; color: var(--ink-2); }
.wish__words {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 14px 0 16px;
  font: 400 clamp(22px, 5.4vw, 28px) / 1.3 var(--font-display);
  font-variation-settings: 'SOFT' 100;
  overflow-wrap: anywhere;
  animation: fade-in 0.6s both;
}
.wish__words--p { font-style: italic; }
.wish__words .marker { width: 26px; height: 26px; }
.wish__date { font-size: 13.5px; color: var(--ink-3); }

/* ── share ── */
.share { display: grid; justify-items: center; gap: 16px; text-align: center; }
.share__preview {
  width: min(100%, 300px, 44dvh);
  aspect-ratio: 1080 / 1350;
  border-radius: 16px;
  background: #08080c;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.share__picture { display: block; width: 100%; height: 100%; }

/* ── motion ── */
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-pop { from { transform: translateY(14px) scale(0.97); opacity: 0; } }
@keyframes sheet-down { to { transform: translateY(26px); opacity: 0; } }
@keyframes star-pop {
  from { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
}
@keyframes edge-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
