:root {
  --ink: #111827;
  --muted: #6b7280;
  --soft: #9ca3af;
  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.16);
  --paper: #f5f6f8;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, rgba(0, 122, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(52, 199, 89, 0.12), transparent 24%),
    linear-gradient(180deg, #fbfbfd 0%, var(--paper) 52%, #eef1f5 100%);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 122, 255, 0.28);
  box-shadow: var(--shadow-soft);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.primary {
  color: #fff;
  border-color: var(--blue);
  background: linear-gradient(180deg, #1c8dff, var(--blue));
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 118px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 248, 0.76);
  backdrop-filter: blur(22px) saturate(1.25);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 5.5vw, 68px);
  line-height: 0.98;
  font-weight: 760;
}

h2 {
  font-size: 21px;
  font-weight: 720;
}

h3 {
  font-size: 15px;
  font-weight: 680;
}

.subtle,
.section-head p,
small {
  color: var(--muted);
}

.subtle {
  max-width: 660px;
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.55;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-grid,
.live-grid,
.band-grid {
  display: grid;
  gap: 12px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.live-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.band-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.metric-grid article,
.panel,
.live-grid article,
.band-card,
.day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.18);
}

.metric-grid article {
  display: grid;
  gap: 7px;
  padding: 16px;
  min-height: 118px;
}

.metric-grid span,
.live-grid span,
.band-card-head span,
label {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid strong,
.live-grid strong {
  font-size: 34px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
}

.metric-grid .heat strong,
td.hot-temp,
.compact-row.hot strong,
.day-card.hot .temp {
  color: var(--red);
}

.panel {
  margin-top: 14px;
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head p {
  margin-top: 5px;
  line-height: 1.5;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.09);
  color: #0057c2;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.live-grid article {
  display: grid;
  gap: 8px;
  min-height: 114px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.live-grid strong {
  color: var(--blue);
}

.live-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.live-lists h3 {
  margin-bottom: 8px;
}

.compact-list,
.table-wrap,
.chart-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.compact-row {
  display: grid;
  grid-template-columns: 58px 74px 1fr 82px 96px 92px;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.07);
  color: var(--muted);
  font-size: 13px;
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 720;
}

.compact-row.hot,
tr.hot-row:not(.today-row) {
  background: rgba(255, 59, 48, 0.055);
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 360px;
}

#tempChart {
  width: 100%;
  height: 360px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 5px;
  min-width: 176px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(18px) saturate(1.2);
}

.chart-tooltip strong {
  font-size: 13px;
}

.chart-tooltip span {
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 28px;
  height: 3px;
  display: inline-block;
  border-radius: 999px;
}

.legend .max-line {
  background: var(--red);
}

.legend .min-line {
  background: var(--blue);
}

.legend .today-mark {
  width: 12px;
  height: 18px;
  background: rgba(255, 59, 48, 0.18);
  border-left: 2px dashed var(--red);
}

.timeline-table {
  max-height: 520px;
}

.forecast-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
}

.day-card {
  display: grid;
  align-content: space-between;
  gap: 8px;
  min-height: 118px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.day-card.hot {
  border-color: rgba(255, 59, 48, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 59, 48, 0.06));
}

.day-card .date {
  font-weight: 720;
}

.day-card .temp {
  color: var(--ink);
  font-size: 25px;
  font-weight: 760;
}

.day-card .meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.summary {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.72;
  overflow: auto;
}

.band-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.band-card.band-lt25 {
  border-top: 3px solid var(--blue);
}

.band-card.band-25to30 {
  border-top: 3px solid var(--orange);
}

.band-card.band-gt30 {
  border-top: 3px solid var(--red);
}

.band-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.band-card-head strong {
  font-size: 27px;
  font-weight: 760;
}

.band-meta,
.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.band-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.month-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 4px;
  height: 70px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}

.month-bars span {
  position: relative;
  min-height: 5px;
  border-radius: 4px 4px 0 0;
  background: var(--blue);
}

.band-card.band-25to30 .month-bars span {
  background: var(--orange);
}

.band-card.band-gt30 .month-bars span {
  background: var(--red);
}

.month-bars em {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  color: var(--soft);
  font-size: 10px;
  font-style: normal;
}

.feature-list {
  margin-top: 28px;
}

.feature-list b,
.feature-list i {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.05);
  color: var(--ink);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.feature-list b {
  background: rgba(0, 122, 255, 0.1);
  color: #0057c2;
}

