@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@1,700&display=swap");

:root {
  --ink: #17352f; --ink-soft: #52645f; --cream: #f7f4ee; --paper: #fffdf9;
  --line: #ddd9cf; --green: #1f5448; --green-deep: #143e35; --mint: #dfeae3;
  --gold: #c99d57; --estate: #385d51; --gift: #9b684d;
  --shadow: 0 20px 60px rgba(32, 57, 49, .09);
  font-family: "Noto Sans TC", system-ui, sans-serif; color: var(--ink); background: var(--cream); font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--cream); }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.site-header { min-height: 84px; padding: 16px clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: rgba(247, 244, 238, .94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 50% 50% 50% 12px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand small { margin-top: 2px; color: var(--ink-soft); font-size: 11px; letter-spacing: .12em; }
.header-meta { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4f926c; box-shadow: 0 0 0 5px rgba(79, 146, 108, .12); }

#app { outline: none; }
.home-hero, .tool-picker, .sources-section, .calculator-layout, .tool-hero { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.home-hero { min-height: 430px; padding: 88px 0 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 70px; align-items: end; }
.hero-copy { max-width: 760px; }
.eyebrow, .step-label, .result-kicker { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.home-hero h1 { margin: 18px 0 28px; font-size: clamp(48px, 7vw, 88px); line-height: 1.05; letter-spacing: -.055em; }
.home-hero h1 em { color: var(--green); font-family: "Playfair Display", serif; font-weight: 700; }
.hero-copy > p { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: 18px; line-height: 1.85; }
.hero-note { min-width: 180px; padding: 26px; border: 1px solid var(--line); border-radius: 100px 100px 18px 18px; text-align: center; background: var(--paper); box-shadow: var(--shadow); }
.hero-note span { display: block; font: italic 700 60px/1 "Playfair Display", serif; color: var(--gold); }
.hero-note p { margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

.tool-picker { padding: 56px 0 80px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.section-heading h2, .sources-section h2 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 42px); }
.section-heading > p { color: var(--ink-soft); font-size: 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tool-card { min-height: 290px; padding: 30px; display: grid; grid-template: auto 1fr auto / auto 1fr auto; gap: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); text-align: left; cursor: pointer; box-shadow: 0 8px 30px rgba(32, 57, 49, .04); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.tool-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: var(--shadow); }
.tool-number { color: #a5aaa5; font: 700 13px/1 ui-monospace, monospace; }
.tool-icon { grid-row: 2; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; color: white; }
.tool-card.estate .tool-icon { background: var(--estate); }
.tool-card.gift .tool-icon { background: var(--gift); }
.tool-icon svg { width: 34px; height: 34px; }
.tool-copy { grid-row: 2 / 4; align-self: center; }
.tool-copy small, .tool-copy strong, .tool-copy em { display: block; }
.tool-copy small { margin-bottom: 8px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.tool-copy strong { font-size: clamp(25px, 3vw, 34px); }
.tool-copy em { margin-top: 12px; color: var(--ink-soft); font-size: 14px; font-style: normal; line-height: 1.7; }
.tool-arrow { grid-column: 3; grid-row: 3; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }

.tool-hero { min-height: 290px; padding: 42px 0 52px; display: grid; grid-template-columns: 1fr auto; align-items: end; }
.back-button { grid-column: 1 / -1; align-self: start; justify-self: start; display: inline-flex; gap: 6px; align-items: center; padding: 8px 0; border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-size: 13px; }
.back-button:hover { color: var(--green); }
.tool-hero h1 { margin: 12px 0 10px; font-size: clamp(42px, 6vw, 68px); letter-spacing: -.04em; }
.tool-hero p { max-width: 760px; margin: 0; color: var(--ink-soft); line-height: 1.8; }
.hero-tool-icon { width: 104px; height: 104px; display: grid; place-items: center; border-radius: 30px; color: white; }
.tool-hero.estate .hero-tool-icon { background: var(--estate); }
.tool-hero.gift .hero-tool-icon { background: var(--gift); }
.hero-tool-icon svg { width: 48px; height: 48px; }

.calculator-layout { padding-bottom: 70px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .75fr); gap: 24px; align-items: start; }
.form-column { display: grid; gap: 18px; }
.form-card { padding: clamp(22px, 4vw, 36px); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; }
.card-heading { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.card-heading > span { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); font: 800 12px/1 ui-monospace, monospace; }
.card-heading h2 { margin: 0; font-size: 21px; }
.card-heading p { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; }
.field-grid.compact { margin-top: 25px; }
.field { display: grid; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
.field small { color: var(--ink-soft); font-size: 11px; font-weight: 400; line-height: 1.55; }
.money-input { height: 48px; display: grid; grid-template-columns: 1fr auto; align-items: center; overflow: hidden; border: 1px solid #d5d5cc; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.money-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 84, 72, .1); }
.money-input input { width: 100%; height: 100%; min-width: 0; padding: 0 12px; border: 0; outline: 0; color: var(--ink); background: transparent; text-align: right; font-weight: 650; }
.money-input em { padding-right: 12px; color: var(--ink-soft); font-size: 12px; font-style: normal; }
.count-input { max-width: 180px; }
.toggle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.toggle { min-height: 78px; padding: 14px; display: flex; gap: 11px; align-items: center; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle > span { flex: 0 0 34px; width: 34px; height: 20px; padding: 2px; border-radius: 99px; background: #c9cec9; transition: .2s; }
.toggle > span::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.16); transition: .2s; }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle strong, .toggle small { display: block; }
.toggle strong { font-size: 13px; }
.toggle small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.form-actions { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.secondary-button, .text-button, .print-button { border-radius: 10px; cursor: pointer; font-weight: 700; }
.secondary-button { padding: 12px 18px; border: 1px solid var(--green); background: transparent; color: var(--green); }
.text-button { padding: 12px; border: 0; background: transparent; color: var(--ink-soft); }
.mobile-result-bar { display: none; }

.result-column { position: sticky; top: 105px; }
.result-card { padding: 34px; border-radius: 24px; color: #f7f4ee; background: var(--green-deep); box-shadow: 0 24px 60px rgba(20, 62, 53, .2); }
.gift-result { background: #704b3b; }
.result-kicker { color: #dbc18f; }
.result-label { margin: 24px 0 4px; color: rgba(255,255,255,.7); font-size: 13px; }
.result-card h2 { margin: 0; font-size: clamp(34px, 5vw, 54px); line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.result-wan { margin: 7px 0 0; color: #d6e4dc; font-size: 14px; }
.result-rule { height: 1px; margin: 28px 0 18px; background: rgba(255,255,255,.16); }
.summary-list { display: grid; gap: 2px; }
.summary-row { padding: 9px 0; display: flex; justify-content: space-between; gap: 18px; color: rgba(255,255,255,.7); font-size: 12px; }
.summary-row strong { color: white; font-size: 13px; text-align: right; }
.summary-row.deduction strong { color: #b8d8c8; }
.summary-row.net { margin: 6px 0; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.14); border-bottom: 1px solid rgba(255,255,255,.14); color: white; font-weight: 700; }
.formula-box { margin-top: 20px; padding: 16px; display: grid; gap: 5px; border-radius: 12px; background: rgba(255,255,255,.07); }
.formula-box span { color: rgba(255,255,255,.58); font-size: 10px; letter-spacing: .1em; }
.formula-box strong { font-size: 13px; }
.result-notice { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.67); }
.result-notice svg { flex: 0 0 18px; width: 18px; height: 18px; }
.result-notice p { margin: 0; font-size: 11px; line-height: 1.65; }
.print-button { width: 100%; margin-top: 22px; padding: 12px; display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: white; }
.print-button:hover { background: rgba(255,255,255,.08); }
.print-button svg { width: 18px; height: 18px; }

.sources-section { padding: 55px 0 75px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 40px; border-top: 1px solid var(--line); }
.source-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.source-links a { min-height: 62px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.35); text-decoration: none; font-size: 13px; font-weight: 650; }
.source-links a:hover { border-color: var(--gold); background: var(--paper); }
.source-links svg { flex: 0 0 18px; width: 18px; height: 18px; }
.site-footer { padding: 26px clamp(20px, 5vw, 72px); display: flex; justify-content: space-between; gap: 30px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.site-footer p { margin: 0; }
.site-footer p:first-child { max-width: 850px; }

@media (min-width: 681px) and (max-width: 1024px) {
  .site-header { padding-inline: 30px; }
  .home-hero { min-height: 390px; padding: 64px 0 54px; grid-template-columns: minmax(0, 1fr) 150px; gap: 34px; }
  .home-hero h1 { font-size: clamp(54px, 8vw, 70px); }
  .hero-copy > p { font-size: 16px; }
  .hero-note { min-width: 150px; padding: 22px 16px; }
  .hero-note span { font-size: 50px; }
  .tool-picker { padding-top: 46px; }
  .tool-card { min-height: 245px; padding: 24px; gap: 18px; }
  .tool-icon { width: 60px; height: 60px; border-radius: 18px; }
  .tool-copy strong { font-size: 27px; }
  .tool-hero { min-height: 250px; padding-block: 34px 42px; }
  .hero-tool-icon { width: 86px; height: 86px; border-radius: 24px; }
  .calculator-layout { width: min(900px, calc(100% - 48px)); grid-template-columns: 1fr; }
  .result-column { position: static; grid-row: 1; }
  .result-card { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(300px, 1.2fr); column-gap: 34px; align-items: start; }
  .result-kicker, .result-label, .result-card h2, .result-wan, .result-rule { grid-column: 1; }
  .summary-list { grid-column: 2; grid-row: 1 / span 7; }
  .formula-box { grid-column: 1; }
  .result-notice, .print-button { grid-column: 1 / -1; }
  .result-card h2 { font-size: 44px; }
  .result-rule { margin-bottom: 10px; }
  .toggle-grid { grid-template-columns: repeat(3, 1fr); }
  .sources-section { grid-template-columns: .7fr 1.3fr; gap: 26px; }
  .source-links { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .site-header { min-height: 72px; padding: 12px 18px; }
  .brand small, .header-meta { display: none; }
  .home-hero, .tool-picker, .sources-section, .calculator-layout, .tool-hero { width: min(100% - 28px, 1180px); }
  .home-hero { min-height: auto; padding: 46px 0 38px; grid-template-columns: 1fr; gap: 30px; }
  .home-hero h1 { margin: 14px 0 22px; font-size: clamp(42px, 12vw, 50px); line-height: 1.08; }
  .hero-copy > p { font-size: 16px; line-height: 1.8; }
  .hero-note { display: none; }
  .tool-picker { padding: 38px 0 56px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 22px; }
  .section-heading > p { margin: 0; line-height: 1.65; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 190px; padding: 22px; grid-template: auto 1fr / auto minmax(0, 1fr) auto; gap: 16px; }
  .tool-number { grid-column: 1 / -1; }
  .tool-icon { width: 58px; height: 58px; border-radius: 18px; }
  .tool-icon svg { width: 29px; height: 29px; }
  .tool-copy { grid-row: 2; }
  .tool-copy strong { font-size: 27px; }
  .tool-copy em { font-size: 12px; }
  .tool-arrow { grid-row: 2; align-self: center; }
  .tool-hero { min-height: 230px; padding: 24px 0 34px; grid-template-columns: 1fr; }
  .tool-hero h1 { font-size: 42px; }
  .tool-hero p { font-size: 13px; }
  .hero-tool-icon { display: none; }
  .calculator-layout { grid-template-columns: 1fr; padding-bottom: 110px; }
  .result-column { position: static; grid-row: auto; }
  .field-grid, .source-links { grid-template-columns: 1fr; }
  .count-input { max-width: none; }
  .toggle-grid { grid-template-columns: 1fr; }
  .form-card, .result-card { padding: 22px 18px; border-radius: 18px; }
  .card-heading { margin-bottom: 22px; }
  .field-grid { gap: 19px; }
  .money-input { height: 52px; }
  .result-card { display: block; }
  .result-card h2 { font-size: 36px; }
  .mobile-result-bar { position: fixed; z-index: 30; left: 14px; right: 14px; bottom: max(12px, env(safe-area-inset-bottom)); min-height: 70px; padding: 10px 12px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; color: white; background: rgba(20, 62, 53, .96); box-shadow: 0 14px 36px rgba(20, 62, 53, .32); backdrop-filter: blur(15px); }
  .mobile-result-bar.gift-bar { background: rgba(112, 75, 59, .96); }
  .mobile-result-bar span, .mobile-result-bar small, .mobile-result-bar strong { display: block; text-align: left; }
  .mobile-result-bar small { margin-bottom: 2px; color: rgba(255,255,255,.65); font-size: 10px; }
  .mobile-result-bar strong { font-size: 22px; line-height: 1.2; }
  .mobile-result-bar em { flex: 0 0 auto; padding: 10px 12px; border-radius: 11px; background: rgba(255,255,255,.13); font-size: 11px; font-style: normal; font-weight: 700; }
  .sources-section { padding: 42px 0 110px; grid-template-columns: 1fr; gap: 24px; }
  .site-footer { flex-direction: column; }
}
@media print {
  .site-header, .tool-hero, .form-column, .sources-section, .site-footer, .print-button, .mobile-result-bar { display: none !important; }
  body { background: white; }
  .calculator-layout { display: block; width: 100%; padding: 0; }
  .result-column { position: static; }
  .result-card { box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
