:root {
  --bg: #f4efe6;
  --bg-soft: rgba(255, 249, 240, 0.68);
  --panel: rgba(255, 252, 247, 0.84);
  --ink: #1f2430;
  --muted: #666154;
  --line: rgba(87, 72, 53, 0.14);
  --accent: #ba5a31;
  --accent-deep: #7f3418;
  --accent-soft: rgba(186, 90, 49, 0.12);
  --good: #2f7d4c;
  --mid: #b67b21;
  --bad: #b03a2e;
  --shadow: 0 24px 60px rgba(77, 57, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 212, 170, 0.7), transparent 32%),
    radial-gradient(circle at top right, rgba(191, 222, 203, 0.75), transparent 28%),
    linear-gradient(180deg, #efe5d7 0%, #f7f2ea 36%, #f3ede2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(98, 76, 48, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 76, 48, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 90%);
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  padding: 28px 8px 32px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero h1,
.panel-heading h2,
#topCityName {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(44px, 8vw, 84px);
  line-height: 0.96;
}

.hero-copy {
  width: min(760px, 100%);
  margin: 20px 0 0;
  font-size: 17px;
  line-height: 1.8;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 20px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 40%);
}

.controls-panel,
.summary-panel,
.ranking-panel,
.table-panel {
  padding: 26px;
}

.control-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.control {
  display: grid;
  gap: 10px;
}

.control-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
}

.control-text strong {
  color: var(--accent-deep);
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.preset {
  border: 1px solid rgba(127, 52, 24, 0.16);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 251, 246, 0.9);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.preset:hover,
.preset.active {
  transform: translateY(-1px);
  border-color: rgba(127, 52, 24, 0.4);
  background: rgba(186, 90, 49, 0.12);
}

.insight {
  margin-top: 22px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(186, 90, 49, 0.08), rgba(255, 255, 255, 0.72));
  color: var(--muted);
  line-height: 1.75;
}

.summary-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.top-city-card {
  margin-top: 18px;
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(127, 52, 24, 0.92), rgba(186, 90, 49, 0.88)),
    linear-gradient(180deg, #9f4b2a, #77301b);
  color: #fff7ef;
}

.top-score-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.top-score-block span {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.top-score-block strong {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
}

.top-city-reason {
  margin: 18px 0 0;
  line-height: 1.75;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tag {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 247, 239, 0.14);
}

.score-legend {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
}

.score-legend div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-dot.high {
  background: var(--good);
}

.legend-dot.medium {
  background: var(--mid);
}

.legend-dot.low {
  background: var(--bad);
}

.ranking-panel,
.table-panel {
  margin-top: 20px;
}

.ranking-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.ranking-caption {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.7;
}

.table-panel .ranking-caption {
  max-width: 100%;
  margin: 12px 0 0;
}

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

.city-card {
  position: relative;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(87, 72, 53, 0.1);
  background: var(--bg-soft);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.city-card:hover {
  transform: translateY(-2px);
  border-color: rgba(127, 52, 24, 0.22);
  box-shadow: 0 16px 28px rgba(80, 57, 28, 0.08);
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--accent-deep);
  background: rgba(186, 90, 49, 0.12);
}

.city-card h3 {
  margin: 14px 0 6px;
  font-size: 26px;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
}

.city-score {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.city-score strong {
  font-size: 34px;
  line-height: 1;
}

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

.meter-list {
  display: grid;
  gap: 10px;
}

.meter-row {
  display: grid;
  gap: 6px;
}

.meter-row header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.meter-track {
  overflow: hidden;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(87, 72, 53, 0.08);
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c88948, #ba5a31);
}

.city-notes {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.city-facts {
  margin-top: 12px;
  color: var(--accent-deep);
  font-size: 13px;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid rgba(87, 72, 53, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 252, 247, 0.68);
}

th,
td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(87, 72, 53, 0.08);
}

th {
  font-size: 13px;
  color: var(--accent-deep);
  background: rgba(186, 90, 49, 0.08);
}

td {
  font-size: 14px;
  color: var(--ink);
}

.score-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}

.score-chip.high {
  background: var(--good);
}

.score-chip.medium {
  background: var(--mid);
}

.score-chip.low {
  background: var(--bad);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .ranking-header {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 24px;
  }

  .controls-panel,
  .summary-panel,
  .ranking-panel,
  .table-panel {
    padding: 18px;
  }

  .hero {
    padding: 12px 4px 22px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .city-grid {
    grid-template-columns: 1fr;
  }
}