.analysis-table {
  max-height: 420px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(0, 122, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.table-wrap {
  margin-top: 16px;
  max-height: 560px;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.07);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(249, 250, 251, 0.96);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

td {
  font-variant-numeric: tabular-nums;
}

tr.today-row {
  background: rgba(0, 122, 255, 0.08);
  outline: 2px solid rgba(0, 122, 255, 0.22);
  outline-offset: -2px;
}

tr.muted-row {
  color: var(--soft);
  background: rgba(17, 24, 39, 0.025);
}

.today-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(14px);
}

@media (max-width: 920px) {
  .hero {
    position: relative;
    align-items: start;
  }

  .actions {
    justify-content: flex-start;
  }

  .compact-row {
    grid-template-columns: 54px 68px 1fr;
    row-gap: 4px;
    padding: 8px 10px;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(180deg, rgba(225, 242, 245, 0.92), rgba(245, 248, 248, 0.96) 42%, #f7f8f9 100%);
    font-size: 14px;
  }

  .shell {
    display: flex;
    flex-direction: column;
    width: min(100vw - 22px, 460px);
    padding: 12px 0 32px;
  }

  .hero {
    order: 1;
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: auto;
    padding: 14px 0 12px;
    background: transparent;
    backdrop-filter: none;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 12px;
  }

  h1 {
    font-size: 42px;
    line-height: 1.02;
  }

  h2 {
    font-size: 22px;
  }

  .subtle {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.45;
  }

  .actions {
    justify-content: flex-start;
  }

  #syncBtn,
  #pushBtn {
    display: none;
  }

  #refreshTodayBtn {
    width: 100%;
    min-height: 42px;
    border-color: rgba(0, 122, 255, 0.22);
    background: rgba(255, 255, 255, 0.92);
    color: #0057c2;
    font-weight: 680;
  }

  .live-panel {
    order: 2;
  }

  .metric-grid {
    order: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 10px 0 0;
  }

  .chart-panel {
    order: 4;
  }

  .forecast-panel {
    order: 5;
  }

  .timeline-panel {
    order: 6;
  }

  .analysis-panel {
    order: 7;
  }

  .history-panel {
    order: 8;
  }

  .panel:not(.live-panel),
  .metric-grid article,
  .live-grid article,
  .day-card,
  .band-card {
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  }

  .panel {
    margin-top: 10px;
    padding: 14px;
  }

  .live-panel {
    margin-top: 8px;
    padding: 14px;
    border-color: rgba(0, 122, 255, 0.13);
    background: rgba(255, 255, 255, 0.86);
  }

  .section-head {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
  }

  .section-head p {
    display: none;
  }

  .pill {
    min-height: 26px;
    padding: 0 9px;
    font-size: 11px;
  }

  .live-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .live-grid article {
    min-height: 96px;
    padding: 12px;
    gap: 6px;
  }

  .live-grid strong {
    font-size: clamp(27px, 9vw, 36px);
    line-height: 1;
  }

  #liveWind {
    font-size: clamp(24px, 7.4vw, 32px);
    overflow-wrap: anywhere;
  }

  .live-grid small {
    line-height: 1.35;
  }

  .metric-grid article {
    min-height: 92px;
    padding: 12px;
    gap: 6px;
    background: rgba(255, 255, 255, 0.82);
  }

  .metric-grid strong {
    font-size: 31px;
  }

  .metric-grid small {
    line-height: 1.35;
  }

  .live-lists {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .compact-row {
    grid-template-columns: 48px 72px minmax(68px, 1fr) 72px;
    gap: 8px;
    min-height: 40px;
    padding: 0 10px;
    font-size: 12px;
  }

  .compact-row strong {
    font-size: 17px;
  }

  .compact-row span:nth-of-type(3),
  .compact-row span:nth-of-type(5) {
    display: none;
  }

  .compact-row span:nth-of-type(4) {
    text-align: right;
  }

  .chart-wrap {
    min-height: 230px;
  }

  #tempChart {
    height: 230px;
  }

  .legend {
    margin-top: 9px;
    gap: 10px;
    font-size: 12px;
  }

  .forecast-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .day-card {
    min-height: 96px;
    padding: 10px;
  }

  .day-card .temp {
    font-size: 22px;
  }

  .summary {
    max-height: 150px;
    margin-top: 10px;
    padding: 10px 12px;
    line-height: 1.55;
    font-size: 13px;
  }

  .timeline-table,
  .analysis-table,
  .table-wrap {
    max-height: 340px;
    margin-top: 10px;
  }

  table {
    min-width: 640px;
  }

  th,
  td {
    padding: 10px 11px;
  }

  .band-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .analysis-panel .summary {
    max-height: 116px;
  }

  .analysis-table {
    display: none;
  }

  .filters {
    gap: 8px;
  }

  .pager {
    gap: 8px;
    margin-top: 12px;
  }
}
