:root {
  --gold: #A37E00;
  --gold-deep: #7A5C00;
  --gold-soft: #F2E7BE;
  --gold-hover: #694F00;
  --ink: #000000;
  --muted: rgb(60 60 67 / .6);
  --subtle: rgb(60 60 67 / .3);
  --paper: #F2F2F7;
  --surface: #FFFFFF;
  --surface-secondary: #F2F2F7;
  --surface-tertiary: #E5E5EA;
  --input-surface: #F9F9FB;
  --hover-surface: #E5E5EA;
  --card-bg: rgb(255 255 255 / .92);
  --line: rgb(60 60 67 / .29);
  --ambient: rgb(163 126 0 / .08);
  --shadow: rgb(36 34 20 / .08);
  --soft-shadow: rgb(24 32 25 / .08);
  --thumb-border: #FFFFFF;
  --tooltip-bg: rgb(28 28 30 / .94);
  --positive: #34C759;
  --negative: #FF3B30;
  --chart-grid: rgb(60 60 67 / .12);
  --chart-label: rgb(60 60 67 / .6);
  --chart-fill-top: rgb(163 126 0 / .20);
  --theme-control: rgb(120 120 128 / .12);
}

:root[data-theme="dark"] {
  --gold: #D1AA2D;
  --gold-deep: #806000;
  --gold-soft: rgb(209 170 45 / .18);
  --gold-hover: #987500;
  --ink: #FFFFFF;
  --muted: rgb(235 235 245 / .6);
  --subtle: rgb(235 235 245 / .3);
  --paper: #000000;
  --surface: #1C1C1E;
  --surface-secondary: #2C2C2E;
  --surface-tertiary: #3A3A3C;
  --input-surface: #2C2C2E;
  --hover-surface: #3A3A3C;
  --card-bg: rgb(28 28 30 / .94);
  --line: rgb(84 84 88 / .65);
  --ambient: rgb(209 170 45 / .11);
  --shadow: rgb(0 0 0 / .38);
  --soft-shadow: rgb(0 0 0 / .3);
  --thumb-border: #FFFFFF;
  --tooltip-bg: rgb(44 44 46 / .96);
  --positive: #30D158;
  --negative: #FF453A;
  --chart-grid: rgb(84 84 88 / .45);
  --chart-label: rgb(235 235 245 / .6);
  --chart-fill-top: rgb(209 170 45 / .24);
  --theme-control: rgb(118 118 128 / .24);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% 0%, var(--ambient), transparent 34rem), var(--paper); transition-property: color, background-color; transition-duration: 180ms; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar { min-height: 96px; margin: 0; padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: transparent; }
