:root {
  --bg: #eef4f6;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #667781;
  --line: #d9e3e7;
  --primary: #087f8c;
  --primary-dark: #07656f;
  --hot: #d75a2d;
  --cold: #2774c7;
  --green: #2d8a57;
  --shadow: 0 16px 36px rgba(22, 43, 50, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 244, 246, 0.9)),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

.home-body {
  background:
    linear-gradient(180deg, rgba(244, 249, 250, 0) 0, #eef4f6 420px),
    radial-gradient(circle at 14% 18%, rgba(45, 138, 87, 0.16), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(215, 90, 45, 0.13), transparent 30%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px min(5vw, 56px) 22px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(8, 127, 140, 0.96), rgba(24, 50, 66, 0.98)),
    url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 124C44 84 78 106 116 60c17-21 31-23 40-24' fill='none' stroke='rgba(255,255,255,.16)' stroke-width='8'/%3E%3Cpath d='M-4 46c42 22 67 21 111-7 18-11 34-16 53-13' fill='none' stroke='rgba(255,255,255,.09)' stroke-width='12'/%3E%3C/svg%3E");
  background-size: cover, 260px;
}

.home-hero {
  display: block;
  min-height: 360px;
  padding: 22px min(5vw, 56px) 54px;
  background:
    linear-gradient(135deg, rgba(9, 111, 122, 0.98), rgba(20, 42, 55, 0.98)),
    url("data:image/svg+xml,%3Csvg width='220' height='180' viewBox='0 0 220 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 142C54 88 94 128 145 57c23-32 48-39 67-35' fill='none' stroke='rgba(255,255,255,.14)' stroke-width='12'/%3E%3Cpath d='M-20 66c56 28 91 26 151-10 25-15 47-21 78-17' fill='none' stroke='rgba(255,255,255,.09)' stroke-width='16'/%3E%3C/svg%3E");
  background-size: cover, 420px;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.site-nav a {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 9px 13px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 700;
}

.site-nav a.active,
.site-nav a:hover {
  color: #12313a;
  background: #ffffff;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 34px;
  align-items: end;
  width: min(1440px, 100%);
  margin: 58px auto 0;
}

.hero-copy {
  max-width: 820px;
}

.hero-copy h1 {
  margin-bottom: 14px;
  font-size: clamp(44px, 6vw, 76px);
}

.hero-copy .subtitle {
  max-width: 720px;
  font-size: 19px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-actions .primary-btn,
.hero-actions .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  min-height: 46px;
}

.hero-primary {
  border-color: #ffffff;
  color: #12313a;
  background: #ffffff;
}

.hero-secondary {
  border-color: rgba(255, 255, 255, 0.36);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.hero-panel {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 24px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

.hero-panel span {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.hero-panel strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1.1;
}

.hero-panel p {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
}

.eyebrow,
.subtitle,
.section-head p,
.metric span,
.toolbar span,
.field > span,
.temp-box span,
#rangeText,
#trendRangeText,
.city-tags-panel > span {
  color: var(--muted);
}

.topbar .eyebrow,
.topbar .subtitle {
  color: rgba(255, 255, 255, 0.78);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.1;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.subtitle {
  margin-bottom: 0;
  font-size: 16px;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.home-body .shell {
  margin-top: -34px;
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.view-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  padding: 9px 16px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.home-grid,
.double-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.refined-home-grid {
  margin-top: 8px;
}

.home-card {
  display: flex;
  align-items: flex-end;
  min-height: 210px;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: rgba(8, 127, 140, 0.42);
  box-shadow: 0 22px 44px rgba(22, 43, 50, 0.14);
}

.home-card.primary-card {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #087f8c, #2d8a57);
}

.home-card em,
.text-link {
  color: var(--primary-dark);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.home-card.primary-card em,
.home-card.primary-card p {
  color: rgba(255, 255, 255, 0.82);
}

.home-card strong {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.home-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card-mark {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary);
  font-size: 26px;
  font-weight: 900;
}

.primary-card .card-mark {
  color: #0b5962;
  background: #ffffff;
}

.home-panel {
  padding: 24px;
}

.rank-list,
.province-link-grid,
.city-overview-grid {
  display: grid;
  gap: 10px;
}

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

.rank-list a,
.province-link-grid a,
.city-overview-card,
.month-summary-grid div {
  border: 1px solid #e3ebee;
  border-radius: 8px;
  background: #fbfdfe;
}

.rank-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  color: var(--ink);
}

.rank-list strong {
  color: var(--green);
  font-size: 20px;
}

.province-link-grid {
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  row-gap: 14px;
}

.province-link-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 12px;
  color: #2b3f49;
  line-height: 1.2;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}

.province-link-grid a:hover,
.rank-list a:hover {
  border-color: var(--primary);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  padding: 7px 12px;
  background: #ffffff;
  white-space: nowrap;
}

.month-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.month-summary-grid div {
  display: grid;
  gap: 6px;
  padding: 13px;
}

.month-summary-grid span,
.month-summary-grid em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.month-summary-grid strong {
  font-size: 22px;
}

.compact-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.candidate-table-wrap {
  max-height: 420px;
}

.candidate-table-wrap table {
  min-width: 560px;
}

.compact-table-wrap table {
  min-width: 560px;
}

.city-overview-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: stretch;
  gap: 14px;
}

.city-overview-card {
  display: grid;
  gap: 16px;
  min-height: 168px;
  padding: 18px;
}

.city-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.city-overview-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.city-overview-card span {
  color: var(--muted);
  font-size: 13px;
}

.city-card-head > div:first-child,
.city-season-temps,
.city-climate-bars {
  display: grid;
  gap: 7px;
}

.city-season-temps {
  min-width: 120px;
  text-align: right;
}

.city-season-temps span {
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 6px 8px;
  background: #ffffff;
  font-weight: 800;
}

.city-climate-bars {
  gap: 10px;
}

.city-bar-row {
  display: grid;
  grid-template-columns: 72px 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.city-bar-row span {
  font-weight: 700;
}

.city-bar-row strong {
  color: var(--ink);
  font-size: 18px;
  text-align: right;
}

.city-bar-row i {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef1;
}

.city-bar-row b {
  display: block;
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
}

.summer-bar b {
  background: linear-gradient(90deg, #15907f, #84a214);
}

.winter-bar b {
  background: linear-gradient(90deg, #0284c7, #312e81);
}

.tab-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

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

.section-head p {
  margin-bottom: 0;
  font-size: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(340px, 1.8fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.trend-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
}

.city-tags-panel {
  margin-top: 18px;
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.city-tags-panel > span {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.city-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 146px;
  overflow: auto;
}

.city-tag {
  min-height: 34px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--ink);
  background: #ffffff;
  white-space: nowrap;
}

.city-tag.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.field,
.temp-box,
.mode-box {
  min-width: 0;
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.field > span,
.temp-box legend,
.mode-box legend {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ccd9de;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 8px 10px;
  outline: none;
}

select:focus,
input:focus,
button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.18);
}

.month-field {
  grid-row: span 2;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(48px, 1fr));
  gap: 8px;
}

.month-btn,
.quick-row button,
.ghost-btn,
.primary-btn {
  min-height: 38px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--ink);
  white-space: nowrap;
}

.month-btn.active,
.primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.month-btn.active {
  font-weight: 700;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-row button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.quick-row button:hover,
.ghost-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.temp-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.temp-box legend,
.mode-box legend {
  grid-column: 1 / -1;
  padding: 0;
}

.temp-box label span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.mode-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.mode-box input {
  width: auto;
  min-height: auto;
  accent-color: var(--primary);
}

.hint-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #bfd2d8;
  border-radius: 50%;
  color: var(--primary-dark);
  background: #ffffff;
}

.actions,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar label {
  display: grid;
  gap: 5px;
  min-width: 130px;
  font-size: 12px;
}

.primary-btn {
  min-width: 112px;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

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

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(26px, 3.3vw, 42px);
  line-height: 1;
}

.metric.hot strong {
  color: var(--hot);
}

.metric.cold strong {
  color: var(--cold);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.chart-box {
  min-width: 0;
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.trend-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.trend-color-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfdfe;
}

.trend-color-legend div,
.trend-color-legend span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.trend-color-legend strong {
  margin-right: 4px;
  font-size: 13px;
}

.trend-color-legend span {
  color: var(--muted);
  font-size: 12px;
}

.trend-color-legend i {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.trend-card {
  min-width: 0;
  border: 1px solid #e3ebee;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

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

.trend-card-head strong {
  font-size: 16px;
}

.trend-card-head span,
.trend-card-meta {
  color: var(--muted);
  font-size: 12px;
}

.trend-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.chart-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

svg {
  width: 100%;
  height: auto;
  display: block;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #ffffff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f4;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #41525c;
  background: #f6fafb;
  font-size: 13px;
}

tbody tr:hover {
  background: #f8fbfc;
}

.detail-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid #cbdde2;
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 700;
}

.detail-row td {
  padding: 0;
  background: #f7fbfc;
}

.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
}

.detail-chip {
  border: 1px solid #d8e5e9;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
}

.temp-hot {
  color: var(--hot);
  font-weight: 700;
}

.temp-cold {
  color: var(--cold);
  font-weight: 700;
}

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

.alert {
  margin-bottom: 14px;
  border: 1px solid #efc4a7;
  border-radius: 8px;
  padding: 12px 14px;
  color: #7a3517;
  background: #fff5ee;
}

.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin: -28px auto 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.admin-topbar {
  background: linear-gradient(135deg, #172026, #274550);
}

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

.admin-table {
  min-width: 0;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  font-size: 13px;
}

.admin-recent-table {
  min-width: 1320px;
}

.path-cell {
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ua-cell {
  max-width: 460px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1120px) {
  .hero-layout {
    grid-template-columns: 1fr;
    margin-top: 42px;
  }

  .filter-grid,
  .chart-grid,
  .trend-controls,
  .rank-list,
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .province-link-grid,
  .month-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .month-field {
    grid-row: auto;
  }

  .mode-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .home-hero {
    min-height: auto;
    padding-bottom: 42px;
  }

  .hero-copy h1 {
    font-size: 38px;
  }

  .hero-copy .subtitle {
    font-size: 16px;
  }

  .hero-actions .primary-btn,
  .hero-actions .ghost-btn {
    width: 100%;
  }

  .hero-panel strong {
    font-size: 28px;
  }

  .topbar,
  .section-head,
  .result-head {
    display: block;
  }

  .site-nav {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .actions.compact,
  .toolbar {
    margin-top: 16px;
  }

  .filter-grid,
  .summary-grid,
  .chart-grid,
  .trend-controls,
  .home-grid,
  .double-panel-grid,
  .admin-grid,
  .rank-list,
  .city-overview-grid {
    grid-template-columns: 1fr;
  }

  .city-card-head {
    display: grid;
  }

  .city-season-temps {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .view-tabs,
  .view-tabs .tab-btn {
    width: 100%;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .trend-card-grid {
    grid-template-columns: 1fr;
  }

  .trend-color-legend {
    grid-template-columns: 1fr;
  }

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

  .province-link-grid,
  .month-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar label,
  .toolbar button {
    width: 100%;
  }

  .home-card {
    align-items: flex-start;
    min-height: auto;
  }

  h1 {
    font-size: 32px;
  }

  .site-footer {
    text-align: left;
  }
}
