:root {
  --canvas: #eef3f6;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-soft: #f4f8fb;
  --text: #123042;
  --muted: #5f7684;
  --line: rgba(18, 48, 66, 0.11);
  --accent: #0f617f;
  --accent-strong: #0b4860;
  --accent-soft: #d9eef5;
  --profit: #0b8f66;
  --loss: #c65b51;
  --warning: #fff4d6;
  --warning-line: #dfc27c;
  --shadow: 0 20px 48px rgba(19, 55, 72, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --page-max: 1180px;
  --ease: 180ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 97, 127, 0.1), transparent 28%),
    linear-gradient(180deg, #f7fafc 0%, var(--canvas) 38%, #e9f0f4 100%);
}

img {
  display: block;
  max-width: 100%;
}

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

button,
input {
  font: inherit;
}

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

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

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: rgba(247, 250, 252, 0.86);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(18, 48, 66, 0.08);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(16, 48, 66, 0.08);
}

.brand,
.topnav a {
  white-space: nowrap;
}

.brand {
  flex: 0 0 auto;
}

.brand-mark {
  width: auto;
  height: 38px;
}

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

.topnav a {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.95rem;
  border-radius: 999px;
  transition: background-color var(--ease), color var(--ease);
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--accent-strong);
  background: rgba(15, 97, 127, 0.08);
  outline: none;
}

main {
  display: grid;
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
  border: 1px solid rgba(18, 48, 66, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 36px), rgba(15, 97, 127, 0.04) calc(100% - 36px), rgba(15, 97, 127, 0.04) 100%),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 29px,
      rgba(18, 48, 66, 0.025) 29px,
      rgba(18, 48, 66, 0.025) 30px
    );
  opacity: 0.7;
}