.header-identity { min-width: 0; display: flex; align-items: center; gap: 16px; }
.brand-mark { width: 64px; height: 64px; flex: 0 0 64px; display: block; overflow: hidden; border-radius: 20px; box-shadow: 0 8px 20px var(--soft-shadow); outline: 1px solid oklch(0 0 0 / .1); }
:root[data-theme="dark"] .brand-mark { outline-color: oklch(1 0 0 / .1); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.header-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.brand-title { color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; }
.btc-ticker { overflow: hidden; font-variant-numeric: tabular-nums; }
.market-content { display: flex; align-items: center; gap: 9px; opacity: 1; translate: 0 0; transition-property: opacity, translate; transition-duration: 150ms; transition-timing-function: ease-out; }
.market-content.is-leaving { opacity: 0; translate: 0 -7px; }
.market-content.is-entering { opacity: 0; translate: 0 7px; }
.market-content.is-resetting { transition-duration: 0ms; }
.btc-icon { width: 16px; height: 16px; flex: 0 0 auto; display: block; filter: drop-shadow(0 3px 6px rgba(246,146,26,.16)); }
.btc-copy { min-width: 0; display: flex; align-items: baseline; gap: 11px; }
.btc-name { display: block; color: var(--ink); font-size: 12px; line-height: 1; font-weight: 400; }
.btc-quote { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.btc-ticker strong { color: var(--ink); font-size: 12px; line-height: 1; font-weight: 400; letter-spacing: -.01em; }
.btc-ticker small { color: var(--muted); font-size: 12px; line-height: 1; font-weight: 400; }
.btc-ticker small.positive { color: var(--positive); }
.btc-ticker small.negative { color: var(--negative); }
.theme-toggle { position: relative; width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 14px; color: var(--ink); background: var(--theme-control); cursor: pointer; transition-property: background-color, scale; transition-duration: 150ms; }
.theme-toggle:hover { background: var(--surface-tertiary); }
.theme-toggle:active { scale: .96; }
.theme-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.theme-icon { position: absolute; inset: 10px; width: 24px; height: 24px; transition-property: opacity, scale, filter; transition-duration: 180ms; transition-timing-function: cubic-bezier(.2,0,0,1); }
.theme-icon-dark { opacity: 1; scale: 1; filter: blur(0); }
.theme-icon-light { opacity: 0; scale: .25; filter: blur(4px); }
:root[data-theme="dark"] .theme-icon-dark { opacity: 0; scale: .25; filter: blur(4px); }
:root[data-theme="dark"] .theme-icon-light { opacity: 1; scale: 1; filter: invert(1) blur(0); }
.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); align-items: start; gap: 22px; padding: 10px 0 70px; }
.card { background: var(--card-bg); border-radius: 24px; box-shadow: 0 1px 0 var(--soft-shadow), 0 18px 50px var(--shadow); backdrop-filter: blur(12px); }
.calculator { padding: 27px; }
.results { padding: 27px 30px 23px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; }
.step { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 9px; color: var(--gold-deep); background: var(--gold-soft); font-size: 10px; font-weight: 800; }
h2 { margin: 0; font-size: 17px; line-height: 1.2; letter-spacing: -.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
form { margin-top: 27px; }
.field-label { display: block; margin: 0 0 9px; font-size: 12px; font-weight: 650; }
.input-shell { height: 51px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--input-surface); transition-property: border-color, box-shadow, background-color; transition-duration: 150ms; }
.input-shell:focus-within { border-color: var(--gold); background: var(--surface); box-shadow: 0 0 0 3px rgb(163 126 0 / .13); }
.money-input .prefix { padding-left: 15px; color: var(--gold-deep); font-weight: 750; }
.money-input input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; padding: 0 9px; color: var(--ink); font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; }
.suffix { margin-right: 8px; padding: 6px 8px; border-radius: 7px; color: var(--muted); background: var(--surface-secondary); font-size: 10px; font-weight: 700; }
.quick-amounts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 8px 0 7px; }
.quick-amounts button { height: 34px; padding: 0 3px; border: 0; border-radius: 8px; color: var(--muted); background: var(--surface-secondary); font-size: 11px; font-weight: 650; cursor: pointer; transition-property: color, background-color, box-shadow, scale; transition-duration: 150ms; }
.quick-amounts button:hover { color: var(--ink); background: var(--hover-surface); }
.quick-amounts button[aria-pressed="true"] { color: #fff; background: var(--gold-deep); box-shadow: 0 4px 10px rgba(122,92,0,.18); }
.quick-amounts button:active { scale: .96; }
.quick-amounts button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.field-note { margin: 0 0 23px; color: var(--subtle); font-size: 10px; }
.rate-row { display: grid; grid-template-columns: minmax(80px, 1fr) 112px; align-items: center; gap: 14px; margin-bottom: 25px; }
input[type="range"] { width: 100%; height: 4px; appearance: none; border-radius: 99px; outline: none; background: linear-gradient(to right, var(--gold) var(--progress, 26.4%), var(--surface-tertiary) var(--progress, 26.4%)); }
input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; appearance: none; border: 4px solid var(--thumb-border); border-radius: 50%; background: var(--gold); box-shadow: 0 1px 8px rgba(69,51,0,.35); cursor: grab; }
input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(.96); }
.rate-input { padding: 0 11px; height: 43px; }
.rate-input input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-weight: 680; font-variant-numeric: tabular-nums; }
.rate-input span { color: var(--gold-deep); font-weight: 650; }
fieldset { margin: 0; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-secondary); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 39px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; transition-property: color, background-color, box-shadow; transition-duration: 150ms; }
.segmented input:checked + span { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px var(--soft-shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.calculate-btn { width: 100%; height: 52px; margin-top: 24px; border: 0; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; background: var(--gold-deep); box-shadow: 0 9px 22px rgb(122 92 0 / .22); font-weight: 680; cursor: pointer; transition-property: background-color, scale, box-shadow; transition-duration: 150ms; }
.calculate-btn:hover { background: var(--gold-hover); box-shadow: 0 11px 26px rgb(122 92 0 / .28); }
.calculate-btn:active { scale: .96; }
.calculate-btn:focus-visible { outline: 3px solid rgba(163,126,0,.28); outline-offset: 3px; }
.results-top { display: flex; justify-content: space-between; gap: 18px; }
.fx-line { color: var(--gold-deep) !important; font-weight: 650; font-variant-numeric: tabular-nums; }
.updated { align-self: flex-start; color: var(--muted); font-size: 10px; white-space: nowrap; }
.updated::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #6C8A62; vertical-align: 1px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0 30px; }
.metric { min-width: 0; padding: 17px; border-radius: 15px; background: var(--surface-secondary); }
.metric > span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; overflow: hidden; margin: 8px 0 4px; font-size: clamp(18px, 2.3vw, 27px); line-height: 1; letter-spacing: -.035em; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.metric .cny-value { display: block; overflow: hidden; margin-bottom: 7px; color: var(--gold-deep); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric small { display: block; color: var(--subtle); font-size: 9px; }
.chart-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding-top: 25px; border-top: 1px solid var(--line); }
.chart-label { margin: 0 0 7px; color: var(--muted); font-size: 11px; }
.chart-header strong { font-size: 24px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chart-header div > span { margin-left: 7px; color: var(--gold-deep); font-size: 10px; font-weight: 700; }
.chart-header .chart-percent { display: inline-block; padding: 3px 6px; border-radius: 6px; background: rgba(163,126,0,.1); font-variant-numeric: tabular-nums; }
.chart-value small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.period-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-secondary); }
.period-tabs button { width: 37px; height: 30px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; transition-property: color, background-color, box-shadow; transition-duration: 150ms; }
.period-tabs button[aria-selected="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 5px var(--soft-shadow); font-weight: 700; }
.period-tabs button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.chart-wrap { position: relative; height: 225px; margin-top: 15px; }
#growth-chart { width: 100%; height: 100%; touch-action: none; }
.chart-tooltip { position: absolute; z-index: 2; width: max-content; max-width: calc(100% - 8px); pointer-events: none; padding: 8px 10px; border-radius: 8px; color: #fff; background: var(--tooltip-bg); box-shadow: 0 5px 15px rgb(0 0 0 / .18); font-size: 10px; line-height: 1.5; text-align: center; white-space: pre-line; overflow-wrap: anywhere; transform: translate(-50%, calc(-100% - 10px)); }
.chart-legend { display: flex; justify-content: space-between; color: var(--subtle); font-size: 9px; }
.chart-legend span:first-child { color: var(--muted); }
.chart-legend i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--gold); }
footer { min-height: 72px; padding: 20px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--subtle); font-size: 10px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 560px); }
  .topbar { min-height: 80px; margin: 0; padding: 14px 0; gap: 14px; }
  .brand-mark { width: 52px; height: 52px; flex-basis: 52px; border-radius: 16px; }
  .header-identity { gap: 12px; }
  .header-copy { gap: 9px; }
  .btc-copy { gap: 8px; }
  .workspace { grid-template-columns: 1fr; gap: 14px; padding: 10px 0 44px; }
  .calculator, .results { padding: 22px; border-radius: 20px; }
  .metric-grid { margin: 22px 0 27px; gap: 7px; }
  .metric { padding: 14px 11px; border-radius: 13px; }
  .metric strong { font-size: clamp(16px, 5vw, 22px); }
  .chart-wrap { height: 210px; }
  footer { flex-direction: column; gap: 7px; }
}

@media (max-width: 520px) {
  .topbar { min-height: 72px; padding: 12px 0; gap: 10px; }
  .header-identity { gap: 10px; }
  .brand-mark { width: 44px; height: 44px; flex-basis: 44px; border-radius: 14px; }
  .header-copy { gap: 7px; }
  .market-content { gap: 7px; }
  .btc-copy { gap: 6px; }
  .theme-toggle { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .theme-icon { inset: 8px; }
}

@media (max-width: 390px) {
  .shell { width: calc(100% - 20px); }
  .topbar { padding: 10px 0; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .market-content { gap: 6px; }
  .btc-copy { gap: 5px; }
  .btc-quote { gap: 4px; }
  .theme-toggle { width: 36px; height: 36px; flex-basis: 36px; border-radius: 12px; }
  .theme-icon { inset: 7px; width: 22px; height: 22px; }
  .calculator, .results { padding: 18px; }
  .results-top { display: block; }
  .updated { display: inline-block; margin: 10px 0 0 40px; }
  .metric strong { font-size: 16px; }
  .chart-header { align-items: center; }
  .chart-header strong { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
