:root {
  color-scheme: dark;
  /* Navy from the tektinkers.com back-to-top button, coral accent kept */
  --polar-deep: #011f3c;
  --polar-ice: #e7f1fa;
  --polar-mist: #a9c3d8;
  --polar-sea: #1498c4;
  --polar-coral: #c46960;
  --bg: var(--polar-deep);
  --bg-elev: #013a54;
  --card: #001428;
  --accent: var(--polar-coral);
  --accent-2: var(--polar-sea);
  --ink: var(--polar-ice);
  --muted: var(--polar-mist);
  --line: color-mix(in oklab, var(--polar-ice) 12%, transparent);
  --sidebar: var(--card);
  --user: color-mix(in oklab, var(--polar-sea) 18%, var(--bg-elev));
  --composer: var(--bg-elev);
  --danger: #e7b2ac;
  --ok: #cfe6f6;
  --wait: #f3dfc0;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(900px 600px at 100% 0%, color-mix(in oklab, var(--polar-sea) 22%, transparent), transparent 70%),
    color-mix(in oklab, var(--polar-ice) 14%, var(--bg));
  color: var(--ink);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { filter: brightness(1.1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
h1, h2 { margin: 0; font-weight: 600; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: transparent;
}
.gate-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 92%, transparent), color-mix(in oklab, var(--bg) 55%, transparent));
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.gate-card h1 { margin: 8px 0; font-size: 2rem; }
.lede { margin: 0 0 8px; color: var(--muted); line-height: 1.5; }
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 0.92rem; }
input, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
}
textarea { resize: none; }
input:focus, textarea:focus { outline: 2px solid color-mix(in oklab, var(--accent) 65%, transparent); border-color: transparent; }
.gate-card button {
  width: 100%;
  margin-top: 18px;
  background: var(--accent);
  color: var(--ink);
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.gate-card button:hover { filter: brightness(1.08); }

.app { height: 100%; display: grid; grid-template-columns: 260px 1fr; }
.rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--sidebar);
  border-right: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
  min-height: 0;
}
.solid {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: 14px;
  padding: 11px 12px;
  text-align: left;
  font-weight: 600;
}
.solid:hover { background: color-mix(in oklab, var(--polar-sea) 16%, var(--bg-elev)); }
.rail nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; min-height: 0; flex: 1; }
.group-form { display: flex; gap: 6px; }
.group-form input { padding: 8px 10px; }
.group-form .solid { width: auto; padding: 8px 10px; }
.group-label { display: flex; align-items: center; gap: 4px; }
.group-label .fold {
  width: 28px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 0 2px;
}
.group-label .name {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 4px 2px;
}
.group-label .count { color: var(--muted); font-size: 0.72rem; padding: 8px 4px 2px; }
.group-label .name.active { color: var(--ink); }
.group-label .quiet { width: auto; padding: 4px 8px; }
#chat-group {
  max-width: 9rem;
}
.picker {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.picker:disabled { opacity: 0.45; cursor: default; }
.quiet {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
}
.quiet:hover { background: color-mix(in oklab, var(--polar-ice) 10%, transparent); color: var(--ink); }
.chat-row { display: flex; align-items: center; border-radius: 10px; }
.chat-row.active, .chat-row:hover { background: color-mix(in oklab, var(--polar-sea) 16%, transparent); }
.chat-row .open {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 8px 10px 12px;
  color: var(--ink);
}
.chat-row .open span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .drop {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 1.1rem;
}
.solid.active { background: var(--accent); color: var(--ink); border-color: transparent; }
.logout { margin-top: auto; }
.accounts { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; }
.account-body { width: min(640px, calc(100% - 32px)); margin: 0 auto 32px; }
.account-body h3 { margin: 28px 0 0; font-size: 1.05rem; }
.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.account-row span { flex: 1; }
.account-row .role { color: var(--muted); flex: none; }
.account-body .picker {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 12px 14px;
}
.action {
  margin-top: 16px;
  background: var(--accent);
  color: var(--ink);
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.action:hover { filter: brightness(1.08); }
.banner.ok { background: color-mix(in oklab, var(--accent-2) 28%, var(--card)); color: var(--ink); }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 8px;
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
}
.top h2,
.chat-title {
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-title {
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}
#chat-name {
  width: min(280px, 46vw);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0 0 2px;
  font-size: 1rem;
  font-weight: 600;
}
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
.pill {
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--accent-2);
  color: var(--card);
  font-size: 0.78rem;
  font-weight: 700;
}
.pill.wait { background: color-mix(in oklab, var(--wait) 24%, var(--card)); color: var(--wait); }
.pill.ok { background: color-mix(in oklab, var(--accent-2) 35%, var(--card)); color: var(--ink); }
.pill.bad { background: color-mix(in oklab, var(--accent) 40%, var(--card)); color: var(--ink); }
.banner {
  width: min(768px, calc(100% - 32px));
  margin: 0 auto 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in oklab, var(--accent) 32%, var(--card));
  color: var(--ink);
}
.thread {
  flex: 1;
  overflow: auto;
  width: min(768px, 100%);
  margin: 0 auto;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.bubble {
  max-width: 100%;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.user {
  align-self: flex-end;
  max-width: min(560px, 86%);
  padding: 12px 16px;
  border-radius: 22px;
  background: var(--user);
}
.bubble img.sent-image {
  display: block;
  max-width: 100%;
  max-height: 240px;
  margin-top: 8px;
  border-radius: 12px;
}
.bubble.assistant {
  align-self: stretch;
  padding: 2px 4px;
}
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.bubble.user .message-actions { justify-content: flex-end; }
.message-actions button,
.message-edit {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
}
.message-edit {
  display: block;
  width: 100%;
  min-height: 72px;
  margin-top: 8px;
  border-radius: 12px;
  padding: 8px 10px;
  resize: vertical;
}
.bubble img {
  display: block;
  max-width: min(100%, 512px);
  margin-top: 8px;
  border-radius: 12px;
}
.picture {
  display: block;
  width: min(100%, 512px);
  margin-top: 8px;
  white-space: normal;
}
.picture img {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  cursor: zoom-in;
}
.picture-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.picture-actions:has(.picture-votes) { justify-content: space-between; }
.picture-votes,
.picture-tools {
  display: flex;
  gap: 8px;
}
.picture-actions a,
.picture-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.picture-votes button { padding: 4px 10px; }
.picture-votes button[aria-pressed="true"] { border-color: var(--ink); }
.picture-votes button.up[aria-pressed="true"] { color: var(--ok); }
.picture-votes button.down[aria-pressed="true"] { color: var(--danger); }
.picture-link {
  display: block;
  margin-top: 6px;
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.picture-frame {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picture-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  cursor: zoom-out;
}
.picture-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.empty {
  margin: auto;
  max-width: 560px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { color: var(--ink); font-size: 1.8rem; font-weight: 500; margin: 0 0 8px; }
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
  width: min(768px, calc(100% - 32px));
  margin: 8px auto 0;
  padding: 8px 8px 8px 16px;
  background: var(--composer);
  border: 1px solid var(--line);
  border-radius: 28px;
}
.composer textarea {
  background: transparent;
  border: 0;
  padding: 10px 0;
  min-height: 28px;
  max-height: 180px;
}
.composer textarea:focus { outline: 0; }
.composer button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.composer button.attach {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
}
.composer button:disabled { opacity: 0.45; cursor: progress; }
.attach-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  padding: 4px 0 6px;
}
.attach-row figure {
  position: relative;
  margin: 0;
}
.attach-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.attach-row button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 20, 40, 0.72);
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  padding: 0;
}
.hint {
  width: min(768px, calc(100% - 32px));
  margin: 8px auto 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}
