:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --line: #2a323d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #4ea1ff;
  --danger: #ff6b6b;
  --ok: #5ed46a;
  --radius: 10px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: #222c38;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06121f;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: #6fb4ff;
}

button.small {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  min-width: 0;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "Cascadia Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* --- landing page ------------------------------------------------------ */

.landing {
  max-width: 34rem;
  margin: 12vh auto;
  padding: 0 1.25rem;
}

.landing h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.landing .sub {
  margin: 0 0 2rem;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.row > input[type="text"] {
  flex: 1;
}

.notice {
  margin-top: 0.75rem;
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--danger);
}

.code-out {
  margin-top: 1rem;
  padding: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.code-out .code {
  font-size: 1.7rem;
  letter-spacing: 0.25em;
  font-weight: 700;
}

/* --- map page ---------------------------------------------------------- */

.map-layout {
  display: grid;
  grid-template-columns: 1fr 20rem;
  height: 100vh;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1rem;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  max-width: min(100%, calc(100vh - 2rem));
  max-height: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0d12;
  touch-action: none;
}

#map.armed {
  cursor: crosshair;
  border-color: var(--accent);
}

.sidebar {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.team-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot.live {
  background: var(--ok);
}

.dot.down {
  background: var(--danger);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--panel-2);
  border-radius: 8px;
  font-size: 0.88rem;
}

.list li .swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex: none;
}

.list li .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list li.offline .name {
  color: var(--muted);
}

.empty {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.3rem 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.spacer {
  flex: 1;
}

@media (max-width: 820px) {
  .map-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}
