:root {
  --bg: #070b12;
  --bg-2: #0b1220;
  --panel: #0e1726;
  --panel-2: #121e31;
  --line: #1d2c44;
  --line-2: #27405f;
  --text: #d8e4f2;
  --muted: #7d91ab;
  --faint: #4c6079;
  --accent: #3fd0ff;
  --accent-2: #7be3ff;
  --ok: #3ee08f;
  --warn: #ffb547;
  --bad: #ff5a6a;
  --discord: #5865f2;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(30, 90, 150, .28) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(63, 208, 255, .06) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
/* faint HUD grid behind everything */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(63, 208, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(63, 208, 255, .035) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%); -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%); }
html.night body::before, body.cockpit::before { display: none; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
code { background: #0a1424; border: 1px solid var(--line); padding: 0.05em 0.35em; border-radius: 4px; font-size: 0.88em; }
pre { background: #050a12; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13px; margin: 8px 0; }
h1, h2, h3 { font-weight: 700; letter-spacing: 0.02em; margin: 0 0 0.4em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 600 15px var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 9px 16px; border-radius: 8px; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; background: #15253c; }
.btn .ic { width: 16px; height: 16px; }
.btn.sm .ic { width: 15px; height: 15px; }
.icon-btn { white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #031019; border-color: var(--accent); box-shadow: 0 0 0 0 rgba(63, 208, 255, 0); transition: box-shadow .2s, background .15s; }
.btn.primary:hover { background: var(--accent-2); box-shadow: 0 0 24px -4px rgba(63, 208, 255, .55); }
.btn.discord { background: var(--discord); border-color: var(--discord); color: #fff; }
.btn.discord:hover { filter: brightness(1.1); background: var(--discord); box-shadow: 0 0 28px -6px rgba(88, 101, 242, .8); }
.btn.lg { padding: 13px 22px; font-size: 17px; border-radius: 10px; }
.btn.danger { border-color: #5a2430; color: #ff9aa5; }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
input[type=text], input[type=search], input[type=number], select {
  background: #08111e; border: 1px solid var(--line-2); color: var(--text); border-radius: 8px;
  padding: 8px 10px; font: 15px var(--sans);
}
input:focus, select:focus, .btn:focus-visible, .tab:focus-visible, summary:focus-visible, .ping:focus-visible, .action-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::placeholder { color: var(--faint); }

/* ------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 20px; background: rgba(7, 11, 18, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: .12em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent); }
.topbar .spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.user img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); }

/* ------------------------------------------------ landing */
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.site-nav { display: flex; gap: 4px; margin-left: 18px; }
.site-nav a { color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; padding: 6px 10px; border-radius: 6px; }
.site-nav a:hover { color: var(--text); text-decoration: none; background: rgba(63, 208, 255, .06); }
.hero { max-width: 1140px; margin: 0 auto; padding: 84px 20px 56px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); line-height: 1.02; margin-top: 14px; }
.hero h1 span { color: var(--accent); text-shadow: 0 0 40px rgba(63, 208, 255, .35); }
.hero p.lead { font-size: 20px; color: var(--muted); max-width: 34em; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(14, 23, 38, .7);
  font: 600 13px var(--mono); letter-spacing: .04em; color: var(--accent-2); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(62, 224, 143, .7); animation: live-ping 1.8s ease-out infinite; }
@keyframes live-ping { 70% { box-shadow: 0 0 0 8px rgba(62, 224, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 143, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.preview { position: relative; border: 1px solid var(--line-2); border-radius: 16px; background: linear-gradient(180deg, #0f1b2d, #0a1220); padding: 18px 20px 20px;
  box-shadow: 0 40px 90px -30px #000, 0 0 0 1px rgba(63, 208, 255, .05), 0 0 80px -20px rgba(63, 208, 255, .25); transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); }
.preview::before { content: ""; position: absolute; inset: -40px; z-index: -1; background: radial-gradient(closest-side, rgba(63, 208, 255, .16), transparent); }
.preview-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  font: 700 12px var(--mono); letter-spacing: .14em; color: var(--ok); }
.preview-top > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.preview-top .mono { color: var(--faint); font-weight: 400; letter-spacing: .04em; }
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(28px, 4vw, 38px); margin: 6px 0 0; }
.features, .how { max-width: 1140px; margin: 0 auto; padding: 56px 20px 24px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { padding: 22px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), #0b1321); transition: border-color .2s, transform .2s, box-shadow .2s; }
.feature:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 18px 40px -24px rgba(63, 208, 255, .35); }
.feature .ic { width: 38px; height: 38px; padding: 8px; border-radius: 10px; color: var(--accent); background: rgba(63, 208, 255, .08); border: 1px solid rgba(63, 208, 255, .25); }
.feature h3 { font-size: 20px; margin: 14px 0 4px; }
.feature p { margin: 0; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.step { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.step .n { font: 700 30px var(--mono); color: var(--accent); letter-spacing: .02em; opacity: .9; text-shadow: 0 0 20px rgba(63, 208, 255, .45); }
.step h3 { font-size: 20px; margin: 6px 0 4px; }
.step p { margin: 0; }
.faq { max-width: 860px; margin: 0 auto; padding: 56px 20px 20px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 8px 0; transition: border-color .15s; }
.faq details[open] { border-color: var(--line-2); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font: 700 20px var(--mono); line-height: 1; transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.cta-band { max-width: 1100px; margin: 50px auto 60px; padding: 44px 24px; text-align: center; border-radius: 16px; border: 1px solid var(--line-2);
  background: radial-gradient(600px 200px at 50% 0%, rgba(63, 208, 255, .16), transparent 70%), var(--panel); }
.cta-band h2 { font-size: clamp(26px, 3.6vw, 36px); margin-bottom: 4px; }
.cta-band p { margin: 0 0 20px; }
footer { text-align: center; color: var(--faint); font-size: 13px; padding: 30px 20px 40px; border-top: 1px solid var(--line); }
@media (max-width: 960px) { .feature-grid { grid-template-columns: 1fr 1fr; } .preview { transform: none; } }
@media (max-width: 760px) {
  .site-nav { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .features, .how, .faq { padding-top: 40px; }
  .cta-band { margin: 30px 16px 40px; }
}

/* ------------------------------------------------ dashboard layout */
.tabs { position: sticky; top: 52px; z-index: 9; display: flex; align-items: stretch; gap: 0; padding: 0 20px; border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .9); backdrop-filter: blur(8px); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-group { display: flex; align-items: stretch; gap: 2px; position: relative; padding: 0 10px; }
.tab-group:first-child { padding-left: 0; }
.tab-group + .tab-group::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: var(--line-2); }
.tab-group.end { margin-left: auto; padding-right: 0; }
.tab-group.end::before { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--muted); font: 600 15px var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 13px 12px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s, background .15s; }
.tab .ic { width: 17px; height: 17px; opacity: .75; }
.tab:hover { color: var(--text); background: rgba(63, 208, 255, .04); }
.tab[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); background: linear-gradient(0deg, rgba(63, 208, 255, .1), transparent 70%); }
.tab[aria-selected=true] .ic { opacity: 1; filter: drop-shadow(0 0 6px rgba(63, 208, 255, .6)); }
.tab .badge { margin-left: 0; }
.attn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 rgba(255, 181, 71, .7); animation: attn 1.6s ease-out infinite; }
@keyframes attn { 70% { box-shadow: 0 0 0 7px rgba(255, 181, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0); } }
@media (prefers-reduced-motion: reduce) { .attn-dot { animation: none; } }

/* page heading inside each dashboard tab */
.view-head { margin: 2px 0 16px; }
.view-head h1 { display: flex; align-items: center; gap: 10px; font-size: 28px; margin: 0; letter-spacing: .04em; }
.view-head h1 .ic { width: 24px; height: 24px; color: var(--accent); }
.view-head p { margin: 2px 0 0; color: var(--muted); max-width: 62em; }
main { padding: 18px 20px 40px; max-width: 1500px; margin: 0 auto; }
.view[hidden] { display: none; }

.statusbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px rgba(255,255,255,.03); }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.dot.bad { background: var(--bad); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, 1fr); }
.panel { background: linear-gradient(180deg, var(--panel), #0c1422); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; position: relative;
  box-shadow: inset 0 1px 0 rgba(123, 227, 255, .05), 0 10px 30px -20px #000; }
.panel::after { content: ""; position: absolute; left: 16px; right: 16px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(63, 208, 255, .35), transparent); pointer-events: none; }
html.night .panel::after { display: none; }
.panel > h2 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel > h2::before { content: ""; width: 3px; height: 12px; background: var(--accent); border-radius: 2px; }
.panel > h2 .right { margin-left: auto; letter-spacing: .04em; text-transform: none; font-size: 13px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.dim { opacity: .38; filter: saturate(.4); }
.empty-note { color: var(--faint); font-size: 14px; padding: 8px 0; }

/* stat + bars */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 14px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.stat .v { font: 600 20px var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v small { font-size: 12px; color: var(--muted); margin-left: 3px; }
.big { font: 700 42px var(--mono); line-height: 1; }
.big small { font-size: 15px; color: var(--muted); margin-left: 6px; }

.bar { margin: 8px 0 12px; }
.bar .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.bar .row b { font: 600 14px var(--mono); color: var(--text); letter-spacing: 0; }
.bar .track { height: 8px; border-radius: 4px; background: #0a1424; border: 1px solid var(--line); overflow: hidden; margin-top: 4px; }
.bar .fill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease, background .3s; }
.bar.ok .fill { background: var(--ok); } .bar.warn .fill { background: var(--warn); } .bar.bad .fill { background: var(--bad); }

.title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.title-row h3 { font-size: 24px; margin: 0; }
.tag { font: 600 12px var(--mono); padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); letter-spacing: .06em; }
.tag.on { color: #04130c; background: var(--ok); border-color: var(--ok); }
.tag.accent { color: #031019; background: var(--accent); border-color: var(--accent); }
.tag.warn { color: #1b1002; background: var(--warn); border-color: var(--warn); }

/* annunciators */
.annun { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.annun div { text-align: center; font: 700 13px var(--mono); padding: 9px 0; border-radius: 6px; background: #0a1220; border: 1px solid var(--line); color: var(--faint); letter-spacing: .08em; }
.annun .NOMINAL { color: var(--ok); border-color: #1d5a3e; }
.annun .MINOR_ON { color: #1b1002; background: var(--warn); border-color: var(--warn); }
.annun .MAJOR_ON { color: #fff; background: var(--bad); border-color: var(--bad); }
.annun .MINOR_FLASHING { color: #1b1002; background: var(--warn); animation: blink 1s steps(2) infinite; }
.annun .MAJOR_FLASHING { color: #fff; background: var(--bad); animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .annun div { animation: none !important; } }

.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 6px 8px; border-radius: 6px; background: #0a1220; border: 1px solid var(--line); }
.toggle.on { color: var(--text); border-color: #1f4a66; }
.toggle .dot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* shields */
.shield-wrap { display: flex; gap: 16px; align-items: center; }
.shield-wrap svg { flex: 0 0 130px; height: 130px; }

/* compass */
.compass { position: relative; height: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #08101c; margin-top: 8px; }
.compass .tape { position: absolute; top: 0; left: 50%; height: 100%; white-space: nowrap; font: 12px var(--mono); color: var(--muted); }
.compass .tape span { position: absolute; top: 8px; transform: translateX(-50%); }
.compass::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--accent); }

/* lists / tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid #142036; }
td.mono { font-size: 13px; }
.feed { max-height: 280px; overflow-y: auto; font-size: 14px; }
.feed div { padding: 5px 0; border-bottom: 1px solid #142036; display: flex; gap: 10px; }
.feed time { font: 12px var(--mono); color: var(--faint); flex: 0 0 64px; }
.ev-ACTOR_DEAD, .ev-ACTOR_DOWNED { color: var(--bad); }
.ev-ACTOR_ENTER_SEAT { color: var(--accent); }
.ev-ACTOR_SPAWN, .ev-ACTOR_RESPAWN { color: var(--ok); }

/* history charts */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.chart { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; position: relative; }
.chart h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; justify-content: space-between; }
.chart h4 b { font: 600 15px var(--mono); color: var(--text); letter-spacing: 0; text-transform: none; }
.chart canvas { width: 100%; height: 130px; display: block; margin-top: 6px; }
.chart .tip { position: absolute; pointer-events: none; background: #050a12; border: 1px solid var(--line-2); font: 12px var(--mono); padding: 4px 7px; border-radius: 5px; white-space: nowrap; display: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: 7px 12px; font: 600 14px var(--mono); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--accent); color: #031019; }

/* actions */
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.action-btn { text-align: left; background: #0a1220; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 11px; cursor: pointer; font: 14px var(--mono); word-break: break-all; }
.action-btn:hover { border-color: var(--accent); }
.action-btn small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; }
.action-btn.flash-ok { border-color: var(--ok); }
.action-btn.flash-bad { border-color: var(--bad); }
.cat { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }

/* setup */
.setup { max-width: 920px; }
.secret { border: 1px solid #1f6b4a; background: #07160f; border-radius: 8px; padding: 12px; margin: 10px 0; }
.copy-row { position: relative; }
.copy-row pre { padding-right: 84px; white-space: pre-wrap; word-break: break-all; }
.copy-row .btn { position: absolute; top: 6px; right: 6px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel-2); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 8px; z-index: 50; font-size: 15px; }

@media (max-width: 1100px) {
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .steps { grid-template-columns: 1fr; }
  .grid > * { grid-column: span 12 !important; }
  main { padding: 14px 16px 40px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .brand { font-size: 18px; }
  .user span, .icon-btn .lbl { display: none; }
  .icon-btn { padding: 6px 8px; }
  .charts { grid-template-columns: 1fr; }
  .annun div { font-size: 11px; }
  .tabs { padding: 0 8px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tab { padding: 12px 10px 11px; font-size: 14px; letter-spacing: .05em; }
  .tab-group { padding: 0 6px; }
  .tab-group.end { margin-left: 0; padding-right: 40px; }
  .tab-group.end::before { display: block; }
  .view-head h1 { font-size: 24px; }
  .view-head p { font-size: 15px; }
  .statusbar { gap: 6px; }
  .statusbar .chip { font-size: 13px; padding: 4px 10px; }
}

/* ------------------------------------------------ social */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff; font: 700 11px/18px var(--mono); text-align: center; letter-spacing: 0; }
.party-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.party-head .spacer { flex: 1; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.member { background: linear-gradient(180deg, var(--panel), #0c1422); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: relative; }
.member.me { border-color: #1f4a66; }
.member.down { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad), 0 0 24px -6px var(--bad); }
.member.offline { opacity: .55; }
.member header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.member header img, .avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: #0a1424; flex: 0 0 auto; object-fit: cover; }
.member header .who { min-width: 0; flex: 1; }
.member header .who b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member header .who span { font-size: 13px; color: var(--muted); }
.member .alert { background: var(--bad); color: #fff; font: 700 13px var(--mono); letter-spacing: .1em; text-align: center; border-radius: 6px; padding: 4px; margin-bottom: 8px; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.mini .bar { margin: 4px 0 6px; }
.mini .bar .track { height: 5px; }
.mini .bar .row { font-size: 11px; }
.mini .bar .row b { font-size: 12px; }
.member .veh { border-top: 1px solid #142036; margin-top: 6px; padding-top: 8px; }
.member .veh .name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; margin-bottom: 2px; }
.member .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 6px; }
.member .kick { position: absolute; top: 10px; right: 10px; }
.crew { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #0a1220; }
.crew.mine { border-color: #1f4a66; }
.crew header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.crew header h3 { margin: 0; font-size: 19px; }
.crew header .spacer { flex: 1; }
.crew-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid #142036; font-size: 14px; }
.crew-row .station { font: 600 12px var(--mono); color: var(--accent); width: 82px; flex: 0 0 auto; text-transform: uppercase; }
.crew-row .live { color: var(--muted); font-size: 13px; }
.crew-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0 2px; border-top: 1px solid #142036; }
.crew-add select { padding: 4px 8px; }
.friend-row .check { display: inline-flex; margin-right: 6px; }
.crew-row .spacer { flex: 1; }
.aboard { color: var(--ok); font: 600 11px var(--mono); }
.ashore { color: var(--warn); font: 600 11px var(--mono); }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.friend-row td { vertical-align: middle; }
.friend-row .who { display: flex; align-items: center; gap: 10px; }
.req { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #142036; }
.req .spacer { flex: 1; }

/* ------------------------------------------------ alerts banner */
.alert-bar:empty { display: none; }
.alert-bar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; font-size: 17px; }
.alert-item b { text-transform: uppercase; letter-spacing: .06em; }
.alert-item span { flex: 1; font: 13px var(--mono); opacity: .9; }
.alert-item button { background: none; border: 0; color: inherit; font-size: 16px; cursor: pointer; padding: 2px 6px; }
.alert-item.major { background: var(--bad); color: #fff; animation: alert-pulse 1.2s ease-in-out infinite; }
.alert-item.minor { background: var(--warn); color: #1b1002; }
@keyframes alert-pulse { 50% { filter: brightness(1.2); } }
@media (prefers-reduced-motion: reduce) { .alert-item.major { animation: none; } }

/* ------------------------------------------------ pings */
.pings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ping { background: #0a1220; border: 1px solid var(--line-2); color: var(--text); border-radius: 999px; padding: 6px 12px; font: 600 14px var(--sans); cursor: pointer; letter-spacing: .03em; }
.ping:hover { border-color: var(--accent); }
.ping.sent { background: var(--accent); color: #031019; border-color: var(--accent); }
.ping[data-ping=medic], .ping[data-ping=help] { border-color: #5a2430; }
.ping-badge { font: 700 13px var(--sans); letter-spacing: .04em; border-radius: 6px; padding: 4px 8px; margin-bottom: 8px; background: var(--accent); color: #031019; }
.ping-badge.ping-medic, .ping-badge.ping-help { background: var(--bad); color: #fff; }
.ping-badge.ping-fuel { background: var(--warn); color: #1b1002; }
.feed .ping-medic, .feed .ping-help { color: #ff9aa5; }

/* ------------------------------------------------ logbook / earnings / hangar */
.pos { color: var(--ok); } .neg { color: var(--bad); }
.big-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.big-stats .stat .v { font-size: 26px; }
.chart.bare { background: none; border: 0; padding: 0; }
.chart.bare canvas { height: 180px; }
.chart .legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 720px; }
.hangar { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ship-card { background: linear-gradient(180deg, var(--panel), #0c1422); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.ship-card header { margin-bottom: 10px; }
.ship-card h3 { margin: 0; font-size: 22px; }
.ship-card .stats { grid-template-columns: repeat(3, 1fr); }
.ship-card .stat .v { font-size: 17px; }
.mini.four { grid-template-columns: repeat(4, 1fr); }

/* ------------------------------------------------ settings */
.rules td { padding: 4px 6px; }
.rules select, .rules input[type=number] { padding: 5px 8px; font-size: 14px; }
.rules input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.toolbar .check { padding: 0; }
input[type=range] { accent-color: var(--accent); }
.toggles label.toggle { cursor: pointer; }
.toggles label.toggle input { accent-color: var(--accent); }

/* ------------------------------------------------ crew remote control */
.remote { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.remote h4 { margin: 0 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.crew-row .check { padding: 0; font-size: 13px; }

/* ------------------------------------------------ operations */
.op-party { margin-bottom: 14px; }
.op-ship { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #0a1220; }
.op-ship.down { border-color: var(--bad); }
.op-ship-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; font-size: 17px; }
.op-crew, .op-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.op-person { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.op-person small { color: var(--accent); font: 600 11px var(--mono); text-transform: uppercase; }
.op-person.down { border-color: var(--bad); color: #ff9aa5; }
.op-person.off { opacity: .5; }
@media (max-width: 760px) { .mini.four { grid-template-columns: 1fr 1fr; } .ship-card .stats { grid-template-columns: repeat(2, 1fr); } }
input[type=range] { width: 120px; }

/* ------------------------------------------------ same-ship suggestion */
.ship-suggest { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px;
  border-radius: var(--radius); border: 1px solid var(--accent); background: linear-gradient(90deg, rgba(63, 208, 255, .14), rgba(63, 208, 255, .04)); }
.ship-suggest-icon { font-size: 22px; color: var(--accent); }
.ship-suggest-text { flex: 1 1 280px; font-size: 16px; }
.danger-zone { border-color: #5a2430; }
.danger-zone > h2::before { background: var(--bad); }

/* ------------------------------------------------ danger actions: hold to confirm */
.action-btn.danger { position: relative; overflow: hidden; border-color: #5a2430; color: #ffb3bb; touch-action: none; user-select: none; -webkit-user-select: none; }
.action-btn.danger::before { content: ""; position: absolute; inset: 0; width: 0; background: rgba(255, 90, 106, .35); pointer-events: none; }
.action-btn.danger.holding::before { width: 100%; transition: width var(--hold-ms, 1500ms) linear; }
.action-btn.danger > * { position: relative; }
.danger-actions { margin-top: 16px; border: 1px solid #5a2430; border-radius: 8px; padding: 10px 12px; }
.danger-actions summary { cursor: pointer; color: #ffb3bb; font-weight: 600; }
.danger-actions .actions-grid { margin-top: 10px; }

/* ------------------------------------------------ night mode: red on black for a dark room */
html.night {
  --bg: #000; --bg-2: #050101; --panel: #0c0202; --panel-2: #140404; --line: #2a0808; --line-2: #3d0c0c;
  --text: #ff5a4a; --muted: #b03a30; --faint: #74241e; --accent: #ff3b2f; --accent-2: #ff6a5e;
  --ok: #e0402f; --warn: #ff7a2f; --bad: #ff1f1f;
}
html.night body { background: #000; }
html.night .panel, html.night .member, html.night .ship-card, html.night .ck-tile, html.night .step, html.night .chart,
html.night .crew, html.night .op-ship { background: var(--panel); }
html.night .topbar, html.night .tabs, html.night .ck-top { background: #000; }
html.night img, html.night .shield-wrap svg, html.night #ck-shield-svg { filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-40deg) brightness(.75); }
html.night .tag.on, html.night .tag.accent, html.night .btn.primary, html.night .annun .NOMINAL { color: #000; }
html.night .annun .NOMINAL { background: transparent; color: var(--ok); }
.night-toggle[aria-pressed=true], .ck-btn[data-night-toggle][aria-pressed=true] { background: var(--accent); color: #000; }

/* ------------------------------------------------ medical triage */
.party-view-switch { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; margin-right: 12px; }
.party-view-switch .seg button { padding: 5px 10px; font-size: 13px; }
#members.triage { display: block; overflow-x: auto; }
.triage-table { min-width: 860px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.triage-table td { vertical-align: middle; }
.tri-badge { display: inline-block; font: 700 12px var(--mono); letter-spacing: .06em; padding: 3px 8px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line-2); }
.tri-down .tri-badge, .tri-critical .tri-badge { background: var(--bad); border-color: var(--bad); color: #fff; }
.tri-medic .tri-badge { background: var(--bad); border-color: var(--bad); color: #fff; animation: alert-pulse 1.2s ease-in-out infinite; }
.tri-hurt .tri-badge { background: var(--warn); border-color: var(--warn); color: #1b1002; }
.tri-ok .tri-badge { color: var(--ok); }
.tri-unknown { opacity: .55; }
.tri-down td, .tri-medic td { background: rgba(255, 90, 106, .07); }
.tri-bar { position: relative; display: grid; grid-template-columns: 28px 1fr 44px; align-items: center; gap: 6px; font: 12px var(--mono); min-width: 140px; }
.tri-bar i { display: block; height: 8px; border-radius: 4px; background: var(--faint); }
.tri-bar.ok i { background: var(--ok); } .tri-bar.warn i { background: var(--warn); } .tri-bar.bad i { background: var(--bad); }
.tri-bar span { color: var(--muted); } .tri-bar b { text-align: right; }
/* cockpit medic mode */
.ck-grid.medic { grid-template-columns: 1fr 1.6fr; grid-template-areas: "vitals party"; }
.ck-grid.medic .vehicle-only { display: none; }
.ck-grid.medic .ck-party .ck-pings { margin-top: 16px; }
.ck-tri { display: grid; grid-template-columns: minmax(0, 1.3fr) auto auto auto; gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 20px; }
.ck-tri-why { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.ck-tri-num b { font: 700 24px var(--mono); }
.ck-tri.tri-down, .ck-tri.tri-medic, .ck-tri.tri-critical { color: var(--bad); }
.ck-btn.on { background: var(--accent); color: #031019; }
@media (max-width: 900px), (orientation: portrait) { .ck-grid.medic { grid-template-columns: 1fr; grid-template-areas: "party" "vitals"; } }
.member .where { margin-top: 6px; color: var(--muted); }
.cb-died td { color: #ff9aa5; } .cb-kill td { color: var(--ok); } .cb-ship_destroyed td { color: var(--warn); }
.action-btn.unbound { opacity: .5; cursor: not-allowed; }
html.night .member.me, html.night .crew.mine, html.night .ship-suggest { border-color: var(--line-2); }
html.night input[type=text], html.night input[type=search], html.night input[type=number], html.night select, html.night pre, html.night code { background: #080000; border-color: var(--line-2); color: var(--text); }
html.night .ship-suggest { background: #100202; }
.run-options { display: grid; gap: 6px; margin: 6px 0 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.run-options .check { align-items: flex-start; }
.run-options .check input { margin-top: 4px; }

/* ------------------------------------------------ new site version notice */
.update-notice { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--accent); box-shadow: 0 12px 40px -10px #000; font-size: 15px; }
.update-notice span { flex: 1 1 240px; }
.cockpit .update-notice { font-size: 18px; }

/* ------------------------------------------------ notices (agent update) */
.alert-item.notice { margin-bottom: 14px; flex-wrap: wrap; }
.alert-item.notice span { font: 15px var(--sans); flex: 1 1 260px; }
@media (max-width: 760px) {
  .alert-item { flex-wrap: wrap; font-size: 15px; }
  .alert-item span { flex: 1 1 100%; order: 3; }
}

/* ------------------------------------------------ first-run checklist on Live */
.onboard { position: relative; overflow: hidden; margin-bottom: 16px; padding: 22px 24px; border-radius: 14px; border: 1px solid var(--line-2);
  background: radial-gradient(600px 220px at 100% 0%, rgba(63, 208, 255, .14), transparent 70%), linear-gradient(180deg, #0f1b2e, #0b1424);
  box-shadow: 0 20px 50px -30px #000, inset 0 1px 0 rgba(123, 227, 255, .08); }
.onboard h2 { font-size: 26px; margin: 2px 0 4px; }
.onboard-head p { margin: 0; max-width: 52em; }
.eyebrow { font: 700 12px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.checklist { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 15, 27, .6); transition: border-color .2s, opacity .2s; }
.checklist li p { margin: 4px 0 0; }
.checklist li > div > b { font-size: 17px; }
.checklist li > div { flex: 1; min-width: 0; }
.checklist .ck { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); color: var(--muted); font: 700 14px var(--mono); }
.checklist .ck .ic { display: none; width: 16px; height: 16px; stroke-width: 3; }
.checklist .ck i { font-style: normal; }
.checklist li.done { opacity: .75; }
.checklist li.done .ck { background: var(--ok); border-color: var(--ok); color: #04130c; }
.checklist li.done .ck .ic { display: block; }
.checklist li.done .ck i { display: none; }
.checklist li.active { border-color: var(--accent); background: rgba(63, 208, 255, .06); box-shadow: 0 0 0 1px rgba(63, 208, 255, .15); }
.checklist li.active .ck { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 14px -2px rgba(63, 208, 255, .6); }
.checklist li:not(.done) .step-done, .checklist li.done .step-todo { display: none; }
.checklist .copy-row { margin-top: 8px; }
.checklist .copy-row pre { margin: 0; }
#live-grid { transition: opacity .3s, filter .3s; }
#live-grid.awaiting { opacity: .4; filter: saturate(.5); }
html.night .onboard { background: var(--panel); }

/* ------------------------------------------------ setup steps */
.setup-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.setup-step { display: flex; gap: 18px; padding: 20px 22px; margin-bottom: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #0c1422); box-shadow: inset 0 1px 0 rgba(123, 227, 255, .05); }
.step-num { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 700 20px var(--mono);
  color: var(--accent); border: 1px solid var(--accent); background: rgba(63, 208, 255, .08); box-shadow: 0 0 18px -6px rgba(63, 208, 255, .7); }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 21px; margin: 6px 0 6px; }
.step-body > p:first-of-type { margin-top: 0; }
.copy-row.big pre { font-size: 14px; padding: 14px 92px 14px 16px; border-color: var(--line-2); }
.copy-row.big .btn { top: 9px; right: 9px; }
details.opts { margin: 12px 0 0; }
details.opts > summary { cursor: pointer; font-weight: 600; font-size: 16px; color: var(--text); list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
details.opts > summary::-webkit-details-marker { display: none; }
details.opts > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; display: inline-block; }
details.opts[open] > summary::before { transform: rotate(90deg); }
details.opts .run-options { margin-top: 10px; }
details.opts ul { margin: 8px 0 0; padding-left: 1.2em; }
details.opts li { margin: 4px 0; }
details.card { padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 0 0 10px; }
details.card[open] { padding-bottom: 16px; }
.callout { margin-top: 16px; padding: 12px 14px; border-radius: 8px; border: 1px solid #5a4520; background: rgba(255, 181, 71, .06); color: #e8d6b5; font-size: 15px; }
.callout .toolbar { margin: 10px 0 0; }
html.night .callout { color: var(--text); border-color: var(--line-2); background: var(--panel); }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; margin: 26px 0 10px; }
.flag-list { list-style: none; padding-left: 0 !important; }
.flag-list code { margin-right: 6px; }
.card.data-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.card.data-row p { margin: 0; flex: 1 1 260px; }
@media (max-width: 760px) {
  .setup-step { padding: 16px; gap: 12px; flex-direction: column; }
  .step-num { width: 34px; height: 34px; flex-basis: 34px; font-size: 17px; }
  .onboard { padding: 18px 16px; }
  .onboard h2 { font-size: 22px; }
  .checklist li { padding: 12px; gap: 10px; }
}
@media (max-width: 760px) {
  .copy-row pre, .copy-row.big pre { padding-right: 14px; margin-bottom: 0; }
  .copy-row .btn, .copy-row.big .btn { position: static; width: 100%; justify-content: center; margin: 6px 0 8px; padding: 9px; }
}
@media (max-width: 760px) { .statusbar .chip:has(#dot-site), .statusbar .chip:has(#st-age) { display: none; } }

/* ------------------------------------------------ beta site */
.beta-gate { max-width: 720px; margin: 60px auto; padding: 0 16px; }
.beta-tag { margin-left: -4px; }
