:root {
  --bg: #0b0f1a;
  --panel: #121929;
  --accent: #38bdf8;
  --text: #e5eef7;
  --sub: #9fb4d1;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --offline: #ff5d5d;
}

* { box-sizing: border-box; }
html, body { margin:0; height:100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif; }

#app { display: grid; place-items: center; min-height: 100dvh; }

.card {
  width: min(420px, 92vw);
  background: linear-gradient(180deg, #121a2b, #0f1524);
  border: 1px solid #1f2b46;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.card h1 { margin: 0 0 8px; }
.card input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #243250; background: #0d1423; color: var(--text); outline: none; }
.card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.2); }
.card button { margin-top: 10px; width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--accent); color: #001322; border: none; font-weight: 700; cursor: pointer; }
.card .hint { color: var(--sub); font-size: .9rem; margin-top: 8px; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 14px; background: #0c1222; border-bottom: 1px solid #1e2b49; }
.brand { font-weight: 800; letter-spacing: .5px; }
.brand .ver { font-weight: 600; color: var(--sub); margin-left: 8px; font-size: .9em; }
.user { color: var(--sub); }

.status { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.dot-green { background: var(--ok); }
.dot-red { background: var(--danger); }
.dot-yellow { background: var(--warn); }
.ping { color: var(--sub); margin-left: 6px; font-variant-numeric: tabular-nums; }

.main { display: grid; grid-template-columns: 1fr 360px; gap: 12px; padding: 12px; width: min(1280px, 95vw); }
canvas#game { width: 100%; height: auto; background: #000; border: 1px solid #1e2b49; border-radius: 12px; }

.chat { display: grid; grid-template-rows: auto 1fr auto; background: var(--panel); border: 1px solid #1e2b49; border-radius: 12px; overflow: hidden; min-height: 480px; }
.chat-tabs { display:flex; gap:6px; padding:8px; background:#0f1628; border-bottom:1px solid #1e2b49; }
.tab-btn { padding:8px 10px; border-radius:8px; border:1px solid #2a3c64; background:#0f1b32; color:var(--text); cursor:pointer; }
.tab-btn.active { background:#163156; }
.chat-logs { position:relative; }
.chat-log { position:absolute; inset:0; padding:10px; overflow:auto; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 13px; display:none; }
.chat-log.active { display:block; }
.line { margin:0 0 .25rem 0; white-space:pre-wrap; word-wrap:break-word; }
.me   { opacity:.9; }
.sys  { color:#9fd3ff; }
.pm   { background:rgba(173,216,230,.10); border-left:3px solid rgba(173,216,230,.35); padding-left:.35rem; border-radius:4px; }

.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #1e2b49; }
.chat-form input { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid #253458; background: #0b1323; color: var(--text); }
.chat-form button { padding: 10px 14px; border-radius: 10px; border: 1px solid #2a3c64; background: #0f1b32; color: var(--text); cursor: pointer; }

.name-offline { color: var(--offline); }
.ship-offline { filter: grayscale(1) brightness(0.6) opacity(0.7); }
