:root {
  --bg: #0f172a;
  --panel: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --success: #22c55e;
  --danger: #f43f5e;
  --border: rgba(148, 163, 184, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 25%),
              linear-gradient(180deg, #020617 0%, #0f172a 100%);
  color: var(--text);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 2.6rem);
}

p {
  margin: 0;
  color: var(--muted);
}

.status-bar {
  display: grid;
  gap: 0.75rem;
  align-items: center;
  justify-items: end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 0.9rem;
}

.badge.connected {
  background: rgba(34, 197, 94, 0.18);
  color: #d9f99d;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 20px;
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.primary,
.secondary {
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  color: #0f172a;
  background: #38bdf8;
}

.secondary {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 0.35rem;
  background: rgba(30, 41, 59, 0.8);
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 14px;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.cell:hover {
  transform: translateY(-1px);
  background: rgba(56, 189, 248, 0.14);
}

input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: #38bdf8;
  cursor: pointer;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.75);
  z-index: 20;
}

.modal {
  width: min(420px, calc(100vw - 32px));
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.modal p {
  margin: 0 0 20px;
  color: var(--muted);
}

.modal input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #020617;
  color: var(--text);
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: 90vw;
  padding: 14px 18px;
  border-radius: 14px;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  z-index: 30;
}

.toast.hidden {
  display: none;
}

.toast.info {
  background: rgba(56, 189, 248, 0.2);
}

.toast.success {
  background: rgba(34, 197, 94, 0.18);
}

.toast.error {
  background: rgba(244, 63, 94, 0.2);
}

@media (max-width: 720px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-bar {
    justify-items: start;
  }
}
