/* ── Reset & base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3350;
  --text:      #e2e8f0;
  --muted:     #8892b0;
  --green:     #4ade80;
  --red:       #f87171;
  --yellow:    #fbbf24;
  --blue:      #60a5fa;
  --accent:    #7c3aed;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header { text-align: center; }
header h1 { font-size: 2rem; font-weight: 700; color: var(--text); }
.subtitle { color: var(--muted); font-size: 0.95rem; margin-top: 0.25rem; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.status-card,
.players-card,
.controls-card,
.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* ── Status rows ────────────────────────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }

.label { color: var(--muted); font-size: 0.9rem; }
.value { font-weight: 500; }

/* ── Address ────────────────────────────────────────────────────────── */
.address-group { display: flex; align-items: center; gap: 0.5rem; }
.address {
  font-family: 'Courier New', monospace;
  background: var(--surface2);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--blue);
}
.copy-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: var(--border); }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-online  { background: rgba(74, 222, 128, 0.15); color: var(--green); border: 1px solid var(--green); }
.badge-offline { background: rgba(248, 113, 113, 0.15); color: var(--red);   border: 1px solid var(--red); }
.badge-starting,
.badge-stopping { background: rgba(251, 191, 36, 0.15);  color: var(--yellow); border: 1px solid var(--yellow); }
.badge-loading { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

/* ── Players list ───────────────────────────────────────────────────── */
.players-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.players-list li {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.75rem;
  font-size: 0.9rem;
  color: var(--green);
}

/* ── Control buttons ────────────────────────────────────────────────── */
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.btn {
  flex: 1 1 auto;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-start   { background: var(--green);  color: #000; }
.btn-stop    { background: var(--red);    color: #000; }
.btn-restart { background: var(--yellow); color: #000; }

.control-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2rem;
}

/* ── History table ──────────────────────────────────────────────────── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.history-table th {
  color: var(--muted);
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.history-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.history-table tr:last-child td { border-bottom: none; }

.loading-text { color: var(--muted); font-size: 0.9rem; }

/* ── Footer ─────────────────────────────────────────────────────────── */
footer { text-align: center; color: var(--muted); font-size: 0.8rem; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .status-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .btn-group  { flex-direction: column; }
}
