*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --on: #22c55e;
  --off: #475569;
}

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

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.online  { background: #166534; color: #86efac; }
.badge.offline { background: #7f1d1d; color: #fca5a5; }

#offline-bar {
  background: #451a03;
  border: 1px solid #92400e;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #fde68a;
}

#offline-bar a {
  color: #fbbf24;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  margin-left: 12px;
}

#relays {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.relay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.relay-card.on {
  border-color: var(--on);
  background: #052e16;
}

.relay-info { display: flex; flex-direction: column; gap: 4px; }

.relay-name {
  font-size: 1rem;
  font-weight: 600;
}

.relay-status {
  font-size: 0.8rem;
  color: var(--muted);
}

.relay-card.on .relay-status { color: var(--on); }

.toggle {
  width: 52px;
  height: 30px;
  background: var(--off);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.relay-card.on .toggle { background: var(--on); }

.toggle::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  top: 4px;
  left: 4px;
  transition: transform 0.2s;
}

.relay-card.on .toggle::after { transform: translateX(22px); }
