:root {
  --bg: #0a0a0c;
  --panel: #16161a;
  --panel-2: #1e1e23;
  --border: #2a2a30;
  --text: #f4f4f5;
  --text-dim: #9a9aa2;
  --accent: #ffffff;
  --glow: rgba(255, 255, 255, 0.18);
  --online: #34d399;
  --offline: #52525b;
  --danger: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand svg { width: 30px; height: 30px; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--offline);
  transition: background 0.2s;
}

.dot.online { background: var(--online); box-shadow: 0 0 8px var(--online); }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 4px 24px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 0 8px;
}

.power-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, #2a2a30, #0d0d10 70%);
  box-shadow: 0 0 0 1px var(--border), 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.power-btn svg { width: 60px; height: 60px; filter: drop-shadow(0 0 10px var(--glow)); }

.power-btn:active { transform: scale(0.96); }

.power-btn.on {
  box-shadow: 0 0 0 1px var(--online), 0 0 30px rgba(52, 211, 153, 0.35);
}

.hero-label {
  font-size: 15px;
  color: var(--text-dim);
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 4px 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.card-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 8px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.card-btn:active { background: var(--panel-2); }
.card-btn:disabled { opacity: 0.4; }

.card-btn.danger { color: var(--danger); }

.icon { width: 24px; height: 24px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }

.screen-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}

.screen-panel img {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16/9;
  object-fit: contain;
}

.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.toggle-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.placeholder {
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* first-run setup */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.setup-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setup-card h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.setup-card p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.6; }

.setup-card input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
}

.setup-card button {
  background: var(--accent);
  color: #0a0a0c;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show { opacity: 1; }

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  padding: 10px 0 4px;
}

footer button {
  background: none;
  border: none;
  color: var(--text-dim);
  text-decoration: underline;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
