/* ===========================================================================
   PELLDRAM · v2

   Same world as before: a night sea under one moon. Rabbit is moonlight,
   Tuna is the glow in deep water, and those two colours carry authorship
   everywhere so nobody reads a name to know who spoke.

   What changed is execution: depth instead of flat boxes, a proper player,
   a header that is a horizon rather than a toolbar, and a phone layout that
   is designed rather than squeezed.

   Dark by default. The "dawn" set is for anyone whose system asks for light.
   The screen itself stays dark in both, because films do.
   =========================================================================== */

:root {
  /* Night sketchbook: the navy your smug cat was drawn on, cream ink. */
  --ink:       #03070d;
  --ground:    #141a22;
  --ground-2:  #10151c;
  --surface:   #1a212c;
  --surface-2: #202938;
  --raise:     #293345;
  --line:      #3a4558;
  --line-soft: #283241;
  --pen:       #e8dcc2;   /* the marker line on cards and buttons */

  --text:      #efe6d2;
  --muted:     #b5aa92;
  --faint:     #82796a;

  --rabbit:    #f2ad6b;   /* the orange cat */
  --tuna:      #7fd0c4;
  --heart:     #f28b9b;
  --on-accent: #1a140d;

  --ok:        #8ad6a2;
  --warn:      #efc46e;
  --bad:       #ee8278;

  --map-sea:   #171e27;
  --map-land:  #75694f;
  --map-night: #04070b;

  --shadow-lg: 0 30px 80px -30px rgb(0 0 0 / 0.8);
  --shadow:    0 16px 40px -22px rgb(0 0 0 / 0.75);
  --edge:      inset 0 1px 0 rgb(255 255 255 / 0.04);

  --r-lg: 20px;
  --r:    14px;
  --r-sm: 10px;

  --display: 'Gaegu', 'Comic Neue', 'Segoe Print', 'Karla', cursive;
  --body:    'Karla', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --gutter: clamp(16px, 3vw, 28px);
  --top-h: 64px;
  --dock-h: 0px;

  color-scheme: dark;
}

/* Paper: the white your doodles were drawn on, and their olive-brown ink. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --ink:       #03070d;
    --ground:    #f3eee2;
    --ground-2:  #ebe4d3;
    --surface:   #fbf8f1;
    --surface-2: #f4efe3;
    --raise:     #eae3d2;
    --line:      #cbbfa6;
    --line-soft: #e2d9c6;
    --pen:       #3b3526;
    --text:      #2e2a20;
    --muted:     #6b6250;
    --faint:     #9a8f7a;
    --rabbit:    #cf7a35;
    --tuna:      #2f8a84;
    --heart:     #c45568;
    --on-accent: #fffaf0;
    --ok:        #3b8a55;
    --warn:      #9a6c14;
    --bad:       #b54a40;
    --map-sea:   #e8e1d0;
    --map-land:  #a39576;
    --map-night: #2c3746;
    --shadow-lg: 0 24px 50px -30px rgb(59 53 38 / 0.35);
    --shadow:    0 12px 26px -20px rgb(59 53 38 / 0.35);
    --edge:      inset 0 1px 0 rgb(255 255 255 / 0.6);
    color-scheme: light;
  }
}

:root[data-theme='light'] {
  --ink:       #03070d;
  --ground:    #f3eee2;
  --ground-2:  #ebe4d3;
  --surface:   #fbf8f1;
  --surface-2: #f4efe3;
  --raise:     #eae3d2;
  --line:      #cbbfa6;
  --line-soft: #e2d9c6;
  --pen:       #3b3526;
  --text:      #2e2a20;
  --muted:     #6b6250;
  --faint:     #9a8f7a;
  --rabbit:    #cf7a35;
  --tuna:      #2f8a84;
  --heart:     #c45568;
  --on-accent: #fffaf0;
  --ok:        #3b8a55;
  --warn:      #9a6c14;
  --bad:       #b54a40;
  --map-sea:   #e8e1d0;
  --map-land:  #a39576;
  --map-night: #2c3746;
  --shadow-lg: 0 24px 50px -30px rgb(59 53 38 / 0.35);
  --shadow:    0 12px 26px -20px rgb(59 53 38 / 0.35);
  --edge:      inset 0 1px 0 rgb(255 255 255 / 0.6);
  color-scheme: light;
}

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

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--tuna) 7%, transparent), transparent 60%),
    radial-gradient(900px 500px at 5% -5%, color-mix(in srgb, var(--rabbit) 6%, transparent), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img, video, canvas, svg { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--tuna); }
::selection { background: color-mix(in srgb, var(--tuna) 35%, transparent); }

:where(button, input, select, textarea, a, [tabindex]):focus-visible {
  outline: 2px solid var(--tuna);
  outline-offset: 2px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 0.8rem; line-height: 1.5; text-wrap: pretty; }

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

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.08s, filter 0.16s, box-shadow 0.16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--raise); border-color: color-mix(in srgb, var(--faint) 70%, var(--line)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-moon {
  background: var(--rabbit);
  border-color: var(--rabbit);
  color: var(--on-accent);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--rabbit) 80%, transparent);
}
.btn-moon:hover:not(:disabled) { background: var(--rabbit); border-color: var(--rabbit); filter: brightness(1.07); }

.btn-tide {
  background: var(--tuna);
  border-color: var(--tuna);
  color: var(--on-accent);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--tuna) 80%, transparent);
}
.btn-tide:hover:not(:disabled) { background: var(--tuna); border-color: var(--tuna); filter: brightness(1.07); }

.btn-soft { background: var(--raise); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--raise) 80%, transparent); color: var(--text); }

.linkish {
  border: 0;
  background: none;
  padding: 0;
  color: var(--tuna);
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.linkish:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- inputs */

.text-input {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ground);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-input:focus { outline: none; border-color: var(--tuna); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tuna) 22%, transparent); }
/* Text boxes grow to fit what is written in them, never a squashed line. */
textarea.text-input { resize: none; line-height: 1.5; field-sizing: content; min-height: 3.4em; max-height: 60vh; flex-shrink: 0; }
select.text-input { cursor: pointer; }

.field { display: grid; gap: 0.35rem; }
.field > span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--ground);
  border: 1px solid var(--line-soft);
}
.seg button {
  flex: 1 1 auto;
  padding: 0.35rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--raise); color: var(--text); box-shadow: var(--edge); }

