:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card2: #273449;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --on: #22c55e;
  --off: #475569;
  --error: #f87171;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

#app {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.5rem; margin: 8px 0 4px; }
.muted { color: var(--muted); font-size: 0.9rem; margin: 6px 0; }
.hidden { display: none !important; }
.screen { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* --- login --- */
#login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
#code {
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--card2);
  background: var(--card);
  color: var(--text);
}
#code:focus { outline: none; border-color: var(--accent); }
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  color: var(--text);
}
#unlock {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #06283d;
}
#unlock:disabled { opacity: 0.5; }
.error { color: var(--error); min-height: 1.2em; font-size: 0.95rem; }

/* --- controls --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
}
.row { display: flex; align-items: center; justify-content: space-between; }
.label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.reading { font-size: 1.1rem; margin-top: 14px; }

.power {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 92px;
  padding: 14px 18px;
  border-radius: 999px;
  background: var(--off);
  transition: background 0.2s;
}
.power.on { background: var(--on); }

.stepper { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.step {
  width: 64px; height: 64px;
  font-size: 2rem;
  border-radius: 50%;
  background: var(--card2);
}
.step:active { background: var(--accent); color: #06283d; }
.step:disabled { opacity: 0.35; }
.target { font-size: 3rem; font-weight: 700; }
.target .deg { font-size: 1.4rem; color: var(--muted); }

.fan-row { display: flex; gap: 10px; margin-top: 12px; }
.fan-btn {
  flex: 1;
  padding: 16px 0;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  background: var(--card2);
}
.fan-btn.active { background: var(--accent); color: #06283d; }

/* 15s lock between changes — dim to signal the control is briefly unavailable */
.power.locked, .fan-row.locked { opacity: 0.5; transition: opacity 0.2s; }

/* small live countdown shown next to the control label while locked */
.cd { margin-left: 8px; font-size: 0.78rem; letter-spacing: normal; color: var(--accent); text-transform: none; }

.status { text-align: center; min-height: 1.4em; color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.status.err { color: var(--error); }
.status.ok { color: var(--on); }
