:root {
  --bg: #0b1d2a; --card: #132c3d; --card2: #1a394e; --line: #24475f;
  --text: #eef6fa; --dim: #8fb0c2; --accent: #35c2c9; --hot: #ff8a4c; --ok: #5fd38d; --bad: #ff6b6b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; }
main { max-width: 520px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 92px); }
h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 26px 4px 10px; font-weight: 600; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
.card { background: var(--card); border-radius: 20px; padding: 18px; }
.muted { color: var(--dim); font-size: 14px; }
.banner { background: #4a2326; color: #ffd0d0; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }

/* hero */
.hero { text-align: center; padding: 24px 18px 18px; background: linear-gradient(160deg, #17475c, #132c3d 70%); }
.hero.heating { background: linear-gradient(160deg, #7a3d1f, #132c3d 75%); }
.hero.ready { background: linear-gradient(160deg, #1f6b4a, #132c3d 75%); }
.hero .label { color: var(--dim); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
.hero .temp { font-size: 104px; font-weight: 200; line-height: 1; margin: 6px 0 4px; letter-spacing: -3px; font-variant-numeric: tabular-nums; }
.hero .temp sup { font-size: 44px; vertical-align: top; position: relative; top: 12px; margin-left: 2px; }
.hero .status { font-size: 17px; min-height: 24px; }
.hero .status b { font-weight: 600; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 18px; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 28px; line-height: 1; }
.stepper button:active { background: rgba(255,255,255,.22); }
.stepper .sp { min-width: 110px; }
.stepper .sp div:first-child { font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stepper .sp div:last-child { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px 16px; }
.tile .v { font-size: 30px; font-weight: 300; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--dim); font-size: 13px; }

.scenes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scene { background: var(--card2); border-radius: 16px; padding: 18px 14px; font-size: 17px; font-weight: 600; text-align: left; min-height: 68px; border: 1px solid var(--line); }
.scene:active { background: var(--accent); color: #062028; }
.scene.busy { opacity: .5; }

.rows { background: var(--card); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); min-height: 58px; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row small { display: block; color: var(--dim); font-size: 13px; }

.sw { position: relative; width: 54px; height: 32px; border-radius: 16px; background: #3a566a; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; }
.sw.on { background: var(--ok); }
.sw.on::after { transform: translateX(22px); }

.btn { background: var(--accent); color: #062028; font-weight: 600; border-radius: 12px; padding: 12px 16px; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--bad); padding: 8px 10px; }
.btn.wide { width: 100%; margin-top: 12px; }
input, select { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; -webkit-user-select: text; user-select: text; }
input[type=number] { width: 84px; text-align: center; }
.form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; }
.form span { color: var(--dim); }

details { border-top: 1px solid var(--line); }
details:first-child { border-top: 0; }
summary { padding: 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "Edit"; color: var(--accent); font-weight: 500; font-size: 14px; }
details[open] summary::after { content: "Close"; }
.edit { padding: 0 16px 16px; display: grid; gap: 10px; }
.edit label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 15px; }
.edit input[type=text] { width: 100%; }
.edit .actions { display: flex; justify-content: space-between; margin-top: 6px; }

.log .row { display: block; }
.log time { color: var(--dim); font-size: 12px; }

nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(11,29,42,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px); }
nav[hidden] { display: none; }
nav button { flex: 1; color: var(--dim); font-size: 12px; display: grid; justify-items: center; gap: 3px; padding: 4px 0; }
nav button.on { color: var(--accent); }
nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.login { min-height: 80vh; display: grid; place-content: center; gap: 14px; text-align: center; }
.login h1 { font-weight: 300; font-size: 34px; margin: 0; }
.login input { text-align: center; font-size: 20px; width: 240px; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%);
  background: #06141d; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; max-width: 86vw; text-align: center; font-size: 15px; z-index: 5; }
#toast[hidden] { display: none; }