.switch { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; font-size: 0.85rem; }
.switch input {
  appearance: none;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s, background 0.18s;
}
.switch input:checked { background: color-mix(in srgb, var(--tuna) 40%, var(--raise)); }
.switch input:checked::after { transform: translateX(14px); background: var(--tuna); }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--rabbit) var(--fill, 0%), var(--line) var(--fill, 0%));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--rabbit);
  border: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rabbit) 20%, transparent);
}
input[type='range']::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
input[type='range']::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--rabbit); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--rabbit); }
input[type='range']:disabled { opacity: 0.4; cursor: not-allowed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.chip-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--heart);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
}

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 0.55rem;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- flags */

.flag {
  display: inline-block;
  width: 1.45em;
  height: 1.05em;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25), 0 2px 6px -2px rgb(0 0 0 / 0.5);
  flex: none;
  vertical-align: -0.15em;
}
.flag-none { display: inline-grid; place-items: center; color: var(--faint); box-shadow: none; }
.flag-lg { width: 44px; height: 32px; border-radius: 6px; }

/* ------------------------------------------------------------------- moon */

.moon-dark { fill: color-mix(in srgb, var(--surface-2) 92%, var(--rabbit)); stroke: var(--line); stroke-width: 1; }
.moon-lit { fill: var(--rabbit); }
.moon-halo { fill: var(--rabbit); filter: blur(6px); }

/* ------------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.35rem;
  background: var(--ground);
  z-index: 100;
}
.boot-cat { width: 96px; color: var(--rabbit); animation: bob 1.4s ease-in-out infinite; }
.boot-word { margin: 0.6rem 0 0; font-family: var(--display); font-size: 1.7rem; letter-spacing: 0.12em; font-weight: 700; }
.boot-sub { margin: 0; color: var(--faint); font-size: 0.85rem; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }

/* ------------------------------------------------------------------- gate */

.gate {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 5rem var(--gutter) 2rem;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--surface-2) 90%, var(--tuna)) 0%, var(--ground) 62%);
  color: var(--text);
}
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-moon {
  position: absolute;
  top: 9%;
  right: 14%;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff1dc, #efd9ae 45%, #b9a27a 100%);
  box-shadow: 0 0 80px 20px rgb(239 217 174 / 0.16);
  opacity: 0.9;
}
/* Stars and moon belong to the night; paper has none. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) #stars, :root:not([data-theme='dark']) .gate-moon { display: none; }
}
:root[data-theme='light'] #stars, :root[data-theme='light'] .gate-moon { display: none; }

.gate-hug {
  position: absolute;
  left: max(3vw, calc(50% - 470px));
  bottom: 4vh;
  height: min(52vh, 420px);
  transform: rotate(-3deg);
  filter: drop-shadow(3px 5px 0 color-mix(in srgb, var(--pen) 14%, transparent));
  pointer-events: none;
}
.gate-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: 1rem;
  padding: 2.25rem 2rem 2rem;
  background: var(--surface);
  color: var(--text);
}
.gate-smug {
  position: absolute;
  top: -80px;
  right: 22px;
  width: 152px;
  transform: rotate(3deg);
  pointer-events: none;
}
.gate-eyebrow { margin: 0; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: var(--faint); }
.gate-title {
  margin: -0.2rem 0 0;
  font-family: var(--display);
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--rabbit);
}
.gate-sub { margin: -0.3rem 0 0.4rem; font-family: var(--display); font-size: 1.15rem; color: var(--muted); }
.gate-error { margin: 0; color: var(--bad); font-size: 0.88rem; text-wrap: pretty; }

/* ------------------------------------------------------------ app shell */

.app { min-height: 100%; display: flex; flex-direction: column; }
body:not(.is-in) .app { opacity: 0; }
body.is-in .app { animation: rise-in 0.4s ease-out; }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  min-height: var(--top-h);
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) var(--gutter) 0.5rem;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
  transition: opacity 0.4s;
}

.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand-word {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 60, 'opsz' 48;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

/* the horizon */

.horizon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
}

.place {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.35rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, opacity 0.3s;
}
.place:hover { background: color-mix(in srgb, var(--surface-2) 80%, transparent); border-color: var(--line-soft); }
.place.is-asleep { opacity: 0.6; }
.place-flag .flag { width: 30px; height: 21px; border-radius: 4px; }
.place-text { display: grid; min-width: 0; line-height: 1.15; }
.place-top { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.place-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;
}
.place-wx { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--faint); font-size: 0.74rem; font-weight: 700; }
.place-time { display: flex; align-items: baseline; gap: 0.35rem; }
.place-clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.place[data-who='rabbit'] .place-clock { color: var(--rabbit); }
.place[data-who='tuna'] .place-clock { color: var(--tuna); }
.place-day { font-size: 0.7rem; color: var(--faint); font-weight: 700; }

.tether {
  position: relative;
  flex: 1 1 160px;
  max-width: 260px;
  min-width: 60px;
  height: 34px;
  margin: 0 0.25rem;
}
.tether-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 0;
  border-top: 1.5px dashed color-mix(in srgb, var(--faint) 60%, transparent);
  transition: border-color 0.4s;
}
.tether.is-live .tether-line {
  border-top: 0;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--from), var(--to));
  box-shadow: 0 0 12px color-mix(in srgb, var(--tuna) 40%, transparent);
}
.tether[data-from='rabbit'] { --from: var(--rabbit); --to: var(--tuna); }
.tether[data-from='tuna'] { --from: var(--tuna); --to: var(--rabbit); }
.tether-pulse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px color-mix(in srgb, var(--rabbit) 70%, transparent);
  opacity: 0;
}
.tether.is-live .tether-pulse { opacity: 1; animation: travel 3.4s ease-in-out infinite alternate; }
@keyframes travel { from { left: 4%; } to { left: 96%; } }
.tether-km {
  position: absolute;
  left: 50%; top: -1px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--faint);
  white-space: nowrap;
  background: color-mix(in srgb, var(--ground) 90%, transparent);
  padding: 0 0.4rem;
  border-radius: 4px;
}

.top-actions { display: flex; align-items: center; gap: 0.25rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 0.5rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border: 1px solid var(--line-soft);
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 30ch;
}
.status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-on .status-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); animation: pulse-dot 2.4s ease-in-out infinite; }
.status-warn .status-dot { background: var(--warn); }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 0%, transparent); } }

/* tabs */