.done-model {
  margin-left: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}

.chooser { width: min(880px, 100%); }
.chooser h1 { margin: 8px 0 0; font-size: 2.4rem; }
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 86%, transparent), color-mix(in oklab, var(--bg) 40%, transparent));
  border: 1px solid color-mix(in oklab, var(--ink) 8%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.choice:hover, .choice:focus-visible {
  outline: 0;
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  transform: translateY(-2px);
  filter: none;
}
.choice-name { font-size: 1.15rem; font-weight: 650; }
.choice-detail { color: var(--muted); line-height: 1.45; font-size: 0.92rem; }
a.back { color: var(--accent); }

.site-module {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}
.site-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 92%, transparent), color-mix(in oklab, var(--bg) 55%, transparent));
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.site-card p { margin: 0; line-height: 1.5; }
.site-choice {
  display: block;
  width: 100%;
  margin-top: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
}
.site-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.site-actions button {
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  background: var(--bg-elev);
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 14px;
  font-weight: 600;
}
#site-accept {
  background: var(--accent);
  border-color: transparent;
}

body.home-page {
  min-height: 100%;
  background:
    radial-gradient(640px 240px at 0% 0%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 72%),
    radial-gradient(900px 600px at 100% 0%, color-mix(in oklab, var(--polar-sea) 22%, transparent), transparent 70%),
    color-mix(in oklab, var(--polar-ice) 14%, var(--bg));
}
.home {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 64px;
}
.home-mast {
  display: flex;
  align-items: center;
  gap: 18px;
}
.home-mark {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 50%;
}
.home h1 { font-size: 2.4rem; line-height: 1.05; }
.shelf-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.shelf-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in oklab, var(--accent) 40%, transparent);
}
.air {
  margin-top: 28px;
  padding: 16px 16px 18px;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--card) 92%, transparent), color-mix(in oklab, #000 28%, var(--card)));
  border: 1px solid color-mix(in oklab, var(--accent) 42%, transparent);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.air-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.air-head .shelf-label { margin: 0; flex: 1; }
.air-count:empty { display: none; }
.air-count { letter-spacing: 0; text-transform: none; color: var(--ink); }
.air-quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 0;
}
.air-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
}
.air-status { margin: 0; color: var(--muted); line-height: 1.45; }
.air-card {
  display: flex;
  flex: 1 0 260px;
  flex-direction: column;
  max-width: 340px;
  color: var(--ink);
  text-decoration: none;
}
.air-row:has(.air-card:only-child) .air-card { max-width: 520px; }
.air-card:hover, .air-card:focus-visible { filter: none; outline: 0; }
.air-shot {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  background: #000;
}
.air-meta {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
}
.air-meta img {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}
.air-name, .air-game, .air-title, .air-viewers { display: block; }
.air-name { font-weight: 650; }
.air-game, .air-viewers { color: var(--muted); font-size: 0.84rem; }
.air-title {
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.live-pip {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a0a08;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.place {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 86%, transparent), color-mix(in oklab, var(--bg) 40%, transparent));
  border: 1px solid color-mix(in oklab, var(--ink) 8%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.place:hover, .place:focus-visible {
  outline: 0;
  filter: none;
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  transform: translateY(-2px);
}
.place img {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: contain;
  border-radius: 12px;
}
.place img.pixel { image-rendering: pixelated; }

.mega-home { min-height: 100%; }
.mega-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--card);
  border-bottom: 1px solid color-mix(in oklab, var(--polar-sea) 45%, transparent);
}
.mega-brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.03em; }
.mega-browse {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  font-weight: 750;
}
.mega-count {
  margin-left: auto;
  flex: none;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}
