:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --text: #1c1b1a;
  --muted: #6b6760;
  --faint: #8f8a82;
  --line: #e9e6e1;
  --line-strong: #d9d4cc;
  --hover: #f2f0ec;
  --accent: #e8590c;
  --accent-strong: #b8460a;
  --accent-soft: #fff1e7;
  --on-accent: #ffffff;
  --ok: #2b8a3e;
  --danger: #c92a2a;
  --mark: #ffe8a3;
  --shadow: 0 1px 2px rgb(28 27 26 / 0.04), 0 2px 8px rgb(28 27 26 / 0.04);
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --card: #1c1a18;
    --text: #ece9e4;
    --muted: #a19c94;
    --faint: #7a756e;
    --line: #2c2926;
    --line-strong: #3b3733;
    --hover: #242220;
    --accent: #ff8a3d;
    --accent-strong: #ffad73;
    --accent-soft: #33221a;
    --on-accent: #1c1a18;
    --ok: #51cf66;
    --danger: #ff6b6b;
    --mark: #5c4a12;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1 { font-size: 1.45rem; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 0.95rem; margin: 24px 0 10px; color: var(--muted); font-weight: 600; }
.card h2 { margin-top: 0; color: var(--text); }
kbd {
  font: 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--card);
}
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- frame */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand svg { width: 26px; height: 26px; }
.brand-tile { fill: var(--accent); }
.brand-p { fill: none; stroke: var(--on-accent); stroke-width: 3; }

nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
nav a .icon { width: 16px; height: 16px; }
#me-label { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav a:hover { color: var(--text); background: var(--hover); }
nav a.active { color: var(--text); background: var(--line); }
nav a.primary { color: var(--on-accent); background: var(--accent); margin-left: 6px; }
nav a.primary:hover { background: var(--accent-strong); }

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 680px);
  justify-content: center;
  gap: 32px;
  align-items: start;
}
main { min-width: 0; }
.sidebar { position: sticky; top: 72px; display: grid; gap: 12px; min-width: 0; }

footer { color: var(--faint); font-size: 0.8rem; text-align: center; padding: 32px 16px; }

@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); max-width: 712px; padding-top: 16px; gap: 16px; }
  .sidebar { position: static; }
  .sidebar .prices, .shortcuts { display: none; }
}
@media (hover: none) { .shortcuts, .kbd-hint { display: none !important; } }

/* Phones: the menu becomes a tab bar along the bottom, within thumb reach. */
@media (max-width: 640px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* A blurred header would trap the fixed tab bar inside it, so phones get a plain one. */
  .topbar { position: static; backdrop-filter: none; background: var(--bg); }
  .new-pill { top: 8px; }
  nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--line);
  }
  nav a { flex-direction: column; gap: 2px; padding: 6px 0; border-radius: 10px; font-size: 0.68rem; min-width: 0; }
  nav a .icon { width: 22px; height: 22px; }
  nav a.active, nav a:hover { background: none; color: var(--accent); }
  nav a.primary, nav a.primary:hover { background: none; color: var(--accent); margin: 0; }
  nav a.primary .icon { width: 34px; height: 34px; padding: 7px; margin: -6px 0 -2px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
  #me-label { max-width: 9ch; }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-height: 36px; }
.page-head h1 { flex: 1; }
.user-head .avatar { width: 36px; height: 36px; font-size: 1rem; }
.lede { color: var(--muted); margin: 0 0 16px; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile .avatar { width: 56px; height: 56px; font-size: 1.4rem; }
.profile-text { flex: 1; min-width: 0; }
.profile h1 { overflow-wrap: anywhere; }
.room-form .row input { flex: 1; min-width: 12em; }
.room-form { display: grid; gap: 8px; }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.room-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-list a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.page-head > .icon { width: 22px; height: 22px; color: var(--muted); }
.room-hint { margin: -4px 0 16px; }
.hint.weak-word { color: var(--danger); margin-top: 6px; }
.following-list { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 12px; }
.following-list a { text-decoration: none; }
.empty-card { text-align: center; color: var(--muted); padding: 32px 24px; }
.empty-card .icon { width: 32px; height: 32px; color: var(--faint); }
.empty-card p { margin: 10px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; text-decoration: none; font-size: 0.9rem; }

/* -------------------------------------------------------------- panels */

.panel, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 14px 16px; }
.card { padding: 16px; margin-bottom: 16px; }
.panel-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }

