:root {
  color-scheme: light;
  --ink: #17211e;
  --muted: #66716d;
  --line: #d9dfdc;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --green: #176b50;
  --green-dark: #124b3a;
  --green-soft: #e4f1eb;
  --yellow: #f1bd49;
  --danger: #a33d34;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; background: var(--canvas); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button, select, textarea, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.content-width {
  width: min(760px, calc(100% - 36px));
  margin: 0 auto;
}

.site-header {
  height: 50px;
  color: #eaf3ef;
  background: #18392f;
}

.header-inner {
  width: min(760px, calc(100% - 36px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
}

.brand-mark { width: 25px; height: 25px; }

.title-band {
  padding: 31px 0 28px;
  color: #fff;
  background: var(--green-dark);
  border-bottom: 5px solid var(--yellow);
}

.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.date-line { margin: 0 0 6px; color: #bcd4ca; font-size: 14px; font-weight: 650; }
h1 { margin: 0; font-size: 36px; line-height: 1.1; font-weight: 850; }

.live-mark {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 4px;
  color: #d5e5df;
  font-size: 12px;
  white-space: nowrap;
}

.live-mark span { width: 8px; height: 8px; border-radius: 50%; background: #6fd29f; box-shadow: 0 0 0 4px rgb(111 210 159 / 15%); }

.control-section, .results-section { background: var(--paper); border-bottom: 1px solid var(--line); }
.control-section { padding: 26px 0 28px; }
.building-section { background: #f9fbfa; }

.section-heading { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.section-heading output { flex: 0 0 auto; margin-left: auto; color: var(--green-dark); font-size: 15px; font-weight: 800; white-space: nowrap; }
.section-note { color: var(--muted); font-size: 13px; }

.range-control {
  --range-left: 0%;
  --range-right: 0%;
  --thumb-center: 15px;
  position: relative;
  height: 42px;
  margin: 0 10px;
}

.range-rail {
  position: absolute;
  top: 19px;
  left: var(--thumb-center);
  right: var(--thumb-center);
  height: 7px;
  border-radius: 3px;
  background: #b9c5bf;
}

.range-fill {
  position: absolute;
  inset: 0 var(--range-right) 0 var(--range-left);
  background: var(--green);
  border-radius: 3px;
}

.range-control input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0;
  appearance: none;
  pointer-events: none;
  background: transparent;
}

.range-control input[type="range"]::-webkit-slider-thumb {
  width: 30px;
  height: 30px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 1px 7px rgb(18 75 58 / 35%);
  pointer-events: auto;
}

.range-control input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 1px 7px rgb(18 75 58 / 35%);
  pointer-events: auto;
}

.range-control input[type="range"]::-moz-range-track { background: transparent; }
.time-scale {
  position: relative;
  height: 36px;
  margin: -5px 10px 3px;
  color: #68736e;
  font-size: 11px;
}
.time-ticks {
  position: absolute;
  inset: 0 15px;
  display: flex;
  justify-content: space-between;
}
.time-ticks i {
  width: 1px;
  height: 7px;
  background: #aeb9b4;
}
.time-labels {
  position: absolute;
  inset: 0 15px;
}
.time-labels span {
  position: absolute;
  top: 12px;
  left: var(--position);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
  transform: translateX(-50%);
}
.time-labels span:first-child { transform: none; }
.time-labels span:last-child { transform: translateX(-100%); }
.range-meta { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; color: var(--muted); font-size: 12px; }
.range-meta span:nth-child(2) { color: var(--green); font-weight: 750; }
.range-meta span:last-child { text-align: right; }

.building-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.building-button {
  min-width: 0;
  height: 66px;
  padding: 0 5px;
  border: 1px solid #cbd5d0;
  border-radius: 7px;
  color: #34413c;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}
.building-button:hover:not(:disabled) { border-color: var(--green); transform: translateY(-1px); }
.building-button.is-active { color: #fff; border-color: var(--green); background: var(--green); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 12%); }
.building-button:disabled { color: #9ca5a1; border-color: #e0e4e2; background: #e9ecea; }
.building-button small { display: block; margin-top: 2px; font-size: 10px; font-weight: 650; }

.results-section { min-height: 340px; padding: 28px 0 38px; }
.results-heading { align-items: flex-start; margin-bottom: 18px; }
.results-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.room-count { min-width: 49px; color: var(--green); font-size: 36px; line-height: 1; text-align: right; }
.room-results { min-height: 150px; }

.floor-group { padding: 18px 0; border-top: 1px solid var(--line); }
.floor-group:first-child { border-top: 0; padding-top: 0; }
.floor-group h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 14px; }
.floor-group h3 span { color: var(--muted); font-size: 11px; font-weight: 600; }
.room-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.room-item {
  min-height: 46px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-wrap: anywhere;
  border: 1px solid #cbd8d2;
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.loading-row, .empty-state {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}
.loading-row span { width: 18px; height: 18px; border: 2px solid #c9d3ce; border-top-color: var(--green); border-radius: 50%; animation: spin 700ms linear infinite; }
.empty-state.error { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.page-footer {
  min-height: 105px;
  padding: 33px 18px calc(33px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
}
.page-footer p { margin: 0; color: #7a8580; font-size: 11px; text-align: center; }

@media (max-width: 600px) {
  .content-width { width: calc(100% - 28px); }
  .header-inner { width: calc(100% - 28px); }
  .title-band { padding: 25px 0 23px; }
  h1 { font-size: 31px; }
  .live-mark { display: none; }
  .control-section { padding: 23px 0 25px; }
  #time-output { width: 100%; margin: -9px 0 0; font-size: 14px; }
  .time-heading { flex-wrap: wrap; }
  .building-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .building-button { height: 60px; padding: 0; font-size: 15px; }
  .building-button small { font-size: 9px; }
  .room-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .content-width { width: calc(100% - 22px); }
  .building-grid { gap: 5px; }
  .building-button { height: 57px; font-size: 15px; }
  .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
