:root {
  --bg: #05070a;
  --bg-elev: #0b0f14;
  --bg-soft: #10151c;
  --line: #2a3340;
  --hair: #1c2430;
  --text: #d8dee8;
  --muted: #7a8799;
  --accent: #5ec8c0;
  --accent-dim: #2a6f6a;
  --danger: #c97a7a;
  --warn: #c4a35a;
  --home-run: #7a8799;
  --past: #4a5564;
  --radius: 0;
  --font: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  --map-strip: 140px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    linear-gradient(var(--hair) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--hair) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(900px 500px at 50% 0%, #0c1218 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { min-height: 100%; display: flex; flex-direction: column; }
#main { flex: 1; padding: 1rem 1rem calc(1.5rem + var(--safe-b)); max-width: 960px; margin: 0 auto; width: 100%; }
#main.wide, #main.home-system-main {
  max-width: none; margin: 0; padding: 0; width: 100%;
}

.topbar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.5rem 1rem; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  position: sticky; top: 0; z-index: 40;
}
.brand {
  font-family: var(--mono); font-weight: 600; font-size: 0.95rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--accent); text-decoration: none; }
.crumbs { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 0.4rem; }
.who { color: var(--muted); font-size: 0.85rem; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--text); border-radius: 0; padding: 0.55rem 0.9rem;
  font: inherit; font-size: 0.9rem; cursor: pointer;
  min-height: 44px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: transparent; color: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-screen {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
}
.auth-panel {
  width: min(100%, 380px);
  background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 0; padding: 1.75rem 1.5rem;
}
.auth-panel h1 {
  margin: 0 0 0.25rem; font-size: 1.85rem; letter-spacing: -0.02em;
}
.auth-panel .tagline { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.95rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field textarea, .field select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 0;
  color: var(--text); padding: 0.7rem 0.8rem; font: inherit; font-size: 1rem;
  min-height: 44px;
}
.field textarea { min-height: 96px; resize: vertical; }
.err { color: var(--danger); font-size: 0.9rem; margin: 0.5rem 0 0; min-height: 1.2em; }