.activity summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}
.activity summary::-webkit-details-marker { display: none; }
.activity summary::after { content: ""; width: 7px; height: 7px; border: solid var(--faint); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -3px 2px 0 8px; transition: transform 0.15s; }
.activity[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.summary-figure { margin-left: auto; font-size: 0.85rem; color: var(--muted); }
.activity[open] .summary-figure { display: none; }
.activity[open] summary { margin-bottom: 12px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--hover); border-radius: 10px; }
.seg button, .seg label span {
  display: block;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.seg button:hover, .seg label span:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.ranges { display: flex; }
.ranges button { flex: 1; text-align: center; }

.hero { margin: 16px 0 12px; }
.hero-value { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.hero-sub { color: var(--muted); font-size: 0.85rem; }

.kpis { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 16px; padding: 10px 0; border-block: 1px solid var(--line); }
.kpis div { min-width: 0; }
.kpis dt { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.kpis dd { margin: 0; font-weight: 600; font-size: 1.05rem; }

figure { margin: 0; }
figcaption { font-size: 0.75rem; color: var(--faint); margin-top: 6px; }
.chart { position: relative; min-height: 104px; }
.chart svg { display: block; overflow: visible; }
.chart .grid, .chart .axis { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--line-strong); }
.chart .tick { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .col path { fill: var(--accent); transition: fill 0.1s; }
.chart .col:hover path { fill: var(--accent-strong); }
.chart .col:hover .hit { fill: var(--hover); }
.chart-tip {
  position: absolute;
  bottom: calc(100% - 4px);
  transform: translateX(-50%);
  display: grid;
  gap: 1px;
  min-width: 140px;
  padding: 7px 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}
.chart-tip strong { font-size: 0.95rem; }
.chart-tip span { opacity: 0.8; }

.prices p { margin: 8px 0; }
.prices table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.prices th { text-align: left; font-weight: 400; color: var(--muted); padding: 3px 0; }
.prices td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.prices button { margin-top: 10px; width: 100%; }
.shortcuts { font-size: 0.78rem; color: var(--faint); text-align: center; margin: 0; }

/* -------------------------------------------------------------- controls */

button {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover:not(:disabled) { background: var(--accent-strong); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.link, button.link:hover { background: none; color: var(--accent); padding: 0; font-weight: 400; }
button.subtle, .button-like.subtle { background: var(--hover); color: var(--text); }
button.small { padding: 5px 12px; font-size: 0.85rem; }
.button-like { display: inline-block; border-radius: 9px; padding: 8px 16px; background: var(--accent); color: var(--on-accent); font-weight: 500; text-decoration: none; white-space: nowrap; }
button.follow { min-width: 104px; }
button.follow.on { background: var(--card); color: var(--text); border: 1px solid var(--line-strong); }
button.follow.on:hover:not(:disabled) { background: var(--hover); }

.quick-compose {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 12px 12px 16px;
  gap: 12px;
  justify-content: flex-start;
  background: var(--card);
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 400;
  font-size: 1rem;
  text-align: left;
}
.quick-compose:hover:not(:disabled) { background: var(--card); border-color: var(--line-strong); }
.quick-compose > span:nth-child(2) { flex: 1; }
.quick-compose .button-like { font-size: 0.95rem; padding: 6px 14px; }

.new-pill {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  margin: 0 auto 10px;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
}
button.subtle:hover:not(:disabled) { background: var(--line); }
button.more { display: flex; margin: 8px auto 24px; background: var(--card); color: var(--text); border: 1px solid var(--line-strong); }
button.more:hover:not(:disabled) { background: var(--hover); }
.icon-button { padding: 8px; background: none; color: var(--muted); border-radius: 50%; }
.icon-button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-button .icon { width: 18px; height: 18px; }

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; resize: vertical; display: block; }
input[type="checkbox"] { padding: 0; accent-color: var(--accent); }

.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.search { flex: 1; position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; padding-right: 34px; }
.search kbd { position: absolute; right: 9px; }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.sort { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9rem; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.chip {
  font-size: 0.82rem;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line-strong);
}
.chip:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.count { margin-left: auto; font-size: 0.82rem; color: var(--faint); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.check { font-size: 0.88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------- notes */

.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 8px;
  margin-bottom: 10px;
  transition: border-color 0.15s, opacity 0.3s;
}
.note:hover { border-color: var(--line-strong); }
.note.clickable { cursor: pointer; }
.note.clickable .body, .note.clickable .life { cursor: text; }
.note.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note.expired { opacity: 0.45; }

.note-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar {
  --hue: 25;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: hsl(var(--hue) 70% 90%);
  color: hsl(var(--hue) 50% 30%);
}
.avatar.anon { background: none; border: 1.5px dashed var(--line-strong); }
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--hue) 30% 24%); color: hsl(var(--hue) 70% 80%); }
}

.meta { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 0.85rem; color: var(--muted); }
.meta a { text-decoration: none; }
.meta-item { display: inline-flex; align-items: center; gap: 3px; }
.author { font-weight: 600; color: var(--text); }
a.author:hover { color: var(--accent); }
.author.anon { font-weight: 400; color: var(--muted); }

.work-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: help;
}
.work-badge .icon { width: 0.9em; height: 0.9em; }

