:root {
  --navy: #081724;
  --navy-raised: #102535;
  --navy-line: #254052;
  --text: #e8eef0;
  --muted: #91a5b1;
  --gold: #c6a45b;
  --gold-soft: #e0c98e;
  --up: #4ebc91;
  --down: #e37570;
  --notice: #1a3343;
}

* { box-sizing: border-box; }
html { background: var(--navy); }
body { margin: 0; min-width: 320px; background: var(--navy); color: var(--text); font-family: "Mulish", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 16px; line-height: 1.5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: var(--gold-soft); text-underline-offset: 3px; }

.site-shell { width: min(100%, 680px); min-height: 100vh; margin: 0 auto; padding: 28px 20px max(24px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 25px; border-bottom: 1px solid var(--navy-line); }
.brand, .eyebrow { margin: 0; color: var(--gold); font-size: 0.76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2 { margin: 4px 0 0; letter-spacing: 0; }
h1 { font-size: 1.25rem; font-weight: 600; }
h2 { font-size: 1.35rem; font-weight: 600; }
h2 span { color: var(--muted); font-size: .78rem; font-weight: 500; }
.status-indicator { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; padding-top: 3px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.status-dot.is-live { background: var(--up); animation: live-pulse 1.6s ease-out infinite; }.status-dot.is-error { background: var(--down); }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgb(78 188 145 / 45%); } 70% { box-shadow: 0 0 0 8px rgb(78 188 145 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(78 188 145 / 0%); } }

.market-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 24px 0 20px; padding: 3px; border: 1px solid var(--navy-line); background: #0b1d2b; }
.tab-button { min-height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tab-button.is-active { background: var(--navy-raised); color: var(--gold-soft); box-shadow: inset 0 -2px var(--gold); }
.tab-button:focus-visible, .icon-button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.diagnostic-panel { margin: 0 0 4px; border: 1px solid var(--navy-line); background: #0a1d2a; color: var(--muted); font-size: .76rem; }
.diagnostic-panel summary { min-height: 40px; padding: 10px 12px; color: var(--gold-soft); cursor: pointer; }.diagnostic-panel ul { display: grid; gap: 6px; margin: 0; padding: 0 12px 12px 29px; }.diagnostic-panel li::marker { color: var(--gold); }.diagnostic-panel .is-ok { color: var(--up); }.diagnostic-panel .is-error { color: var(--down); }.diagnostic-panel .is-pending { color: var(--muted); }
.unit-toggle { display: flex; width: fit-content; max-width: 100%; margin: 20px 0 0; border: 1px solid var(--navy-line); }
.unit-button { min-height: 38px; padding: 0 12px; border: 0; border-right: 1px solid var(--navy-line); background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; white-space: nowrap; }
.unit-button:last-child { border-right: 0; }.unit-button.is-active { background: var(--navy-raised); color: var(--gold-soft); }
.unit-button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }

.market-panel { padding: 22px 0 18px; border-bottom: 1px solid var(--navy-line); }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--navy-line); border-radius: 4px; background: transparent; color: var(--gold-soft); cursor: pointer; }
.icon-button:disabled { cursor: wait; opacity: .55; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-button.is-spinning svg { animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { margin: 22px 0 0; padding: 13px 14px; border-left: 3px solid var(--gold); background: var(--notice); color: #c6d3d8; font-size: .9rem; }
.notice-error { border-color: var(--down); }.notice-stale { border-color: var(--gold); }.notice-loading { border-color: var(--gold-soft); }
.quote-content { padding: 24px 0 4px; }
.quote-main { display: grid; gap: 18px; }
.quote-summary { min-width: 0; }
.quote-label { margin: 0; color: var(--muted); font-size: .85rem; }
.primary-price { min-height: 1.1em; margin: 3px 0; color: var(--gold-soft); font-family: "Mulish", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: clamp(2.45rem, 12vw, 4rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.price-stack { display: inline-grid; height: 1.1em; overflow: hidden; vertical-align: top; }.price-old, .price-new { grid-area: 1 / 1; }.price-new { transform: translateY(110%); }
.primary-price.is-rising { color: var(--up); text-shadow: 0 0 14px rgb(78 188 145 / 38%); }.primary-price.is-falling { color: var(--down); text-shadow: 0 0 14px rgb(227 117 112 / 38%); }
.primary-price.is-rising .price-old { animation: price-out-up .72s ease-in forwards; }.primary-price.is-rising .price-new { animation: price-in-up .72s ease-out forwards; }
.primary-price.is-falling .price-old { animation: price-out-down .72s ease-in forwards; }.primary-price.is-falling .price-new { animation: price-in-down .72s ease-out forwards; }
@keyframes price-out-up { to { opacity: 0; transform: translateY(-110%); } } @keyframes price-in-up { to { transform: translateY(0); } }
@keyframes price-out-down { to { opacity: 0; transform: translateY(110%); } } @keyframes price-in-down { from { transform: translateY(-110%); } to { transform: translateY(0); } }
.live-rail { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 12px 0 0; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.live-track { grid-column: 1 / -1; height: 3px; overflow: hidden; background: var(--navy-line); }.live-track span { display: block; width: 0; height: 100%; background: var(--up); box-shadow: 0 0 8px rgb(78 188 145 / 65%); transition: width .2s linear; }
.quote-trace { min-height: 165px; padding: 12px; border: 1px solid var(--navy-line); background: #0a1d2a; }
.trace-heading { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .72rem; }.trace-heading span:first-child { color: var(--gold-soft); }
#gold-trace { display: block; width: 100%; height: 116px; margin-top: 8px; }.trace-status { margin: 4px 0 0; color: var(--muted); font-size: .7rem; }
.kline-panel { margin-top: 22px; border: 1px solid var(--navy-line); background: #07131d; }
.kline-heading { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--navy-line); color: var(--muted); font-size: .76rem; }.kline-heading span:first-child { color: var(--gold-soft); }
.tradingview-widget-container { position: relative; height: 390px; width: 100%; }.tradingview-widget-container__widget { height: calc(100% - 25px); width: 100%; }.widget-attribution { margin: 0; padding: 4px 10px; color: var(--muted); font-size: .68rem; text-align: right; }
.price-change { margin: 0; font-size: 1rem; font-variant-numeric: tabular-nums; }.is-up { color: var(--up); }.is-down { color: var(--down); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 24px 0 0; border-top: 1px solid var(--navy-line); border-left: 1px solid var(--navy-line); }
.metric-grid div { padding: 12px; border-right: 1px solid var(--navy-line); border-bottom: 1px solid var(--navy-line); }
dt { color: var(--muted); font-size: .77rem; } dd { margin: 3px 0 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.meta-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 20px; color: var(--muted); font-size: .77rem; }

.stock-list { margin-top: 18px; border-top: 1px solid var(--navy-line); }
.stock-market-toggle { display: flex; width: fit-content; margin-top: 18px; border: 1px solid var(--navy-line); }
.stock-market-button { min-width: 74px; min-height: 36px; border: 0; border-right: 1px solid var(--navy-line); background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; }.stock-market-button:last-child { border-right: 0; }.stock-market-button.is-active { background: var(--navy-raised); color: var(--gold-soft); }.stock-market-button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }
.stock-add-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }.stock-add-form input { min-width: 0; min-height: 42px; border: 1px solid var(--navy-line); border-radius: 0; background: #0a1d2a; color: var(--text); padding: 0 11px; font: inherit; font-size: .82rem; }.stock-add-form input::placeholder { color: var(--muted); }.stock-add-form button { min-height: 42px; border: 1px solid var(--gold); border-radius: 0; background: transparent; color: var(--gold-soft); cursor: pointer; padding: 0 15px; font: inherit; font-size: .82rem; }.stock-add-form input:focus-visible, .stock-add-form button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.stock-watchlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.watchlist-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; border: 1px solid var(--navy-line); padding: 0 6px 0 9px; color: var(--muted); font-size: .73rem; }.watchlist-chip button { width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 1rem; }.watchlist-chip button:hover { color: var(--down); }
.stock-widget-shell { position: relative; margin-top: 14px; }.tradingview-stock-widget { min-height: 180px; }
.stock-widget-loading { position: absolute; inset: 0; display: grid; place-items: center; min-height: 180px; background: rgb(7 19 29 / 88%); color: var(--gold-soft); font-size: .84rem; }
.stock-widget-loading[hidden] { display: none; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--navy-line); }
.stock-code { color: var(--gold-soft); font-size: .82rem; }.stock-name { display: block; margin-top: 2px; }.stock-price { text-align: right; font-variant-numeric: tabular-nums; }.stock-change { display: block; margin-top: 2px; font-size: .83rem; }
footer { padding: 24px 0 8px; color: var(--muted); font-size: .76rem; } footer p { margin: 0 0 10px; }

@media (min-width: 600px) { .quote-main { grid-template-columns: minmax(0, 1fr) minmax(230px, .9fr); align-items: end; } }
@media (min-width: 700px) { .site-shell { padding-top: 48px; } .metric-grid { grid-template-columns: repeat(4, 1fr); } }