:root {
  color-scheme: dark;
  --bg: #061744;
  --panel: rgba(10, 38, 91, 0.9);
  --panel-strong: rgba(18, 53, 115, 0.92);
  --line: rgba(77, 132, 228, 0.74);
  --line-soft: rgba(77, 132, 228, 0.32);
  --text: #eaf3ff;
  --muted: #9ebfff;
  --gold: #f2b45d;
  --green: #88df8b;
  --amber: #ffcf67;
  --red: #ff6b61;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(94, 158, 255, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(94, 158, 255, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #071d52 0%, #071744 56%, #051238 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: calc(64px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: env(safe-area-inset-top) 14px 0;
  background: rgba(8, 35, 94, 0.96);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(100, 153, 255, 0.54);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(15, 49, 104, 0.8);
  font-size: 19px;
  line-height: 1;
}

.title-wrap {
  min-width: 0;
  text-align: center;
}

.platform-title {
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.sub-title {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page {
  padding: 13px 13px 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary,
.data-card,
.control-panel,
.floor,
.detail-hero {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.summary {
  min-height: 58px;
  padding: 9px 6px;
  text-align: center;
}

.summary span,
.data-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.summary strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  line-height: 1;
}

.green {
  color: var(--green);
}

.amber {
  color: var(--amber);
}

.search-row {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 26, 70, 0.78);
  color: var(--muted);
  margin-bottom: 12px;
}

.search-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.section-label,
.control-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #b8ceff;
  font-size: 12px;
  margin-bottom: 8px;
}

.section-label span,
.control-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floor {
  margin-bottom: 10px;
  overflow: hidden;
}

.floor-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.floor-head span {
  color: var(--green);
  font-size: 11px;
  white-space: nowrap;
}

.device {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px 11px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.device:last-child {
  border-bottom: 0;
}

.device:focus-visible,
.device:hover {
  background: linear-gradient(90deg, rgba(29, 83, 157, 0.88), rgba(13, 44, 97, 0.48));
  outline: 0;
}

.device-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(95, 157, 255, 0.18);
  border: 1px solid rgba(113, 168, 255, 0.4);
}

.device-main {
  min-width: 0;
}

.device-name,
.device-meta {
  display: block;
}

.device-name {
  font-size: 14px;
  line-height: 1.2;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.pill {
  min-width: 42px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(128, 174, 255, 0.5);
  background: rgba(7, 28, 75, 0.72);
  font-size: 11px;
  white-space: nowrap;
}

.detail-hero {
  padding: 13px;
  margin-bottom: 11px;
  background:
    linear-gradient(135deg, rgba(34, 79, 152, 0.86) 0%, rgba(8, 34, 85, 0.82) 62%),
    rgba(8, 34, 85, 0.82);
}

.detail-top,
.temp-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-top > div:first-child {
  min-width: 0;
}

.room-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 6px;
}

.room-path,
.feedback {
  color: var(--muted);
  font-size: 11px;
}

.room-path {
  line-height: 1.45;
}

.ac-art {
  width: 126px;
  height: 80px;
  position: relative;
  flex: none;
}

.ac-body {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 14px;
  height: 42px;
  border-radius: 17px;
  background: linear-gradient(135deg, #e5f1ff 0%, #8ebeff 52%, #3c71dd 100%);
  box-shadow: inset -8px -10px 18px rgba(7, 29, 72, 0.24);
}

.ac-body::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 22px;
  height: 4px;
  border-radius: 99px;
  background: #092b63;
}

.air {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 9px;
  height: 3px;
  border-radius: 99px;
  background: rgba(106, 225, 255, 0.8);
  box-shadow: 0 11px 0 rgba(106, 225, 255, 0.35), 0 22px 0 rgba(106, 225, 255, 0.18);
}

.temp-row {
  align-items: end;
  margin-top: 6px;
}

.big-temp {
  font-size: 52px;
  line-height: 0.92;
  color: #fff;
}

.big-temp small {
  font-size: 19px;
  color: #b9ceff;
}

.feedback {
  text-align: right;
  line-height: 1.5;
}

.feedback b {
  color: var(--text);
  font-size: 22px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 11px;
}

.data-card {
  min-height: 76px;
  padding: 11px;
}

.data-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.control-panel {
  padding: 12px;
}

.stepper {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 8px;
}

.stepper button,
.action-button,
.step-value,
.mode-control select {
  height: 46px;
  border: 1px solid rgba(118, 171, 255, 0.58);
  border-radius: 8px;
}

.stepper button,
.action-button,
.mode-control select {
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
}

.step-value {
  display: grid;
  place-items: center;
  background: rgba(5, 23, 61, 0.86);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mode-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 0.55fr);
  gap: 8px;
  margin-top: 10px;
}

.mode-control select {
  width: 100%;
  padding: 0 10px;
  font-size: 14px;
}

.action-button {
  height: 42px;
  font-size: 12px;
}

.action-button.primary {
  background: var(--gold);
  color: #071744;
  border-color: #ffc982;
}

.control-message {
  margin-top: 9px;
  color: #b8ceff;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 340px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ac-art {
    width: 100px;
  }

  .big-temp {
    font-size: 44px;
  }
}

@media (min-width: 481px) {
  #app {
    padding: 18px;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    overflow: hidden;
  }
}