.body { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; opacity: var(--ink, 1); transition: opacity 1s; }
.note.expired .body { opacity: 1; }

/* Stand-in for text this reader can't see: a place-bound note from afar, or a private one. */
.sealed-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.sealed-body p { margin: 0; flex: 1; min-width: 12em; }
.meta .kind { color: var(--faint); }
.capsule { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); border-style: solid; border-color: var(--line); }
.capsule .opens { font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none; color: var(--accent-strong); pointer-events: none; }
.capsule .opens.ready { pointer-events: auto; text-decoration: underline; }

/* Warmth: a quiet count of the different people who kept a note alive. */
.warmth { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 5px 4px; font-size: 0.82rem; color: var(--faint); }
.warmth .icon { color: var(--accent); opacity: 0.75; }
.actions .warmth + .action:last-child { margin-left: 4px; }
.body a { text-decoration: none; overflow-wrap: anywhere; }
.body a:hover { text-decoration: underline; }
.body .mention, .body .tag { font-weight: 500; }

/* A reply's parent sits above it, joined by a short line like a thread. */
.thread-parent { position: relative; padding-bottom: 10px; }
.thread-parent .note { margin-bottom: 0; }
.thread-parent::after { content: ""; position: absolute; left: 30px; bottom: 0; width: 2px; height: 10px; background: var(--line-strong); }
.thread-gone { margin-bottom: 10px; }

mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

.life { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--muted); }
.life .bar { flex: 1; }
.countdown { min-width: 7em; text-align: right; font-variant-numeric: tabular-nums; }
.life.low .bar-fill { background: var(--danger); }
.life.low .countdown { color: var(--danger); }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar.thin { height: 4px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.3s; }

.actions { display: flex; gap: 4px; margin: 6px -8px 0; font-size: 0.85rem; }
.action, button.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: none;
  text-decoration: none;
  font-weight: 400;
}
.action:hover, button.action:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.actions .action:last-child { margin-left: auto; }
.action.tend[aria-pressed="true"] { color: var(--ok); }