.hero,
.calculator-panel,
.spotlight-panel,
.period-panel,
#results,
.chart-panel,
.info-panel,
.risk-panel {
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 28px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2 {
  margin: 0;
  line-height: 1.08;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
}

.hero-subtitle {
  max-width: 52ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.8;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-badges span {
  padding: 10px 14px;
  background: rgba(15, 97, 127, 0.08);
  border: 1px solid rgba(15, 97, 127, 0.12);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

.audience-band {
  display: block;
  margin-top: 24px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(217, 238, 245, 0.72));
  border: 1px solid rgba(15, 97, 127, 0.12);
  border-radius: 24px;
}

.audience-band-copy {
  display: grid;
  gap: 12px;
}

.audience-band-label {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.audience-band-value {
  font-size: clamp(1.8rem, 4.3vw, 3rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums lining-nums;
}

.audience-live-value {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.2em;
  padding: 6px 0;
  text-shadow: 0 12px 26px rgba(11, 72, 96, 0.12);
}

.audience-live-value.is-pulsing {
  animation: audiencePulse 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.audience-live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.audience-live-delta {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.audience-live-delta {
  background: rgba(11, 143, 102, 0.14);
  border: 1px solid rgba(11, 143, 102, 0.14);
  color: var(--profit);
}

.hero-side {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.hero-visual-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(216, 238, 245, 0.82), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(15, 97, 127, 0.12);
  border-radius: 24px;
}

.hero-visual {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.hero-stat {
  display: grid;
  gap: 8px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(11, 72, 96, 0.96), rgba(15, 97, 127, 0.88));
  border-radius: 22px;
  color: #f3fbff;
}

.stat-label,
.stat-meta,
.summary-label,
.field-hint,
.field-error,
.helper-copy,
.risk-copy,
.info-list,
.formula-label {
  line-height: 1.6;
}

.stat-label,
.stat-meta {
  color: rgba(243, 251, 255, 0.82);
}

.hero-stat strong {
  font-size: clamp(2rem, 4vw, 3rem);
  font-variant-numeric: tabular-nums lining-nums;
}

.workspace-grid,
.notes-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.section-heading {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
}

.form-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

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

.choice-field {
  align-content: start;
}

.index-banner-field {
  grid-column: 1 / -1;
}

.field-label {
  font-weight: 700;
  font-size: 1rem;
}

.field-card-header {
  display: grid;
  gap: 6px;
}

.field-hint-inline {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.field-input {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 18px;
  background: var(--surface-soft);
  border: 1px solid rgba(18, 48, 66, 0.1);
  border-radius: 18px;
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.field-input:focus-within {
  border-color: rgba(15, 97, 127, 0.48);
  box-shadow: 0 0 0 4px rgba(15, 97, 127, 0.12);
  background: #fff;
}

.field-input input {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.34rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  outline: none;
}

.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.field-unit {
  padding-right: 10px;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
}

.field-unit-right {
  padding-right: 0;
  padding-left: 10px;
}

.field-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.choice-card,
.currency-choice {
  border: 1px solid rgba(18, 48, 66, 0.1);
  background: rgba(244, 248, 251, 0.84);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--ease),
    box-shadow var(--ease),
    background-color var(--ease),
    transform var(--ease);
}

.choice-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 97, 127, 0.08);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.choice-card-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.choice-banner-rail {
  display: grid;
  gap: 14px;
}

.choice-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 126px;
  padding: 18px 20px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, var(--banner-soft, rgba(217, 238, 245, 0.92)) 0%, rgba(255, 255, 255, 0.97) 72%),
    rgba(255, 255, 255, 0.94);
}

.choice-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(180deg, var(--banner-accent, var(--accent)), rgba(18, 48, 66, 0.28));
}

.choice-card::after {
  content: "";
  position: absolute;
  inset: auto -60px -56px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.72), transparent 66%);
  opacity: 0.9;
  pointer-events: none;
}

.index-banner-main,
.index-banner-side {
  position: relative;
  z-index: 1;
}

.index-banner-main {
  display: grid;
  gap: 10px;
}

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

.index-banner-tag {
  color: color-mix(in srgb, var(--banner-accent, var(--accent)) 78%, #16313f 22%);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.index-banner-title {
  font-size: clamp(1.12rem, 1.8vw, 1.42rem);
  line-height: 1.12;
}

.index-banner-side {
  display: grid;
  gap: 4px;
  min-width: 142px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 48, 66, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-align: right;
}

.index-banner-rate-label,
.index-banner-market {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.index-banner-rate-value {
  color: color-mix(in srgb, var(--banner-accent, var(--accent)) 84%, #133042 16%);
  font-size: 1.44rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums lining-nums;
}

.choice-card.is-active,
.currency-choice.is-active,
.choice-card:hover,
.choice-card:focus-visible,
.currency-choice:hover,
.currency-choice:focus-visible {
  border-color: rgba(15, 97, 127, 0.42);
  background: rgba(217, 238, 245, 0.56);
  box-shadow: 0 0 0 3px rgba(15, 97, 127, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.choice-card.is-active {
  border-color: color-mix(in srgb, var(--banner-accent, var(--accent)) 62%, rgba(18, 48, 66, 0.18));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--banner-accent, var(--accent)) 16%, transparent),
    0 16px 28px rgba(18, 48, 66, 0.1);
}

.choice-card.is-active .index-banner-side {
  background: rgba(255, 255, 255, 0.92);
  border-color: color-mix(in srgb, var(--banner-accent, var(--accent)) 28%, rgba(18, 48, 66, 0.08));
}

.currency-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.currency-choice {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px 14px;
  border-radius: 18px;
}

.currency-choice strong {
  font-size: 1rem;
}

.currency-choice span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.field-error {
  min-height: 1.4em;
  color: var(--loss);
  font-size: 0.9rem;
  font-weight: 600;
}

.field.is-invalid .field-input {
  border-color: rgba(198, 91, 81, 0.48);
  background: rgba(198, 91, 81, 0.05);
}

.form-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.primary-button {
  min-width: 148px;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #effbff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(11, 72, 96, 0.22);
  transition: transform var(--ease), box-shadow var(--ease), filter var(--ease);
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(11, 72, 96, 0.26);
  filter: saturate(1.06);
  outline: none;
}

.helper-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.status-banner {
  position: relative;
  z-index: 1;
  min-height: 24px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.scenario-note {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(15, 97, 127, 0.06);
  border: 1px solid rgba(15, 97, 127, 0.1);
  border-radius: 14px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  line-height: 1.7;
}

.status-banner.is-warning {
  padding: 10px 12px;
  background: rgba(255, 244, 214, 0.72);
  border: 1px solid rgba(223, 194, 124, 0.64);
  border-radius: 12px;
  color: #6f5530;
}

.summary-grid,
.period-cards {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.selection-snapshot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.snapshot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(15, 97, 127, 0.07);
  border: 1px solid rgba(15, 97, 127, 0.11);
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: nowrap;
}

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

.summary-card,
.period-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: rgba(244, 248, 251, 0.84);
  border: 1px solid rgba(18, 48, 66, 0.08);
  border-radius: 18px;
}

.summary-card strong,
.period-card strong,
.period-card .value-emphasis {
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  font-variant-numeric: tabular-nums lining-nums;
}

.summary-label,
.period-card .mini-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.profit-positive {
  color: var(--profit);
}

.profit-negative {
  color: var(--loss);
}

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

.period-card {
  gap: 12px;
}

.period-card .period-year {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 97, 127, 0.08);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.9rem;
}

.period-meta {
  display: grid;
  gap: 8px;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-line span:last-child {
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

.table-shell {
  position: relative;
  z-index: 1;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.results-table th,
.results-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(18, 48, 66, 0.08);
}

.results-table th {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: left;
}

.results-table td {
  font-size: 0.98rem;
}

.results-table td:not(:first-child),
.results-table th:not(:first-child) {
  text-align: right;
}

.results-table tbody tr:last-child td {
  border-bottom: 0;
}

.chart-panel {
  display: grid;
  gap: 18px;
}

.chart-legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  color: var(--muted);
  font-size: 0.94rem;
}

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

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

.legend-principal {
  background: #7d97a7;
}

.legend-value {
  background: var(--accent);
}

.legend-profit {
  background: var(--profit);
}

.chart-frame {
  position: relative;
  z-index: 1;
  padding: 12px;
  background: linear-gradient(180deg, rgba(244, 248, 251, 0.88), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(18, 48, 66, 0.08);
  border-radius: 22px;
}

#comparisonChart {
  width: 100%;
  height: auto;
  display: block;
}

.axis-text,
.value-tag,
.x-label {
  fill: var(--muted);
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

.axis-text {
  font-size: 14px;
}

.x-label {
  font-size: 15px;
  font-weight: 700;
}

.grid-line {
  stroke: rgba(18, 48, 66, 0.09);
  stroke-width: 1;
  stroke-dasharray: 3 8;
}

.zero-line {
  stroke: rgba(18, 48, 66, 0.24);
  stroke-width: 1.5;
}

.bar-principal {
  fill: #94a9b5;
}

.bar-value {
  fill: var(--accent);
}

.bar-profit-positive {
  fill: var(--profit);
}

.bar-profit-negative {
  fill: var(--loss);
}

.info-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.formula-box {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding: 16px 18px;
  background: rgba(15, 97, 127, 0.07);
  border: 1px solid rgba(15, 97, 127, 0.1);
  border-radius: 16px;
}

.formula-label {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.formula-box code {
  font-family: "IBM Plex Mono", "SFMono-Regular", "Consolas", monospace;
  color: var(--text);
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.risk-panel {
  background: linear-gradient(180deg, rgba(255, 250, 237, 0.96), rgba(255, 248, 228, 0.84));
  border-color: rgba(223, 194, 124, 0.42);
}

.risk-copy {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #6b5434;
  font-size: 1rem;
}

.risk-copy-secondary {
  margin-top: 14px;
  color: #7b6442;
  font-size: 0.94rem;
}

@keyframes audiencePulse {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  32% {
    transform: translateY(-6px) scale(1.09);
    filter: brightness(1.08);
  }
  64% {
    transform: translateY(2px) scale(0.985);
    filter: brightness(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@media (max-width: 1100px) {
  .hero,
  .workspace-grid,
  .notes-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--page-max));
    padding-top: 16px;
  }

  .topbar {
    top: 10px;
    flex-direction: column;
    align-items: stretch;
    border-radius: 24px;
  }

  .topnav {
    justify-content: space-between;
  }

  .hero,
  .calculator-panel,
  .spotlight-panel,
  .period-panel,
  #results,
  .chart-panel,
  .info-panel,
  .risk-panel {
    padding: 22px;
  }

  .form-grid,
  .summary-grid,
  .period-cards {
    grid-template-columns: 1fr;
  }

  .currency-choice-group {
    grid-template-columns: 1fr;
  }

  .choice-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 18px 20px;
  }

  .audience-band {
    padding: 18px;
  }

  .audience-live-meta {
    align-items: stretch;
  }

  .index-banner-top {
    flex-wrap: wrap;
  }

  .index-banner-side {
    min-width: 0;
    text-align: left;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topnav {
    gap: 8px;
  }

  .topnav a {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  .snapshot-pill {
    white-space: normal;
  }

  .hero h1 {
    max-width: none;
  }

  .hero-stat strong {
    font-size: 2.2rem;
  }

  .audience-live-delta {
    width: 100%;
    justify-content: center;
  }
}