.tree { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; }
.tree a, .tree .crumb-only {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.75rem 0.85rem; border-radius: 0;
  border: 1px solid transparent; color: var(--text); text-decoration: none;
  font-family: var(--mono); font-size: 0.85rem;
}
.tree a:hover { background: var(--bg-elev); border-color: var(--line); text-decoration: none; }
.tree .id { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); min-width: 3.2rem; }
.tree .name { font-weight: 560; }
.tree .type { margin-left: auto; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.tree .crumb-only { opacity: 0.55; cursor: default; }
.tree .depth-1 { padding-left: 1.4rem; }
.tree .depth-2 { padding-left: 2.2rem; }
.tree .depth-3 { padding-left: 3rem; }
.tree .depth-4 { padding-left: 3.8rem; }

.section-head { margin: 0 0 1rem; }
.section-head h1 { margin: 0; font-size: 1.6rem; }
.section-head p { margin: 0.35rem 0 0; color: var(--muted); }

/* Trip layout */
.trip {
  display: flex; flex-direction: column; gap: 0.75rem;
  margin: -1rem -1rem 0; max-width: none; width: calc(100% + 2rem);
}
.trip-map-wrap {
  position: relative; height: var(--map-strip); transition: height 0.25s ease;
  border-bottom: 1px solid var(--line); background: #0a0e14;
}
.trip-map-wrap.expanded { height: min(55vh, 420px); }
.trip-map { height: 100%; width: 100%; }
.trip-map-toggle {
  position: absolute; right: 0.6rem; bottom: 0.6rem; z-index: 1000;
}
.map-filter {
  position: absolute; left: 0.6rem; top: 0.6rem; z-index: 1000;
  display: flex; gap: 0.3rem; flex-wrap: wrap;
}
.map-filter button {
  min-height: 36px; padding: 0.3rem 0.55rem; font-size: 0.8rem;
  background: rgba(5,7,10,0.9); border: 1px solid var(--line); color: var(--text);
  border-radius: 0; cursor: pointer; font-family: var(--mono);
}
.map-filter button.active { border-color: var(--accent); color: var(--accent); }

.trip-body { padding: 0 1rem 1rem; max-width: 960px; margin: 0 auto; width: 100%; }
.trip-settings {
  display: grid; gap: 0.6rem; grid-template-columns: 1fr;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 0;
  padding: 0.85rem; margin-bottom: 0.85rem;
}
@media (min-width: 700px) {
  .trip-settings { grid-template-columns: 1fr 1fr; }
  .trip-map-wrap { height: min(42vh, 380px); }
  .trip-map-wrap.expanded { height: min(60vh, 520px); }
  #main.wide { max-width: none; padding-left: 0; padding-right: 0; }
}

.itinerary { display: flex; flex-direction: column; gap: 0.55rem; }
.item {
  display: grid; grid-template-columns: 44px 1fr; gap: 0.65rem;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 0;
  padding: 0.7rem 0.75rem; scroll-margin-top: 70px;
}
.item.past { opacity: 0.55; }
.item.past .item-num { background: var(--past); }
.item-num {
  width: 44px; height: 44px; border-radius: 0; display: grid; place-items: center;
  font-weight: 700; color: #061018; font-size: 0.95rem; font-family: var(--mono);
}
.item-num.home { background: var(--home-run); color: #fff; }
.item-main h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.item-meta { color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.item-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.item-actions .btn { min-height: 40px; padding: 0.4rem 0.65rem; font-size: 0.85rem; }
.now-line {
  display: flex; align-items: center; gap: 0.5rem; color: var(--accent);
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  margin: 0.2rem 0;
}
.now-line::before, .now-line::after {
  content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.comments { margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px dashed var(--line); }
.comment { font-size: 0.88rem; margin: 0.25rem 0; }
.comment .by { color: var(--muted); }

.marker-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 0.75rem; color: #061018; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.marker-dot.home { color: #fff; }
.marker-dot.faded { opacity: 0.45; }
.marker-dot.backup {
  width: 14px; height: 14px; background: #94a3b8; border: 2px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35); opacity: 0.85;
}
.item-num.backup-num { background: #64748b; color: #e2e8f0; font-size: 1.25rem; line-height: 1; }
.item.backup { border-style: dashed; }
.optional-tag {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); vertical-align: middle;
}
.item-links { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.35rem; font-size: 0.85rem; }
.item-links a { color: var(--accent); word-break: break-all; }
.list-link { font-size: 0.85rem; margin-top: 0.15rem; }
.list-link a { color: var(--accent); word-break: break-all; }
.backups { margin-bottom: 2rem; }
.now-marker {
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 3px solid var(--accent); box-shadow: 0 0 0 4px rgba(61,214,198,0.25);
}

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.75rem; border-bottom: 1px solid var(--line);
}
.checklist input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.checklist .done { text-decoration: line-through; color: var(--muted); }
.checklist .by { font-size: 0.75rem; color: var(--muted); }

.admin-grid { display: grid; gap: 1rem; }
.panel {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 0;
  padding: 1rem;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.mono { font-family: var(--mono); font-size: 0.85rem; }
.muted { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }

.game-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.game-wrap canvas {
  width: min(100%, 480px); background: #05070a; border: 1px solid var(--line);
  border-radius: 0; touch-action: none;
}
.game-wrap canvas.game-canvas.tall { width: min(100%, 300px); }
.game-wrap canvas.game-canvas.mid { width: min(100%, 640px); }
.game-wrap canvas.game-canvas.wide { width: min(100%, 900px); }
.scores { width: min(100%, 420px); }
.scores ol { margin: 0; padding-left: 1.2rem; }
.scores li { padding: 0.25rem 0; }

.empty { color: var(--muted); padding: 1rem 0; }

.leaflet-container { background: #0a0e14; font: inherit; }

.landing {
  min-height: 70dvh; display: flex; flex-direction: column; justify-content: center;
  max-width: 36rem; margin: 0 auto; padding: 2rem 0;
}
.landing-brand {
  font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.75rem; font-weight: 600;
}
.landing h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 3.4rem); letter-spacing: -0.03em; }
.landing-blurb { color: var(--muted); font-size: 1.1rem; margin: 0.85rem 0 1.5rem; }
.landing-actions { margin-bottom: 2rem; }
.landing-pages { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.landing-pages li { border-bottom: 1px solid var(--line); }
.landing-pages a {
  display: flex; gap: 0.75rem; padding: 0.85rem 0.2rem; color: var(--text); text-decoration: none;
}
.landing-pages a:hover { color: var(--accent); }
.landing-pages .id { font-family: var(--mono); color: var(--accent); min-width: 3rem; }

.warn-note {
  font-size: 0.85rem; margin: 0.75rem 0; padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  border-radius: 8px; color: var(--warn);
}
.check { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0.75rem; color: var(--muted); font-size: 0.9rem; }

.file-image img, .embed-img img {
  max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line);
}
.file-pdf { width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.note-body, .note-preview { margin-top: 1rem; line-height: 1.55; }
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.88);
  display: grid; place-items: center; padding: 1.5rem;
}
.lightbox img { max-width: min(96vw, 1200px); max-height: 85vh; border-radius: 0; }
.lightbox .btn { position: absolute; top: 1rem; right: 1rem; }

/* —— Planetary home system —— */
.home-system {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  min-height: calc(100dvh - 0px);
  height: calc(100dvh - 0px);
  background: var(--bg);
}
.topbar ~ #main .home-system,
#app:has(.topbar:not([hidden])) .home-system {
  height: calc(100dvh - 49px);
  min-height: calc(100dvh - 49px);
}
.sys-panel {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
  overflow: hidden;
  transition: width 0.2s ease, margin 0.2s ease;
}
.sys-panel.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}
.sys-panel-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line);
}
.sys-panel-toggle {
  appearance: none; background: transparent; border: 1px solid var(--line);
  color: var(--muted); width: 32px; height: 32px; cursor: pointer; font-size: 1rem;
}
.sys-brand { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sys-brand-mark {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
}
.sys-brand-sub { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.sys-signin { padding: 0.35rem 0.65rem; min-height: 36px; font-size: 0.8rem; }
.sys-blurb {
  margin: 0; padding: 0.55rem 0.75rem; font-size: 0.8rem; color: var(--muted);
  border-bottom: 1px solid var(--hair); font-family: var(--mono);
}
.sys-tree-wrap { flex: 1; overflow: auto; padding: 0.35rem 0; }
.sys-panel-foot {
  border-top: 1px solid var(--line); padding: 0.5rem 0.75rem;
}
.sys-tree-row {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.35rem 0.5rem 0.35rem calc(0.4rem + var(--d, 0) * 0.85rem);
  cursor: pointer; font-family: var(--mono); font-size: 0.78rem;
  border-left: 1px solid transparent;
}
.sys-tree-row:hover, .sys-tree-row:focus {
  background: var(--bg-soft); outline: none; border-left-color: var(--accent);
}
.sys-tree-row.active { background: var(--bg-soft); border-left-color: var(--accent); color: var(--accent); }
.sys-chev {
  appearance: none; background: transparent; border: 0; color: var(--muted);
  width: 1.1rem; cursor: pointer; font-size: 0.7rem; padding: 0;
}
.sys-chev.empty { cursor: default; opacity: 0.35; }
.sys-tree-label { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; }
.sys-tree-label .id { color: var(--accent); flex-shrink: 0; }
.sys-tree-label .icon { color: var(--muted); flex-shrink: 0; }
.sys-tree-label .icon.planet { display: inline-flex; align-self: center; margin: -2px 0; }
.sys-tree-label .icon.planet svg { display: block; }
.sys-tree-label .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-tree-label.restricted { opacity: 0.55; }
.sys-tree-label.restricted .name { font-style: italic; }

.sys-stage {
  position: relative; min-width: 0; min-height: 0;
  background: #05070a;
}
.sys-canvas-mount, .system-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.sys-hud {
  position: absolute; right: 0.75rem; top: 0.75rem; z-index: 2;
  padding: 0.55rem 0.7rem; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  font-size: 0.72rem; line-height: 1.55; color: var(--muted);
  pointer-events: none;
}
.sys-hud .k { color: var(--accent); margin-right: 0.35rem; }
.sys-hud span[data-h] { color: var(--text); }
.sys-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-family: var(--mono); font-size: 0.85rem;
  padding: 2rem; text-align: center;
}
.sys-sheet-handle {
  display: none;
  appearance: none; border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text); font-family: var(--mono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.55rem 1rem; cursor: pointer;
}

.sys-page {
  position: absolute; inset: 0; z-index: 8;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  overflow: auto; padding: 0;
  border-left: 1px solid var(--line);
}
.home-system.page-open .sys-page { display: block; }
.sys-page-bar {
  position: sticky; top: 0; z-index: 2;
  padding: 0.5rem 1rem; border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.sys-page-body {
  padding: 1rem 1rem calc(1.5rem + var(--safe-b));
  max-width: 960px; margin: 0 auto;
}
.sys-page-body .trip {
  margin: -1rem; width: calc(100% + 2rem); max-width: none;
}

@media (max-width: 800px) {
  .home-system {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .sys-panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
    max-height: 42%;
    border-right: none; border-top: 1px solid var(--line);
    transform: translateY(calc(100% - 0px));
    transition: transform 0.25s ease;
  }
  .home-system.sheet-open .sys-panel {
    transform: translateY(0);
    max-height: 70%;
  }
  .sys-panel:not(.collapsed) {
    transform: translateY(calc(100% - 48px));
  }
  .home-system.sheet-open .sys-panel:not(.collapsed) {
    transform: translateY(0);
  }
  .sys-sheet-handle {
    display: block; position: absolute; left: 50%; bottom: 0.65rem;
    transform: translateX(-50%); z-index: 7;
  }
  .home-system.sheet-open .sys-sheet-handle { bottom: calc(70% + 0.4rem); }
  .sys-panel-toggle { display: none; }
  .sys-hud { top: auto; bottom: 3.5rem; right: 0.5rem; font-size: 0.65rem; }
  .sys-page { inset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sys-panel, .home-system .sys-panel { transition: none; }
}

/* Game companion astronaut */
.game-wrap { position: relative; }
.game-companion {
  position: absolute; right: 0; top: 0;
  width: 110px; height: 150px;
  pointer-events: auto; z-index: 2;
}
.companion-canvas { width: 100%; height: 100%; display: block; }

/* Suit up panel */
.suitup-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 7, 10, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.suitup-panel {
  width: min(920px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.suitup-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
}
.suitup-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: 0.04em; }
.suitup-body {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1rem;
  padding: 1rem;
  min-height: 320px;
}
.suitup-preview {
  background: #05070a;
  border: 1px solid var(--line);
  min-height: 280px;
}
.suitup-canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.suitup-form { display: flex; flex-direction: column; gap: 0.75rem; }
.suitup-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.swatch {
  width: 28px; height: 28px; border: 1px solid var(--line);
  background: var(--sw); cursor: pointer; padding: 0;
}
.swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.decal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.35rem;
  font-size: 0.85rem;
}
.decal-opt { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.suitup-foot {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.75rem 1rem; border-top: 1px solid var(--line);
}
.suitup-msg { padding: 0 1rem 0.75rem; margin: 0; min-height: 1.2em; }

@media (max-width: 700px) {
  .suitup-body { grid-template-columns: 1fr; }
  .suitup-preview { min-height: 220px; }
  .game-companion { width: 84px; height: 120px; }
}

[hidden] { display: none !important; }

/* Phone: one-line top bar, floating Open button, sheet peeks at the bottom */
.sys-open-fab { display: none; }
@media (max-width: 800px) {
  .topbar { flex-wrap: nowrap; gap: 0.4rem; padding: 0.4rem 0.6rem; }
  .topbar .brand { font-size: 0.8rem; white-space: nowrap; }
  .topbar .crumbs { display: none; }
  .topbar button, .topbar .btn, .topbar a.btn { font-size: 0.75rem; padding: 0.3rem 0.5rem; }
  .topbar .who, .topbar .user-name { display: none; }
  .sys-open-fab {
    display: block; position: absolute; left: 50%; bottom: 3.6rem; transform: translateX(-50%);
    z-index: 4; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em;
    max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    border: 1px solid var(--accent); color: var(--accent); background: rgba(5, 7, 10, 0.85);
  }
  .sys-open-fab[hidden] { display: none !important; }
  .sys-hud { bottom: auto; top: 0.5rem; }
}
@media (max-width: 800px) {
  /* Game buddy: bottom corner on phones, clear of where pieces spawn, and never eats swipes */
  .game-companion { position: fixed; top: auto; right: 0.4rem; bottom: 0.4rem; width: 70px; height: 96px; pointer-events: none; }
}
.home-system.page-open .sys-hud { display: none; }

/* Suit up: the form scrolls, the preview stays put, buttons stay reachable */
.suitup-panel { overflow: hidden; }
.suitup-body { flex: 1; min-height: 0; overflow: auto; align-items: start; }
.suitup-preview { position: sticky; top: 0; height: min(440px, 60vh); }
.suitup-foot { background: var(--bg-elev); position: relative; z-index: 1; }
@media (max-width: 700px) {
  .suitup-preview { position: relative; height: 240px; min-height: 240px; }
}

/* Trip page: edit form tucked away so the itinerary comes first */
.trip-edit { margin-bottom: 0.85rem; border: 1px solid var(--line); background: var(--bg-elev); }
.trip-edit > summary {
  cursor: pointer; padding: 0.6rem 0.85rem; font-family: var(--mono); font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.trip-edit[open] > summary { border-bottom: 1px solid var(--line); }
.trip-edit .trip-settings { border: 0; margin: 0; }
.trip-edit .row-actions { padding: 0 0.85rem 0.85rem; }
@media (max-width: 800px) {
  .trip-map-wrap { height: 46vh; }
  .trip-map-wrap.expanded { height: 72vh; }
  /* An open page owns the screen: no index sheet or Open button over it */
  .home-system.page-open .sys-panel,
  .home-system.page-open .sys-sheet-handle,
  .home-system.page-open .sys-open-fab { display: none !important; }
}
.itinerary .notes, #backups .notes { white-space: pre-line; }

/* "Your avatar is freezing" prompt */
.suit-prompt {
  position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem 0.6rem 1rem;
  background: rgba(5, 7, 10, 0.88); border: 1px solid var(--accent);
  font-family: var(--mono); font-size: 0.82rem; color: var(--text); white-space: nowrap;
}
.suit-prompt[hidden] { display: none !important; }
@media (max-width: 800px) {
  .suit-prompt { top: 10.5rem; bottom: auto; flex-direction: column; gap: 0.45rem; white-space: normal; text-align: center; max-width: 86%; }
  .home-system.page-open .suit-prompt { display: none !important; }
}

/* Planet and place labels over the scene */
.sys-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.sys-label {
  position: absolute; left: 0; top: 0; display: none; pointer-events: auto; cursor: pointer;
  translate: -50% -100%; white-space: nowrap; appearance: none; border: 0; padding: 0.18rem 0.45rem;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.03em; color: #e8edf3;
  background: rgba(5, 7, 10, 0.78); border-left: 2px solid var(--acc, var(--accent));
}
.sys-label.on { display: inline-flex; gap: 0.4rem; align-items: baseline; }
.sys-label .idx { color: var(--acc, var(--accent)); }
.sys-label.planet { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sys-label.loc { translate: -50% calc(-100% - 6px); font-size: 0.68rem; }
.sys-label.loc::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 1px; height: 6px; background: var(--acc, var(--accent));
}
.sys-label.focus { background: var(--acc, var(--accent)); color: #05070a; }
.sys-label.focus .idx { color: #05070a; }
.sys-label.restricted .nm { color: #7c8694; font-style: italic; }
.suitup-body > * { min-width: 0; }
.suitup-preview { overflow: hidden; }

/* Dark map: invert the standard OSM tiles, then rotate hues back so water stays blue */
.trip-map .tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.6); }

/* ---------- Trip page: tight list on the left, map fills the right ---------- */
.trip2 {
  display: grid; grid-template-columns: minmax(280px, 360px) 1fr;
  height: calc(100dvh - 112px); min-height: 420px; margin: -1rem; font-size: 13px;
}
.trip-side { overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); padding: 0.5rem 0 1rem; }
.trip-mapcol { position: relative; min-width: 0; }
.trip-mapcol .trip-map { position: absolute; inset: 0; height: auto; }
.trip-head { padding: 0.15rem 0.75rem 0.4rem; border-bottom: 1px solid var(--line); }
.trip-head-row { display: flex; align-items: center; gap: 0.5rem; }
.trip-head h1 { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-head p { margin: 0.1rem 0 0; font-size: 11.5px; }
.tiny-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.tbtn, .tacts button, .tacts a {
  appearance: none; background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 11px; padding: 0.1rem 0.4rem; cursor: pointer; text-decoration: none; line-height: 1.5;
}
.tbtn:hover, .tacts button:hover, .tacts a:hover { color: var(--text); border-color: var(--accent); }
.tacts .danger { color: #f87171; }

.trip-side .trip-edit { margin: 0; border: 0; border-bottom: 1px solid var(--line); background: none; }
.trip-side .trip-edit > summary { padding: 0.3rem 0.75rem; font-size: 11px; }
.trip-side .trip-settings { grid-template-columns: 1fr 1fr; gap: 0.35rem; padding: 0.5rem 0.75rem; font-size: 12px; }
.trip-side .trip-settings input, .trip-side .trip-settings textarea, .trip-side .item-form input,
.trip-side .item-form textarea, .trip-side .item-form select { padding: 0.25rem 0.4rem; font-size: 12px; min-height: 0; }
.trip-side .trip-settings label, .trip-side .item-form label { font-size: 10.5px; }
.trip-side .row-actions { gap: 0.3rem; }
.trip-side .row-actions .btn { font-size: 11.5px; padding: 0.2rem 0.5rem; min-height: 0; }
.trip-side .item-form { margin: 0.4rem 0.5rem; padding: 0.5rem; }
.trip-side .item-form h2 { font-size: 13px; margin: 0 0 0.3rem; }
.trip-side .panel { padding: 0.4rem 0.75rem; font-size: 12px; margin: 0; border: 0; border-bottom: 1px solid var(--line); }

.tlist { display: flex; flex-direction: column; }
.tgroup-head, .trow-head {
  display: flex; align-items: center; gap: 0.4rem; width: 100%; appearance: none; background: none; border: 0;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; padding: 0 0.75rem;
}
.tgroup-head { height: 28px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.tgroup-head .muted { text-transform: none; letter-spacing: 0; }
.tglabel { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcount { color: var(--muted); font-size: 10.5px; }
.tdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chev { width: 10px; color: var(--muted); font-size: 10px; flex-shrink: 0; }
.trow { border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.trow-head { height: 26px; padding-left: 1.05rem; }
.trow-head:hover, .tgroup-head:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.trow.sel > .trow-head { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.tnum { min-width: 18px; height: 16px; padding: 0 3px; border-radius: 3px; color: #05070a; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--mono); }
.ttitle { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.twhen { color: var(--muted); font-size: 11px; white-space: nowrap; max-width: 34%; overflow: hidden; text-overflow: ellipsis; }
.trow.past .ttitle, .trow.past .tnum { opacity: 0.45; }
.trow.optional .ttitle { font-style: italic; }
.trow.backup .tnum { color: #e5e7eb; }
.trow-body { padding: 0.2rem 0.75rem 0.5rem 2.6rem; font-size: 12px; display: flex; flex-direction: column; gap: 0.3rem; }
.tmeta { color: var(--muted); font-size: 11.5px; }
.trow-body .notes { white-space: pre-line; line-height: 1.4; }
.tlinks { display: flex; flex-direction: column; gap: 0.1rem; font-size: 11.5px; overflow: hidden; }
.tlinks a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tacts { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.tcomments { font-size: 11.5px; display: flex; flex-direction: column; gap: 0.15rem; }
.tcomments .comment b { color: var(--accent); font-weight: 600; }
.tcomment-form input { width: 100%; font-size: 11.5px; padding: 0.2rem 0.4rem; background: transparent;
  border: 1px solid var(--line); color: var(--text); }
.tnow { font-family: var(--mono); font-size: 10px; color: #f87171; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 0.75rem; border-top: 1px solid #f87171; line-height: 1.6; }
.marker-dot.sel, .sel > .marker-dot { outline: 3px solid #fff; outline-offset: 1px; transform: scale(1.25); }
.trip-mapcol .map-filter { top: 0.5rem; left: 0.5rem; }
.trip-mapcol .map-filter button { min-height: 0; padding: 0.15rem 0.45rem; font-size: 11px; }

@media (max-width: 800px) {
  .trip2 { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; height: calc(100dvh - 96px); margin: -1rem; }
  .trip-mapcol { order: -1; border-bottom: 1px solid var(--line); }
  .trip-side { border-right: 0; }
  .tgroup-head { height: 34px; }
  .trow-head { height: 36px; }
}

/* Compact page bar, and the trip page uses the full width */
.sys-page-bar { padding: 0.25rem 0.5rem; }
.sys-page-bar .btn { min-height: 0; padding: 0.15rem 0.55rem; font-size: 12px; }
.sys-page-body:has(.trip2) { max-width: none; padding: 0; }
.sys-page-body .trip2 { margin: 0; height: calc(100dvh - 49px - 33px); }
@media (max-width: 800px) {
  .sys-page-body .trip2 { height: calc(100dvh - 42px - 33px); }
}

/* Denser chrome everywhere: smaller top bar and buttons (touch screens keep bigger tap targets) */
.topbar { padding: 0.3rem 0.75rem; gap: 0.5rem; min-height: 38px; box-sizing: border-box; }
.topbar .brand { font-size: 0.85rem; }
.topbar .crumbs { font-size: 0.78rem; }
.topbar .btn, .topbar button { min-height: 0; padding: 0.18rem 0.6rem; font-size: 12px; }
@media (pointer: fine) {
  .btn { min-height: 0; padding: 0.3rem 0.7rem; font-size: 13px; }
}
.topbar ~ #main .home-system,
#app:has(.topbar:not([hidden])) .home-system { height: calc(100dvh - 38px); min-height: calc(100dvh - 38px); }
.sys-page-body .trip2 { height: calc(100dvh - 38px - 34px); }
@media (max-width: 800px) {
  .sys-page-body .trip2 { height: calc(100dvh - 38px - 34px); }
}
.trow-head { cursor: pointer; padding-left: 0.35rem; }
.tchev {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer; flex-shrink: 0;
  width: 26px; height: 24px; margin-right: -2px; font-size: 13px; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 3px;
}
.tchev:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.trow.open .tchev { color: var(--accent); }
@media (max-width: 800px) { .tchev { width: 34px; height: 34px; font-size: 15px; } }

/* Suit up: handle + face pickers */
.face-row { display: flex; gap: 0.75rem; align-items: center; }
.face-preview { width: 64px; height: 64px; flex-shrink: 0; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.35rem 0.5rem; }
.face-opt { display: flex; flex-direction: column; gap: 0.15rem; font-size: 11px; color: var(--muted); }
.face-opt select { font-size: 12px; padding: 0.2rem 0.3rem; }

/* Trip: house link, comments with faces, suggestions */
.trip-links { margin-top: 0.2rem; font-size: 12px; }
.trip-links a { color: var(--accent); }
.tbtn.on { color: #05070a; background: var(--accent); border-color: var(--accent); }
.pchip { display: inline-flex; align-items: center; gap: 0.25rem; appearance: none; background: none; border: 0; padding: 0 0.15rem;
  color: var(--accent); font: inherit; font-size: 11.5px; cursor: pointer; flex-shrink: 0; max-width: 45%; }
.pchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip.small { font-size: 11px; }
.pchip:hover span { text-decoration: underline; }
.face-svg { display: block; flex-shrink: 0; }
.pcard { position: fixed; z-index: 200; width: 240px; display: flex; gap: 0.6rem; align-items: center; padding: 0.6rem;
  background: var(--bg-elev); border: 1px solid var(--accent); box-shadow: 0 8px 30px rgba(0,0,0,0.5); font-size: 12px; }
.pcard-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pcard-text b { font-size: 13px; }
.pcard-text a, .pcard-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pcard-text a { color: var(--accent); }
.tcomments .comment { display: flex; align-items: flex-start; gap: 0.3rem; flex-wrap: wrap; }
.tcomments .comment .cbody { flex: 1; min-width: 40%; }
.cacts { display: inline-flex; gap: 0.2rem; }
.cacts button, .comment.editing button { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: 10.5px; cursor: pointer; padding: 0 0.15rem; }
.cacts button:hover { color: var(--text); }
.cacts .danger { color: #f87171; }
.comment.editing input { flex: 1; font-size: 11.5px; padding: 0.15rem 0.35rem; background: transparent; border: 1px solid var(--accent); color: var(--text); }
.trow.tsugg { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, #c084fc 6%, transparent) 6px 12px); }
.trow.tsugg > .trow-head { padding-left: 1.4rem; }
.tsugg-badge { background: transparent !important; color: #c084fc !important; border: 1px dashed #c084fc; }
.tsugg .ttitle { color: #e9d5ff; }
.tsugg-count { color: #c084fc; }
.tgap { display: block; width: 100%; height: 10px; margin: -5px 0; position: relative; z-index: 1; appearance: none; border: 0; background: none; cursor: pointer; padding: 0; }
.tgap span { display: none; }
.tgap::before { content: ""; position: absolute; left: 0.75rem; right: 0.75rem; top: 4px; height: 2px; background: color-mix(in srgb, #c084fc 25%, transparent); }
.tgap:hover, .tgap:focus-visible { height: 24px; margin: 0; background: color-mix(in srgb, #c084fc 14%, transparent); }
.tgap:hover::before, .tgap:focus-visible::before { top: 11px; background: #c084fc; box-shadow: 0 0 8px #c084fc; }
.tgap:hover span, .tgap:focus-visible span { display: inline-block; position: relative; background: var(--bg); color: #e9d5ff; font-size: 11px; padding: 0 0.4rem; border: 1px solid #c084fc; }
.tsugg-form { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.45rem 0.75rem 0.55rem 1.4rem; border: 1px solid #c084fc;
  margin: 0.2rem 0.4rem; background: color-mix(in srgb, #c084fc 8%, var(--bg)); }
.tsugg-form input, .tsugg-form textarea { font: inherit; font-size: 12px; padding: 0.25rem 0.4rem; background: var(--bg); border: 1px solid var(--line); color: var(--text); width: 100%; box-sizing: border-box; }
.tsf-row { display: flex; gap: 0.3rem; }
.tsf-msg { font-size: 11px; }
.marker-dot.sugg { background: #1a1024 !important; color: #c084fc; border: 2px dashed #c084fc; font-size: 11px; display: flex; align-items: center; justify-content: center; }
@media (max-width: 800px) {
  .tgap { height: 14px; margin: -7px 0; }
  .tlist.suggesting .tgap { height: 28px; margin: 0; }
  .tlist.suggesting .tgap span { display: inline-block; position: relative; background: var(--bg); color: #e9d5ff; font-size: 11px; padding: 0 0.4rem; border: 1px solid #c084fc; }
  .tlist.suggesting .tgap::before { top: 13px; }
}

/* Your character on the trip map */
.mini-astro { position: relative; width: 106px; height: 76px; pointer-events: none; transition: left 0.4s ease;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); animation: mini-bob 2.4s ease-in-out infinite; }
.mini-astro svg { display: block; overflow: visible; transform-origin: 50% 62%;
  transform: rotate(var(--rot, 0deg)) scaleX(var(--flip, 1)); transition: transform 0.35s cubic-bezier(.3,1.4,.5,1); }
.mini-astro .pose-stand, .mini-astro .pose-fly { transition: opacity 0.18s ease; }
.mini-astro .pose-fly { opacity: 0; }
.mini-astro.flying .pose-fly { opacity: 1; }
.mini-astro.flying .pose-stand { opacity: 0; }
.mini-astro.flying { animation: none; }
.mini-astro .wings { transform-box: view-box; transform-origin: 62px 46px; transform: scale(0.1, 0); transition: transform 0.35s cubic-bezier(.3,1.6,.5,1) 0.08s; }
.mini-astro.flying .wings { transform: scale(1); }
.mini-astro .flame { transform-box: fill-box; transform-origin: 100% 50%; animation: mini-flame 0.11s ease-in-out infinite alternate; }
.mini-astro .flame + .flame { animation-duration: 0.09s; animation-delay: 0.04s; }
.mini-astro .wave-arm { transform-box: view-box; transform-origin: 87px 52px; }
.mini-astro.waving .wave-arm { animation: mini-wave 0.5s ease-in-out 3 alternate; }
@keyframes mini-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes mini-flame { from { transform: scale(0.75, 0.85); } to { transform: scale(1.15, 1.08); } }
@keyframes mini-wave { 0% { transform: rotate(0deg); } 35% { transform: rotate(-165deg); } 100% { transform: rotate(-125deg); } }
@media (prefers-reduced-motion: reduce) { .mini-astro, .mini-astro * { animation: none !important; transition: none !important; } }

/* Map layer switcher, compact and dark */
.trip-map .leaflet-control-layers { background: rgba(5,7,10,0.92); color: var(--text); border: 1px solid var(--line); border-radius: 0; box-shadow: none; font-size: 12px; }
.trip-map .leaflet-control-layers-toggle { width: 30px; height: 30px; background-size: 18px; filter: invert(1); }
.trip-map .leaflet-control-layers-expanded { padding: 0.35rem 0.6rem; }
.trip-map .leaflet-control-layers-separator { border-top-color: var(--line); }
.trip-map .leaflet-control-layers label { margin: 0.1rem 0; }
.map-view-toggles { position: absolute; z-index: 1000; left: 0.5rem; bottom: 1.7rem; display: flex; gap: 0.25rem; margin-left: 2.4rem; }
.map-view-toggles label { display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--mono); font-size: 11px; color: var(--text);
  background: rgba(5,7,10,0.88); border: 1px solid var(--line); padding: 0.15rem 0.45rem; cursor: pointer; user-select: none; }
.map-view-toggles input { margin: 0; accent-color: var(--accent); }
.map-view-toggles label:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.mini-astro.is-3d { width: 96px; height: 96px; animation: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.45)); }
.map-buddy canvas { display: block; }

/* Agent planet: chat left, scene right */
.sys-page-body:has(.agent-page) { max-width: none; padding: 0; }
.agent-page {
  display: grid; grid-template-columns: minmax(300px, 420px) 1fr;
  height: calc(100dvh - 49px - 33px); min-height: 420px;
}
.agent-chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.agent-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 13px; }
.agent-head .spacer { flex: 1; }
.agent-toggle { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 12px; color: var(--muted); cursor: pointer; }
.btn.tiny { min-height: 0; padding: 0.1rem 0.5rem; font-size: 12px; }
.agent-msgs { flex: 1; overflow: auto; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 14px; line-height: 1.45; }
.agent-msg { max-width: 92%; padding: 0.45rem 0.65rem; border-radius: 10px; border: 1px solid var(--line); word-wrap: break-word; }
.agent-msg.user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev)); }
.agent-msg.assistant { align-self: flex-start; background: var(--bg-elev); border-left: 3px solid #d4a017; }
.agent-msg.error { border-left-color: #ff4b5c; color: #ffb3bb; }
.agent-msg pre { overflow: auto; background: #05070a; padding: 0.4rem; border-radius: 6px; margin: 0.3rem 0; }
.agent-msg code { font-size: 12.5px; }
.agent-form { display: flex; gap: 0.35rem; padding: 0.5rem; border-top: 1px solid var(--line); align-items: flex-end; }
.agent-form textarea { flex: 1; resize: none; min-height: 2.4rem; max-height: 8rem; font: inherit; font-size: 14px; }
.agent-mic.on { background: #d4a017; color: #0b0d10; border-color: #d4a017; }
.agent-login { padding: 0.8rem; display: grid; gap: 0.5rem; border-top: 1px solid var(--line); }
.agent-scene { position: relative; min-height: 0; overflow: hidden; background: #070a12; }
.agent-canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 800px) {
  .agent-page { grid-template-columns: 1fr; grid-template-rows: 38vh 1fr; height: calc(100dvh - 49px - 33px); }
  .agent-scene { order: -1; }
  .agent-chat { border-right: 0; border-top: 1px solid var(--line); }
}
/* thinking: a bubble in the chat and a thought cloud over the agent */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.3; animation: agent-dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.agent-msg.thinking { color: var(--muted); font-style: italic; }
.agent-thought {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.2s;
  padding: 0.3rem 0.65rem; border-radius: 14px; background: #f4f6fa; color: #14161c;
  border: 2px solid #0b0d10; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.agent-thought::before, .agent-thought::after {
  content: ""; position: absolute; background: #f4f6fa; border: 2px solid #0b0d10; border-radius: 50%;
}
.agent-thought::before { width: 10px; height: 10px; left: -6px; bottom: -10px; }
.agent-thought::after { width: 6px; height: 6px; left: -14px; bottom: -17px; }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.7; } }

/* Chat planet: the crew's group chat */
.sys-page-body:has(.chat-page) { max-width: 820px; padding: 0; }
.chat-page { display: flex; flex-direction: column; height: calc(100dvh - 49px - 33px); min-height: 360px; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 13px; }
.chat-msgs { flex: 1; overflow: auto; padding: 0.5rem 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.chat-empty { margin: auto; }
.chat-day { text-align: center; margin: 0.7rem 0 0.35rem; font-size: 11px; color: var(--muted); }
.chat-day span { padding: 0.1rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev); }
.chat-row { display: flex; align-items: flex-end; gap: 0.4rem; margin-top: 0.45rem; }
.chat-row.grouped { margin-top: 0; }
.chat-row.mine { justify-content: flex-end; }
.chat-face { width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border: 0; background: none; cursor: pointer; align-self: flex-start; }
.chat-face svg { display: block; }
.chat-bubble { max-width: min(78%, 520px); padding: 0.35rem 0.6rem 0.25rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elev); font-size: 14px; line-height: 1.4; }
.chat-row.mine .chat-bubble { background: color-mix(in srgb, #ff4fa3 18%, var(--bg-elev)); border-color: color-mix(in srgb, #ff4fa3 40%, var(--line)); }
.chat-who { margin-bottom: 1px; }
.chat-handle { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: #ff8cc6; cursor: pointer; }
.chat-text { word-wrap: break-word; overflow-wrap: anywhere; }
.chat-text a { color: var(--accent); }
.chat-meta { font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 1px; }
.linkish { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--text, #e8ecf2); }
.chat-edit { width: 100%; min-width: 220px; font: inherit; font-size: 14px; }
.chat-form { display: flex; gap: 0.4rem; padding: 0.5rem 0.75rem calc(0.5rem + var(--safe-b, 0px)); border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; font: inherit; font-size: 14px; min-height: 2.3rem; max-height: 140px; }

/* Moon Cruiser */
.mc-stage { position: relative; width: min(100%, 960px); background: #05060a; border: 1px solid var(--line); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.game-wrap canvas.mc-canvas, .mc-canvas { display: block; width: 100%; height: 100%; border: 0; }
.mc-hud { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; font: 12px ui-monospace, monospace; color: #e8ecf2; pointer-events: none; text-shadow: 0 1px 2px #000; }
.mc-hud b { font-size: 18px; }
.mc-bars { display: flex; gap: 0.8rem; }
.mc-bars label { display: inline-flex; align-items: center; gap: 0.35rem; }
.mc-bar { display: inline-block; width: 90px; height: 8px; border: 1.5px solid #0b0d10; background: #22252c; border-radius: 4px; overflow: hidden; }
.mc-bar i { display: block; height: 100%; transition: width 0.1s; }
.mc-bar.hull i { background: #34c759; }
.mc-bar.energy i { background: #ff4fa3; }
.mc-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 0.6rem 1.2rem; text-align: center; font: bold 20px ui-monospace, monospace; color: #e8ecf2; background: rgba(5,6,10,0.65); border: 1px solid #2fd3c4; pointer-events: none; }
.mc-banner small { display: block; font-weight: normal; font-size: 12px; color: #c9d1dc; margin-top: 2px; }
.mc-touch { display: none; }
.mc-boost-hud { position: absolute; top: 30px; left: 10px; display: flex; gap: 3px; align-items: center; font: 11px ui-monospace, monospace; color: #c9d1dc; pointer-events: none; }
.mc-boost-hud span { margin-right: 3px; }
.mc-boost-hud i { width: 14px; height: 6px; border-radius: 3px; border: 1.5px solid #0b0d10; background: #22252c; }
.mc-boost-hud i.on { background: #ffb347; } .mc-boost-hud i.part { background: #6a5030; }
.mc-controls { display: none; }
@media (hover: none) and (pointer: coarse) {
  /* two-thumb bar under the game: drive pad left, fire + boost right */
  .mc-controls { display: flex; gap: 10px; align-items: stretch; width: min(100%, 960px); height: 128px; padding: 10px; box-sizing: border-box; background: #0b0f17; border: 1px solid var(--line); border-top: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
  .mc-drive { position: relative; flex: 1; border-radius: 16px; border: 2px solid #2a3442; background: #121a26; overflow: hidden; touch-action: none; display: grid; grid-template-rows: 1fr 1fr; }
  .mc-drive-half { display: grid; place-items: center; font: 700 13px ui-monospace, monospace; letter-spacing: 0.06em; color: #8b98a8; }
  .mc-drive-half.fwd { border-bottom: 1px dashed #2a3442; }
  .mc-drive.fwd .mc-drive-half.fwd { background: rgba(47,211,196,0.22); color: #2fd3c4; }
  .mc-drive.rev .mc-drive-half.rev { background: rgba(255,179,71,0.2); color: #ffb347; }
  .mc-drive-steer { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; padding: 0 10px; font: 11px ui-monospace, monospace; color: #5b6675; pointer-events: none; }
  .mc-drive-dot { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,0.18); border: 2px solid rgba(255,255,255,0.6); pointer-events: none; }
  .mc-pad.right { display: flex; gap: 10px; align-items: center; }
  .mc-pad button { display: grid; place-items: center; align-content: center; width: 72px; height: 72px; border-radius: 50%; border: 2px solid #0b0d10; background: rgba(232,236,242,0.18); color: #fff; font-size: 24px; line-height: 1; touch-action: none; }
  .mc-pad button small { font: 600 9.5px ui-monospace, monospace; letter-spacing: 0.05em; margin-top: 3px; text-transform: uppercase; }
  .mc-pad button.fire { background: rgba(255,79,163,0.6); width: 96px; height: 96px; font-size: 30px; }
  .mc-pad button.boost { background: rgba(255,179,71,0.5); width: 64px; height: 64px; font-size: 20px; }
  .mc-pad button:active { filter: brightness(1.4); transform: scale(0.96); }
  .mc-hud .mc-bars label { font-size: 10px; } .mc-bar { width: 56px; }
  .mc-boost-hud { top: auto; bottom: 8px; left: 10px; }
  .game-wrap.is-full .mc-controls { width: 100vw; border: 0; }
}
/* full screen with the phone held sideways: thumbs are at the edges, so the pads float over the
   bottom corners of the view instead of taking height from it */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .game-wrap.is-full { position: relative; }
  .game-wrap.is-full .mc-controls { position: absolute; left: 0; right: 0; bottom: 52px; height: 124px; width: auto; background: none; border: 0; pointer-events: none; justify-content: space-between; }
  .game-wrap.is-full .mc-drive { flex: 0 0 min(40%, 300px); pointer-events: auto; background: rgba(18,26,38,0.5); border-color: rgba(255,255,255,0.22); }
  .game-wrap.is-full .mc-pad.right { pointer-events: auto; }
}
}

/* Colony */
.colony { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 0.75rem; width: min(100%, 980px); align-items: start; }
.col-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 13px; }
.col-top .spacer { flex: 1; }
.col-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; padding: 6px; background: #3a1712; border: 2px solid #0b0d10; border-radius: 10px; }
.col-tile { aspect-ratio: 1; border: 1.5px solid rgba(11,13,16,0.6); border-radius: 6px; background: #c1552f; font-size: clamp(14px, 2.6vw, 24px); display: grid; place-items: center; padding: 0; cursor: pointer; position: relative; }
.col-tile.plain { background: radial-gradient(circle at 30% 30%, #d06a40, #b44c2a); }
.col-tile.ice { background: radial-gradient(circle at 35% 30%, #e8fbff, #8fd3e8); }
.col-tile.ore { background: radial-gradient(circle at 35% 30%, #9a6a5a, #5a3a30); }
.col-tile.ore::after { content: ""; position: absolute; width: 22%; height: 22%; border-radius: 50%; background: #ffd23f; top: 22%; left: 55%; box-shadow: -10px 12px 0 -2px #ffd23f; opacity: 0.8; }
.col-tile.crater { background: radial-gradient(circle at 50% 55%, #4a1d16 45%, #8a3a22 50%, #b44c2a 75%); cursor: not-allowed; }
.col-tile.ok { outline: 2.5px solid #2fd3c4; outline-offset: -2px; box-shadow: 0 0 10px #2fd3c4 inset; }
.col-tile.dark span { filter: grayscale(1) brightness(0.55); }
.col-tile.dark::before { content: "⚡"; position: absolute; top: 1px; right: 3px; font-size: 10px; }
.col-tile span { position: relative; z-index: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5)); }
.col-legend { font-size: 11px; margin-top: 0.3rem; }
.col-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.col-legend .lg.ice { background: #8fd3e8; } .col-legend .lg.ore { background: #5a3a30; } .col-legend .lg.crater { background: #4a1d16; }
.col-res { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.col-res th { text-align: left; font-weight: normal; color: var(--muted); font-size: 11px; }
.col-res td { padding: 2px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.col-res td:nth-child(3) { font-family: ui-monospace, monospace; }
.col-res td.up { color: #34c759; } .col-res td.down { color: #ff6b6b; }
.col-res td.note { color: #ffb347; font-size: 11px; }
.col-build { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-top: 0.6rem; }
.col-b { display: grid; grid-template-columns: 26px 1fr auto; grid-template-rows: auto auto; column-gap: 4px; text-align: left; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev); color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.col-b .ic { grid-row: span 2; font-size: 18px; align-self: center; }
.col-b .cost { font-size: 11px; color: var(--muted); }
.col-b .fx { grid-column: 2 / span 2; font-size: 10.5px; color: var(--muted); }
.col-b.on { border-color: #2fd3c4; box-shadow: 0 0 0 1px #2fd3c4 inset; }
.col-b:disabled { opacity: 0.4; cursor: not-allowed; }
.col-sel { font-size: 12px; margin: 0.5rem 0; min-height: 2.4em; }
.col-end { width: 100%; }
.col-log { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 180px; overflow: auto; font-size: 12px; }
.col-log li { padding: 2px 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 760px) { .colony { grid-template-columns: 1fr; } }
.col-advisor { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem; border: 1px solid #2fd3c4; border-radius: 10px; background: color-mix(in srgb, #2fd3c4 10%, var(--bg-elev)); font-size: 13px; }
.col-advisor .col-face { font-size: 26px; line-height: 1; }
.col-advisor p { margin: 0.15rem 0 0; }
.col-advisor > div { flex: 1; }
.col-howto { font-size: 12.5px; line-height: 1.45; padding: 0.4rem 0.7rem; margin-bottom: 0.5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-elev); }
.col-howto p { margin: 0.35rem 0; }
.col-stage { position: relative; }
.col-stage canvas { display: block; width: 100%; height: auto; border: 2px solid #0b0d10; border-radius: 10px; cursor: pointer; background: #3a1712; touch-action: manipulation; }
.col-tip { position: absolute; z-index: 3; max-width: 220px; padding: 0.35rem 0.55rem; font-size: 12px; background: #0b0d10ee; border: 1px solid var(--line); border-radius: 8px; pointer-events: none; }
.col-tip .bad { color: #ff6b6b; }
.col-res .prev { margin-left: 4px; padding: 0 3px; border-radius: 3px; background: rgba(47,211,196,0.15); font-weight: 600; }
.col-res .prev.up { color: #34c759; } .col-res .prev.down { color: #ff6b6b; }

/* Lists (Keep style) */
.keep-new { display: grid; gap: 0.4rem; max-width: 640px; margin: 0 auto 1rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.keep-new input#kn-name { font: inherit; font-size: 15px; padding: 0.45rem 0.6rem; border: 0; background: transparent; color: inherit; outline: none; }
.keep-new-opts { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: 13px; color: var(--muted); }
.keep-new-opts .btn { margin-left: auto; }
.keep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.7rem; }
.keep-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); color: inherit; text-decoration: none; min-height: 120px; transition: border-color 0.15s, transform 0.15s; }
.keep-card:hover { border-color: #8b5cf6; transform: translateY(-1px); }
.keep-card-head { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 15px; }
.keep-card-sub { font-size: 11px; margin-top: -0.25rem; }
.keep-card ul { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--text, #e8ecf2); flex: 1; }
.keep-card li { padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keep-card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; }
.keep-owner { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 12px; }
.keep-owner svg { display: block; }
.keep-list { max-width: 640px; margin: 0 auto; }
.kl-head { margin-bottom: 0.6rem; }
.kl-head h1 { margin: 0 0 0.25rem; }
.kl-name { width: 100%; font: inherit; font-size: 1.6rem; font-weight: 700; background: transparent; border: 0; border-bottom: 1px dashed transparent; color: inherit; padding: 0.1rem 0; }
.kl-name:hover, .kl-name:focus { border-bottom-color: var(--line); outline: none; }
.kl-meta { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; font-size: 12.5px; color: var(--muted); }
.kl-add { display: flex; gap: 0.5rem; align-items: center; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-elev); margin-bottom: 0.35rem; }
.kl-add span { color: var(--muted); font-size: 18px; }
.kl-add input { flex: 1; font: inherit; font-size: 14.5px; border: 0; background: transparent; color: inherit; outline: none; }
.kl-items { list-style: none; margin: 0; padding: 0; }
.kl-item { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.4rem 0.4rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 14.5px; }
.kl-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: #8b5cf6; }
.kl-dot { width: 18px; text-align: center; color: var(--muted); }
.kl-body { flex: 1; min-width: 0; cursor: text; border-radius: 6px; }
.kl-body:hover { background: color-mix(in srgb, var(--line) 30%, transparent); }
.kl-title { overflow-wrap: anywhere; }
.kl-title a, .kl-link a { color: var(--accent); }
.kl-link, .kl-note { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.kl-item.done .kl-title { text-decoration: line-through; color: var(--muted); }
.kl-del { appearance: none; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; padding: 0 0.2rem; }
.kl-item:hover .kl-del, .kl-del:focus { opacity: 1; }
@media (hover: none) { .kl-del { opacity: 0.6; } }
.kl-done-toggle { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 0.6rem 0.2rem 0.3rem; cursor: pointer; }
.kl-items.completed { opacity: 0.85; }
.kl-edit { flex: 1; display: grid; gap: 0.3rem; }
.kl-edit input { font: inherit; font-size: 14px; padding: 0.3rem 0.45rem; }
.kl-msg { min-height: 1.2em; font-size: 12.5px; }

/* Admin: people and access */
.am-wrap { overflow-x: auto; }
.am-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.am-table th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); padding: 0.3rem; white-space: nowrap; }
.am-table td { padding: 0.35rem 0.3rem; border-top: 1px solid var(--line); vertical-align: top; }
.am-who { display: flex; gap: 0.45rem; align-items: flex-start; min-width: 200px; }
.am-who div { display: flex; flex-direction: column; }
.am-who span { font-size: 11px; }
.am-table select { font: inherit; font-size: 12px; padding: 0.15rem; }
.am-actions { white-space: nowrap; }
.am-actions details { margin-top: 0.3rem; white-space: normal; }
.am-actions textarea { width: 100%; min-width: 200px; font: 11px ui-monospace, monospace; }

/* Full screen games */
.bf-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  /* left thumb moves, right thumb drops and rotates */
  .bf-touch { display: flex; justify-content: space-between; gap: 10px; width: 100%; max-width: 460px; margin: 10px auto 0; user-select: none; -webkit-user-select: none; }
  .bf-l, .bf-r { display: flex; gap: 10px; }
  .bf-touch button { width: 68px; height: 64px; border-radius: 14px; border: 2px solid #0b0d10; background: var(--bg-elev); color: inherit; font-size: 24px; touch-action: none; }
  .bf-touch button.rot { width: 80px; background: rgba(47,211,196,0.25); }
  .bf-touch button:active { filter: brightness(1.4); }
}
body.game-full-open { overflow: hidden; }
.is-full { position: fixed !important; inset: 0; z-index: 2000; margin: 0 !important; width: 100vw !important; max-width: none !important; height: 100dvh; overflow: auto;
  background: #05070a; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.game-wrap.is-full { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.game-wrap.is-full .scores { display: none; }
.game-wrap.is-full .row-actions { margin: 0; }
.game-wrap.is-full > canvas.game-canvas { width: auto !important; height: auto; max-width: 100vw; max-height: calc(100dvh - 60px); }
.game-wrap.is-full > canvas.game-canvas.tall { max-height: calc(100dvh - 130px); }
.game-wrap.is-full .mc-stage { width: 100vw; border: 0; }
.colony.is-full { display: grid; padding: 0.6rem; gap: 0.6rem; }

/* Colony 3D */
.c3 { width: min(100%, 1100px); margin: 0 auto; }
.c3-stage { position: relative; width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #2a1420; user-select: none; -webkit-user-select: none; touch-action: none; }
.c3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c3-r { display: inline-flex; align-items: baseline; gap: 3px; padding: 2px 7px; border-radius: 999px; background: rgba(20,10,18,0.62); border: 1px solid rgba(255,255,255,0.12); color: #f2e8e4; font: 12px ui-monospace, monospace; pointer-events: auto; }
.c3-r b { font-size: 13px; }
.c3-r .d { font-size: 10.5px; opacity: 0.85; }
.c3-r .d.up { color: #7ee06a; } .c3-r .d.down { color: #ff8a8a; }
.c3-r .pv { font-size: 10.5px; padding: 0 3px; border-radius: 3px; background: rgba(47,211,196,0.25); }
.c3-r .pv.up { color: #9cf7a0; } .c3-r .pv.down { color: #ffb0b0; }
.c3-r.warn { border-color: #ffb347; } .c3-r.bad { border-color: #ff4b5c; background: rgba(90,10,20,0.7); animation: c3-pulse 1s infinite; }
@keyframes c3-pulse { 50% { box-shadow: 0 0 10px #ff4b5c; } }
.c3-clock { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 8px; background: rgba(20,10,18,0.62); color: #f2e8e4; font: 12px ui-monospace, monospace; }
.c3-solbar { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.15); overflow: hidden; }
.c3-solbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, #b18fd0); }
.c3-speed, .c3-tools { display: flex; gap: 3px; }
.c3-speed button, .c3-tools button { min-width: 30px; height: 28px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.18); background: rgba(20,10,18,0.62); color: #f2e8e4; font: 12px ui-monospace, monospace; cursor: pointer; }
.c3-speed button.on { background: #2fd3c4; color: #0b0d10; border-color: #2fd3c4; }
.c3-face { font-size: 22px; line-height: 1; }
.c3-b { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto auto; column-gap: 4px; min-width: 96px; padding: 4px 7px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.18); background: rgba(30,14,22,0.82); color: #f2e8e4; font: inherit; font-size: 11.5px; text-align: left; cursor: pointer; }
.c3-b .ic { grid-row: span 2; font-size: 20px; align-self: center; }
.c3-b .nm { font-weight: 600; white-space: nowrap; }
.c3-b .cost { font-size: 10.5px; opacity: 0.75; }
.c3-b .fx { grid-column: 1 / span 2; font-size: 10px; opacity: 0.75; white-space: nowrap; }
.c3-b.on { border-color: #2fd3c4; box-shadow: 0 0 0 1px #2fd3c4 inset, 0 0 12px #2fd3c455; }
.c3-b[data-poor] { opacity: 0.45; }
.c3-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 92%); max-height: 82%; overflow: auto; padding: 0.8rem 1rem; border-radius: 12px; background: rgba(14,10,16,0.95); border: 1px solid var(--line); color: #f2e8e4; font-size: 13px; z-index: 5; }
.c3-panel h3 { margin: 0 0 0.3rem; }
.c3-panel p { margin: 0.35rem 0; line-height: 1.45; }
.c3-slot { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.c3-slot > div:first-child { display: flex; flex-direction: column; }
.c3-slot.cur b { color: #2fd3c4; }
.c3-panel-foot { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.6rem; }
.c3-actions { justify-content: flex-end; }
.c3.is-full .c3-stage { border: 0; border-radius: 0; }

/* Stardust ticker on the home view */
.sys-stardust { position: absolute; right: 0.75rem; top: 8.4rem; z-index: 3; width: 236px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); font-size: 12px; }
.sys-stardust button { appearance: none; border: 0; background: none; color: inherit; font: inherit; width: 100%; text-align: left; cursor: pointer; }
.sd-head { display: flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.6rem; }
.sd-head b { font-size: 14px; color: #ffd23f; }
.sd-star { color: #ffd23f; text-shadow: 0 0 6px #ffd23f88; }
.sd-chev { margin-left: auto; color: var(--muted); }
.sd-body { border-top: 1px solid var(--line); padding: 0.25rem 0.4rem 0.4rem; }
.sd-row { display: grid !important; grid-template-columns: 1fr auto auto; gap: 0.5rem; padding: 0.2rem 0.2rem !important; border-radius: 4px; }
.sd-row:hover { background: color-mix(in srgb, var(--line) 40%, transparent); }
.sd-n { color: #ffd23f; min-width: 3.6em; text-align: right; }
.sd-crew { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px dashed var(--line); }
.sd-p { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.sd-p.me { color: #ffd23f; }
.sd-p svg { display: block; }
@media (max-width: 800px) { .sys-stardust { top: 0.5rem; right: 0.5rem; width: 200px; } }
.c3-prompt kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 2px; border-radius: 4px; background: #0b0d10; color: #ffd23f; font: 700 12px ui-monospace, monospace; text-align: center; }
@keyframes c3pulse { 50% { transform: translateX(-50%) scale(1.04); } }
.c3-fuel i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff6a1f, #ffd23f); transition: width 0.1s linear; }
.c3-fuel.low i { background: #ff4b5c; }

/* ---------- profile name tags + cards ---------- */
[data-person] { cursor: pointer; }
.ptag { position: fixed; z-index: 9000; animation: ptagIn 0.14s ease-out; }
@keyframes ptagIn { from { opacity: 0; transform: translateY(4px) scale(0.96); } }
.ptag-btn { display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.7rem; min-height: 40px; border-radius: 999px; border: 1px solid #2fd3c4; background: #0e141c; color: #e8eef6; font: 600 14px system-ui, sans-serif; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.45); }
.ptag-btn .flag-svg { display: block; }
.ptag-go { color: #2fd3c4; font-weight: 500; font-size: 12.5px; }
.pmodal { position: fixed; inset: 0; z-index: 9100; background: rgba(4,6,10,0.72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 12px; animation: ptagIn 0.16s ease-out; }
.pcard2 { position: relative; width: min(420px, 100%); max-height: calc(100dvh - 24px); overflow: auto; border-radius: 18px; border: 1px solid #243041; background: linear-gradient(180deg, #121a2a, #0b0f17 55%); color: #e8eef6; padding: 0 1rem 1.1rem; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.pclose { position: absolute; top: 8px; right: 8px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: #e8eef6; font-size: 16px; cursor: pointer; }
.pc-loading { padding: 3rem 1rem; text-align: center; color: #8b98a8; }
.pc-stage { position: relative; height: 230px; margin: 0 -1rem; background: radial-gradient(circle at 50% 35%, #2a2350, #0f1426 60%, transparent 80%); display: grid; place-items: center; overflow: hidden; border-radius: 18px 18px 0 0; }
.pc-stage::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 20%, #fff9, transparent), radial-gradient(1.5px 1.5px at 85% 60%, #fffa, transparent), radial-gradient(1px 1px at 35% 75%, #fff7, transparent), radial-gradient(1px 1px at 55% 45%, #fff6, transparent); pointer-events: none; }
.pc-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: pan-y; cursor: grab; }
.pc-head h2 { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0 0.1rem; font-size: 1.35rem; }
.pc-head p { margin: 0.15rem 0; }
.pc-role { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: #ffd23f; color: #0b0d10; }
.pc-private { font-size: 13px; color: #ffd9a0; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 12.5px; color: #8b98a8; }
.pc-online { color: #34d399; }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.8rem 0; }
.pc-stats div { padding: 0.55rem 0.3rem; border-radius: 10px; background: rgba(255,255,255,0.04); text-align: center; }
.pc-stats b { display: block; font-size: 16px; color: #ffd23f; }
.pc-stats span { font-size: 11px; color: #8b98a8; }
.pcard2 h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: #8b98a8; margin: 0.9rem 0 0.4rem; }
.pc-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.4rem; }
.pc-badge { display: grid; grid-template-columns: auto 1fr; column-gap: 0.4rem; align-items: center; padding: 0.4rem 0.5rem; border-radius: 10px; background: rgba(47,211,196,0.08); border: 1px solid rgba(47,211,196,0.2); }
.pc-badge span { grid-row: span 2; font-size: 20px; }
.pc-badge b { font-size: 12px; line-height: 1.2; }
.pc-badge small { font-size: 10.5px; color: #8b98a8; line-height: 1.2; }
.pc-games { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.pc-game { display: flex; justify-content: space-between; gap: 0.4rem; padding: 0.5rem 0.6rem; border-radius: 9px; background: rgba(255,255,255,0.04); color: #e8eef6; text-decoration: none; font-size: 13px; }
.pc-game b { color: #ffd23f; }
.pchip .flag-svg { margin-left: 2px; }
.keep-owner[data-person], .sd-p[data-person] { cursor: pointer; }

/* ---------- flags ---------- */
.flag-svg { display: inline-block; vertical-align: middle; flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4)); }
.flag-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.flag-opt { height: 40px; border-radius: 8px; border: 2px solid transparent; background: rgba(255,255,255,0.05); display: grid; place-items: center; cursor: pointer; padding: 0; }
.flag-opt.on { border-color: #2fd3c4; background: rgba(47,211,196,0.12); }
.flag-none { font-size: 11px; color: #8b98a8; }

/* ---------- home news strip ---------- */
.sys-news { position: absolute; left: 50%; top: 0.75rem; transform: translateX(-50%); z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: min(560px, calc(100% - 520px)); pointer-events: none; }
.sys-news > * { pointer-events: auto; }
.news-chip { display: flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.5rem 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--line, #243041); background: color-mix(in srgb, var(--bg, #07090f) 88%, transparent); color: var(--text, #e8eef6); font-size: 12.5px; text-decoration: none; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.news-req { border-color: #ffd23f; }
.news-req b { color: #ffd23f; }
.news-req span { color: #2fd3c4; }
.news-rival .nr-text { min-width: 0; line-height: 1.3; }
.news-rival .nr-text b { color: #ffd23f; }
.nr-face { display: inline-flex; vertical-align: middle; }
.nr-face.sm { margin: 0 2px; }
.nr-trophy { font-size: 16px; }
.nr-x { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: inherit; cursor: pointer; font-size: 11px; }
.news-rival-min { padding: 0.35rem 0.55rem; font-size: 15px; }
@media (max-width: 1100px) { .sys-news { max-width: calc(100% - 300px); } }
@media (max-width: 800px) {
  /* phones: full width, just under the stardust ticker, one line each */
  .sys-news { left: 0.5rem; right: 0.5rem; transform: none; top: 3.2rem; max-width: none; align-items: stretch; }
  .news-chip { font-size: 12px; border-radius: 14px; }
  .news-rival .nr-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
  .news-rival-min { align-self: flex-start; }
  .home-system .sys-hud { display: none; }
}

/* ---------- admin requests ---------- */
.admin-requests.has { border-color: #ffd23f; }
.req-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 6px; border-radius: 11px; background: #ffd23f; color: #0b0d10; font-size: 12px; vertical-align: middle; }
.req-list { display: flex; flex-direction: column; gap: 6px; }
.req { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.04); }
.req-who { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.req-denied { margin-top: 10px; }

/* ---------- Colony layout: top bar, notes stack on the left, controls + build bar at the bottom.
   Nothing floats over anything else; every note can be closed and ? brings them back. ---------- */
.c3-hud { position: absolute; top: 6px; left: 6px; right: 300px; display: flex; flex-wrap: wrap; gap: 4px; z-index: 3; pointer-events: none; }
.c3-key { cursor: pointer; font-size: 12px; padding: 2px 8px; }
.c3-top { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; z-index: 3; }
.c3-round { padding: 0 5px; margin-right: 4px; border-radius: 4px; background: #ffd23f; color: #0b0d10; font-weight: 700; font-size: 10.5px; }
.c3-help { position: relative; }
.c3-help[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #ff4b5c; color: #fff; font: 700 10px/16px system-ui; }
.c3-notes { position: absolute; left: 6px; top: 64px; width: min(370px, calc(100% - 12px)); max-height: calc(100% - 64px - 150px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; z-index: 3; scrollbar-width: none; pointer-events: none; }
.c3-note { pointer-events: auto; position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 7px 34px 7px 10px; border-radius: 12px; background: rgba(12,26,30,0.86); border: 1px solid #2fd3c4; color: #e8f8f6; font-size: 12.5px; line-height: 1.35; animation: c3noteIn 0.2s ease-out; }
@keyframes c3noteIn { from { opacity: 0; transform: translateX(-8px); } }
.c3-note.alert { background: rgba(48,12,20,0.88); border-color: #ffb347; color: #ffe2b8; }
.c3-note.event { background: rgba(30,18,10,0.88); border-color: #ffd23f; color: #fff3e4; }
.c3-note.help { background: rgba(16,18,36,0.9); border-color: #8b7bff; }
.c3-note .muted { color: #c9b8b0; }
.c3-face { font-size: 20px; line-height: 1; flex: none; }
.c3-show { flex-shrink: 0; align-self: center; padding: 4px 9px; border-radius: 7px; border: 1px solid #2fd3c4; background: #2fd3c4; color: #0b0d10; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.c3-show.ghost { background: transparent; color: #2fd3c4; }
.c3-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: inherit; font-size: 11px; cursor: pointer; }
.c3-lg { padding: 0 4px; border-radius: 4px; font: 11px ui-monospace, monospace; background: rgba(0,0,0,0.3); }
.c3-lg.up { color: #7ee06a; } .c3-lg.down { color: #ff8a8a; }
.c3-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; flex-direction: column; pointer-events: none; }
.c3-ctl { display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 0 10px 6px; }
.c3-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.c3-tip { max-width: 100%; padding: 5px 12px; border-radius: 9px; background: rgba(11,13,16,0.88); color: #fff; font-size: 12.5px; text-align: center; pointer-events: none; }
.c3-prompt { padding: 7px 14px; border-radius: 10px; background: rgba(255,210,63,0.94); color: #0b0d10; font: 600 13px system-ui, sans-serif; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.35); pointer-events: none; animation: c3pulse 1.4s ease-in-out infinite; }
.c3-fuel { position: static; transform: none; width: 120px; height: 6px; border-radius: 4px; background: rgba(11,13,16,0.6); border: 1px solid rgba(255,255,255,0.25); overflow: hidden; pointer-events: none; }
.c3-tip[hidden], .c3-prompt[hidden], .c3-fuel[hidden] { display: none; }
.c3-build { position: static; display: flex; gap: 4px; padding: 6px; overflow-x: auto; background: linear-gradient(transparent, rgba(20,8,14,0.8) 35%); scrollbar-width: thin; pointer-events: auto; }
.c3-joy, .c3-touch-btns { display: none; }
@media (hover: none) and (pointer: coarse) {
  .c3-joy { display: block; position: relative; flex: none; width: 112px; height: 112px; border-radius: 50%; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.3); pointer-events: auto; touch-action: none; }
  .c3-joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(47,211,196,0.8); border: 2px solid #0b0d10; }
  .c3-touch-btns { display: flex; flex: none; flex-direction: column; gap: 10px; pointer-events: auto; }
  .c3-touch-btns button { width: 58px; height: 58px; border-radius: 50%; border: 2px solid #0b0d10; background: rgba(255,179,71,0.6); color: #fff; font-size: 22px; touch-action: none; }
  .c3-touch-btns button[data-k="hop"] { width: 66px; height: 66px; background: rgba(47,211,196,0.55); }
  .c3-b { min-width: 84px; padding: 5px 7px; }
}
/* narrow screens: row 1 = clock + speed, row 2 = resources (scroll sideways) + tools, then notes */
@media (max-width: 700px) {
  .c3-top { left: 6px; right: 6px; flex-direction: row; align-items: center; justify-content: space-between; }
  .c3-top .c3-speed button, .c3-top .c3-tools button { min-width: 30px; height: 30px; padding: 0 4px; }
  .c3-speed { gap: 2px; }
  .c3-clock { white-space: nowrap; font-size: 11.5px; padding: 3px 6px; gap: 4px; }
  .c3-clock .c3-dp { display: none; }
  .c3-solbar { width: 28px; }
  .c3-tools { position: absolute; top: 38px; right: 0; }
  .c3-hud { top: 44px; right: 150px; flex-wrap: nowrap; overflow-x: auto; pointer-events: auto; scrollbar-width: none; padding: 2px 0; }
  .c3-hud::-webkit-scrollbar { display: none; }
  .c3-hud .c3-r { flex: none; }
  .c3-notes { top: 84px; right: 6px; width: auto; max-height: calc(100% - 84px - 210px); }
  .c3-note { font-size: 12px; }
}

/* ---------- Brain planet (learning games for little ones) ---------- */
.brain { --bc: #ffd23f; position: relative; max-width: 760px; margin: 0 auto; padding: 0.5rem 0.5rem 2rem; background: #0c0a1a; border-radius: 18px; min-height: 100%; font-family: ui-rounded, "Nunito", "Comic Sans MS", system-ui, sans-serif; color: #f6f3ff; }
.br-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.br-back { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,0.08); color: inherit; text-decoration: none; font-size: 18px; }
.br-title { flex: 1; display: flex; align-items: center; gap: 0.4rem; font-size: 1.35rem; font-weight: 800; }
.br-title span { font-size: 1.6rem; }
.br-who, .br-voice { min-height: 44px; padding: 0 0.8rem; border-radius: 14px; border: 2px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.br-voice { width: 44px; padding: 0; font-size: 20px; }
.br-stars { padding: 0.35rem 0.7rem; border-radius: 14px; background: rgba(255,210,63,0.15); color: #ffd23f; font-weight: 800; font-size: 1.05rem; }
.br-levels { display: flex; gap: 6px; overflow-x: auto; padding: 0.6rem 0 0.3rem; scrollbar-width: none; }
.br-levels::-webkit-scrollbar { display: none; }
.br-lv { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color: #c9c3dd; font: inherit; font-size: 13px; cursor: pointer; }
.br-lv b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.1); }
.br-lv.done b { background: #34d399; color: #0b0d10; }
.br-lv.on { border-color: var(--bc); color: #fff; }
.br-lv.on b { background: var(--bc); color: #0b0d10; }
.br-stage { margin-top: 0.6rem; min-height: 420px; padding: 1rem; border-radius: 26px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--bc) 22%, #1a1636), #120f24 70%); border: 3px solid color-mix(in srgb, var(--bc) 55%, transparent); text-align: center; }
.br-stage.br-in { animation: brIn 0.35s ease-out; }
@keyframes brIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.br-q { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin: 0.3rem 0 0.8rem; font-size: 1.5rem; font-weight: 800; line-height: 1.25; }
.br-q.big { font-size: 2.6rem; letter-spacing: 0.02em; }
.br-big { font-size: 2.6rem; font-weight: 900; color: var(--bc); }
.br-say { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.12); font-size: 20px; cursor: pointer; }
.br-hint { color: #c9c3dd; font-size: 1rem; margin: 0.4rem 0; }
.br-objs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0.5rem auto 1rem; max-width: 520px; }
.br-obj { position: relative; font-size: 46px; line-height: 1; cursor: pointer; transition: transform 0.15s; user-select: none; }
.br-obj.counted { transform: scale(1.18); filter: drop-shadow(0 0 8px #ffd23f); }
.br-obj.counted::after { content: attr(data-c); position: absolute; top: -8px; right: -10px; min-width: 22px; height: 22px; border-radius: 11px; background: #ffd23f; color: #0b0d10; font-size: 14px; font-weight: 900; line-height: 22px; }
.br-obj.gone { opacity: 0.25; transform: translateY(-10px) rotate(-12deg); }
.br-objs.small span, .br-objs.small .br-obj { font-size: 30px; }
.br-sum { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.br-op { font-size: 2.2rem; font-weight: 900; color: var(--bc); }
.br-answers { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 0.6rem; }
.br-ans { min-width: 96px; min-height: 96px; padding: 10px 16px; border-radius: 24px; border: 4px solid rgba(255,255,255,0.15); background: #241f45; color: #fff; font: inherit; font-size: 2.2rem; font-weight: 900; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform 0.12s; touch-action: manipulation; }
.br-ans:active { transform: scale(0.95); }
.br-ans small { font-size: 0.95rem; font-weight: 700; color: #d9d3f0; }
.br-ans.right { border-color: #34d399; background: #14452f; animation: brPop 0.4s; }
.br-ans.wrong { border-color: #ff6b6b; animation: brShake 0.4s; }
.br-ans.wide { min-height: 64px; font-size: 1.2rem; padding: 0 1.4rem; background: var(--bc); color: #0b0d10; border-color: transparent; }
.br-ans.wide.ghost { background: rgba(255,255,255,0.1); color: #fff; }
.br-ans[data-n]::before { content: attr(data-n); position: absolute; margin: -70px 0 0 -70px; width: 28px; height: 28px; border-radius: 50%; background: #34d399; color: #0b0d10; font-size: 16px; line-height: 28px; }
.br-ans { position: relative; }
@keyframes brPop { 50% { transform: scale(1.12); } }
@keyframes brShake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.br-answers.sides .br-ans { flex: 1; max-width: 340px; min-height: 150px; }
.br-answers.pics .br-ans { min-width: 130px; min-height: 130px; }
.br-answers.pics.two .br-ans, .br-answers.pics.three .br-ans { flex: 1; max-width: 220px; }
.br-pic { font-size: 56px; line-height: 1.1; }
.br-pic.huge { font-size: 96px; }
.br-letter { font-size: 3rem; font-weight: 900; font-family: "Andika", "Comic Sans MS", ui-rounded, sans-serif; }
.br-letter.big { font-size: 4rem; color: var(--bc); }
.br-word { font-size: 2rem; font-weight: 900; text-transform: none; }
.br-word.sm { font-size: 1.15rem; }
.br-word.huge { font-size: 4rem; letter-spacing: 0.08em; color: var(--bc); }
.br-answers.words .br-ans { min-width: 140px; }
.br-slots { display: flex; justify-content: center; gap: 10px; margin: 0.4rem 0 1rem; }
.br-slot { width: 64px; height: 72px; border-radius: 16px; border: 3px dashed rgba(255,255,255,0.35); font-size: 2.6rem; font-weight: 900; display: grid; place-items: center; }
.br-slot.on { border-style: solid; border-color: #34d399; background: rgba(52,211,153,0.15); }
.br-tiles { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.br-tile { width: 72px; height: 72px; border-radius: 18px; border: 0; background: var(--bc); color: #0b0d10; font: inherit; font-size: 2.4rem; font-weight: 900; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,0.3); }
.br-tile:disabled { opacity: 0.2; box-shadow: none; }
.br-tile.wrong { animation: brShake 0.4s; background: #ff6b6b; }
.br-story { max-width: 520px; margin: 0 auto; }
.br-story h2 { margin: 0.2rem 0; font-size: 1.7rem; }
.br-story p { font-size: 1.15rem; line-height: 1.45; }
.br-when { color: var(--bc); font-weight: 800; }
.br-line { display: flex; justify-content: center; gap: 18px; margin-top: 1rem; font-size: 40px; }
.br-line span { display: flex; flex-direction: column; align-items: center; }
.br-line small { font-size: 12px; color: #c9c3dd; max-width: 110px; }
.soro-wrap { display: flex; flex-direction: column; align-items: center; }
.soro { width: min(100%, var(--sw, 260px)); max-height: 360px; touch-action: manipulation; }
.soro-frame { fill: #5a3a22; stroke: #2e1c0f; stroke-width: 4; }
.soro-beam { fill: #2e1c0f; }
.soro-rod { stroke: #e0c9a0; stroke-width: 5; }
.soro-dot { fill: #ffd9a0; }
.soro-bead path { fill: #a8743f; stroke: #3a2412; stroke-width: 2.5; transition: fill 0.15s; }
.soro-bead.on path { fill: #ffb347; }
.soro-bead { cursor: pointer; transition: transform 0.18s ease-out; }
.soro-places { display: flex; justify-content: space-around; color: #c9c3dd; font-weight: 700; max-width: 100%; }
.soro-num { min-height: 3rem; }
.br-burst { position: absolute; left: 50%; top: 45%; pointer-events: none; z-index: 5; }
.br-burst span { position: absolute; font-size: 28px; opacity: 0; }
.br-burst.go span { animation: brBurst 0.9s ease-out forwards; }
@keyframes brBurst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(0.5); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1.2); } }
.br-levelup { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; background: rgba(10,8,25,0.75); border-radius: 26px; animation: brIn 0.3s; pointer-events: none; }
.br-levelup div { font-size: 80px; animation: brRise 2.4s ease-in forwards; }
.br-levelup b { font-size: 2.4rem; color: #ffd23f; }
.br-levelup span { font-size: 1.2rem; }
@keyframes brRise { 60% { transform: translateY(0); } 100% { transform: translateY(-200px); } }
.br-hello { font-size: 1.4rem; font-weight: 800; margin: 1rem 0 0.6rem; }
.br-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.br-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 1.2rem 0.6rem; border-radius: 26px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--bc) 35%, #1a1636), #161230 75%); border: 3px solid color-mix(in srgb, var(--bc) 60%, transparent); color: #fff; text-decoration: none; font-size: 1.15rem; }
.br-card-ic { font-size: 56px; }
.br-card-lv { font-size: 0.85rem; color: #d9d3f0; }
.br-note { margin-top: 1.2rem; color: #9b94b8; font-size: 0.9rem; font-family: system-ui, sans-serif; }
.br-modal { position: fixed; inset: 0; z-index: 9200; display: grid; place-items: center; background: rgba(4,6,10,0.7); padding: 12px; }
.br-modal-card { width: min(380px, 100%); padding: 1rem; border-radius: 20px; background: #1a1636; border: 2px solid #3a3268; display: flex; flex-direction: column; gap: 0.7rem; }
.br-modal-card h3 { margin: 0; }
.br-names { display: flex; flex-wrap: wrap; gap: 8px; }
.br-name { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 10px; border-radius: 16px; border: 2px solid rgba(255,255,255,0.15); background: #241f45; color: #fff; font: inherit; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.br-name.on { border-color: #ffd23f; }
.br-name small { color: #ffd23f; font-size: 0.8rem; }
.br-add { display: flex; gap: 6px; }
.br-add input { flex: 1; min-height: 44px; }
@media (max-width: 560px) {
  .br-stage { padding: 0.7rem 0.4rem; min-height: 380px; border-radius: 20px; }
  .br-q { font-size: 1.25rem; }
  .br-q.big { font-size: 2.1rem; }
  .br-ans { min-width: 84px; min-height: 84px; font-size: 1.9rem; }
  .br-answers.pics .br-ans { min-width: 100px; min-height: 110px; }
  .br-pic { font-size: 46px; } .br-pic.huge { font-size: 80px; }
  .br-obj { font-size: 38px; }
  .br-title { font-size: 1.1rem; }
}

/* ---------- Game Crucible ---------- */
.forge { max-width: 1200px; margin: 0 auto; }
.forge-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.forge-head h1 { margin: 0; font-size: 1.4rem; }
.forge-left { padding: 3px 10px; border-radius: 999px; background: rgba(255,179,71,0.14); color: #ffc98a; font-size: 13px; }
.forge-left b { color: #ffd23f; }
.forge-kit { margin-left: auto; position: relative; }
.forge-kit summary { cursor: pointer; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; list-style: none; }
.forge-kit > div { position: absolute; right: 0; top: 110%; z-index: 20; width: min(320px, 86vw); padding: 0.7rem; border-radius: 12px; background: #0e141c; border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.forge-kit p { margin: 0 0 4px; width: 100%; }
.forge-slots { display: flex; gap: 8px; margin: 0.6rem 0; }
.forge-slot { flex: 1; max-width: 280px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.forge-slot span { font-size: 11px; color: var(--muted, #8b98a8); }
.forge-slot b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.forge-slot i { font-style: normal; font-size: 11px; color: #34d399; }
.forge-slot.on { border-color: #ff7a3d; box-shadow: 0 0 0 1px #ff7a3d inset; }
.forge-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.1fr); gap: 12px; }
.forge-left-col { display: flex; flex-direction: column; min-width: 0; }
.forge-scene { position: relative; height: 230px; border-radius: 14px; overflow: hidden; border: 1px solid #3a1d1a; background: #0b0608; }
.forge-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.forge-noscene { display: grid; place-items: center; height: 100%; font-size: 48px; }
.forge-chat { flex: 1; min-height: 180px; max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 2px; }
.forge-msg { display: flex; gap: 8px; align-items: flex-start; max-width: 92%; }
.forge-msg p { margin: 0; padding: 8px 11px; border-radius: 12px; line-height: 1.4; font-size: 14px; white-space: pre-wrap; }
.forge-msg.you { align-self: flex-end; }
.forge-msg.you p { background: #1d3a52; }
.forge-msg.smith p { background: #2a1714; border: 1px solid #5a2a1f; }
.forge-msg.smith.err p { border-color: #ff4b5c; }
.forge-msg.live p { border-color: #ffb347; animation: forgeGlow 1.2s ease-in-out infinite; }
@keyframes forgeGlow { 50% { box-shadow: 0 0 12px #ff7a3d55; } }
.forge-ava { font-size: 22px; line-height: 1; }
.forge-meter { font: 11px ui-monospace, monospace; color: #ffb347; align-self: center; }
.forge-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.forge-idea { padding: 5px 10px; border-radius: 999px; border: 1px solid #5a2a1f; background: rgba(255,122,61,0.08); color: #ffd9c2; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.forge-input { display: flex; gap: 8px; align-items: stretch; }
.forge-input textarea { flex: 1; min-height: 52px; resize: vertical; font: inherit; font-size: 15px; }
.forge-input .btn { white-space: nowrap; }
.forge-right-col { min-width: 0; }
.forge-play-wrap { display: flex; flex-direction: column; gap: 6px; }
.forge-play { position: relative; height: 520px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #05070a; }
.forge-play.big { height: min(72vh, 640px); }
.forge-frame { display: block; width: 100%; height: 100%; border: 0; }
.forge-empty { display: grid; place-items: center; height: 100%; color: #6b7686; font-size: 14px; padding: 1rem; text-align: center; }
.forge-crash { padding: 6px 10px; border-radius: 10px; background: rgba(255,75,92,0.12); border: 1px solid #ff4b5c; font-size: 13px; }
.forge-crash code { font-size: 12px; }
.forge-acts { margin-top: 0; }
.forge-play-wrap.is-full .forge-play, .forge-game.is-full .forge-play { height: calc(100dvh - 60px); border-radius: 0; border: 0; }
.forge-maker { color: #2fd3c4; cursor: pointer; }
#fp-board li.me { color: #ffd23f; }
@media (max-width: 860px) {
  .forge-grid { grid-template-columns: 1fr; }
  .forge-scene { height: 170px; }
  .forge-chat { max-height: 300px; min-height: 120px; }
  .forge-play { height: 62vh; }
}
.game-wrap.forge-game { width: 100%; max-width: 1000px; display: block; }
.forge-game .forge-play.big { width: 100%; }
/* Colony building cards */
.c3-note.card { border-color: #ffd23f; background: rgba(28,22,8,0.92); }
.c3-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.c3-card-row { font-size: 12px; }
.c3-card-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.c3-dark { color: #ffb347; font-size: 11.5px; }
.c3-show[disabled] { opacity: 0.45; cursor: default; }
/* Drive photos on trip stops */
.tphotos { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: thin; }
.tphoto { position: relative; flex: none; }
.tphoto a { display: block; width: 96px; height: 72px; border-radius: 8px; overflow: hidden; background: #141b24; border: 1px solid var(--line); }
.tphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tphoto-name { display: none; }
.tphoto a.nothumb img { display: none; }
.tphoto a.nothumb .tphoto-name { display: grid; place-items: center; height: 100%; padding: 4px; font-size: 11px; text-align: center; color: #c9d1dc; }
.tphoto a.nothumb::before { content: "🖼️"; position: absolute; top: 6px; left: 6px; font-size: 14px; }
.tphoto-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; cursor: pointer; }
.tphoto-add { flex: none; width: 96px; height: 72px; border-radius: 8px; border: 1px dashed #2fd3c4; background: rgba(47,211,196,0.06); color: #2fd3c4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 12px; cursor: pointer; }
.tphoto-add:disabled { opacity: 0.6; }
/* photo notice + camera button */
.photo-notice { width: min(440px, 100%); background: #0f141b; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; color: #e6ebf2; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.photo-notice h3 { margin: 0 0 10px; font-size: 17px; }
.photo-notice ul { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.4; }
.photo-notice .pn-small { font-size: 12px; color: #9aa6b5; margin: 0 0 14px; }
.photo-notice .pn-row { display: flex; gap: 8px; justify-content: flex-end; }
.photo-notice button { font: inherit; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: #c9d1dc; cursor: pointer; }
.photo-notice .pn-yes { background: #2fd3c4; border-color: #2fd3c4; color: #071014; font-weight: 600; }
.tphoto-add.cam { border-style: solid; background: rgba(47,211,196,0.12); }
.tphoto-add.cam.ready { background: #2fd3c4; color: #071014; animation: camPulse 1.2s ease-in-out infinite; }
@keyframes camPulse { 50% { transform: scale(1.05); } }
.c3-diff { display: block; width: 100%; text-align: left; margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: inherit; font: inherit; cursor: pointer; }
.c3-diff b { display: block; font-size: 15px; margin-bottom: 2px; }
.c3-diff span { font-size: 12px; color: #9aa6b5; }
.c3-diff.rec { border-color: #2fd3c4; }
.c3-diff:hover { background: rgba(47,211,196,0.08); }
/* Sophie, the host */
.sophie-say { position: absolute; z-index: 6; transform: translate(-50%, -100%); width: min(280px, 70vw); background: #fffdf6; color: #14171c; border: 2.5px solid #0b0d10; border-radius: 14px; padding: 9px 12px 10px; box-shadow: 4px 4px 0 #0b0d10; font-size: 14px; line-height: 1.35; animation: ptagIn 0.2s ease-out; }
.sophie-say::after { content: ""; position: absolute; left: 50%; bottom: -11px; width: 16px; height: 16px; background: #fffdf6; border-right: 2.5px solid #0b0d10; border-bottom: 2.5px solid #0b0d10; transform: translateX(-50%) rotate(45deg); }
.sophie-say b { color: #b8860b; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.sophie-say p { margin: 2px 0 0; }
.sophie-say .btn { margin-top: 8px; width: 100%; }
.sophie-say .btn.primary { background: #2fd3c4; color: #071014; border: 2px solid #0b0d10; font-weight: 700; }
@media (max-width: 700px) { .sophie-say { font-size: 13px; width: min(240px, 66vw); } }
/* star system switcher */
.sys-switch { position: absolute; left: 12px; bottom: 14px; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px; background: rgba(10,13,18,0.82); border: 1px solid var(--line); backdrop-filter: blur(4px); font-size: 13px; }
.sys-switch .sw-name { font-weight: 600; color: #e6ebf2; white-space: nowrap; }
.sys-switch .sw-note { color: #9aa6b5; font-size: 11px; }
.sys-switch .btn.tiny { white-space: nowrap; }
@media (max-width: 700px) {
  .sys-switch { bottom: 74px; left: 8px; right: 8px; justify-content: space-between; }
  .sys-switch .sw-note { display: none; }
}
/* Sophie in the Brain games */
.br-sophie { display: flex; align-items: center; gap: 10px; margin: 0.5rem 0 0.6rem; }
.br-sophie-av { flex: none; width: 46px; height: 62px; display: grid; place-items: center; }
.br-sophie-av svg { width: 46px; height: 62px; }
.br-sophie.talking .br-sophie-av { animation: sophieBob 0.36s ease-in-out infinite alternate; }
@keyframes sophieBob { to { transform: translateY(-3px) rotate(-2deg); } }
.br-said-wrap { position: relative; flex: 1; min-height: 44px; background: #fffdf6; color: #14171c; border: 2.5px solid #0b0d10; border-radius: 14px; padding: 6px 12px 8px; box-shadow: 3px 3px 0 #0b0d10; }
.br-said-wrap::before { content: ""; position: absolute; left: -9px; top: 18px; width: 14px; height: 14px; background: #fffdf6; border-left: 2.5px solid #0b0d10; border-bottom: 2.5px solid #0b0d10; transform: rotate(45deg); }
.br-said-wrap b { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #b8860b; }
.br-said-wrap p { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.br-sophie.pop .br-said-wrap { animation: ptagIn 0.18s ease-out; }
.agent-mic { display: inline-grid; place-items: center; }
.agent-mic svg { display: block; }
/* Robot Code */
.code-wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.code-grid { --cell: min(64px, 15vw); position: relative; display: grid; grid-template-columns: repeat(var(--n), var(--cell)); gap: 4px; padding: 6px; border-radius: 14px; background: #1a2230; border: 2.5px solid #0b0d10; }
.code-cell { width: var(--cell); height: var(--cell); border-radius: 10px; background: #26344a; display: grid; place-items: center; font-size: calc(var(--cell) * 0.55); }
.code-cell.rock { background: #3a3028; }
.code-bot { position: absolute; left: 6px; top: 6px; width: var(--cell); height: var(--cell); display: grid; place-items: center; font-size: calc(var(--cell) * 0.62); transform: translate(calc(var(--x) * (var(--cell) + 4px)), calc(var(--y) * (var(--cell) + 4px))); transition: transform 0.28s ease-in-out; pointer-events: none; }
.code-bot.bump { animation: codeBump 0.35s ease-in-out 2; }
@keyframes codeBump { 50% { margin-left: 6px; } }
.code-side { display: flex; flex-direction: column; gap: 10px; min-width: 240px; flex: 1; max-width: 360px; }
.code-plan-head { display: flex; justify-content: space-between; align-items: baseline; }
.code-limit { font-size: 13px; color: #9aa6b5; }
.code-plan { display: flex; flex-wrap: wrap; gap: 6px; min-height: 64px; padding: 8px; border-radius: 12px; border: 2px dashed #3a4656; }
.code-empty { color: #9aa6b5; font-size: 14px; align-self: center; }
.code-block { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; height: 52px; padding: 2px 6px; border-radius: 10px; border: 2.5px solid #0b0d10; background: #ffd23f; font-size: 22px; cursor: pointer; box-shadow: 2px 2px 0 #0b0d10; }
.code-block small { font-size: 10px; font-weight: 700; color: #14171c; }
.code-block.until { background: #7cc65c; }
.code-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.code-key { height: 58px; border-radius: 12px; border: 2.5px solid #0b0d10; background: #fffdf6; font-size: 26px; cursor: pointer; box-shadow: 3px 3px 0 #0b0d10; }
.code-key:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #0b0d10; }
.code-key.until { grid-column: 1 / -1; font-size: 16px; font-weight: 800; }
.code-key.until.on { background: #7cc65c; }
.code-go { display: flex; gap: 8px; }
/* Calendar planet */
.cal { max-width: 1100px; margin: 0 auto; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head h1 { margin: 0; font-size: 1.5rem; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav b { min-width: 150px; text-align: center; font-size: 1.05rem; }
.cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; font-size: 11px; color: #9aa6b5; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { position: relative; min-height: 78px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 5px 5px 6px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.cal-cell:hover { background: rgba(255,255,255,0.05); }
.cal-cell.out { opacity: 0.4; }
.cal-cell.today .cal-n { background: #e8774a; color: #0b0d10; }
.cal-cell.sel { border-color: #2fd3c4; box-shadow: inset 0 0 0 1px #2fd3c4; }
.cal-n { align-self: flex-start; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.cal-bar { display: flex; gap: 4px; align-items: center; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 22%, transparent); border-left: 3px solid var(--c); font-size: 11px; line-height: 1.5; white-space: nowrap; overflow: hidden; }
.cal-bar span { overflow: hidden; text-overflow: ellipsis; }
.cal-bar b { margin-left: auto; color: var(--c); }
.cal-more { font-size: 10px; color: #9aa6b5; }
.cal-side { display: flex; flex-direction: column; gap: 12px; }
.cal-side h3 { margin: 0 0 8px; font-size: 1rem; }
.cal-tag { font-size: 10px; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; background: #e8774a; color: #0b0d10; vertical-align: middle; }
.cal-trip { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: rgba(255,255,255,0.02); }
.cal-trip-head { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; color: inherit; text-decoration: none; font-size: 13px; }
.cal-trip-head span { margin-left: auto; color: #2fd3c4; font-size: 12px; }
.cal-trip ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.cal-stop { width: 100%; display: flex; gap: 8px; align-items: baseline; padding: 5px 6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.cal-stop:hover { background: rgba(47,211,196,0.08); }
.cal-time { flex: none; min-width: 58px; font-size: 11px; color: #9aa6b5; font-variant-numeric: tabular-nums; }
.cal-soon h4 { margin: 0 0 6px; font-size: 12px; color: #9aa6b5; text-transform: uppercase; letter-spacing: 0.05em; }
.cal-soon-row { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; grid-template-areas: "dot name when" "dot dates when"; column-gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; margin-bottom: 4px; }
.cal-soon-row .cal-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cal-soon-row b { grid-area: name; font-size: 13px; }
.cal-soon-row span:not(.cal-dot) { grid-area: dates; font-size: 12px; color: #9aa6b5; }
.cal-soon-row em { grid-area: when; font-style: normal; font-size: 12px; color: #2fd3c4; }
@media (max-width: 760px) {
  .cal-body { grid-template-columns: 1fr; }
  .cal-cell { min-height: 48px; padding: 3px; }
  .cal-bar { padding: 0; border-left-width: 0; height: 6px; border-radius: 3px; background: var(--c); }
  .cal-bar span, .cal-bar b { display: none; }
  .cal-nav b { min-width: 110px; }
}
/* Colony menu */
.c3-tools .c3-menu-btn { min-width: auto; padding: 0 9px; font-weight: 700; background: rgba(232,119,74,0.85); border-color: #e8774a; color: #0b0d10; }
.c3-paused { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-left: 6px; }
.c3-menu-now { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; margin: 6px 0 10px; border-radius: 9px; background: rgba(255,255,255,0.05); }
.c3-menu-now span { font-size: 12px; color: #c9b8b0; }
.c3-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.c3-menu-item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: inherit; font: inherit; font-size: 18px; cursor: pointer; }
.c3-menu-item b { font-size: 14px; }
.c3-menu-item span { grid-column: 2; font-size: 11.5px; color: #b9a8a0; }
.c3-menu-item:hover { background: rgba(232,119,74,0.12); border-color: #e8774a; }
.c3-menu-item.primary { border-color: #2fd3c4; background: rgba(47,211,196,0.1); }
.c3-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid rgba(255,255,255,0.08); cursor: pointer; }
.c3-set b { display: block; font-size: 13.5px; }
.c3-set small { color: #b9a8a0; }
.c3-set input { width: 20px; height: 20px; accent-color: #2fd3c4; }
.c3-top10 { margin: 6px 0; padding-left: 22px; }
.c3-top10 li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,0.08); }
@media (max-width: 560px) { .c3-menu-grid { grid-template-columns: 1fr; } }
/* Cetus Live Voice: per-turn stage timing receipt */
.ag-timing { margin-top: 6px; font: 11px ui-monospace, monospace; color: #8b96a5; opacity: 0.85; }
/* TV mode (the Pi's browser, /?tv=1): readable across the room, D-pad focus you can see */
body.tv-mode { font-size: 20px; }
body.tv-mode :focus-visible, body.tv-mode .sys-tree-row:focus {
  outline: 4px solid #ffcc33 !important; outline-offset: 3px; border-radius: 6px;
}
body.tv-mode .sys-tree-row { padding-top: 6px; padding-bottom: 6px; }
body.tv-mode .sys-tree-label .name { font-size: 1.1em; }
.tv-login .auth-panel { text-align: center; }
.tv-login .tv-steps { text-align: left; display: inline-block; margin: 0.5rem auto 0; line-height: 1.7; }
.tv-code { font: 700 4.5rem/1.1 ui-monospace, monospace; letter-spacing: 0.15em; margin: 0.6rem 0 0.4rem; color: #ffcc33; }
.tv-login .auth-panel { max-width: 680px; width: min(680px, 92vw); }
.tv-code { white-space: nowrap; }
/* TV (Raspberry Pi): blur behind panels is expensive on its graphics chip */
body.tv-mode * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

/* trip photo gallery */
.gal-open { margin-left: 8px; }
.gallery-modal { padding: 3vh 3vw; place-items: stretch; background: rgba(4,6,10,0.55); }
.gallery { background: rgba(11,16,22,0.82); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: 94vh; width: min(1100px, 100%); margin: 0 auto; overflow: hidden; }
.gal-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.gal-head .gal-close { margin-left: auto; }
.gal-close, .gal-all { background: none; border: 1px solid var(--line); color: inherit; border-radius: 6px; padding: 4px 9px; cursor: pointer; font: inherit; font-size: 13px; }
.gal-body { overflow-y: auto; padding: 4px 12px 16px; }
.gal-stop { margin: 12px 0 6px; font-size: 13px; color: #c9d1dc; font-weight: 600; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.gal-th { aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #141b24; cursor: pointer; }
.gal-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-th.nothumb::after { content: "🖼️"; display: grid; place-items: center; height: 100%; }
.gal-th.nothumb img { display: none; }
.gal-view { position: fixed; inset: 0; background: #000; display: grid; place-items: center; }
.gal-view img { max-width: 100vw; max-height: calc(100vh - 48px); object-fit: contain; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 34px; cursor: pointer; }
.gal-nav.prev { left: 6px; } .gal-nav.next { right: 6px; }
.gal-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; padding: 8px 12px; background: rgba(0,0,0,.6); font-size: 13px; }
.gal-acts { display: flex; gap: 8px; align-items: center; }
.gal-acts a { color: var(--accent); }
.gal-th { position: relative; }
.gal-th.hl { outline: 3px solid var(--accent); outline-offset: -3px; }
.gal-th-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 5px; font-size: 10px; text-align: left; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-person { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.add-person input { flex: 1 1 200px; }
.ap-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.ap-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.trip-owner { font-size: 13px; color: #c9d1dc; margin-right: 8px; }
.trip-share { background: #0e141b; border: 1px solid var(--line); border-radius: 12px; padding: 14px; width: min(460px, 94vw); max-height: 86vh; display: flex; flex-direction: column; gap: 8px; }
.trip-share h3 { margin: 0; }
.ts-search { width: 100%; }
.ts-list { overflow-y: auto; display: grid; gap: 2px; min-height: 60px; }
.ts-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.ts-row:hover { background: rgba(255,255,255,.04); }
.ts-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-row.fixed { opacity: .7; cursor: default; }

/* find a place / set the spot on the map */
.place-search { display: grid; gap: 6px; margin-bottom: 8px; }
.ps-row { display: flex; gap: 6px; }
.ps-row input { flex: 1; min-width: 0; }
.ps-results { display: grid; gap: 3px; max-height: 260px; overflow-y: auto; }
.ps-hit { text-align: left; background: #111821; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.ps-hit:hover { border-color: var(--accent); }
.trip-mapcol { position: relative; }
.map-crosshair { position: absolute; inset: 0; pointer-events: none; z-index: 800; }
.mc-plus { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 2px solid #ffcc33; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.mc-plus::before, .mc-plus::after { content: ""; position: absolute; background: #ffcc33; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.mc-plus::before { left: 50%; top: -14px; bottom: -14px; width: 2px; margin-left: -1px; }
.mc-plus::after { top: 50%; left: -14px; right: -14px; height: 2px; margin-top: -1px; }
.mc-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; background: rgba(8,12,18,.9); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; pointer-events: auto; font-size: 13px; max-width: 94%; }

/* drag and drop on the itinerary */
.tdrag { margin-left: auto; padding: 2px 6px; cursor: grab; color: #8a96a6; font-size: 16px; line-height: 1; touch-action: none; user-select: none; }
.tdrag-day { margin-left: 0; margin-right: 2px; }
.tdrag:hover { color: #fff; }
.trow.dragging, .tgroup.dragging { opacity: .4; }
.tdrag-ghost { position: fixed; z-index: 9500; pointer-events: none; background: #1c2633; border: 1px solid var(--accent); border-radius: 8px; padding: 4px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.drop-into > .tgroup-head { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tday-empty { font-size: 13px; padding: 6px 10px; margin: 0; }
.tday-add { margin: 6px 0 2px; }

/* chat: conversations list beside the messages */
.chat-with-threads { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: minmax(0, 1fr); gap: 0; }
.chat-with-threads .chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-threads { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.chat-new { margin-bottom: 4px; }
.chat-th { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px; color: inherit; font: inherit; cursor: pointer; }
.chat-th:hover { background: rgba(255,255,255,.04); }
.chat-th.on { background: rgba(255,255,255,.07); border-color: var(--line); }
.chat-th-faces { display: flex; min-width: 26px; font-size: 18px; }
.chat-th-faces svg + svg { margin-left: -10px; }
.chat-th-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13px; }
.chat-th-text .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.chat-unread { background: var(--accent); color: #061018; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.chat-list-btn { display: none; }
@media (max-width: 720px) {
  .chat-with-threads { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .chat-threads { display: none; border-right: 0; border-bottom: 1px solid var(--line); max-height: 50vh; }
  .chat-with-threads.list-open .chat-threads { display: flex; }
  .chat-list-btn { display: inline-block; }
}
.ps-hit-row { display: flex; gap: 4px; align-items: stretch; }
.ps-hit-row .ps-hit { flex: 1; min-width: 0; }
.ps-g { display: grid; place-items: center; padding: 0 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); white-space: nowrap; }

/* the stop form */
.if-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.if-head h2 { margin: 0; }
.if-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #111821; color: inherit; font-size: 16px; cursor: pointer; flex: none; }
.if-x.small { width: 26px; height: 26px; font-size: 12px; }
.if-x:hover { border-color: var(--accent); }
.if-sec { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; display: grid; gap: 6px; }
.if-sec h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8a96a6; }
.ps-panel { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #0c1218; }
.ps-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }
.if-ll { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; align-items: end; }
.if-ll .field { margin: 0; }
.if-ll input { width: 100%; }
.if-cursor { font-size: 20px; line-height: 1; padding: 6px 10px; }
.if-cursor.on { background: #ffcc33; color: #000; border-color: #ffcc33; }
.if-hint, .if-msg { font-size: 12px; margin: 0; }
.if-gmaps { font-size: 13px; color: var(--accent); justify-self: start; }
.mc-read { position: absolute; left: 50%; top: calc(50% + 30px); transform: translateX(-50%); background: rgba(8,12,18,.9); border: 1px solid #ffcc33; color: #ffcc33; border-radius: 6px; padding: 2px 8px; font: 12px var(--mono); white-space: nowrap; }
.tcontact { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; margin: 4px 0; }
@media (max-width: 520px) { .if-ll { grid-template-columns: 1fr 1fr; } }

/* numbered search pins */
.hit-pin { width: 22px; height: 22px; border-radius: 50%; background: #1b2633; color: #fff; border: 2px solid var(--accent); display: grid; place-items: center; font: 700 11px/1 system-ui, sans-serif; box-shadow: 0 1px 4px #0008; }
.hit-pin.on { width: 30px; height: 30px; background: var(--accent); color: #0b1016; border-color: #fff; font-size: 14px; box-shadow: 0 0 0 4px #ffffff40, 0 2px 8px #000a; }
.hit-num { display: grid; place-items: center; min-width: 22px; font-weight: 700; font-size: 12px; color: var(--accent); }
.ps-pin { display: grid; place-items: center; min-width: 40px; padding: 0 6px; font-size: 18px; background: #111821; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ps-hit-row.lit .ps-hit, .ps-hit-row.lit .ps-pin { border-color: var(--accent); background: #16222e; }

/* ================= Trips, Google Maps style =================
   Big round controls, Lucide icons, chips over the map, panels that slide in with a clear ✕,
   and the action whose panel is open stays lit. Dark Home Base colors. */
.lu { flex: none; display: inline-block; vertical-align: middle; }
.trip2 { font-size: 14.5px; grid-template-columns: minmax(320px, 408px) 1fr; transition: grid-template-columns .22s ease; }
.trip2.side-off { grid-template-columns: 0 1fr; }
.trip2.side-off .trip-side { visibility: hidden; }
.trip2 .trip-side { background: var(--bg-elev); padding: 0 0 1.2rem; }

/* header: title, meta, round actions, icon rows */
.trip2 .gm-head { padding: 18px 20px 4px; border-bottom: 1px solid var(--line); }
.trip2 .gm-head h1 { font-size: 22px; font-weight: 500; margin: 0; line-height: 1.25; white-space: normal; }
.trip2 .gm-meta { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.gm-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px 2px; padding: 16px 0 14px; margin: 0 -6px; }
.gm-act { appearance: none; background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px; padding: 2px 0; border-radius: 12px; }
.gm-act-ic { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); transition: background .15s, color .15s, transform .1s; }
.gm-act:hover .gm-act-ic { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.gm-act:active .gm-act-ic { transform: scale(.94); }
.gm-act-lb { font-size: 12.5px; font-weight: 500; line-height: 1.2; text-align: center; }
.gm-act.on .gm-act-ic { background: var(--accent); color: #05070a; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.gm-act.on .gm-act-lb { font-weight: 700; }
.gm-badge { position: absolute; top: -3px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--text); color: #05070a; font: 700 11px/18px system-ui, sans-serif; font-style: normal; }
.gm-rows { display: flex; flex-direction: column; margin: 0 -20px; border-top: 1px solid var(--line); padding: 4px 0; }
.gm-row { display: flex; align-items: center; gap: 18px; padding: 10px 20px; color: var(--text); font-size: 14px; text-decoration: none; }
.gm-row > .lu:first-child { color: var(--accent); }
a.gm-row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; }
.gm-row-end { margin-left: auto; color: var(--muted); }

/* panels: rounded card, header with icon + title + round ✕, slides in and out */
.trip2 .trip-side .gm-panel { margin: 12px; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg-soft); box-shadow: 0 6px 24px rgba(0,0,0,.35); font-size: 14px; animation: gmIn .22s ease both; }
.gm-panel.gm-out { animation: gmOut .17s ease both; pointer-events: none; }
@keyframes gmIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes gmOut { to { opacity: 0; transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .gm-panel, .gm-panel.gm-out { animation: none; } }
.trip2 .if-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.trip2 .if-head h2, .trip2 .trip-side .item-form h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 500; }
.gm-ph-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #05070a; }
.gm-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.gm-x:hover { background: color-mix(in srgb, var(--text) 16%, transparent); }
.gm-x.small { width: 32px; height: 32px; }
.trip2 .if-sec { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; gap: 10px; }
.trip2 .if-sec h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; text-transform: none;
  letter-spacing: 0; color: var(--text); }
.trip2 .if-sec h3 .lu { color: var(--accent); }

/* bigger, rounder controls everywhere on the trip page */
.trip2 .trip-side .trip-settings { grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 0; font-size: 14px; }
.trip2 .trip-side .field { gap: 5px; margin: 0; }
.trip2 .trip-side .field label, .trip2 .trip-side .trip-settings label, .trip2 .trip-side .item-form label {
  font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.trip2 .trip-side input:not([type=checkbox]), .trip2 .trip-side textarea, .trip2 .trip-side select {
  min-height: 44px; padding: 10px 14px; font-size: 15px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); }
.trip2 .trip-side textarea { min-height: 80px; }
.trip2 .trip-side input:focus, .trip2 .trip-side textarea:focus, .trip2 .trip-side select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.trip2 .trip-side .ps-row input[type=search], .trip2 .trip-side .ps-row input[type=url] { border-radius: 24px; padding-left: 18px; }
.trip2 .trip-side .btn, .trip2 .trip-side .row-actions .btn {
  min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.trip2 .trip-side .btn.primary { background: var(--accent); color: #05070a; border-color: var(--accent); }
.trip2 .trip-side .btn.primary:hover { filter: brightness(1.1); color: #05070a; }
.trip2 .trip-side .row-actions { gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.trip2 .if-cursor { width: 44px; padding: 0 !important; }
.trip2 .if-cursor[aria-pressed=true] { background: var(--accent); color: #05070a; border-color: var(--accent); }
.trip2 .if-gmaps { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.trip2 .ps-panel { border-radius: 16px; padding: 8px; }
.trip2 .ps-hit { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.trip2 .ps-pin, .trip2 .ps-g { border-radius: 12px; min-width: 44px; color: var(--accent); }
.trip2 .tacts button, .trip2 .tacts a { border-radius: 999px; padding: 6px 12px; font-size: 13px; }

/* itinerary list: roomier rows, round badges */
.trip2 .tgroup-head { height: 48px; padding: 0 16px; font-family: inherit; font-size: 15px; font-weight: 600;
  text-transform: none; letter-spacing: 0; background: transparent; }
.trip2 .tdot { width: 12px; height: 12px; }
.trip2 .tcount { font-size: 13px; }
.trip2 .chev { width: 18px; font-size: 0; }
.trip2 .trow-head { height: 48px; padding: 0 12px 0 8px; gap: 10px; }
.trip2 .tchev { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.trip2 .tnum { min-width: 28px; height: 28px; border-radius: 50%; font-size: 12.5px; font-family: inherit; }
.trip2 .ttitle { font-size: 14.5px; font-weight: 500; }
.trip2 .twhen { font-size: 12.5px; }
.trip2 .trow-body { padding: 4px 16px 14px 62px; font-size: 14px; gap: 8px; }
.trip2 .tmeta { font-size: 13px; }
.trip2 .tlinks { font-size: 13.5px; }
.trip2 .trow.sel > .trow-head { box-shadow: inset 4px 0 0 var(--accent); }
.trip2 .tdrag { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; padding: 0; }
.trip2 .tdrag:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }

/* chips floating over the map */
.trip2 .gm-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.trip2 .trip-mapcol .map-filter { top: 12px; left: 36px; right: 70px; }
.trip2 .gm-chip, .trip2 .trip-mapcol .map-filter button.gm-chip, .trip2 .map-view-toggles label.gm-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; min-height: 0; padding: 0 14px; border-radius: 18px;
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent); color: var(--text); border: 1px solid var(--line);
  font: 500 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: background .15s, border-color .15s; }
.trip2 .gm-chip:hover { background: var(--bg-soft); }
.trip2 .gm-chip.active, .trip2 .map-view-toggles label.gm-chip:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-elev)); border-color: var(--accent); color: var(--accent); }
.gm-dot { width: 10px; height: 10px; border-radius: 50%; }
.trip2 .map-view-toggles { left: 36px; bottom: 24px; margin: 0; gap: 8px; }
.trip2 .map-view-toggles input { position: absolute; opacity: 0; pointer-events: none; }

/* the tab that hides / shows the list */
.gm-collapse { position: absolute; z-index: 1001; left: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 52px;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--bg-elev); color: var(--text);
  display: grid; place-items: center; cursor: pointer; box-shadow: 2px 0 6px rgba(0,0,0,.3); }
.gm-collapse:hover { background: var(--bg-soft); }

/* map controls: round */
.trip2 .leaflet-bar { border: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.trip2 .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; font-size: 20px; background: var(--bg-elev); color: var(--text); border-color: var(--line); }
.trip2 .leaflet-bar a:hover { background: var(--bg-soft); }
.trip2 .leaflet-right.leaflet-bottom { margin-bottom: 20px; }
.trip2 .trip-map .leaflet-control-layers { border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.trip2 .trip-map .leaflet-control-layers-toggle { width: 44px; height: 44px; border-radius: 14px; }
.trip2 .trip-map .leaflet-control-layers-expanded { padding: 10px 14px; font-size: 14px; }

@media (max-width: 800px) {
  .trip2 { grid-template-columns: 1fr; }
  .gm-collapse { display: none; }
  .trip2 .trip-mapcol .map-filter { left: 10px; right: 60px; overflow-x: auto; flex-wrap: nowrap; }
  .trip2 .map-view-toggles { left: 10px; }
  .gm-act { width: 64px; }
}

/* ================= Whole site, Google style =================
   The Trips look everywhere: pill buttons with icons, rounded inputs with a focus ring, rounded
   cards and dialogs, round ✕ buttons, chips. Games keep their own look. */
:root { --radius: 14px; }
.btn { border-radius: 999px; min-height: 40px; padding: 0 18px; font-size: 14.5px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #05070a; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent); color: #05070a; filter: brightness(1.1); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 8%, transparent); border-color: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: var(--danger); }
.btn.tiny { min-height: 34px; padding: 0 14px; font-size: 13.5px; gap: 6px; }
.btn.tiny:has(> .lu:only-child) { width: 36px; min-height: 36px; padding: 0; }
.btn.block { display: flex; }
a.btn:hover { text-decoration: none; }

.field label { font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.field input, .field textarea, .field select, .pmodal input[type=search], .pmodal input[type=text], .pmodal textarea {
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 15px; }
:where(#main) :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), textarea, select) { border-radius: 12px; }
:where(#main) input[type=search], .pmodal input[type=search] { border-radius: 24px; padding-left: 18px; }
.field input:focus, .field textarea:focus, .field select:focus,
:where(#main) :where(input, textarea, select):focus, .pmodal input:focus, .pmodal textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }

.panel, .auth-panel { border-radius: 18px; }
.panel { box-shadow: 0 4px 18px rgba(0,0,0,.28); }
.auth-panel { box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.tree a, .tree .crumb-only { border-radius: 12px; }
.lightbox img { border-radius: 12px; }

/* top bar and the page bar */
.topbar .btn, .topbar button.btn { min-height: 32px; padding: 0 14px; font-size: 13px; }
.sys-page-bar { padding: 6px 10px; }
.sys-page-bar .btn { min-height: 36px; padding: 0 14px 0 10px; font-size: 14px; }

/* small trip/list action buttons become pills */
.tbtn { border-radius: 999px; padding: 4px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* dialogs: rounded card, icon + title + round ✕ */
.pmodal .trip-share, .pmodal .pcard2 { border-radius: 20px; box-shadow: 0 16px 50px rgba(0,0,0,.55); animation: gmIn .2s ease both; }
.trip-share .if-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.trip-share .if-head h3 { flex: 1; margin: 0; font-size: 18px; font-weight: 500; }
.trip-share .pn-row button { border-radius: 999px; min-height: 40px; padding: 0 18px; font-size: 14.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.pclose { display: grid; place-items: center; }
.gal-close.gm-x { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 0; }
.gal-head b { display: inline-flex; align-items: center; gap: 8px; }
.gal-acts a { display: inline-flex; align-items: center; gap: 6px; }

/* map chips anywhere */
.map-filter button { border-radius: 18px; height: 36px; min-height: 0; padding: 0 14px; font-family: inherit; font-size: 14px; font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.map-filter button.active { background: color-mix(in srgb, var(--accent) 22%, var(--bg-elev)); }

/* chat */
.chat-head { font-size: 15px; padding: 10px 14px; gap: 10px; }
.chat-form { gap: 8px; padding: 10px 14px calc(10px + var(--safe-b, 0px)); }
.chat-form textarea { border-radius: 22px !important; padding: 10px 16px; font-size: 15px; min-height: 44px; }

/* calendar month arrows */
.cal-nav { display: flex; align-items: center; gap: 8px; }

/* Trips side panel: nothing squishes, and nothing scrolls sideways.
   Badges, icons and buttons keep fixed sizes; rows that run out of room wrap onto the next line;
   only text and text boxes give way, and text boxes stop at a minimum and move to their own row. */
.trip2 { grid-template-columns: minmax(360px, 440px) 1fr; }
.trip2 .trip-side { overflow-x: hidden; min-width: 0; }
.trip2 .lu, .trip2 .tnum, .trip2 .tchev, .trip2 .chev, .trip2 .tdrag, .trip2 .tdot, .trip2 .gm-act, .trip2 .gm-act-ic,
.trip2 .gm-ph-ic, .trip2 .gm-x, .trip2 .gm-dot, .trip2 .hit-num, .trip2 .ps-pin, .trip2 .ps-g, .trip2 .trip-side .btn { flex: none; }
.trip2 .tnum { width: 28px; min-width: 28px; height: 28px; padding: 0; font-size: 12px; letter-spacing: -0.02em; }
.trip2 .ttitle, .trip2 .tglabel { flex: 1 1 auto; min-width: 0; }
.trip2 .twhen { flex: 0 1 auto; min-width: 0; }
.trip2 .gm-actions { justify-content: flex-start; gap: 10px 4px; margin: 0 -6px; }
.trip2 .gm-act { width: 66px; }
/* text boxes: shrink to a minimum, then wrap to their own row */
.trip2 .trip-side input:not([type=checkbox]), .trip2 .trip-side textarea, .trip2 .trip-side select { width: 100%; min-width: 0; }
.trip2 .trip-side .trip-settings { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.trip2 .trip-side .trip-settings .field { min-width: 0; }
.trip2 .trip-side .ps-row { flex-wrap: wrap; }
.trip2 .trip-side .ps-row input { flex: 1 1 200px; }
.trip2 .if-ll { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.trip2 .if-ll .btn { width: 100%; }
.trip2 .if-cursor { width: 100%; padding: 0 14px !important; }
.trip2 .ps-hit-row { flex-wrap: nowrap; }
.trip2 .ps-hit { flex: 1 1 auto; min-width: 0; }
.trip2 .ps-hit b, .trip2 .ps-hit span, .trip2 .tlinks a, .trip2 .trow-body { overflow-wrap: anywhere; }
.trip2 .trip-side .row-actions { flex-wrap: wrap; }
@media (max-width: 800px) { .trip2 { grid-template-columns: 1fr; } }

/* ================= Install app sheet ================= */
.sys-panel-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.sys-install { width: 100%; }
.in-sheet-wrap { align-items: end; }
@media (min-width: 640px) { .in-sheet-wrap { align-items: center; } }
.in-sheet { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 16px); overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 10px 20px calc(20px + var(--safe-b));
  box-shadow: 0 -10px 40px rgba(0,0,0,.5); animation: inUp .26s cubic-bezier(.2,.8,.2,1) both; font-size: 15px; }
@media (min-width: 640px) { .in-sheet { border-radius: 24px; padding-bottom: 20px; } }
.in-sheet-wrap.closing .in-sheet { animation: inDown .18s ease both; }
@keyframes inUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes inDown { to { transform: translateY(40px); opacity: 0; } }
.in-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
@media (min-width: 640px) { .in-grab { display: none; } }
.in-sheet .if-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.in-sheet .if-head h3 { flex: 1; margin: 0; font-size: 20px; font-weight: 500; }
.in-logo { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.in-intro { margin: 6px 0 14px; color: var(--text); line-height: 1.45; }
.in-perks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.in-perks li { display: flex; align-items: center; gap: 14px; }
.in-perks .lu { color: var(--accent); flex: none; }
.in-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.in-step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-soft); }
.in-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #05070a; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.in-text { flex: 1 1 auto; min-width: 0; line-height: 1.5; }
.in-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.in-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); font-weight: 600; white-space: nowrap; vertical-align: middle; }
.in-chip .lu { flex: none; }
.in-sheet .btn.block { width: 100%; min-height: 48px; font-size: 16px; margin-top: 8px; }
.in-done { text-align: center; padding: 10px 0 0; }
.in-done > .lu { color: var(--accent); }
.in-done h3 { margin: 8px 0 4px; font-size: 20px; font-weight: 500; }
.in-arrow { position: fixed; left: 50%; bottom: calc(6px + var(--safe-b)); transform: translateX(-50%); color: var(--accent); z-index: 9200;
  animation: inBob 1.1s ease-in-out infinite; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
@keyframes inBob { 50% { transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { .in-sheet, .in-arrow { animation: none; } }
.in-sheet-wrap:has(.in-arrow) { align-items: center; padding-bottom: 64px; }
.in-sheet-wrap:has(.in-arrow) .in-sheet { border-radius: 24px; }

/* ================= Trips: Today (directions + "we're here") ================= */
.gm-panel.gm-still { animation: none; }
.td-panel .gm-chips { margin: 4px 0 8px; }
.td-panel .gm-chip { box-shadow: none; }
.td-sub { font-size: 13px; margin: 4px 0 10px; }
.td-note { font-size: 12.5px; margin: 0 0 8px; }
.td-next { border: 1px solid color-mix(in srgb, var(--dc, var(--accent)) 60%, var(--line)); border-radius: 16px; padding: 14px;
  background: color-mix(in srgb, var(--dc, var(--accent)) 10%, var(--bg)); margin-bottom: 12px; }
.td-next-k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dc, var(--accent)); }
.td-next-t { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: 17px; }
.td-next-t b { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.td-next-m { font-size: 13.5px; margin-left: 38px; }
.td-next-b { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.td-next-b .btn { flex: 1 1 140px; min-height: 48px !important; font-size: 15px !important; }
.td-alldone { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.td-list { display: flex; flex-direction: column; }
.td-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.td-row.next { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 12px; border-top-color: transparent; padding-left: 4px; padding-right: 4px; }
.td-check { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: none; color: transparent;
  display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.td-check:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 60%, transparent); }
.td-row.done .td-check { background: var(--accent); border-color: var(--accent); color: #05070a; }
.td-row .tnum { flex: none; width: 28px; min-width: 28px; height: 28px; border-radius: 50%; padding: 0; color: #05070a; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; }
.td-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 4px 0; }
.td-main b { font-weight: 500; font-size: 14.5px; overflow-wrap: anywhere; }
.td-main .muted { font-size: 12.5px; }
.td-row.done .td-main b { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.td-go { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.td-go:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); text-decoration: none; }
.tvisited { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #05070a; }
.tvisited .lu { width: 14px; height: 14px; }
.trip2 .tacts a.tgo { background: var(--accent); color: #05070a; border-color: var(--accent); font-weight: 600; }
.tacts a, .tacts button { display: inline-flex; align-items: center; gap: 6px; }
.you-dot { width: 22px; height: 22px; border-radius: 50%; background: #4285f4; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(66,133,244,.25), 0 2px 6px rgba(0,0,0,.5);
  animation: youPulse 2s ease-out infinite; }
@keyframes youPulse { 0% { box-shadow: 0 0 0 0 rgba(66,133,244,.45), 0 2px 6px rgba(0,0,0,.5); } 100% { box-shadow: 0 0 0 16px rgba(66,133,244,0), 0 2px 6px rgba(0,0,0,.5); } }
@media (prefers-reduced-motion: reduce) { .you-dot { animation: none; } }

/* ================= Google photos and description on stops ================= */
.gplace { display: flex; flex-direction: column; gap: 8px; }
.gplace:empty { display: none; }
.gp-desc { margin: 0; line-height: 1.45; }
.gp-photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; margin-right: -16px; }
.gp-ph { flex: none; width: 132px; height: 96px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: zoom-in; scroll-snap-align: start; background: var(--bg-soft); }
.gp-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gp-ph:hover img { transform: scale(1.04); }
.gp-src { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.gp-src a, .gp-credit a, .gp-hero-credit a { color: inherit; text-decoration: underline; }
.gp-hero { position: relative; margin: -14px -14px 12px; height: 150px; border-radius: 16px 16px 0 0; overflow: hidden; background: var(--bg-soft); }
.gp-hero:empty { display: none; }
.gp-hero img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.gp-hero-credit { position: absolute; right: 8px; bottom: 6px; font-size: 10.5px; color: #fff; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 999px; }
.gp-view-card { position: relative; max-width: min(96vw, 1100px); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.gp-view-card img { max-width: 100%; max-height: 78vh; border-radius: 16px; box-shadow: 0 16px 50px rgba(0,0,0,.6); }
.gp-view-card .gp-x { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; }
.gp-view-foot { display: flex; align-items: center; gap: 12px; color: #dfe6ee; font-size: 13px; }

/* ================= Paid features: admin switches + locked card ================= */
.am-feats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.am-feat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12.5px; cursor: pointer; user-select: none; color: var(--muted); }
.am-feat input { margin: 0; width: 15px; height: 15px; }
.am-feat.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lock-card { max-width: 460px; margin: 10vh auto; padding: 28px 24px; text-align: center; border: 1px solid var(--line); border-radius: 22px;
  background: var(--bg-elev); box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lock-card h2 { margin: 12px 0 6px; font-size: 21px; font-weight: 500; }
.lock-card p { margin: 6px 0; line-height: 1.5; }
.lock-ic { width: 56px; height: 56px; border-radius: 50%; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.cal-sub-note { font-size: 12.5px; margin: 12px 0 0; line-height: 1.45; }
.cal-nav { flex-wrap: wrap; }

/* ================= Plan with AI (admin test) ================= */
.ask-test { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); vertical-align: middle; }
.ask-panel .gm-chips { margin: 4px 0 10px; }
.ask-panel .gm-chip { box-shadow: none; }
.ask-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.ask-row label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.trip2 .trip-side .ask-row select { width: auto; min-height: 40px; }
.ask-hint { font-size: 12.5px; margin: 8px 0 0; }
.ask-title { margin: 14px 0 6px; font-size: 16px; }
.ask-steps { display: flex; flex-direction: column; gap: 12px; }
.ask-step { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--bg); }
.ask-step-h { display: flex; align-items: center; gap: 10px; }
.ask-step-h .tnum { flex: none; width: 26px; min-width: 26px; height: 26px; border-radius: 50%; padding: 0; color: #05070a; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ask-note { font-size: 12.5px; margin: 4px 0 0 36px; }
.ask-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; margin-top: 6px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-size: 14px; }
.ask-opt input { margin-top: 3px; flex: none; }
.ask-opt > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ask-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ask-opt.skip { padding-top: 4px; padding-bottom: 4px; }
.ask-cost { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; line-height: 1.45; }

/* ================= Suit up: one page, one thumb ================= */
.suitup-panel { border-radius: 22px; }
.suitup-form { gap: 12px; }
.su-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; position: sticky; top: 0; z-index: 2;
  background: var(--bg-elev); padding: 4px 0 8px; }
.su-cat { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font: 500 12.5px/1.15 inherit; cursor: pointer; min-height: 64px; text-align: center; }
.su-cat-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.su-cat.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-soft)); }
.su-cat.on .su-cat-ic { background: var(--accent); color: #05070a; }
.su-sec { display: flex; flex-direction: column; gap: 12px; animation: gmIn .18s ease both; }
.su-sec[hidden] { display: none; }
.su-sec .field { margin: 0; }
.su-hidden { display: none !important; }
.su-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.su-chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font: 500 14px/1 inherit; cursor: pointer; }
.su-chip.on { border-color: var(--accent); background: var(--accent); color: #05070a; }
.su-costumes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.su-costume { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font: 500 13px/1.15 inherit; cursor: pointer; min-height: 84px; }
.su-emoji { font-size: 30px; line-height: 1; }
.su-costume.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-soft)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.su-tip { font-size: 12.5px; margin: 0; }
.su-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.su-check { display: inline-flex; align-items: center; gap: 0; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); font-size: 14px; cursor: pointer; user-select: none; text-transform: none; letter-spacing: 0; color: var(--text); }
.su-check input { position: absolute; opacity: 0; pointer-events: none; }
.su-check:has(input:checked) { border-color: var(--accent); background: var(--accent); color: #05070a; }
.su-face-top { display: flex; align-items: center; gap: 12px; }
.su-face-top p { margin: 0; font-size: 13px; }
.swatches { gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; }
@media (max-width: 800px) {
  .suitup-preview { height: 34vh !important; min-height: 200px !important; }
}

/* trip owner + public / private */
.trip-ownerrow { flex-wrap: wrap; }
.tor-face { flex: none; width: 30px; height: 30px; display: grid; place-items: center; }
.tor-face svg { width: 30px; height: 30px; }
.tor-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font: 600 12.5px/1 inherit;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); }
button.tor-badge { cursor: pointer; }
button.tor-badge:hover { border-color: var(--accent); color: var(--text); }
.tor-badge.pub { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ================= Trip page fills its window (no page scroll) ================= */
.home-system.page-open .sys-page:has(.trip2) { display: flex; flex-direction: column; overflow: hidden; }
.sys-page:has(.trip2) .sys-page-body { flex: 1 1 auto; min-height: 0; }
/* a flex column with margin:auto would shrink the body to the list's width and leave the map 0px wide */
.sys-page:has(.trip2) .sys-page-body { width: 100%; max-width: none; margin: 0; align-self: stretch; }
.sys-page-body .trip2 { height: 100% !important; }

/* trip header folds away behind a chevron */
.gm-title-row { display: flex; align-items: center; gap: 10px; }
.gm-title-row h1 { flex: 1 1 auto; min-width: 0; }
.head-toggle { flex: none; }
.gm-head.head-closed { padding-bottom: 12px; }
.gm-head.head-closed .gm-actions, .gm-head.head-closed .gm-rows { display: none; }

/* bigger, easier chevrons */
.trip2 .chev { width: 24px; }
.trip2 .chev .lu, .trip2 .tchev .lu { width: 22px; height: 22px; }
.trip2 .tgroup-head { height: 52px; }
.trip2 .tchev { width: 40px; height: 40px; }
.sys-chev { width: 40px; height: 40px; font-size: 1rem; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.sys-chev:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.sys-tree-row { min-height: 44px; }

/* ================= Phone: the list is a see-through sheet over the map ================= */
.sheet-tab { display: none; }
@media (max-width: 800px) {
  .trip2 { display: block !important; position: relative; height: 100%; }
  .trip2 .trip-mapcol { position: absolute; inset: 0; border: 0; }
  .trip2 .trip-side {
    position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet-h, 52%); z-index: 1100;
    border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
    background: color-mix(in srgb, var(--bg-elev) 84%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -10px 30px rgba(0,0,0,.45); padding-top: 22px; overflow-y: auto; overscroll-behavior: contain;
    transition: height .28s cubic-bezier(.2,.8,.2,1), left .28s, right .28s; visibility: visible !important;
  }
  .trip2[data-sheet="low"] { --sheet-h: 150px; }
  .trip2[data-sheet="mid"] { --sheet-h: 52%; }
  .trip2[data-sheet="high"] { --sheet-h: calc(100% - 64px); }
  .trip2[data-sheet="high"] .trip-side { left: 12px; right: 12px; }
  .sheet-tab {
    display: flex; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sheet-h, 52%) - 20px); z-index: 1200;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev); box-shadow: 0 4px 14px rgba(0,0,0,.45);
    transition: bottom .28s cubic-bezier(.2,.8,.2,1); overflow: hidden; touch-action: none;
  }
  .sheet-tab button { width: 52px; height: 40px; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
  .sheet-tab button + button { border-left: 1px solid var(--line); }
  .sheet-tab button:active { background: color-mix(in srgb, var(--accent) 20%, transparent); }
  /* keep the map's own controls above the sheet */
  .trip2 .leaflet-bottom { bottom: var(--sheet-h, 52%); transition: bottom .28s; }
  .trip2 .map-view-toggles { bottom: calc(var(--sheet-h, 52%) + 14px); transition: bottom .28s; }
  .trip2 .gm-collapse { display: none; }
}

/* costume colors: the ✨ swatch keeps the costume's own colors */
.swatch.swatch-def { background: var(--bg-soft); color: var(--text); display: inline-grid; place-items: center; }