.tend-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tend-panel .panel-title { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.tend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.tend-list li { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.tend-list a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.tend-list a:hover { color: var(--accent); }
.tend-list .hint { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tend-list .icon-button { padding: 0 6px; font-size: 1.1rem; line-height: 1.4; }
.hint.small { font-size: 0.78rem; }
@media (max-width: 480px) { .label-wide { display: none; } }

.keepalive { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 6px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 0.9rem; }

.skeleton { pointer-events: none; }
.skeleton div { height: 12px; border-radius: 6px; background: var(--line); margin-bottom: 10px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton div:first-child { width: 30%; }
.skeleton div:nth-child(2) { width: 85%; }
.skeleton div:last-child { width: 60%; height: 4px; }
@keyframes pulse { 50% { opacity: 0.45; } }

.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* --------------------------------------------------------------- compose */

.compose { display: grid; gap: 12px; }
.field { position: relative; }
.field textarea { padding-bottom: 24px; border-radius: 10px; }
.counter { position: absolute; right: 10px; bottom: 6px; font-size: 0.72rem; color: var(--faint); font-variant-numeric: tabular-nums; pointer-events: none; }
.counter.near { color: var(--danger); }
.compose-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.compose-row .label { font-size: 0.88rem; color: var(--muted); }
.estimate strong { color: var(--text); font-weight: 600; }
.compose-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; flex: 1; }
.kbd-hint { display: inline-flex; gap: 2px; }
.note + .compose { margin-top: 12px; }

.work { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; width: 100%; }
.work-head { display: flex; align-items: center; gap: 8px; color: var(--accent-strong); }
.work-title { font-weight: 600; flex: 1; color: var(--text); }
.work-stats { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ username */

.near-card { display: grid; gap: 10px; }
.secret { display: block; margin: 8px 0; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.callout p { margin: 0; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; display: grid; gap: 10px; }
.danger-link, button.link.danger-link { color: var(--danger); }
.upload { display: inline-block; margin-bottom: 10px; }
.upload .file { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload .button-like { cursor: pointer; }
.upload .file:focus-visible + .button-like { outline: 2px solid var(--accent); outline-offset: 2px; }
.availability { font-size: 0.85rem; color: var(--muted); }
.availability.free { color: var(--ok); }
.availability.taken { color: var(--danger); }

/* ---------------------------------------------------------------- toasts */

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100% - 32px); z-index: 20; }
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  background: #c92a2a;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.2);
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.ok { background: #2b8a3e; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

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

/* ----------------------------------------------------------------- world */

/* The globe takes the whole window below the top bar. */
.wide .layout { display: block; max-width: none; padding: 0; }
.wide .sidebar, .wide footer { display: none; }

.world {
  position: relative;
  height: calc(100dvh - 57px);
  overflow: hidden;
  color: #ece9e4;
  background: radial-gradient(ellipse at 50% 45%, #1d1830 0%, #0b0a14 55%, #050508 100%);
}
/* A few faint stars, drawn in CSS so there's no extra image to download. */
.world::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.7;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 27% 72%, #fff, transparent),
    radial-gradient(1px 1px at 41% 9%, #fff, transparent), radial-gradient(1.5px 1.5px at 58% 88%, #fff, transparent),
    radial-gradient(1px 1px at 69% 23%, #fff, transparent), radial-gradient(1px 1px at 83% 61%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 91% 12%, #fff, transparent), radial-gradient(1px 1px at 7% 53%, #fff, transparent),
    radial-gradient(1px 1px at 35% 41%, #fff, transparent), radial-gradient(1px 1px at 76% 79%, #fff, transparent);
}
.globe { position: absolute; inset: 0; }
.globe canvas { display: block; }

.world-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.world-head h1 { color: #fff; }
.world-stats { margin: 4px 0 0; font-size: 0.88rem; color: #b9b3c9; }
.world-legend { display: grid; gap: 4px; font-size: 0.78rem; color: #b9b3c9; }
.world-legend .dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #ff9a55; box-shadow: 0 0 8px #ff9a55; }
.world-legend .dot.here { background: #7dd3fc; box-shadow: 0 0 8px #7dd3fc; }
.world-legend .dot.capsule { background: #c4b5fd; box-shadow: 0 0 8px #c4b5fd; }
.world-legend .dot.orbit { background: #ffffaa; box-shadow: 0 0 8px #ffffaa; }
.world-button {
  pointer-events: auto;
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.22);
  backdrop-filter: blur(8px);
}
.world-button:hover:not(:disabled) { background: rgb(255 255 255 / 0.2); }

.world-card { position: absolute; right: 24px; bottom: 24px; width: min(440px, calc(100% - 32px)); display: grid; justify-items: end; gap: 6px; color: var(--text); }
.world-card .note { width: 100%; max-height: 55dvh; overflow: auto; margin: 0; box-shadow: 0 12px 40px rgb(0 0 0 / 0.45); }
.world-close, .world-close:hover:not(:disabled) { color: #fff; background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.22); backdrop-filter: blur(8px); }

.globe-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; }

@media (max-width: 640px) {
  .world { height: calc(100dvh - 50px - 64px - env(safe-area-inset-bottom)); }
  .world-overlay { padding: 14px 16px; }
  .world-button { top: 14px; right: 16px; }
  .world-legend { display: none; }
  .world-card { right: 16px; bottom: 16px; }
  nav { grid-template-columns: repeat(7, 1fr); }
  nav a { font-size: 0.62rem; }
}
