:root {
  --ink: #102033;
  --muted: #5e6f82;
  --navy: #102a43;
  --blue: #1b6ca8;
  --teal: #1f9d8a;
  --gold: #c99a2e;
  --coral: #d56b4c;
  --paper: #fbf7ef;
  --mist: #eaf4f6;
  --white: #ffffff;
  --line: rgba(16, 32, 51, 0.14);
  --shadow: 0 18px 46px rgba(16, 32, 51, 0.12);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(251, 247, 239, 0.94);
  backdrop-filter: blur(16px);
}

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

.brand img {
  width: clamp(132px, 18vw, 210px);
  height: auto;
}

.brand span {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.brand strong,
.brand small {
  line-height: 1.25;
}

.brand strong {
  font-size: 15px;
  font-weight: 950;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a {
  min-width: 64px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--navy);
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 900;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  outline: none;
  color: var(--white);
  background: var(--navy);
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(26px, 4vw, 58px);
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: clamp(36px, 6vw, 76px) clamp(20px, 5vw, 72px);
  background:
    linear-gradient(110deg, rgba(16, 42, 67, 0.96) 0%, rgba(20, 75, 105, 0.9) 54%, rgba(233, 244, 245, 0.96) 54% 100%),
    url("assets/logo642insurance.png");
  background-size: cover, 520px auto;
  background-position: center, right 5% center;
  background-repeat: no-repeat;
}

.hero-copy {
  color: var(--white);
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: clamp(16px, 1.8vw, 21px);
  line-height: 1.35;
  font-weight: 950;
}

.hero-copy .eyebrow {
  color: #f3c45d;
}

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

h1 {
  margin-bottom: 22px;
  color: var(--white);
  font-size: clamp(52px, 8vw, 106px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 950;
}

h1 span {
  display: block;
}

.hero-lead {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(22px, 2.4vw, 33px);
  line-height: 1.52;
  font-weight: 850;
}

.water-visual {
  display: grid;
  grid-template-columns: minmax(150px, 0.82fr) minmax(72px, 0.28fr) minmax(170px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 430px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  min-width: 0;
}

.reservoir {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 156px;
  padding: 22px;
  border: 3px solid rgba(27, 108, 168, 0.45);
  border-radius: 8px 8px 26px 26px;
  color: var(--navy);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0 28%, rgba(31, 157, 138, 0.22) 28% 100%),
    var(--white);
  min-width: 0;
  overflow-wrap: anywhere;
}

.reservoir-large {
  min-height: 300px;
  border-color: rgba(27, 108, 168, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0 20%, rgba(27, 108, 168, 0.28) 20% 100%),
    var(--white);
}

.reservoir span,
.reservoir small {
  color: var(--muted);
  font-weight: 900;
}

.reservoir span {
  font-size: 18px;
}

.reservoir strong {
  display: block;
  margin: 10px 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.16;
  font-weight: 950;
}

.reservoir small {
  font-size: 16px;
}

.flow-line {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 90px;
  color: var(--navy);
  font-weight: 950;
}

.flow-line::before,
.flow-line::after {
  content: "";
  position: absolute;
}

.flow-line::before {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.flow-line::after {
  right: -4px;
  width: 0;
  height: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 24px solid var(--teal);
}

.flow-line span {
  position: relative;
  z-index: 1;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 15px;
}

.small-reservoirs {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.small-reservoirs .reservoir {
  min-height: 118px;
  padding: 16px;
}

.small-reservoirs strong {
  margin-bottom: 0;
  font-size: clamp(20px, 1.8vw, 28px);
}

.reservoir-percent {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 100%;
}

.hero-percent-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: min(96px, 100%);
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid rgba(16, 32, 51, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.hero-percent-row input {
  width: 50px;
  min-width: 0;
  border: 0;
  outline: none;
  color: var(--navy);
  text-align: right;
  font-size: 20px;
  font-weight: 950;
  background: transparent;
}

.hero-percent-row b {
  color: var(--gold);
  font-size: 16px;
  font-weight: 950;
}

.small-b {
  border-color: rgba(201, 154, 46, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0 34%, rgba(201, 154, 46, 0.22) 34% 100%),
    var(--white);
}

.small-c {
  border-color: rgba(213, 107, 76, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0 38%, rgba(213, 107, 76, 0.2) 38% 100%),
    var(--white);
}

.content-band {
  padding: clamp(44px, 6vw, 78px) clamp(20px, 5vw, 72px);
  background: var(--white);
}

.band-light {
  background: #f5fbfb;
}

.band-accent {
  background: linear-gradient(180deg, #fff9ed 0%, #f0faf7 100%);
}

.section-heading {
  max-width: 920px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 950;
}

.section-heading h2 span {
  display: block;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(16, 32, 51, 0.08);
  min-width: 0;
}

.risk-note {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.68;
  font-weight: 700;
}

.demo-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

.demo-controls,
.demo-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(16, 32, 51, 0.08);
  min-width: 0;
}

.demo-controls {
  display: grid;
  gap: 20px;
  padding: 26px;
}

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

.field span,
.auto-rule-card span {
  color: var(--navy);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 950;
}

.input-row,
.range-row,
.percent-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-row,
.percent-row,
.field select {
  min-height: 58px;
  border: 1px solid rgba(16, 32, 51, 0.18);
  border-radius: 8px;
  background: var(--white);
}

.input-row,
.percent-row {
  padding: 0 14px;
}

.input-row b,
.percent-row b {
  color: var(--gold);
  font-size: 18px;
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.field input[type="number"],
.field input[type="text"] {
  min-width: 0;
  border: 0;
  outline: none;
}

.field select {
  padding: 0 14px;
}

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

.auto-rule-card {
  display: grid;
  gap: 9px;
  min-height: 128px;
  padding: 18px;
  border: 1px solid rgba(16, 32, 51, 0.14);
  border-radius: 8px;
  background: #f4fbfa;
}

.auto-rule-card strong {
  color: var(--navy);
  font-size: 23px;
  line-height: 1.36;
  font-weight: 950;
}

.auto-rule-card small {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 800;
}

.range-row strong {
  min-width: 64px;
  color: var(--navy);
  text-align: right;
  font-size: 24px;
  font-weight: 950;
}

.range-row--months strong {
  min-width: 116px;
  font-size: 21px;
}

.field-hint {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 850;
}

.demo-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px;
}

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

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 17px;
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  color: var(--navy);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.12;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.allocation-track {
  height: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.1);
}

.allocation-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width 180ms ease;
}

.risk-note {
  margin: 18px 0 0;
  padding: 18px 22px;
  border-left: 8px solid var(--coral);
  background: rgba(255, 255, 255, 0.72);
}

.simulation-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(420px, 1.22fr);
  gap: 18px;
  align-items: stretch;
}

.rebalance-panel,
.simulation-results,
.chart-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(16, 32, 51, 0.08);
  min-width: 0;
}

.rebalance-panel {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.section-mini {
  display: grid;
  gap: 6px;
}

.section-mini span {
  color: var(--gold);
  font-size: 18px;
  font-weight: 950;
}

.section-mini strong {
  color: var(--navy);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 950;
}

.target-grid,
.settings-row {
  display: grid;
  gap: 14px;
}

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

.settings-row {
  grid-template-columns: minmax(150px, 0.7fr) minmax(160px, 1fr);
}

.field--small span {
  font-size: 16px;
}

.status-note {
  margin: 0;
  padding: 14px 16px;
  border-left: 6px solid var(--teal);
  background: #f4fbfa;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 850;
}

.status-note.is-warning {
  border-left-color: var(--coral);
  background: #fff3ee;
  color: #9b3f2d;
}

.status-note.hero-target-status {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.35;
}

.simulation-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.simulation-results .metric-card {
  min-height: 108px;
  box-shadow: none;
}

.simulation-results .metric-card:first-child {
  grid-column: 1 / -1;
}

.simulation-results .metric-card strong {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.16;
}

.chart-card {
  margin-top: 18px;
  padding: 18px;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: auto;
}

.table-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.table-card {
  min-width: 0;
  padding: 22px;
}

.table-card h3 {
  margin-bottom: 16px;
  color: var(--navy);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 950;
}

.table-scroll {
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(16, 32, 51, 0.12);
  color: var(--ink);
  text-align: left;
  font-size: 15px;
  line-height: 1.38;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
}

th:nth-child(1),
td:nth-child(1) {
  width: 36%;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
  width: 18%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 28%;
  text-align: right;
}

th {
  color: var(--muted);
  background: #f4fbfa;
  font-weight: 950;
}

.summary-row td {
  color: var(--navy);
  background: #fff8e8;
  font-weight: 950;
}

.site-footer {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 30px 20px;
  color: var(--white);
  text-align: center;
  background: var(--navy);
}

.site-footer strong {
  font-size: 24px;
  font-weight: 950;
}

.site-footer span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
  line-height: 1.45;
  font-weight: 800;
}

@media (min-width: 981px) and (max-width: 1180px) and (orientation: landscape) {
  .site-header {
    min-height: 68px;
    padding: 9px 40px;
  }

  .brand img {
    width: 184px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 12px;
  }

  .top-nav a {
    min-width: 58px;
    padding: 9px 10px;
  }

  .hero-band {
    grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
    gap: 28px;
    min-height: calc(100vh - 68px);
    padding: 38px 52px;
  }

  h1 {
    margin-bottom: 18px;
    font-size: clamp(68px, 7.3vw, 78px);
  }

  .hero-lead {
    font-size: clamp(23px, 2.45vw, 26px);
    line-height: 1.48;
  }

  .water-visual {
    grid-template-columns: minmax(135px, 0.82fr) minmax(62px, 0.24fr) minmax(160px, 1fr);
    gap: 10px;
    min-height: 390px;
    padding: 22px;
  }

  .reservoir {
    padding: 18px;
  }

  .reservoir-large {
    min-height: 280px;
  }

  .reservoir strong {
    font-size: clamp(25px, 2.8vw, 32px);
  }

  .small-reservoirs {
    gap: 12px;
  }

  .small-reservoirs .reservoir {
    min-height: 124px;
    padding: 13px;
  }

  .small-reservoirs strong {
    font-size: clamp(21px, 2.1vw, 24px);
  }

  .reservoir-percent {
    gap: 6px;
  }

  .hero-percent-row {
    min-height: 32px;
  }

  .hero-percent-row input {
    font-size: 18px;
  }

  .hero-target-status {
    padding: 9px 12px;
    font-size: 14px;
  }

  .content-band {
    padding: 48px 52px;
  }

  .section-heading {
    margin-bottom: 24px;
  }

  .section-heading h2 {
    font-size: clamp(40px, 4.1vw, 46px);
  }

  .demo-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .demo-controls {
    gap: 18px;
    padding: 24px;
  }

  .metric-card {
    min-height: 112px;
    padding: 20px;
  }

  .metric-card strong {
    font-size: clamp(30px, 3.1vw, 36px);
  }

  .simulation-grid {
    grid-template-columns: minmax(350px, 0.82fr) minmax(0, 1.18fr);
  }

  .rebalance-panel {
    gap: 18px;
    padding: 22px;
  }

  .section-mini strong {
    font-size: 24px;
  }

  .field span,
  .auto-rule-card span {
    font-size: 17px;
  }

  .field--small span {
    font-size: 15px;
  }

  .simulation-results {
    gap: 12px;
    padding: 16px;
  }

  .simulation-results .metric-card {
    min-height: 98px;
    padding: 18px;
  }

  .simulation-results .metric-card strong {
    font-size: clamp(22px, 2.15vw, 28px);
  }

  .chart-card,
  .table-card {
    padding: 18px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 14px;
  }

  .risk-note {
    font-size: 18px;
    line-height: 1.62;
  }
}

@media (max-width: 980px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero-band,
  .demo-grid,
  .simulation-grid,
  .table-grid {
    grid-template-columns: 1fr;
  }

  .hero-band {
    min-height: auto;
    background:
      linear-gradient(180deg, rgba(16, 42, 67, 0.96) 0%, rgba(20, 75, 105, 0.92) 48%, rgba(233, 244, 245, 0.96) 48% 100%),
      url("assets/logo642insurance.png");
    background-size: cover, 420px auto;
    background-position: center, center 62%;
  }

  .water-visual {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .flow-line {
    min-height: 74px;
  }

  .flow-line::before {
    width: 12px;
    height: 100%;
  }

  .flow-line::after {
    right: auto;
    bottom: -6px;
    border-top: 24px solid var(--teal);
    border-right: 18px solid transparent;
    border-left: 18px solid transparent;
    border-bottom: 0;
  }

  .simulation-results {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 660px) {
  .brand span {
    display: none;
  }

  .top-nav a {
    min-width: 58px;
    padding-inline: 10px;
  }

  .hero-band,
  .content-band {
    padding-inline: 16px;
  }

  h1 {
    font-size: clamp(44px, 12vw, 48px);
    line-height: 1.08;
  }

  .hero-lead {
    font-size: 22px;
  }

  .target-grid,
  .settings-row,
  .simulation-results {
    grid-template-columns: 1fr;
  }

  .simulation-results .metric-card:first-child {
    grid-column: auto;
  }

  .metric-card {
    min-height: auto;
    padding: 18px;
  }

  .metric-card strong,
  .simulation-results .metric-card strong {
    font-size: clamp(24px, 8vw, 32px);
  }

  .table-card {
    padding: 18px;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 12px 0;
    border-bottom: 1px solid rgba(16, 32, 51, 0.12);
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  th:nth-child(1),
  td:nth-child(1),
  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4) {
    width: 100%;
    text-align: left;
  }

  td {
    display: grid;
    grid-template-columns: minmax(78px, 0.34fr) minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border-bottom: 0;
    text-align: left;
    overflow-wrap: normal;
    word-break: normal;
  }

  td::before {
    color: var(--muted);
    font-weight: 950;
  }

  td:nth-child(1)::before {
    content: "基金";
  }

  td:nth-child(2)::before {
    content: "目標比例";
  }

  td:nth-child(3)::before {
    content: "期末比例";
  }

  td:nth-child(4)::before {
    content: "期末市值";
  }

}
