/* ── 全域 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --border:    #e4e7ec;
  --text:      #1a1d23;
  --muted:     #8a92a0;
  --accent-t:  #e8622a;   /* 溫度 - 暖橙 */
  --accent-h:  #3a82c4;   /* 濕度 - 藍 */
  --high:      #d94f2b;
  --low:       #3a82c4;
  --radius:    10px;
  --shadow:    0 1px 4px rgba(0,0,0,.07);
}

body {
  font-family: 'Helvetica Neue', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px 16px;
  text-align: center;
}

.brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.current-cards {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 36px;
}

.card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.card .val {
  font-size: 52px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -.02em;
}

.temp-card .val { color: var(--accent-t); }
.humi-card .val { color: var(--accent-h); }

.card .unit {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.divider {
  width: 1px;
  height: 56px;
  background: var(--border);
}

.last-update {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}

/* ── Controls ── */
.controls {
  max-width: 600px;
  margin: 20px auto 0;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn {
  flex: 1;
  max-width: 160px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover {
  border-color: #b0b8c4;
  color: var(--text);
}

.btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ── Stats ── */
.stats {
  max-width: 640px;
  margin: 20px auto 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-val {
  display: block;
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
}

.stat-val.high { color: var(--high); }
.stat-val.low  { color: var(--low); }

/* ── Chart Area ── */
.chart-area {
  max-width: 760px;
  margin: 20px auto 0;
  padding: 0 16px;
}

#canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Data Table ── */
#table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#data-table th {
  background: var(--bg);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

#data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

#data-table tbody tr:last-child td { border-bottom: none; }

#data-table tbody tr:hover { background: var(--bg); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .card .val { font-size: 40px; }
  .card { padding: 0 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .btn { font-size: 12px; }
}