.mega-count:empty { display: none; }
.mega-panel {
  display: none;
  position: absolute;
  z-index: 25;
  left: 16px;
  right: 16px;
  top: 62px;
  max-height: min(72vh, 680px);
  overflow: auto;
  padding: 16px 18px;
  background: var(--bg-elev);
  border-radius: 18px;
  box-shadow: var(--shadow);
  columns: 4 220px;
}
.mega-panel.is-open { display: block; }
.mega-col { break-inside: avoid; margin: 0 0 16px; }
.mega-col h2 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.mega-link {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  color: var(--ink);
}
.mega-link img {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
}
.mega-link img.pixel { image-rendering: pixelated; }
.mega-link span { display: flex; flex-direction: column; min-width: 0; }
.mega-link small { color: var(--muted); font-size: 0.78rem; }
.mega-home .home {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 18px 48px;
}
.mega-home .air {
  width: auto;
  margin: 0;
  border-radius: 22px;
}
.mega-home .air-card { max-width: none; flex-basis: 280px; }
@media (max-width: 800px) {
  .mega-panel { columns: 1; }
}
.upload-preview {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 0 8px;
  border-radius: 12px;
  background: var(--card);
}
.place-name { display: block; font-size: 1.05rem; font-weight: 650; }
.place-detail { display: block; margin-top: 2px; color: var(--muted); line-height: 1.4; font-size: 0.9rem; }
@media (max-width: 700px) {
  .choices { grid-template-columns: 1fr; }
  .home-mast { align-items: flex-start; }
  .home h1 { font-size: 2rem; }
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { max-height: 34vh; }
  .top { padding-left: 14px; padding-right: 14px; }
}