.tabs {
  position: sticky;
  top: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.55rem var(--gutter);
  background: color-mix(in srgb, var(--ground) 70%, transparent);
  backdrop-filter: blur(12px);
  transition: opacity 0.4s;
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tab.is-on { color: var(--text); background: var(--surface-2); border-color: var(--line); box-shadow: var(--edge); }
.tab.is-on .nav-ico { color: var(--rabbit); }
.tab .badge { margin-left: 0.1rem; }

.dock { display: none; }

.views {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0.75rem var(--gutter) calc(2.5rem + var(--dock-h) + env(safe-area-inset-bottom, 0px));
}
.view { display: none; }
.view.is-on { display: block; animation: rise-in 0.25s ease-out; }

/* lights down while something plays */
body.lights-down .top,
body.lights-down .tabs,
body.lights-down .nowbar,
body.lights-down .sources,
body.lights-down .rail { opacity: 0.32; }
body.lights-down .top:hover,
body.lights-down .tabs:hover,
body.lights-down .nowbar:hover,
body.lights-down .sources:hover,
body.lights-down .rail:hover,
body.lights-down .rail:focus-within { opacity: 1; }
.nowbar, .sources, .rail { transition: opacity 0.5s; }

/* ------------------------------------------------------------------ cards */

.card {
  padding: 1.25rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), color-mix(in srgb, var(--surface) 88%, var(--ground)));
  box-shadow: var(--edge), var(--shadow);
}
.card-head {
  margin: 0 0 0.9rem;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 50, 'opsz' 36;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.9rem; }
.card-row .card-head { margin: 0; }
.card-sub { margin: -0.5rem 0 1rem; color: var(--muted); font-size: 0.86rem; text-wrap: pretty; }
.card-foot { margin: 0.9rem 0 0; color: var(--faint); font-size: 0.8rem; text-wrap: pretty; }
.card-empty { margin: 0; color: var(--faint); font-style: italic; font-size: 0.9rem; }
.sub-head { margin: 1.25rem 0 0.6rem; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }

/* ================================================================ CINEMA */

.cinema { display: grid; gap: 1.1rem; }

.theater {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
  align-items: stretch;
}
body.rail-closed .theater { grid-template-columns: minmax(0, 1fr); }

.ambient {
  position: absolute;
  left: 4%;
  top: 4%;
  width: calc(100% - 340px - 1rem - 8%);
  height: 92%;
  filter: blur(70px) saturate(1.5);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.2s;
  pointer-events: none;
  z-index: 0;
}
body.rail-closed .ambient { width: 92%; }
.ambient.is-on { opacity: 0.5; }
:root[data-theme='light'] .ambient.is-on { opacity: 0.3; }

/* the screen */

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - var(--top-h) - 150px);
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: radial-gradient(120% 120% at 50% 0%, #0d1a2a 0%, var(--ink) 70%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: var(--shadow-lg);
  color: #eaf1f8;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity 0.4s;
}
.stage.has-media video { opacity: 1; }
.stage.is-idle { cursor: none; }

.stage:fullscreen { border-radius: 0; border: 0; max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; }
.stage:-webkit-full-screen { border-radius: 0; border: 0; max-height: none; width: 100vw; height: 100vh; }

/* layers */

.stage-subs {
  position: absolute;
  left: 6%; right: 6%;
  bottom: 7%;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  pointer-events: none;
  z-index: 3;
  transition: bottom 0.25s;
  --sub-size: clamp(0.95rem, 2.2vw, 1.55rem);
}
.stage-subs[data-size='s'] { --sub-size: clamp(0.8rem, 1.7vw, 1.2rem); }
.stage-subs[data-size='l'] { --sub-size: clamp(1.15rem, 2.9vw, 2.1rem); }
.stage:fullscreen .stage-subs { --sub-size: clamp(1.3rem, 2.6vw, 2.6rem); }
.stage:not(.is-idle).has-media .stage-subs { bottom: calc(7% + 64px); }
.sub-cue { display: grid; justify-items: center; gap: 0.1rem; text-align: center; }
.sub-line {
  padding: 0.08em 0.45em;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.62);
  font-size: var(--sub-size);
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.8);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.stage-float { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.floater {
  position: absolute;
  bottom: 14%;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  animation: float-up 2.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.5));
}
.floater::after {
  content: '';
  position: absolute;
  inset: 20% 10%;
  z-index: -1;
  border-radius: 50%;
  filter: blur(14px);
  opacity: 0.55;
}
.floater.who-rabbit::after { background: var(--rabbit); }
.floater.who-tuna::after { background: var(--tuna); }
@keyframes float-up {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.5); }
  12%  { opacity: 1; transform: translate(0, -16px) scale(1.15); }
  100% { opacity: 0; transform: translate(var(--drift, 0), -240px) scale(1); }
}

.stage-toasts {
  position: absolute;
  left: 3%;
  bottom: calc(7% + 70px);
  display: grid;
  gap: 0.4rem;
  max-width: min(420px, 60%);
  z-index: 5;
  pointer-events: none;
}
.stage-toast {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  background: rgb(7 14 24 / 0.78);
  backdrop-filter: blur(8px);
  border-left: 3px solid var(--tuna);
  font-size: 0.92rem;
  animation: rise-in 0.3s ease-out;
  transition: opacity 0.6s, transform 0.6s;
}
.stage-toast.who-rabbit { border-left-color: var(--rabbit); }
.stage-toast.is-out { opacity: 0; transform: translateY(-6px); }

