/* The kettle's own look: matte black, one orange arc, thin white numerals.
   Single dark theme on purpose (it matches the kettle). Phone-first column. */
:root {
  --ground: #000000;
  --surface: #141414;
  --line: #262626;
  --line-strong: #2e2e2e;
  --text: #ffffff;
  --text-2: #d4d4d4;
  --muted: #a3a3a3;
  --dim: #5c5c5c;
  --orange: #ff5f00;
  --orange-text: #ff7a2e;
  --orange-wash: #2a1405;
  --ok: #3dd68c;
  --font: Figtree, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--ground); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange-text); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2 { text-wrap: balance; }

.app {
  max-width: 440px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 20px calc(env(safe-area-inset-bottom) + 88px);
}
.view { display: flex; flex-direction: column; gap: 20px; }

.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.topbar-title { display: flex; flex-direction: column; gap: 2px; }
.topbar-title .name { font-size: 17px; font-weight: 600; }
.topbar-title .sub { font-size: 12px; color: var(--muted); }
.page-title { margin: 0; font-size: 28px; font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.chip.chip-heat { background: var(--orange-wash); border-color: #5a2a0a; color: #ffb27f; }
.chip.chip-heat .dot { background: var(--orange); }
.chip.chip-idle .dot { background: var(--dim); }
.chip.chip-offline .dot { background: transparent; border: 1.5px solid var(--muted); }

/* dial */
.dial-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 8px; }
.dial { position: relative; width: min(320px, 82vw); aspect-ratio: 1; }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dial circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.arc-track { stroke: #1f1f1f; }
.arc { stroke: var(--dim); transition: stroke-dasharray .6s ease, stroke .3s; }
.dial.is-on .arc { stroke: var(--orange); }
.dial-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.dial-target { font-size: clamp(26px, 9vw, 34px); font-weight: 300; color: var(--text-2); }
.dial-temp { font-size: clamp(84px, 29vw, 112px); font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.dial-unit { font-size: clamp(24px, 8vw, 30px); font-weight: 300; margin-top: 6px; }
.dial-offline .dial-text span { color: var(--dim); }

.stepper { display: flex; align-items: center; gap: 24px; margin-top: -8px; }
.stepper-value { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.round { width: 52px; height: 52px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); font-size: 26px; line-height: 1; }
.round:active { background: #1f1f1f; }
.heat-line { margin: 4px 0 0; font-size: 15px; color: var(--text-2); text-align: center; }
.heat-line b { color: var(--text); font-weight: 600; }

/* presets */
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.presets button { height: 60px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.presets b { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.presets span { font-size: 11px; color: #bdbdbd; }
.presets button[aria-pressed="true"] { background: var(--orange-wash); border-color: var(--orange); }

/* heating cards */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.card-label { font-size: 12px; color: var(--muted); }
.card-value { font-size: 20px; font-weight: 500; }
.card-note { font-size: 11px; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.bars span { height: 4px; border-radius: 2px; background: #333; }
.bars span.on { background: var(--orange); }

/* buttons */
.actions { display: flex; flex-direction: column; gap: 10px; }
.btn { width: 100%; height: 58px; border-radius: 16px; border: none; font-size: 17px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--orange); color: #000; }
.btn-off { background: transparent; border: 1px solid var(--orange); color: var(--orange-text); }
.btn-outline { height: 50px; background: transparent; border: 1px solid var(--line-strong); font-size: 15px; font-weight: 400; }
.btn-quiet { height: 44px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 400; }
.btn-small { flex: none; white-space: nowrap; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--orange); background: transparent; color: var(--orange-text); font-size: 14px; font-weight: 600; }
.link { background: none; border: none; padding: 0; color: var(--text); text-decoration: underline; font-size: inherit; }

/* panels, rows, inputs */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.panel-flush { padding: 0; gap: 0; border-radius: 18px; }
.panel-flush > * + * { border-top: 1px solid var(--line); }
.group { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; }
.panel-flush .row { padding: 0 16px; }
.row-divider { border-top: 1px solid var(--line); padding-top: 16px; }
.row-text { display: flex; flex-direction: column; gap: 1px; font-size: 15px; }
.row-title { font-size: 17px; font-weight: 500; }
.row-slider { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.row-between { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; margin: 0; accent-color: var(--orange); height: 28px; }

.switch { flex: none; width: 52px; height: 32px; border-radius: 999px; border: none; background: #333; padding: 3px; display: flex; justify-content: flex-start; transition: background .2s; }
.switch span { width: 26px; height: 26px; border-radius: 50%; background: #fff; }
.switch[aria-checked="true"] { background: var(--orange); justify-content: flex-end; }

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--ground); border-radius: 10px; padding: 3px; width: 112px; }
.seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 200px; }
.seg button { height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--line-strong); color: var(--text); }

.big-time { text-align: center; font-size: 88px; font-weight: 300; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding: 8px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--muted); }
input[type=time], input[type=email], input[type=text], .input-unit { height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--ground); padding: 0 12px; font-size: 17px; width: 100%; }
.input-unit { display: flex; align-items: center; gap: 4px; }
.input-unit input { width: 100%; border: none; background: transparent; font-size: 17px; padding: 0; }
.input-unit input:focus-visible { outline: none; }
.input-unit:focus-within { outline: 2px solid var(--orange-text); outline-offset: 2px; }
.input-unit span { color: var(--muted); font-size: 15px; }
.input-small { width: 96px; height: 36px; border-radius: 10px; padding: 0 10px; }
.input-small input { text-align: right; font-size: 15px; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 14px; background: #0d0d0d; border: 1px solid #1f1f1f; color: var(--muted); }
.note svg { flex: none; margin-top: 1px; }
.note p { margin: 0; font-size: 12px; line-height: 1.5; }

.offline-text { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.offline-text h1 { margin: 0; font-size: 22px; font-weight: 500; }
.offline-text p { margin: 0; max-width: 300px; }
#off-body { font-size: 14px; line-height: 1.5; color: #bdbdbd; }

/* sign in */
.signin { min-height: 80vh; justify-content: center; }
.signin-body { display: flex; flex-direction: column; gap: 12px; }
.signin-body h1 { margin: 8px 0 0; font-size: 32px; font-weight: 500; }
.signin-body p { margin: 0 0 8px; }
.signin-mark { display: block; }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 440px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(0, 0, 0, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #1f1f1f;
}
.tabs a { height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; }
.tabs a[aria-current="page"] { color: var(--orange-text); font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%);
  max-width: min(400px, calc(100% - 32px)); padding: 12px 16px; border-radius: 14px;
  background: #1f1f1f; border: 1px solid var(--line-strong); font-size: 14px; line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- desktop (≥1024px): one dashboard, no tabs ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-ghost { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; text-decoration: none; }
.card-link { font-size: 12px; font-weight: 600; color: var(--orange-text); text-decoration: none; }
.card-link:hover { color: #ffb27f; }
.layout { display: flex; flex-direction: column; }

@media (max-width: 1023px) {
  .desk-only { display: none !important; }
}
.app:not(.signed-in) .desk-only { display: none !important; }

@media (min-width: 1024px) {
  .mobile-only, .tabs { display: none !important; }
  .app { max-width: 1320px; padding: 28px 40px 32px; display: flex; flex-direction: column; gap: 28px; }

  .desk-header { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
  .brand { display: flex; align-items: center; gap: 14px; }
  .brand-name { font-size: 20px !important; }
  .desk-header-right { display: flex; align-items: center; gap: 14px; }
  .desk-header .chip { font-size: 13px; padding: 7px 14px; }

  .layout { flex-direction: row; flex-wrap: wrap; gap: 24px; align-items: stretch; }
  .main-col { flex: 1 1 420px; display: flex; }
  .side-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
  .main-col > .view:not(.signin) { flex: 1; background: #0a0a0a; border: 1px solid #1f1f1f; border-radius: 28px; padding: 36px 32px; align-items: center; justify-content: center; gap: 22px; }
  .main-col .signin { flex: 1; max-width: 400px; margin: 0 auto; }
  .main-col .dial-wrap { width: 100%; }
  .main-col .dial { width: min(420px, 100%); }
  .main-col .dial-temp { font-size: 148px; letter-spacing: -.03em; }
  .main-col .dial-target { font-size: 40px; }
  .main-col .dial-unit { font-size: 34px; }
  .main-col .dial circle { stroke-width: 8; }
  .main-col .presets, .main-col .actions, .main-col .offline-text { width: 100%; max-width: 420px; }
  .main-col .presets button { height: 64px; }

  /* chart */
  .chart-card { background: #0a0a0a; border: 1px solid #1f1f1f; border-radius: 28px; padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 18px; }
  .chart-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
  .chart-read { display: flex; flex-direction: column; gap: 4px; }
  .chart-now { display: flex; align-items: baseline; gap: 12px; font-variant-numeric: tabular-nums; }
  .chart-now > span:first-child { font-size: 44px; font-weight: 300; line-height: 1; }
  .chart-rate { font-size: 15px; color: var(--orange-text); }
  .chart-rate.falling { color: var(--muted); }
  .chart-eta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .chart-eta-value { font-size: 28px; font-variant-numeric: tabular-nums; }
  .chart-body { display: flex; gap: 12px; }
  .chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 220px; width: 28px; font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; margin-top: -6px; margin-bottom: 26px; }
  .chart-plot-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
  .chart-plot { position: relative; height: 220px; }
  .chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .chart-plot line { stroke: #1f1f1f; vector-effect: non-scaling-stroke; }
  .chart-plot line.chart-target { stroke: #8a8a8a; stroke-dasharray: 6 6; }
  .chart-area { fill: var(--orange); fill-opacity: .12; }
  .chart-line { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
  .chart-dot { position: absolute; right: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 5px rgba(255, 95, 0, .22); transform: translateY(-50%); }
  .chart-target-label { position: absolute; left: 8px; font-size: 11px; color: var(--muted); transform: translateY(-130%); }
  .chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

  .desk-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .desk-cards .card { border-radius: 20px; padding: 18px; gap: 8px; }
  .desk-cards .card-value { font-size: 24px; font-variant-numeric: tabular-nums; }
  .desk-cards .card-note { font-size: 12px; }

  /* settings: one panel, three groups side by side */
  #view-settings { background: #0a0a0a; border: 1px solid #1f1f1f; border-radius: 28px; padding: 22px 28px 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px 20px; align-items: start; }
  #view-settings > .topbar { grid-column: 1 / -1; min-height: 0; align-items: baseline; }
  #view-settings .page-title { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  #view-settings .seg-3 { width: 180px; }

  /* schedule: a panel over the dashboard */
  #view-schedule { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 440px; max-height: calc(100% - 48px); overflow: auto; z-index: 20; background: #0a0a0a; border: 1px solid var(--line-strong); border-radius: 28px; padding: 24px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .72); }

  .desk-footer { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
  .keys { display: flex; flex-wrap: wrap; gap: 18px; }
  .keys span { display: flex; align-items: center; gap: 6px; }
  kbd { font-family: inherit; font-size: 11px; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); }

  .toast { bottom: 32px; }
}
