/* 投連險目標導向選基 — 試玩頁（零 CDN） */
:root {
  --ink: #1a1f2e;
  --ink-soft: #4a5168;
  --muted: #8b92a8;
  --paper: #f4f1ea;
  --card: #ffffff;
  --line: #e2ded4;
  --accent: #2f6fed;
  --accent-soft: #e8f0fe;
  --accent-2: #0d9488;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #475569;
  --danger-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(26, 31, 46, 0.06);
  --ease: 180ms ease;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  min-height: 100vh;
}
button, input { font-family: inherit; }
a { color: var(--accent); }
a:hover { text-decoration: underline; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* Top */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
}
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.topbar-tag {
  font-size: 12px;
  color: var(--muted);
}

/* Step progress */
.step-progress { margin-bottom: 22px; }
.dots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  position: relative;
}
.dots::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.dot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 11px;
  color: var(--muted);
}
.dot span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.dot em { font-style: normal; font-weight: 500; }
.dot.is-current span {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.dot.is-current { color: var(--ink); font-weight: 600; }
.dot.is-done span {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #fff;
}

/* Steps */
.step { animation: fadeIn var(--ease); }
.step[hidden] { display: none !important; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

h1 {
  font-size: clamp(26px, 5vw, 32px);
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(20px, 4vw, 22px);
  margin: 0 0 8px;
}
h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
.thin { font-weight: 400; color: var(--ink-soft); }
.lead { color: var(--ink-soft); margin: 0 0 18px; font-size: 15px; }
.hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.muted { color: var(--muted); font-size: 12px; }
.eyebrow {
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 600;
  margin: 0 0 8px;
}

.hero-card {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  padding: 28px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.play-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.play-steps li {
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 8px;
}
.play-steps span {
  color: var(--accent);
  font-weight: 700;
}

.callout {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.callout-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #fde68a;
}

/* Buttons */
.btn-primary, .btn-ghost {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 650;
  transition: transform var(--ease), opacity var(--ease), background var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 111, 237, 0.28);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--card); }
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* Plan cards */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
}
.plan-card {
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  box-shadow: var(--shadow);
  width: 100%;
  color: inherit;
}
.plan-card:hover { border-color: #c5d4f7; }
.plan-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.plan-card .plan-name {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 8px;
  line-height: 1.35;
}
.plan-card .plan-note {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-weight: 550;
  border: 1px solid var(--line);
}
.plan-card.is-selected .tag {
  background: #fff;
  border-color: #c5d4f7;
  color: var(--accent);
}

.link-row { margin: 16px 0 0; font-size: 13px; }
.link-out { font-weight: 600; text-decoration: none; }
.link-out:hover { text-decoration: underline; }

/* Goal chips */
.goal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .goal-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.goal-chip {
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
  width: 100%;
  color: inherit;
  box-shadow: var(--shadow);
}
.goal-chip:hover { border-color: #c5d4f7; }
.goal-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.goal-chip .g-name {
  display: block;
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 6px;
}
.goal-chip .g-horizon {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-weight: 550;
}
.goal-chip.is-selected .g-horizon {
  background: #fff;
  color: var(--accent);
}

.cap-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px dashed var(--accent);
  font-size: 14px;
}
.cap-banner strong { color: var(--accent); font-size: 18px; }

/* Risk */
.risk-meter {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.risk-segs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.risk-seg {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 14px 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.risk-seg:hover { border-color: #c5d4f7; }
.risk-seg[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.or-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0 10px;
}
.score-label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}
#riskScore {
  width: 100%;
  accent-color: var(--accent);
  height: 28px;
}
.fine-print {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* Summary */
.summary-strip {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 14px;
}
.summary-strip dl {
  margin: 0;
  display: grid;
  gap: 10px;
}
.summary-strip dt {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
}
.summary-strip dd {
  margin: 2px 0 0;
  font-weight: 650;
  color: var(--ink);
}
.checks {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  background: var(--card);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.check input { margin-top: 3px; accent-color: var(--accent); }

/* Result */
.result-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.alloc-card, .funds-card, .illust-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.alloc-bar {
  display: flex;
  height: 28px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
  margin-bottom: 12px;
}
.alloc-seg {
  height: 100%;
  transition: width var(--ease);
  min-width: 0;
}
.alloc-seg--eq { background: #64748b; }   /* 中性 slate，唔用綠 */
.alloc-seg--bd { background: #94a3b8; }
.alloc-seg--ca { background: #cbd5e1; }
.alloc-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 13px;
}
.alloc-legend li { display: flex; align-items: center; gap: 6px; font-weight: 550; }
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.swatch-eq { background: #64748b; }
.swatch-bd { background: #94a3b8; }
.swatch-ca { background: #cbd5e1; }
.cap-line {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--info);
}

.fund-list { display: grid; gap: 8px; }
.fund-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--line);
}
.fund-row .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  color: var(--info);
  font-size: 12px;
}
.fund-row .fname { font-weight: 600; }
.fund-row .meta { color: var(--muted); font-size: 11px; }
.fund-row .weight {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}

.ng-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  color: var(--warn);
  background: var(--warn-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 0 12px;
}
.illust-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.illust-item {
  background: var(--paper);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--line);
}
.illust-item .label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.illust-item .val {
  font-size: 18px;
  font-weight: 700;
  color: var(--info); /* 中性，唔用穩賺綠 */
}

.fee-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.fee-box strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 14px; }
.fee-box p { margin: 0; }

.disclaimer-bar {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 12px;
  color: #7f1d1d;
  line-height: 1.6;
  margin-bottom: 8px;
}
.disclaimer-bar p { margin: 0; }

.site-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(440px, calc(100vw - 32px));
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
  z-index: 50;
  border-left: 4px solid #fbbf24;
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Hard block (emergency) */
.hard-block {
  background: var(--danger-soft);
  border: 2px solid #f87171;
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
}
.hard-block-msg {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #7f1d1d;
  line-height: 1.65;
}

.disclaimer-bullets {
  margin: 0 0 10px;
  padding-left: 1.25em;
}
.disclaimer-bullets li {
  margin-bottom: 6px;
  font-weight: 600;
}
.disclaimer-extra {
  margin: 10px 0 0;
  font-weight: 400;
  opacity: 0.95;
}
.foot-disclaimer {
  margin: 10px auto 0;
  max-width: 640px;
  font-size: 10px;
  line-height: 1.55;
  color: var(--muted);
  text-align: left;
}

/* 短線／緊急目標 chip 提示 */
.goal-chip.is-blocked-goal .g-horizon {
  color: #b91c1c;
  font-weight: 650;
}
.goal-chip.is-blocked-goal.is-selected {
  border-color: #f87171;
  background: #fff7f7;
}