.stage-top {
  position: absolute;
  top: 0.8rem; left: 0.8rem; right: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 6;
  pointer-events: none;
  transition: opacity 0.3s;
}
.stage.is-idle .stage-top { opacity: 0; }
.src-badge, .signal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgb(3 7 13 / 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgb(255 255 255 / 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #eaf1f8;
}
.signal { gap: 2px; }
.signal i { display: inline-block; width: 3px; border-radius: 1px; background: rgb(255 255 255 / 0.25); }
.signal i:nth-child(1) { height: 5px; }
.signal i:nth-child(2) { height: 8px; }
.signal i:nth-child(3) { height: 11px; }
.signal i:nth-child(4) { height: 14px; }
.signal i.on { background: var(--ok); }
.signal[data-bars='1'] i.on, .signal[data-bars='2'] i.on { background: var(--warn); }
.signal span { margin-left: 0.4rem; font-family: var(--mono); }

.stage-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
  transition: opacity 0.25s;
}
.stage-center.is-on { opacity: 1; }
.stage-center > * {
  pointer-events: auto;
  max-width: min(520px, 86%);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: rgb(3 7 13 / 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgb(255 255 255 / 0.1);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  text-wrap: balance;
}
.stage-center .is-error { color: #ffb4ad; border-radius: var(--r); }
.stage-center .skip-flash { display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border-radius: 50%; }
.need {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  border-radius: var(--r-lg) !important;
  padding: 1.1rem 1.3rem !important;
}
.need p { margin: 0; font-weight: 600; }

/* empty stage: the launcher */

.stage-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: auto;
}
.launch { display: grid; justify-items: center; gap: 0.5rem; text-align: center; width: 100%; max-width: 760px; }
.launch-eyebrow { margin: 0; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: #7c95ae; }
.launch-title {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.05;
  color: #f2ad6b;
}
.launch-note { margin: -0.2rem 0 0.4rem; color: #71d8cf; font-weight: 700; font-size: 0.9rem; }
.launch-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}
.launch-btn {
  flex: 1 1 130px;
  max-width: 172px;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.9rem 0.5rem;
  border-radius: var(--r);
  border: 1px solid rgb(255 255 255 / 0.08);
  background: rgb(255 255 255 / 0.03);
  color: #eaf1f8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.launch-btn:hover { background: rgb(255 255 255 / 0.07); border-color: rgb(242 173 107 / 0.35); transform: translateY(-2px); }
.launch-btn .ico { color: #f2ad6b; }
.launch-btn span { font-weight: 700; font-size: 0.86rem; }
.launch-btn small { color: #7c95ae; font-size: 0.72rem; line-height: 1.3; }
.launch-quick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  border: 0;
  background: none;
  color: #71d8cf;
  font-weight: 700;
  cursor: pointer;
}
.launch-quick:hover { text-decoration: underline; }

/* controls */

.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  padding: 2.5rem 1rem 0.7rem;
  background: linear-gradient(to top, rgb(0 0 0 / 0.85), rgb(0 0 0 / 0.45) 55%, transparent);
  transition: opacity 0.3s, transform 0.3s;
}
.stage:not(.has-media) .controls { display: none; }
.stage.is-idle .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }

.scrub {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  margin-bottom: 0.2rem;
}
.scrub-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.18);
  overflow: hidden;
  transition: height 0.15s;
}
.scrub:hover .scrub-track, .stage.is-scrubbing .scrub-track { height: 7px; }
.scrub-buffer, .scrub-fill, .scrub-hover { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.scrub-buffer { background: rgb(255 255 255 / 0.28); }
.scrub-hover { background: rgb(255 255 255 / 0.18); }
.scrub-fill { background: linear-gradient(90deg, #f2ad6b, #ffd3a8); }
.scrub-thumb {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #ffe2c4;
  box-shadow: 0 0 0 4px rgb(242 173 107 / 0.25), 0 2px 6px rgb(0 0 0 / 0.5);
  transform: scale(0);
  transition: transform 0.15s;
}
.scrub:hover .scrub-thumb, .stage.is-scrubbing .scrub-thumb { transform: scale(1); }
.scrub-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgb(3 7 13 / 0.9);
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
}

.ctl-row { display: flex; align-items: center; gap: 0.15rem; }
.ctl {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #eaf1f8;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, color 0.15s;
}
.ctl:hover { background: rgb(255 255 255 / 0.1); }
.ctl:active { transform: scale(0.94); }
.ctl.is-on { color: #f2ad6b; }
#c-play { width: 48px; height: 48px; }
#c-play:hover { background: rgb(242 173 107 / 0.15); color: #f2ad6b; }
.vol { display: flex; align-items: center; }
.vol-range { width: 0; opacity: 0; transition: width 0.2s, opacity 0.2s; }
.vol:hover .vol-range, .vol:focus-within .vol-range { width: 86px; opacity: 1; margin-right: 0.4rem; }
.ctl-time { margin-left: 0.6rem; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.82rem; color: rgb(234 241 248 / 0.85); white-space: nowrap; }
.ctl-spacer { flex: 1; }

/* settings popover & reaction tray */

.pop, .tray {
  position: absolute;
  right: 0.9rem;
  bottom: 76px;
  z-index: 9;
  border-radius: var(--r);
  background: rgb(10 18 30 / 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgb(255 255 255 / 0.1);
  box-shadow: var(--shadow-lg);
  color: #eaf1f8;
}
.pop {
  width: min(360px, calc(100% - 1.8rem));
  max-height: calc(100% - 96px);
  overflow: auto;
  padding: 0.4rem 1rem 1rem;
  --line: #1f3550; --line-soft: #152739; --ground: #070e18; --raise: #19293f; --muted: #93abc3; --faint: #5f7a95; --text: #eaf1f8;
}
.pop-sec { padding-top: 0.8rem; }
.pop-sec + .pop-sec { border-top: 1px solid rgb(255 255 255 / 0.07); margin-top: 0.8rem; }
.pop-sec header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.pop-sec h4 { margin: 0; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #f2ad6b; }
.pop-sec .muted { font-size: 0.75rem; }
.pop-label { margin: 0.75rem 0 0.35rem; font-size: 0.74rem; color: #93abc3; font-weight: 700; }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pop .range { width: 100%; margin-top: 0.4rem; }
.pop-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.64rem; color: #5f7a95; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 0.8rem; margin-top: 0.9rem; padding: 0.7rem; border-radius: var(--r-sm); background: rgb(0 0 0 / 0.25); }
.stat { display: grid; gap: 0.05rem; }
.stat span { font-size: 0.66rem; color: #5f7a95; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.stat b { font-size: 0.82rem; font-weight: 600; }
.spark { grid-column: 1 / -1; width: 100%; height: 36px; }
.spark-area { fill: rgb(113 216 207 / 0.14); }
.spark-line { fill: none; stroke: #71d8cf; stroke-width: 1.5; }
.spark-dot { fill: #71d8cf; }
.advice { grid-column: 1 / -1; margin: 0.2rem 0 0; font-size: 0.8rem; color: #ecc46e; text-wrap: pretty; }

.tray { display: flex; gap: 0.15rem; padding: 0.35rem; right: auto; left: 50%; transform: translateX(-50%); }
.tray-btn { width: 46px; height: 46px; border: 0; border-radius: 12px; background: transparent; font-size: 1.55rem; cursor: pointer; transition: transform 0.12s, background 0.12s; }
.tray-btn:hover { background: rgb(255 255 255 / 0.08); transform: translateY(-3px) scale(1.12); }

/* rail */

.rail {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - var(--top-h) - 150px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--edge), var(--shadow);
  overflow: hidden;
}
body.rail-closed .rail { display: none; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.6rem 0.4rem 1rem; }
.rail-head h2 { margin: 0; font-family: var(--display); font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.rail-head .icon-btn .ico { transform: rotate(-90deg); }
.rail-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rail-open {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  z-index: 9;
  display: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.1);
  background: rgb(3 7 13 / 0.6);
  backdrop-filter: blur(8px);
  color: #eaf1f8;
  cursor: pointer;
}
body.rail-closed .rail-open { display: inline-flex; }

/* now playing */

.nowbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  border-radius: var(--r);
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.now-main { flex: 1 1 260px; display: grid; min-width: 0; }
.now-eyebrow { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.now-title { font-family: var(--display); font-variation-settings: 'SOFT' 50; font-size: 1.2rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.now-meta { color: var(--muted); font-size: 0.84rem; }

/* sources */

.sources {
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: var(--edge), var(--shadow);
  overflow: hidden;
  scroll-margin-top: calc(var(--top-h) + 64px);
}
.src-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--ground) 40%, var(--surface));
}
.src-tabs::-webkit-scrollbar { display: none; }
.src-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap;
  cursor: pointer;
}
.src-tab:hover { color: var(--text); background: color-mix(in srgb, var(--raise) 60%, transparent); }
.src-tab.is-on { color: var(--text); background: var(--raise); box-shadow: var(--edge); }
.src-tab.is-on .ico { color: var(--rabbit); }
.src-panel { padding: 1.25rem; }

.panel-intro { margin: 0 0 1rem; color: var(--muted); max-width: 64ch; text-wrap: pretty; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 1.5rem; }
.panel-grid > div { display: grid; gap: 0.8rem; align-content: start; justify-items: start; }
.panel-aside {
  align-self: start;
  padding: 1rem;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.panel-aside h4 { margin: 0 0 0.5rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.panel-aside h4:not(:first-child) { margin-top: 1rem; }
.form-row { display: flex; align-items: center; gap: 0.6rem; width: 100%; flex-wrap: wrap; }
.add-row { display: flex; gap: 0.5rem; width: 100%; }
.add-row .text-input { flex: 1; }

.drop {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 1.8rem 1rem;
  border-radius: var(--r);
  border: 1.5px dashed var(--line);
  background: color-mix(in srgb, var(--ground) 50%, transparent);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.is-over { border-color: var(--rabbit); background: color-mix(in srgb, var(--rabbit) 6%, transparent); }
.drop .ico { color: var(--rabbit); }
.drop b { color: var(--text); font-size: 1rem; }
.drop span { font-size: 0.82rem; max-width: 46ch; }

.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.job { display: grid; gap: 0.35rem; }
.job b { overflow-wrap: anywhere; }

.meter { display: grid; gap: 0.3rem; min-width: 220px; }
.meter > span { font-weight: 700; font-size: 0.86rem; }
.meter-bar { height: 6px; border-radius: 999px; background: var(--raise); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rabbit), var(--tuna)); transition: width 0.4s; }

.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; width: 100%; }
.recent li { display: flex; justify-content: space-between; gap: 0.8rem; }
.recent .linkish { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn { width: 100%; margin-top: 0.8rem; }
.turn summary { cursor: pointer; font-weight: 700; font-size: 0.84rem; color: var(--muted); }
.turn[open] { display: grid; gap: 0.5rem; }

/* library */

.lib { display: grid; gap: 1.2rem; }
.lib-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.lib-head .panel-intro { margin: 0; flex: 1 1 320px; }
.lib-empty { display: grid; justify-items: start; gap: 0.7rem; color: var(--muted); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }

.film {
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: var(--r);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.film:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: var(--shadow); }
.film.is-now { border-color: var(--rabbit); box-shadow: 0 0 0 1px var(--rabbit), var(--shadow); }
.film.is-pending .film-art img { filter: grayscale(0.6) brightness(0.7); }
.film-art { position: relative; aspect-ratio: 16 / 9; background: var(--ink); display: grid; place-items: center; }
.film-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-art-none { color: var(--faint); }
.film-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: rgb(0 0 0 / 0);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
}
.film:hover .film-play, .film-play:focus-visible { opacity: 1; background: rgb(0 0 0 / 0.35); }
.film-progress, .film-upload { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(255 255 255 / 0.15); }
.film-progress > span { display: block; height: 100%; background: var(--heart); }
.film-upload > span { display: block; height: 100%; background: var(--tuna); transition: width 0.6s; }
.film-body { display: grid; gap: 0.15rem; padding: 0.75rem 0.85rem 0.85rem; align-content: start; }
.film-title { margin: 0; font-size: 0.98rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.film-meta { margin: 0; font-size: 0.76rem; color: var(--faint); }
.film-actions { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; flex-wrap: wrap; }
.film-actions .icon-btn { margin-left: auto; width: 32px; height: 32px; }

/* ================================================================== CHAT */

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 1rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.view-chat.is-on {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--top-h) - 120px - var(--dock-h) - env(safe-area-inset-bottom, 0px));
  min-height: 420px;
  max-width: 880px;
  margin: 0 auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: var(--edge), var(--shadow);
  overflow: hidden;
  position: relative;
}
.view-chat.is-drop::after {
  content: 'Drop to send';
  position: absolute;
  inset: 0.6rem;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  border: 2px dashed var(--tuna);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--tuna);
  font-weight: 800;
  font-size: 1.1rem;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--line-soft);
}
.chat-head h2 { margin: 0; font-family: var(--display); font-variation-settings: 'SOFT' 60; font-size: 1.15rem; font-weight: 600; }

.day-rule {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.9rem 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.day-rule::before, .day-rule::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.msg.is-first { margin-top: 0.55rem; }
.msg.is-mine { align-self: flex-end; align-items: flex-end; }
.msg-who { margin: 0 0 0.15rem 0.2rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.msg.from-rabbit .msg-who { color: var(--rabbit); }
.msg.from-tuna .msg-who { color: var(--tuna); }

.bubble {
  padding: 0.5rem 0.8rem;
  border-radius: 16px 16px 16px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.45;
}
.msg.is-mine .bubble { border-radius: 16px 16px 6px 16px; }
.msg.from-rabbit .bubble { background: color-mix(in srgb, var(--rabbit) 11%, var(--surface-2)); border-color: color-mix(in srgb, var(--rabbit) 22%, var(--line-soft)); }
.msg.from-tuna .bubble { background: color-mix(in srgb, var(--tuna) 11%, var(--surface-2)); border-color: color-mix(in srgb, var(--tuna) 22%, var(--line-soft)); }
.bubble a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.bubble.is-emoji { background: none !important; border: 0 !important; padding: 0 0.1rem; font-size: 2.3rem; line-height: 1.15; }
.bubble.is-image { padding: 4px; }
.msg-img { display: block; max-width: min(320px, 100%); max-height: 360px; border-radius: 12px; cursor: zoom-in; background: var(--raise); min-width: 120px; min-height: 80px; object-fit: cover; }
.caption { margin: 0.35rem 0.4rem 0.2rem; white-space: pre-wrap; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0.3rem 0;
  font-size: 0.66rem;
  color: var(--faint);
  min-height: 1em;
}
.msg-meta time { font-family: var(--mono); }
.msg-seen { color: var(--tuna); font-weight: 700; }
.msg-pending { font-style: italic; }
.msg-failed { color: var(--bad); font-weight: 700; }
.msg-take { border: 0; background: none; padding: 0; color: var(--faint); font-size: inherit; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-take, .msg-take:focus-visible { opacity: 1; }
.msg-take:hover { color: var(--bad); }
.msg-meta .linkish { font-size: 0.72rem; }

.chat-typing { padding: 0 1.1rem 0.35rem; font-size: 0.78rem; font-style: italic; color: var(--tuna); }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 0.5rem; color: var(--faint); text-align: center; }
.chat-empty p { margin: 0; }
.load-older { align-self: center; margin: 0.4rem 0; border: 0; background: none; color: var(--faint); font-size: 0.78rem; cursor: pointer; }
.load-older:hover { color: var(--text); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem calc(0.6rem + env(safe-area-inset-bottom, 0px) * 0);
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--ground) 30%, var(--surface));
}
.composer-input {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ground);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
  resize: none;
}
.composer-input:focus { outline: none; border-color: var(--tuna); }
.composer-send { width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 12px; }
.composer-attach { width: 42px; height: 42px; }

.rail .chat-log { padding: 0.25rem 0.8rem 0.5rem; }
.rail .msg { max-width: 92%; }
.rail .bubble { font-size: 0.9rem; padding: 0.4rem 0.65rem; }
.rail .composer { background: transparent; }
.rail .chat-typing { padding: 0 0.9rem 0.3rem; }

/* ==================================================================== US */

.us { display: grid; gap: 1.1rem; }

.us-map {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: var(--map-sea);
  box-shadow: var(--edge), var(--shadow);
  overflow: hidden;
  aspect-ratio: 960 / 500;
  max-height: 520px;
  width: 100%;
}
.us-map.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--text) 5%, transparent) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.map-fallback { margin: 0; position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.map-svg { display: block; width: 100%; height: 100%; }
.map-sea { fill: var(--map-sea); }
.map-grid { fill: none; stroke: color-mix(in srgb, var(--text) 6%, transparent); stroke-width: 0.6; }
.map-dot { fill: var(--map-land); }
.map-coast { fill: none; stroke: color-mix(in srgb, var(--map-land) 45%, transparent); stroke-width: 0.5; }
.map-night { fill: var(--map-night); opacity: 0.2; }
.map-arc { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.map-arc-glow { fill: none; stroke: color-mix(in srgb, var(--tuna) 50%, var(--rabbit)); stroke-width: 10; opacity: 0.12; filter: blur(4px); }
.map-arc-pulse { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 2 26; opacity: 0; }
.map-arc-pulse.is-live { opacity: 0.85; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.stop-rabbit { stop-color: var(--rabbit); }
.stop-tuna { stop-color: var(--tuna); }
.pin-core { stroke: var(--map-sea); stroke-width: 2; }
.pin-halo { opacity: 0.22; animation: halo 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pin-rabbit .pin-core, .pin-rabbit .pin-halo { fill: var(--rabbit); }
.pin-tuna .pin-core, .pin-tuna .pin-halo { fill: var(--tuna); }
@keyframes halo { 50% { transform: scale(1.5); opacity: 0.05; } }

.map-labels { position: absolute; inset: 0; pointer-events: none; }
.map-label {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.6rem 0.3rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  white-space: nowrap;
  transform: translate(16px, -50%);
}
.map-label.is-left { transform: translate(calc(-100% - 16px), -50%); flex-direction: row-reverse; padding: 0.3rem 0.4rem 0.3rem 0.6rem; }
.map-label-text { display: grid; line-height: 1.1; }
.map-label-text b { font-size: 0.8rem; }
.map-label-text span { font-size: 0.72rem; color: var(--muted); }
.map-label.is-left .map-label-text { text-align: right; }
.map-label.who-rabbit { border-color: color-mix(in srgb, var(--rabbit) 45%, var(--line-soft)); }
.map-label.who-tuna { border-color: color-mix(in srgb, var(--tuna) 45%, var(--line-soft)); }
.map-km {
  position: absolute;
  transform: translate(-50%, -140%);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ground) 80%, transparent);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  white-space: nowrap;
}
.map-hint { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); margin: 0; padding: 0.4rem 0.8rem; border-radius: 999px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--muted); font-size: 0.84rem; white-space: nowrap; }

.us-places { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.us-between { display: grid; place-content: center; justify-items: center; gap: 0.1rem; padding: 0 0.5rem; text-align: center; }
.us-between-km { font-family: var(--mono); font-size: 1.05rem; font-weight: 600; }
.us-between-sub { font-size: 0.72rem; color: var(--faint); }

.place-card {
  display: grid;
  gap: 0.8rem;
  padding: 1.25rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: var(--edge), var(--shadow);
  position: relative;
  overflow: hidden;
}
.place-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
}
.place-card.who-rabbit::before { background: linear-gradient(90deg, var(--rabbit), transparent); }
.place-card.who-tuna::before { background: linear-gradient(90deg, var(--tuna), transparent); }
.pc-head { display: flex; align-items: center; gap: 0.85rem; }
.pc-where { flex: 1; min-width: 0; }
.pc-where h3 { margin: 0; font-family: var(--display); font-variation-settings: 'SOFT' 60; font-size: 1.25rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.pc-where p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.84rem; }
.pc-time { display: grid; }
.pc-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(2.2rem, 5vw, 3rem); font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.place-card.who-rabbit .pc-clock { color: var(--rabbit); }
.place-card.who-tuna .pc-clock { color: var(--tuna); }
.pc-date { margin-top: 0.3rem; color: var(--muted); font-size: 0.86rem; }
.pc-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; color: var(--muted); font-size: 0.86rem; }
.pc-wx, .pc-sun { display: inline-flex; align-items: center; gap: 0.35rem; }
.pc-wx b { color: var(--text); font-size: 1rem; }
.pc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--faint); }
.pc-rel { color: var(--muted); }
.pc-off { font-family: var(--mono); }

