:root {
  --bg-top: #f7f2e8;
  --bg-bottom: #eef3f6;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --ink: #1f2d3a;
  --ink-soft: #4f6373;
  --line: rgba(52, 79, 99, 0.15);
  --accent: #2b8b83;
  --accent-soft: rgba(43, 139, 131, 0.2);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 16px 36px rgba(26, 43, 62, 0.12);
  --shadow-subtle: 0 8px 20px rgba(20, 36, 52, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 0% 0%, rgba(193, 216, 226, 0.35), transparent 60%),
    radial-gradient(900px 520px at 100% 10%, rgba(228, 180, 94, 0.16), transparent 58%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.app-shell {
  width: min(1260px, calc(100% - 1.8rem));
  margin: 1rem auto 2rem;
  display: grid;
  gap: 0.95rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
}

.hero {
  padding: clamp(1rem, 2.3vw, 1.8rem);
  overflow: hidden;
  position: relative;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.96), rgba(242, 233, 218, 0.94));
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -78px;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(43, 139, 131, 0.2), rgba(43, 139, 131, 0));
  pointer-events: none;
}

.hero .eyebrow {
  margin: 0 0 0.28rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  color: #5a7283;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 3.2vw, 2.95rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.hero .date-range {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  font-weight: 600;
}

.hero .tagline {
  margin: 0.64rem 0 0;
  max-width: 74ch;
  line-height: 1.45;
  font-size: 1.01rem;
  color: var(--ink-soft);
}

.hero-meta {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.56rem;
  align-items: center;
}

.meta-pill {
  border-radius: 999px;
  border: 1px solid rgba(46, 77, 99, 0.2);
  padding: 0.33rem 0.76rem;
  background: rgba(255, 255, 255, 0.76);
  color: #405567;
  font-size: 0.84rem;
  font-weight: 600;
}

.meta-pill strong {
  color: #2f4d64;
}

.chart-hero {
  padding: 0.86rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.62rem;
}

.panel-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.chart-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.chart-root {
  position: relative;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(47, 73, 92, 0.12);
  background: var(--panel-strong);
  overflow: hidden;
}

#monthly-chart {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  background: rgba(20, 31, 42, 0.93);
  color: #fbfaf5;
  border-radius: 10px;
  padding: 0.44rem 0.58rem;
  font-size: 0.76rem;
  line-height: 1.3;
  box-shadow: 0 10px 22px rgba(14, 20, 28, 0.35);
  min-width: 136px;
}

.chart-tooltip[hidden] {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 0.95rem;
}

.controls-panel {
  padding: 0.9rem;
  position: sticky;
  top: 0.9rem;
  height: fit-content;
}

.controls-intro {
  margin: 0 0 0.72rem;
  color: #5a6e7d;
  font-size: 0.83rem;
  line-height: 1.4;
}

.button-subtle {
  appearance: none;
  border: 1px solid rgba(36, 66, 87, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 0.34rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.button-subtle:hover {
  border-color: rgba(36, 66, 87, 0.52);
}

.feature-control-list {
  display: grid;
  gap: 0.62rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(46, 73, 92, 0.13);
  border-radius: var(--radius-md);
  padding: 0.58rem 0.64rem;
}

.feature-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.feature-help {
  margin: 0.18rem 0 0.54rem;
  color: #607483;
  font-size: 0.75rem;
  line-height: 1.35;
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 0.64rem;
  align-items: end;
}

.control-block {
  display: grid;
  gap: 0.36rem;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.45rem;
}

.control-label {
  margin: 0;
  color: #4d6476;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.control-value {
  margin: 0;
  color: #1f6f70;
  font-size: 0.79rem;
  font-weight: 800;
}

.slider {
  width: 100%;
  height: 30px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(110, 129, 145, 0.24);
}

.slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(110, 129, 145, 0.24);
}

.slider::-webkit-slider-thumb,
.range-dual input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid var(--accent);
  margin-top: -4px;
  box-shadow: 0 0 0 1px rgba(26, 56, 73, 0.14);
}

.slider::-moz-range-thumb,
.range-dual input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(26, 56, 73, 0.14);
}

.range-dual {
  position: relative;
  height: 30px;
  margin-top: 0.05rem;
}

.range-dual-track,
.range-dual-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
}

.range-dual-track {
  left: 0;
  right: 0;
  background: rgba(110, 129, 145, 0.24);
}

.range-dual-fill {
  background: rgba(43, 139, 131, 0.45);
  left: 25%;
  width: 50%;
}

