:root {
  color-scheme: light;
  --ink: #10233b;
  --muted: #607086;
  --paper: #f3f1eb;
  --card: #ffffff;
  --navy: #0a1b31;
  --navy-2: #102d4d;
  --teal: #0f766e;
  --teal-soft: #d9f1ed;
  --gold: #d1a23b;
  --gold-soft: #f5e9c9;
  --danger: #b54f4f;
  --border: #dfe4e9;
  --shadow: 0 18px 50px rgba(15, 35, 59, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(15, 118, 110, 0.1), transparent 27rem),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", "PingFang TC", sans-serif;
  line-height: 1.6;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--navy-2), var(--teal));
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.18);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.brand > span:last-child {
  display: grid;
}

.brand small {
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
}

.brand strong {
  line-height: 1.25;
}

.home-link,
.chart-actions button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.home-link,
.secondary-button {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.home-link:hover,
.secondary-button:hover,
.chart-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 8px 22px rgba(15, 35, 59, 0.08);
}

.primary-button {
  color: white;
  background: var(--teal);
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.26);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #0b655e;
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.hero {
  min-height: 420px;
  padding: clamp(34px, 5vw, 76px);
  border-radius: 32px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: center;
  gap: clamp(28px, 6vw, 90px);
  color: white;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 78% 28%, rgba(32, 181, 166, 0.34), transparent 24rem),
    linear-gradient(135deg, #071528, var(--navy-2));
  background-size: 42px 42px, 42px 42px, auto, auto;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #72d8cb;
}

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