.us-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

/* countdown */
.cd-num { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; }
.cd-unit { display: grid; }
.cd-unit b {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--heart);
}
.cd-unit i { font-style: normal; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.cd-empty, .cd-done { margin: 0; font-family: var(--display); font-style: italic; font-size: 1.3rem; color: var(--muted); }
.cd-label { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.9rem; }
.cd-label b { color: var(--text); }
.cd-progress { margin-top: 0.9rem; }
.cd-bar { height: 8px; border-radius: 999px; background: var(--raise); overflow: hidden; }
.cd-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rabbit), var(--heart)); }
.cd-progress p { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--faint); }
.cd-together { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.8rem 0 0; color: var(--heart); font-weight: 700; font-size: 0.86rem; }

/* ribbon */
.rb { --rb-label: 92px; position: relative; display: grid; gap: 0.45rem; }
.rb-row { display: grid; grid-template-columns: var(--rb-label) minmax(0, 1fr); align-items: center; gap: 0; }
.rb-name { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.rb-track { position: relative; height: 14px; border-radius: 999px; background: var(--raise); overflow: hidden; }
.rb-seg { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.seg-rabbit { background: color-mix(in srgb, var(--rabbit) 75%, transparent); }
.seg-tuna { background: color-mix(in srgb, var(--tuna) 75%, transparent); }
.seg-both { background: linear-gradient(90deg, var(--rabbit), var(--tuna)); box-shadow: 0 0 10px color-mix(in srgb, var(--tuna) 50%, transparent); }
.rb-both .rb-name { color: var(--text); }
.rb-now { position: absolute; top: -4px; bottom: 18px; width: 2px; margin-left: -1px; background: var(--heart); border-radius: 2px; }
.rb-now::before { content: 'now'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; font-weight: 800; color: var(--heart); letter-spacing: 0.08em; }
.rb-ticks { display: flex; justify-content: space-between; margin-left: var(--rb-label); font-family: var(--mono); font-size: 0.64rem; color: var(--faint); }
.rb-summary { margin: 0.9rem 0 0; font-weight: 700; text-wrap: pretty; }

/* streak */
.st-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.st-count { display: flex; align-items: baseline; gap: 0.5rem; }
.st-count b { font-family: var(--display); font-variation-settings: 'SOFT' 100, 'opsz' 144; font-size: 2.6rem; font-weight: 500; line-height: 1; color: var(--tuna); }
.st-count span { color: var(--muted); font-size: 0.86rem; }
.st-heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.st-cell { aspect-ratio: 1; border-radius: 3px; background: var(--raise); min-width: 6px; }
.st-cell.is-one { background: color-mix(in srgb, var(--tuna) 30%, var(--raise)); }
.st-cell.is-both { background: var(--tuna); box-shadow: 0 0 6px color-mix(in srgb, var(--tuna) 40%, transparent); }
.st-cell.is-today { outline: 1.5px solid var(--heart); outline-offset: 1px; }
.st-cell.is-future { opacity: 0.25; }

/* moon */
.mn-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.mn-svg { flex: none; }
.mn-facts { flex: 1; min-width: 160px; }
.mn-facts p { margin: 0; }
.mn-name { font-family: var(--display); font-variation-settings: 'SOFT' 80; font-size: 1.35rem; font-weight: 500; }
.mn-lit { margin-top: 0.2rem !important; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.mn-next { margin-top: 0.4rem !important; font-size: 0.84rem; color: var(--faint); }

/* ================================================================= LISTS */

.lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }

.wl-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.wl-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.wl-item.is-picked { border-color: var(--rabbit); background: color-mix(in srgb, var(--rabbit) 10%, var(--surface-2)); }
.wl-item.is-chosen { transform: scale(1.02); box-shadow: 0 0 0 2px var(--rabbit), var(--shadow); }
.wl-item.is-done { opacity: 0.55; }
.wl-item.is-done .wl-title { text-decoration: line-through; text-decoration-color: var(--faint); }
.wl-tick {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: none;
  border-radius: 7px;
  border: 1.5px solid var(--faint);
  background: transparent;
  color: var(--on-accent);
  cursor: pointer;
}
.wl-tick[aria-pressed='true'] { background: var(--tuna); border-color: var(--tuna); }
.wl-main { flex: 1; min-width: 0; display: grid; }
.wl-title { font-weight: 700; overflow-wrap: anywhere; }
.wl-meta { font-size: 0.74rem; color: var(--faint); }
.wl-del { width: 30px; height: 30px; }
.wl-done { margin-top: 1rem; }
.wl-done summary { cursor: pointer; color: var(--faint); font-weight: 700; font-size: 0.84rem; }

.note-form { display: grid; gap: 0.6rem; }
.note-form-row { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.note-form-row > .text-input { flex: 1 1 180px; }
.note-when { display: grid; gap: 0.2rem; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.note-when .text-input { width: 160px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.note { border-radius: var(--r); }
.note.is-open, .note.is-mine { padding: 0.9rem 1rem; background: var(--surface-2); border: 1px solid var(--line-soft); }
.note.is-open.from-rabbit { border-left: 3px solid var(--rabbit); }
.note.is-open.from-tuna { border-left: 3px solid var(--tuna); }
.note-label { margin: 0; font-family: var(--display); font-variation-settings: 'SOFT' 80; font-style: italic; font-size: 1.02rem; }
.note-body { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.note-meta { margin: 0.4rem 0 0; font-size: 0.74rem; color: var(--faint); }
.note-mine-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.note-seal {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.9rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, transparent 49.5%, color-mix(in srgb, var(--line) 60%, transparent) 50%, transparent 50.5%) no-repeat,
    linear-gradient(225deg, transparent 49.5%, color-mix(in srgb, var(--line) 60%, transparent) 50%, transparent 50.5%) no-repeat,
    var(--surface-2);
  background-size: 50% 60%, 50% 60%, auto;
  background-position: left top, right top, center;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.note-seal:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--heart); box-shadow: var(--shadow); }
.note-seal:disabled { cursor: not-allowed; opacity: 0.75; }
.note-seal.is-opening { animation: unseal 0.5s ease-in forwards; }
@keyframes unseal { to { transform: scale(1.04); opacity: 0; } }
.note-wax {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--heart) 70%, #fff), var(--heart) 60%, color-mix(in srgb, var(--heart) 70%, #000));
  color: #fff;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--heart) 70%, transparent), inset 0 -2px 4px rgb(0 0 0 / 0.2);
}
.note.from-rabbit .note-wax { background: radial-gradient(circle at 35% 30%, #ffe2c4, var(--rabbit) 55%, #a8834a); color: #3a2a10; }
.note.from-tuna .note-wax { background: radial-gradient(circle at 35% 30%, #d9fbf7, var(--tuna) 55%, #2e8b83); color: #06302c; }
.note.is-locked .note-wax { filter: grayscale(0.7); }
.note-seal .note-label { align-self: end; }
.note-seal .note-meta { margin: 0.1rem 0 0; align-self: start; }

/* ================================================================ DIALOGS */

.dlg {
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dlg::backdrop { background: rgb(3 7 13 / 0.6); backdrop-filter: blur(4px); }
.dlg form { display: grid; gap: 1rem; padding: 1.5rem; }
.dlg h2 { margin: 0; font-family: var(--display); font-variation-settings: 'SOFT' 60; font-size: 1.35rem; font-weight: 600; }
.dlg p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.3rem; }
.place-current { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; border-radius: var(--r-sm); background: var(--surface-2); font-weight: 700; }
.results { list-style: none; margin: -0.4rem 0 0; padding: 0; display: grid; gap: 0.25rem; max-height: 240px; overflow: auto; }
.results li.muted { padding: 0.4rem 0.2rem; font-size: 0.86rem; }
.result {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.result .flag { grid-row: 1 / 3; width: 26px; height: 18px; }
.result span { font-size: 0.9rem; }
.result small { color: var(--faint); font-family: var(--mono); font-size: 0.7rem; }
.result:hover { background: var(--surface-2); }
.result.is-on { border-color: var(--tuna); background: color-mix(in srgb, var(--tuna) 10%, var(--surface-2)); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.2rem; margin: 0; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
}

.dlg-photo { width: auto; max-width: calc(100vw - 2rem); background: transparent; border: 0; box-shadow: none; }
.dlg-photo form { padding: 0; position: relative; }
.dlg-photo img { display: block; max-width: calc(100vw - 2rem); max-height: calc(100vh - 2rem); border-radius: var(--r); }
.dlg-close { position: absolute; top: 0.5rem; right: 0.5rem; background: rgb(3 7 13 / 0.7); color: #fff; }

/* ================================================================= TOASTS */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + var(--dock-h) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  width: min(560px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--raise) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  text-wrap: pretty;
}
.toast.is-in { opacity: 1; transform: none; }
.toast-error { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.toast-warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.toast-love { border-color: color-mix(in srgb, var(--heart) 50%, var(--line)); }
.toast-action { flex: none; border: 0; background: none; color: var(--tuna); font-weight: 800; cursor: pointer; padding: 0.2rem 0.3rem; }

/* ============================================================ RESPONSIVE */

@media (max-width: 1180px) {
  .theater { grid-template-columns: minmax(0, 1fr) 300px; }
  .ambient { width: calc(100% - 300px - 1rem - 8%); }
}

@media (max-width: 980px) {
  .theater { grid-template-columns: minmax(0, 1fr); }
  .ambient { width: 92%; height: 60%; }
  .rail { max-height: 460px; min-height: 320px; }
  .rail-open { display: none !important; }
  body.rail-closed .rail { display: flex; }
  .rail-head .icon-btn { display: none; }
  .panel-grid { grid-template-columns: minmax(0, 1fr); }
  .us-grid { grid-template-columns: minmax(0, 1fr); }
  .lists { grid-template-columns: minmax(0, 1fr); }
  .top { grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; }
  .status-text { display: none; }
  .status { padding: 0.45rem; margin-right: 0; }
}

@media (max-width: 760px) {
  :root { --top-h: 58px; --dock-h: 64px; }

  .brand-word, #keys-btn { display: none; }
  .top { gap: 0.4rem; padding-inline: 10px; }
  .horizon { justify-content: space-between; gap: 0; }
  .place { padding: 0.25rem 0.35rem; gap: 0.45rem; }
  .place-flag .flag { width: 24px; height: 17px; }
  .place-name { max-width: 9ch; font-size: 0.62rem; }
  .place-wx span { display: none; }
  .place-clock { font-size: 1.08rem; }
  .place-day { display: none; }
  .tether { flex: 1 1 30px; min-width: 24px; margin: 0; }
  .tether-km { display: none; }
  .top-actions .icon-btn { width: 32px; height: 32px; }

  .tabs { display: none; }
  .dock {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--ground) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.3);
    border-top: 1px solid var(--line-soft);
  }
  .dock-btn {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.15rem;
    border: 0;
    background: transparent;
    color: var(--faint);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
  }
  .dock-btn.is-on { color: var(--text); }
  .dock-btn.is-on .nav-ico { color: var(--rabbit); }
  .dock-btn .badge { position: absolute; top: 8px; left: calc(50% + 6px); }

  .views { padding-top: 0.5rem; }

  .stage {
    margin-inline: calc(var(--gutter) * -1);
    width: calc(100% + var(--gutter) * 2);
    border-radius: 0;
    border-inline: 0;
    max-height: none;
    min-height: 0;
  }
  .ambient { display: none; }
  .controls { padding: 1.8rem 0.5rem 0.4rem; }
  .ctl { width: 40px; height: 40px; }
  .vol, #c-pip { display: none; }
  .ctl-time { font-size: 0.74rem; margin-left: 0.3rem; }
  .pop { right: 0.5rem; left: 0.5rem; width: auto; bottom: 64px; }
  .launch-title { margin-bottom: 0.3rem; }
  .launch-grid { flex-wrap: nowrap; gap: 0.35rem; }
  .launch-btn { flex: 1 1 0; min-width: 0; max-width: none; padding: 0.55rem 0.2rem; }
  .launch-btn small, .launch-eyebrow { display: none; }
  .launch-btn span { font-size: 0.66rem; }

  .src-panel { padding: 1rem; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
  .film-play { opacity: 1; background: transparent; }
  .film-play .ico { opacity: 0.85; }

  .view-chat.is-on {
    height: calc(100dvh - var(--top-h) - var(--dock-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 0.75rem);
    margin-inline: calc(var(--gutter) * -1);
    border-radius: 0;
    border-inline: 0;
    min-height: 0;
  }
  .msg { max-width: 88%; }

  .us-places { grid-template-columns: minmax(0, 1fr); }
  .us-between { padding: 0; grid-auto-flow: column; gap: 0.6rem; }
  .us-map { aspect-ratio: 960 / 560; margin-inline: calc(var(--gutter) * -1); width: calc(100% + var(--gutter) * 2); border-radius: 0; border-inline: 0; }
  .map-label-text span { display: none; }
  .card { padding: 1.05rem; }
  .field-pair { grid-template-columns: 1fr; }
  .gate-moon { width: 80px; height: 80px; top: 6%; right: 8%; }
}

@media (max-width: 380px) {
  .place-name { display: none; }
  .launch-grid { flex-wrap: wrap; }
  .launch-btn { flex: 1 1 30%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
