* { box-sizing: border-box; }

:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5e7eb;
  background: #0f172a;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #111827, #020617);
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

header { margin-bottom: 20px; }
h1 { margin: 0 0 8px; font-size: clamp(28px, 7vw, 42px); }
h2 { margin-top: 0; }
p { color: #cbd5e1; line-height: 1.5; }

.card {
  background: rgba(30, 41, 59, .9);
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.2);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  font-weight: 700;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #64748b;
}
.dot.on { background: #22c55e; box-shadow: 0 0 15px #22c55e; }

.meter {
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #475569;
}

#meterFill {
  width: 0%;
  height: 100%;
  transition: width .06s linear;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6);
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin: 6px 2px 20px;
}

.controls { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 7px;
  color: #e2e8f0;
  font-weight: 600;
}

input[type="range"] { width: 100%; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #334155;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: #7c3aed; }
button:active:not(:disabled) { transform: scale(.98); }

#test { grid-column: 1 / -1; }

.message {
  margin-bottom: 0;
  padding: 12px;
  background: #0f172a;
  border-radius: 12px;
  font-size: 14px;
}

.pattern {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 70px;
  padding: 15px;
  background: #0f172a;
  border-radius: 14px;
  color: #94a3b8;
}

#patternText {
  color: #f8fafc;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

footer {
  text-align: center;
  padding: 10px;
  color: #64748b;
}

@media (max-width: 480px) {
  .buttons { grid-template-columns: 1fr; }
  #test { grid-column: auto; }
}