.range-dual input[type="range"] {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.range-dual input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.range-dual input[type="range"]::-moz-range-track {
  height: 6px;
  background: transparent;
}

.range-dual input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
}

.range-dual input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
}

.panel-note {
  margin: 0.78rem 0 0;
  color: #4f6374;
  font-size: 0.77rem;
  line-height: 1.4;
}

.support-column {
  display: grid;
  gap: 0.95rem;
}

.table-panel {
  padding: 0.86rem;
}

.decomposition-panel {
  padding: 0.86rem;
}

.decomposition-note {
  margin: 0.08rem 0 0.52rem;
  color: #576d7d;
  font-size: 0.78rem;
  line-height: 1.35;
}

.decomposition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.68rem;
}

.input-curve-card {
  position: relative;
  border: 1px solid rgba(47, 73, 92, 0.13);
  border-radius: 12px;
  background: var(--panel-strong);
  padding: 0.56rem;
}

.input-curve-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.48rem;
  margin-bottom: 0.34rem;
}

.input-curve-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2d4a5e;
}

.input-curve-unit {
  margin: 0;
  font-size: 0.72rem;
  color: #5f7485;
}

.input-curve-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
}

.input-axis path,
.input-axis line {
  stroke: #c1cfd7;
  stroke-width: 1;
}

.input-axis text {
  fill: #5a6f80;
  font-size: 10px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.input-grid line {
  stroke: rgba(102, 132, 153, 0.2);
  stroke-dasharray: 3 4;
}

.input-grid path {
  stroke-width: 0;
}

.input-city-line {
  fill: none;
  stroke-width: 1.45;
  opacity: 0.56;
  transition: opacity 130ms ease, stroke-width 130ms ease;
}

.input-city-line.is-dimmed {
  opacity: 0.08;
  stroke-width: 0.98;
}

.input-city-line.is-active {
  opacity: 1;
  stroke-width: 2.5;
}

.input-city-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  cursor: pointer;
}

.input-curve-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  background: rgba(20, 31, 42, 0.93);
  color: #fbfaf5;
  border-radius: 10px;
  padding: 0.42rem 0.56rem;
  font-size: 0.74rem;
  line-height: 1.3;
  box-shadow: 0 10px 22px rgba(14, 20, 28, 0.35);
  min-width: 128px;
}

.input-curve-tooltip[hidden] {
  display: none;
}

.table-wrap {
  max-height: 420px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(47, 73, 92, 0.13);
  background: var(--panel-strong);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
  font-size: 0.82rem;
  padding: 0.42rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(42, 68, 87, 0.1);
}

.ranking-table th {
  position: sticky;
  top: 0;
  background: rgba(225, 235, 241, 0.87);
  color: #2d4a5e;
  z-index: 1;
}

.ranking-row {
  transition: background 120ms ease;
}

.ranking-row:hover {
  background: rgba(36, 85, 112, 0.09);
}

.ranking-row.is-active {
  background: rgba(43, 139, 131, 0.18);
}

.key-chip {
  transition: transform 120ms ease, border-color 120ms ease;
}

.key-chip:hover {
  transform: translateY(-1px);
}

.key-chip.is-active {
  border-color: rgba(23, 62, 67, 0.66) !important;
  background: rgba(23, 62, 67, 0.14) !important;
}

.axis path,
.axis line {
  stroke: #b8c7d0;
  stroke-width: 1;
}

.axis text {
  fill: #506375;
  font-size: 11px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.grid line {
  stroke: rgba(102, 132, 153, 0.2);
  stroke-dasharray: 3 4;
}

.grid path {
  stroke-width: 0;
}

.city-line {
  fill: none;
  stroke-width: 1.8;
  opacity: 0.58;
  transition: opacity 130ms ease, stroke-width 130ms ease;
}

.city-line.is-dimmed {
  opacity: 0.08;
  stroke-width: 1.1;
}

.city-line.is-active {
  opacity: 1;
  stroke-width: 3.25;
}

.city-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
}

.winner-dot {
  stroke: #fff6e5;
  stroke-width: 1.2;
}

.footer-note {
  margin: 0;
  color: #4d6070;
  font-size: 0.78rem;
  line-height: 1.42;
}

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

  .controls-panel {
    position: static;
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: calc(100% - 1rem);
    margin: 0.62rem auto 1.2rem;
  }

  .hero {
    border-radius: 16px;
    padding: 0.9rem;
  }

}
