:root {
  color-scheme: light;
  --ink: #27312d;
  --ink-soft: #66706b;
  --paper: #f5f1ea;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(39, 49, 45, 0.11);
  --sage: #668276;
  --sage-dark: #486358;
  --sage-pale: #dce8e1;
  --amber: #dca85e;
  --amber-pale: #f7ead4;
  --danger: #9a4f48;
  --shadow: 0 18px 55px rgba(54, 65, 59, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(231, 204, 165, 0.34), transparent 32rem),
    radial-gradient(circle at 88% 84%, rgba(142, 176, 158, 0.25), transparent 30rem),
    var(--paper);
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(102, 130, 118, 0.35);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 19rem;
  height: 19rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.25;
}
.ambient-one { top: -7rem; right: -5rem; background: #dfb26f; }
.ambient-two { bottom: -7rem; left: -5rem; background: #8db4a1; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 480px);
  padding: clamp(30px, 7vw, 52px);
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 34px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.centered { text-align: center; }

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 19px;
  color: white;
  background: var(--sage);
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(72, 99, 88, .24);
}
.brand-mark.muted { margin-inline: auto; background: #89938e; }
.brand-mark.small { width: 42px; height: 42px; border-radius: 14px; font-size: 25px; }

.eyebrow {
  margin: 26px 0 8px;
  color: var(--sage-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(2rem, 8vw, 3.15rem); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: clamp(1.65rem, 5vw, 2.35rem); letter-spacing: -.035em; }
h3 { margin-bottom: 6px; font-size: 1rem; }
.welcome-copy { color: var(--ink-soft); line-height: 1.65; }

form { margin-top: 28px; }
label { display: block; margin-bottom: 9px; font-size: .85rem; font-weight: 750; }
input[type="password"] {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255,255,255,.92);
  font-size: 1.25rem;
  letter-spacing: .25em;
}

.primary-button, .secondary-button, .quiet-button, .icon-button, .scene-button,
.radio-button, .light-toggle, .brand-button, .room-card, .back-button {
  border: 0;
  cursor: pointer;
}
.primary-button {
  width: 100%;
  margin-top: 14px;
  padding: 16px 20px;
  border-radius: 16px;
  color: white;
  background: var(--sage-dark);
  font-weight: 800;
}
.primary-button:hover { background: #3c554b; }
.secondary-button { padding: 13px 20px; border-radius: 14px; background: var(--sage-pale); font-weight: 750; }
.form-message { min-height: 1.4em; margin: 14px 0 0; color: var(--danger); font-size: .88rem; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 234, .86);
  backdrop-filter: blur(18px);
}
.brand-button { display: flex; align-items: center; gap: 11px; padding: 0; text-align: left; background: transparent; }
.brand-button strong, .brand-button small { display: block; }
.brand-button strong { font-size: .95rem; }
.brand-button small { margin-top: 2px; color: var(--ink-soft); font-size: .72rem; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.quiet-button { padding: 11px 13px; border-radius: 13px; background: rgba(255,255,255,.72); font-size: .82rem; font-weight: 750; }
.icon-button { width: 42px; height: 42px; border-radius: 13px; background: rgba(255,255,255,.72); font-size: 1.2rem; }

.content { width: min(100%, 1180px); margin: 0 auto; padding: clamp(28px, 5vw, 58px) 18px 70px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 22px; margin-bottom: 30px; }
.hero p { margin-bottom: 0; color: var(--ink-soft); line-height: 1.6; }
.temperature-pair { display: flex; gap: 10px; }
.temperature-pill { min-width: 104px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.temperature-pill small { display: block; color: var(--ink-soft); font-size: .7rem; }
.temperature-pill strong { display: block; margin-top: 2px; font-size: 1.2rem; }

.status-row { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 28px; }
.status-chip { padding: 9px 13px; border-radius: 999px; background: var(--sage-pale); color: var(--sage-dark); font-size: .78rem; font-weight: 800; }
.status-chip.warning { background: var(--amber-pale); color: #7b5625; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 34px 0 16px; }
.section-heading p { margin: 0; color: var(--ink-soft); font-size: .84rem; }
.room-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.room-card {
  position: relative;
  min-height: 176px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 25px;
  background: var(--card);
  box-shadow: 0 8px 28px rgba(62,70,66,.07);
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}
.room-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(62,70,66,.12); }
.room-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 15px; background: var(--sage-pale); font-size: 1.25rem; }
.room-card h3 { margin-top: 28px; font-size: 1.08rem; }
.room-meta { color: var(--ink-soft); font-size: .83rem; }
.room-arrow { position: absolute; right: 18px; bottom: 17px; color: var(--sage-dark); font-weight: 900; }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.feature-card { padding: 22px; border: 1px solid rgba(255,255,255,.82); border-radius: 25px; background: var(--card); }
.feature-card p { color: var(--ink-soft); line-height: 1.55; }
.radio-button { padding: 12px 16px; border-radius: 14px; color: white; background: var(--sage-dark); font-weight: 800; }

.room-header { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.back-button { display: grid; flex: 0 0 auto; width: 44px; height: 44px; place-items: center; border-radius: 14px; background: var(--card); font-size: 1.25rem; }
.room-header p { margin: 2px 0 0; color: var(--ink-soft); }
.climate-line { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.climate-card { min-width: 130px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.climate-card small { display: block; color: var(--ink-soft); }
.climate-card strong { font-size: 1.25rem; }

.light-list { display: grid; gap: 12px; }
.light-row { padding: 18px; border: 1px solid rgba(255,255,255,.82); border-radius: 22px; background: var(--card); }
.light-row-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.light-identity { display: flex; align-items: center; gap: 12px; }
.light-dot { width: 38px; height: 38px; border-radius: 13px; background: #e6e8e6; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.light-row.on .light-dot { background: #f6d18d; box-shadow: 0 5px 20px rgba(220,168,94,.35); }
.light-identity small { display: block; margin-top: 2px; color: var(--ink-soft); }
.light-toggle { min-width: 70px; padding: 10px 13px; border-radius: 13px; background: #e8ece9; font-size: .78rem; font-weight: 850; }
.light-row.on .light-toggle { color: #66491f; background: var(--amber-pale); }
.slider-wrap { display: grid; grid-template-columns: 1fr 48px; align-items: center; gap: 13px; margin-top: 15px; }
input[type="range"] { width: 100%; accent-color: var(--amber); cursor: pointer; }
.slider-value { color: var(--ink-soft); font-size: .8rem; text-align: right; }

.scene-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.scene-button { padding: 11px 14px; border-radius: 14px; background: var(--sage-pale); color: var(--sage-dark); font-size: .82rem; font-weight: 800; }

.departure-card { max-width: 780px; padding: clamp(24px, 6vw, 42px); border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.step-list { display: grid; gap: 18px; margin: 28px 0; padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 38px 1fr; gap: 13px; }
.step-number { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: white; background: var(--sage); font-weight: 850; }
.step p { margin: 2px 0 0; color: var(--ink-soft); line-height: 1.6; }
.code-box { padding: 16px 18px; border-radius: 17px; background: var(--amber-pale); }
.code-box strong { font-size: 1.35rem; letter-spacing: .16em; }
.note-box { margin-top: 18px; padding: 16px 18px; border-left: 4px solid var(--sage); border-radius: 8px 16px 16px 8px; background: var(--sage-pale); line-height: 1.55; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(360px, calc(100vw - 36px)); padding: 13px 16px; border-radius: 14px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 860px) {
  .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .temperature-pair { justify-self: start; }
}

@media (max-width: 560px) {
  .topbar { padding: 11px 13px; }
  .brand-button small { display: none; }
  .quiet-button { max-width: 112px; padding: 9px 10px; }
  .content { padding: 28px 14px 60px; }
  .room-grid { gap: 10px; }
  .room-card { min-height: 148px; padding: 16px; border-radius: 21px; }
  .room-card h3 { margin-top: 20px; }
  .feature-grid { grid-template-columns: 1fr; }
  .temperature-pair { width: 100%; }
  .temperature-pill { flex: 1; }
  .login-card { border-radius: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
