:root {
  color-scheme: dark;
  --bg0: #020617;
  --bg1: #0f172a;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --muted2: #64748b;
  --accent: #7dd3fc;
  --accent2: #a78bfa;
  --danger: #fb7185;
  --success: #86efac;
  --shadow: rgba(0, 0, 0, 0.36);
  --radius: 28px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.18), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(167, 139, 250, 0.18), transparent 30rem),
    linear-gradient(135deg, var(--bg0), var(--bg1));
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.hero-card {
  width: min(680px, 100%);
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 72px var(--shadow);
  backdrop-filter: blur(20px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.9), rgba(167, 139, 250, 0.9));
  color: #020617;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-name {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 58px);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.lead {
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: clamp(16px, 3.5vw, 19px);
}

.main-action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.primary-button,
.toggle-button,
.secondary-button {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.primary-button:active,
.toggle-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button {
  min-height: 74px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #020617;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.primary-button.running {
  background: linear-gradient(135deg, #fda4af, #fb7185);
}

.toggle-button {
  min-height: 54px;
  padding: 13px 16px;
  background: rgba(30, 41, 59, 0.95);
  color: var(--text);
  font-weight: 800;
}

.toggle-button.on {
  background: rgba(56, 189, 248, 0.18);
  color: #bae6fd;
  outline: 1px solid rgba(125, 211, 252, 0.34);
}

.controls {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}

.control-block {
  display: grid;
  gap: 12px;
}

.control-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
}

.control-topline strong {
  color: var(--text);
  font-size: 20px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.meter-wrap {
  height: 12px;
  margin-top: 24px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.meter-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent), var(--accent2));
  transition: width 0.06s linear;
}

.phase-text {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-box {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.42);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.68;
  white-space: pre-line;
}

.details-panel {
  margin-top: 18px;
  color: var(--muted);
}

.details-panel summary {
  cursor: pointer;
  user-select: none;
}

.diagnostic-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.secondary-button {
  min-height: 44px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.95);
  color: var(--text);
}

.secondary-button.danger {
  color: #fecdd3;
}

.tiny-note {
  margin: 10px 0 0;
  color: var(--muted2);
  font-size: 12px;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #7f1d1d;
  color: #fff;
}

@media (min-width: 600px) {
  .main-action-row {
    grid-template-columns: 1fr 1fr;
  }

  .primary-button {
    grid-row: span 2;
  }
}
