:root {
  --bg: #0d0f14;
  --surface: #161a22;
  --surface-2: #1e232d;
  --line: #2a313d;
  --text: #e8ecf3;
  --muted: #98a2b3;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.14);
  --ok: #3ddc97;
  --warn: #f5a524;
  --err: #f4696b;
  --radius: 14px;
}

:root:not([data-theme="dark"]) {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(110, 168, 254, 0.16), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(61, 220, 151, 0.10), transparent 55%);
}

#lobby {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 64px;
}

header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 7vw, 42px);
  letter-spacing: -0.02em;
  font-weight: 700;
}

header h1 span {
  color: var(--accent);
  font-weight: 400;
}

.tagline {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 16px;
  max-width: 52ch;
}

.tagline strong { color: var(--text); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
  box-shadow: 0 0 0 4px rgba(152, 162, 179, 0.14);
}

.dot.ok   { background: var(--ok);   box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.16); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 165, 36, 0.16); }
.dot.err  { background: var(--err);  box-shadow: 0 0 0 4px rgba(244, 105, 107, 0.16); }

.model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.model {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.model-row { display: flex; gap: 8px; align-items: stretch; }
.model-row .model { flex: 1; min-width: 0; }

.model-delete,
.link-btn {
  width: auto;
  flex: none;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.model-delete:hover { color: var(--err); border-color: var(--err); }
.link-btn { padding: 4px 12px; }
.link-btn:hover { color: var(--text); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; white-space: nowrap; }
.card-head + .model-list { margin-top: 12px; }

.badge.cloud { background: var(--accent-soft); color: var(--accent); }

.model:hover { border-color: var(--line); }

.model[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.model .name { font-weight: 600; }

.model .meta {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(61, 220, 151, 0.16);
  color: var(--ok);
  vertical-align: 1px;
}

.filedrop {
  display: block;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.filedrop:hover { border-color: var(--accent); background: var(--accent-soft); }
.filedrop strong { display: block; font-size: 15px; }
.filedrop span { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }

button {
  width: 100%;
  padding: 15px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  color: #0b1020;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}

button:hover:not(:disabled) { opacity: 0.9; }
button:active:not(:disabled) { transform: translateY(1px); }

button:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

.muted { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.controls dl {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}

.controls dt { color: var(--accent); font-weight: 600; }
.controls dd { margin: 0; color: var(--muted); }

footer { margin-top: 28px; }

#hud {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: rgba(13, 15, 20, 0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  pointer-events: none;
  z-index: 10;
}

@media (max-width: 480px) {
  #lobby { padding: 28px 16px 48px; }
  .model { flex-direction: column; gap: 3px; }
  .controls dl { grid-template-columns: 1fr; gap: 2px 0; }
  .controls dd { margin-bottom: 8px; }
}