h1 {
  margin-bottom: 18px;
  max-width: 850px;
  font-size: clamp(2.3rem, 5.2vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h3 {
  line-height: 1.3;
}

.hero-intro {
  max-width: 740px;
  margin-bottom: 26px;
  color: #d8e3ee;
  font-size: clamp(1rem, 1.45vw, 1.18rem);
}

.hero-copy,
.source-card,
.brand,
.brand > span:last-child {
  min-width: 0;
}

.source-card strong,
.source-card p {
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero .secondary-button {
  color: white;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.source-card {
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.085);
  backdrop-filter: blur(14px);
}

.status-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #b7c6d8;
  font-weight: 750;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #5de0c9;
  box-shadow: 0 0 0 6px rgba(93, 224, 201, 0.12);
}

.source-card strong {
  display: block;
  margin: 16px 0 4px;
  font-size: clamp(1.12rem, 2vw, 1.45rem);
}

.source-card p {
  margin-bottom: 16px;
  color: #d6e0ea;
}

.verified {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  color: #b8f4e9;
  background: rgba(93, 224, 201, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.control-panel,
.chart-card,
.events-section,
.method-section,
.disclaimer {
  padding: clamp(22px, 3.5vw, 40px);
  border: 1px solid rgba(223, 228, 233, 0.88);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.control-heading,
.section-heading,
.chart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.control-heading > p,
.section-heading > p {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  text-align: right;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(350px, 1.1fr) minmax(250px, 0.8fr) minmax(260px, 0.8fr);
  align-items: end;
  gap: 18px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f6f8f9;
}

.segmented-control button,
.filter-chips button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-weight: 760;
}

.segmented-control button.is-active {
  color: white;
  background: var(--navy);
  box-shadow: 0 6px 18px rgba(10, 27, 49, 0.18);
}

.scale-note {
  min-height: 78px;
  padding: 12px 15px;
  border-left: 3px solid var(--teal);
  background: #f5faf9;
}

.scale-note strong {
  display: block;
  margin-bottom: 2px;
}

.scale-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.metric-card {
  min-height: 144px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 8px 0 3px;
  font-size: clamp(1.35rem, 2.4vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--muted);
}

.chart-card {
  overflow: hidden;
}

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

.chart-actions button {
  min-height: 40px;
  padding: 8px 12px;
  border-color: var(--border);
  background: #f8fafb;
  font-size: 0.84rem;
}

.chart-explainer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.chart-explainer span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-line {
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.legend-marker {
  width: 12px;
  height: 12px;
  border: 3px solid white;
  border-radius: 999px;
  outline: 2px solid var(--gold);
  background: var(--navy);
}

.chart-wrap {
  position: relative;
  height: clamp(430px, 55vw, 620px);
  min-height: 430px;
  border: 1px solid #e4e8eb;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.035), transparent 35%),
    #fbfcfc;
}

#spChart {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: pan-y;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 170px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  background: rgba(10, 27, 49, 0.94);
  box-shadow: 0 10px 30px rgba(10, 27, 49, 0.22);
  pointer-events: none;
  font-size: 0.8rem;
}

.chart-tooltip strong {
  display: block;
  font-size: 0.96rem;
}

.chart-tooltip span {
  display: block;
  color: #c6d3e0;
}

.chart-tooltip em {
  display: block;
  margin-top: 5px;
  color: #80ded2;
  font-style: normal;
  font-weight: 800;
}

.chart-axis-note {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.chart-axis-note span:nth-child(2) {
  text-align: center;
}

.chart-axis-note span:last-child {
  text-align: right;
}

.selected-event {
  margin-top: 18px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid #dbe7e5;
  border-radius: 18px;
  background: linear-gradient(135deg, #f1f8f7, #fbfcfc);
}

.event-number {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--navy);
  font-weight: 900;
}

.selected-event span {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
}

.selected-event h3 {
  margin: 2px 0 4px;
  font-size: 1.2rem;
}

.selected-event p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.selected-event dl {
  display: flex;
  gap: 22px;
  margin: 0;
}

.selected-event dl > div {
  min-width: 110px;
}

.selected-event dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.selected-event dd {
  margin: 1px 0 0;
  font-size: 1.1rem;
  font-weight: 850;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-chips button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: white;
}

.filter-chips button.is-active {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

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

.event-card {
  position: relative;
  padding: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #fff;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.event-card:hover,
.event-card.is-selected {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 12px 28px rgba(15, 35, 59, 0.08);
}

.event-card.is-selected {
  background: #f7fbfa;
}

.event-card .event-number {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 0.88rem;
}

.event-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-card time {
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 850;
}

.category-tag {
  padding: 3px 8px;
  border-radius: 999px;
  color: #755716;
  background: var(--gold-soft);
  font-size: 0.68rem;
  font-weight: 850;
}

.event-card h3 {
  margin: 4px 0;
  font-size: 1.06rem;
}

.event-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.event-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  color: var(--muted);
  font-size: 0.74rem;
}

.event-card-metrics strong {
  color: var(--ink);
}

.event-card-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.locate-event {
  border: 0;
  padding: 0;
  color: var(--teal);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
}

.source-link {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.method-grid article {
  min-height: 210px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfcfc;
}

.method-grid article > span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
}

.method-grid strong {
  display: block;
  margin: 6px 0;
}

.method-grid p {
  color: var(--muted);
  font-size: 0.85rem;
}

.method-grid a {
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
}

.disclaimer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  border-color: #e6dcc0;
  background: #fffaf0;
  box-shadow: none;
}

.disclaimer strong {
  color: #7a5b19;
}

.disclaimer p {
  margin-bottom: 0;
  color: #6f6655;
}

footer {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 36px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--teal);
  font-weight: 800;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1.3fr 0.7fr;
    min-height: 380px;
    padding: 42px;
  }

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

  .scale-note {
    grid-column: 1 / -1;
  }

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

@media (max-width: 820px) {
  .topbar,
  main,
  footer {
    width: min(100% - 24px, 760px);
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .source-card {
    max-width: 560px;
  }

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

  .chart-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .section-heading > p {
    text-align: left;
  }

  .selected-event {
    grid-template-columns: auto 1fr;
  }

  .selected-event dl {
    grid-column: 1 / -1;
    padding-left: 66px;
  }

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

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    max-width: 155px;
    font-size: 0.86rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .home-link {
    display: none;
  }

  .hero {
    min-height: 0;
    padding: 28px 22px;
    border-radius: 22px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .hero-actions {
    display: grid;
  }

  .control-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .metric-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 120px;
  }

  .chart-wrap {
    height: 440px;
    min-height: 440px;
    margin-inline: -10px;
  }

  .chart-axis-note {
    grid-template-columns: 1fr 1fr;
  }

  .chart-axis-note span:nth-child(2) {
    display: none;
  }

  .selected-event {
    padding: 16px;
  }

  .selected-event dl {
    padding-left: 0;
    gap: 14px;
  }

  .selected-event dl > div {
    min-width: 0;
  }

  .event-card {
    padding: 15px;
  }

  .event-card-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .disclaimer {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: white;
    font-size: 10pt;
  }

  .topbar,
  .hero-actions,
  .control-panel,
  .chart-actions,
  .filter-chips,
  .locate-event,
  footer {
    display: none !important;
  }

  main {
    width: 100%;
    display: block;
  }

  .hero,
  .chart-card,
  .method-section,
  .disclaimer {
    margin-bottom: 8mm;
    box-shadow: none;
    break-inside: avoid;
  }

  .hero {
    min-height: 0;
    padding: 12mm;
    grid-template-columns: 1.5fr 0.5fr;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  h1 {
    font-size: 30pt;
  }

  .metric-grid {
    margin-bottom: 8mm;
  }

  .metric-card {
    min-height: 0;
    padding: 4mm;
  }

  .chart-card {
    padding: 7mm;
  }

  .chart-wrap {
    height: 118mm;
    min-height: 118mm;
  }

  .selected-event {
    display: none;
  }

  .event-grid {
    display: block;
    column-count: 2;
    column-gap: 4mm;
  }

  .events-section {
    padding: 5mm 0 0;
    border: 0;
    box-shadow: none;
    break-inside: auto;
  }

  .events-section .section-heading {
    break-after: avoid;
  }

  .event-card {
    margin-bottom: 3mm;
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 4mm;
  }

  .event-card p {
    font-size: 8.5pt;
  }

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

  .method-section {
    break-before: page;
  }

  .method-grid article {
    min-height: 0;
  }
}
