:root {
  color-scheme: dark;
  --bg: #131312;
  --panel: #1b1a19;
  --line: #34302d;
  --text: #f9f2e7;
  --muted: #b7aea3;
  --accent: #ff805b;
  --green: #80dbb2;
  --display: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --number: "DIN Alternate", "Arial", sans-serif;
  --top: max(env(safe-area-inset-top), var(--toy-top, 0px));
  --right: max(env(safe-area-inset-right), var(--toy-right, 0px));
  --bottom: max(env(safe-area-inset-bottom), var(--toy-bottom, 0px));
  --left: max(env(safe-area-inset-left), var(--toy-left, 0px));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
html.toy-container:not(.toy-measured) { --top: max(env(safe-area-inset-top), var(--toy-top, 56px)); }
body {
  margin: 0; min-width: 0; min-height: 100vh; padding: var(--top) var(--right) var(--bottom) var(--left);
  background: radial-gradient(ellipse at 79% 7%, #221a17 0%, transparent 46%), var(--bg);
  color: var(--text); font-family: var(--display); font-size: 15px; line-height: 1.55;
}
h1, p, dl, dd { margin: 0; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #ffd4a9; outline-offset: 4px; }
h1:focus { outline: none; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.mast { min-height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; gap: 10px; align-items: center; padding: 0; border: 0; background: none; color: var(--text); font-size: 16px; font-weight: 800; }
.brand-icon { width: 31px; height: 31px; display: flex; justify-content: center; align-items: center; gap: 3px; background: var(--accent); border-radius: 8px; }
.brand-icon i { display: block; position: relative; background: #211410; width: 3px; height: 7px; transform: translateY(3px); border-radius: 1px; }
.brand-icon i:nth-child(2) { height: 10px; transform: translateY(-2px); }
.brand-icon i:nth-child(3) { height: 6px; transform: translateY(-5px); }
.brand-icon i::after { content: ""; position: absolute; inset: -3px 1px; background: #211410; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 12px; min-height: 52px; padding: 10px 22px;
  border: 1px solid #51453e; border-radius: 10px; color: var(--text); background: #23201e; font-weight: 700;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.button:hover { background: #302925; border-color: #816456; }
.button:active { transform: translateY(1px); }
.button-small { min-height: 38px; padding: 5px 12px; font-size: 13px; }
.button span { font-family: var(--number); }
.primary { background: var(--accent); color: #26150f; border-color: var(--accent); box-shadow: 0 6px 22px #f76c4826; }
.primary:hover { background: #ff9a79; border-color: #ff9a79; }
.boot { padding: 70px 0; color: var(--muted); }
.boot .button { margin-top: 14px; }
.footer { display: flex; justify-content: space-between; gap: 8px 16px; padding-block: 20px; color: var(--muted); font-size: 12px; }
.footer a { text-underline-offset: 3px; }

.hero { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 84px); align-items: center; padding: clamp(42px, 8vh, 100px) 0 48px; }
.hero-copy { min-width: 0; }
.kicker { display: flex; align-items: center; gap: 9px; color: var(--accent); font-size: 13px; font-weight: 700; }
.signal { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.hero h1 { font-size: clamp(58px, 8vw, 112px); line-height: 1.1; letter-spacing: -.06em; margin: 8px 0 15px; font-weight: 900; white-space: nowrap; }
.hero h1 span { color: var(--accent); }
.hero-hook { font-size: clamp(21px, 3vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.hero-description { color: var(--muted); max-width: 370px; margin: 12px 0 24px; }
.start { min-width: min(100%, 214px); justify-content: space-between; }
.cover { min-width: 0; position: relative; padding: 22px 0 22px 20px; }
.cover::before { content: ""; position: absolute; inset: 0 20px 0 0; border: 1px solid #664238; border-radius: 20px; transform: rotate(-3deg); background: #2b1d183d; }
.cover-frame { position: relative; overflow: hidden; border: 1px solid #6d4a3e; border-radius: 17px; background: #1b1917; box-shadow: 0 24px 55px #0007; }
.cover-head, .cover-foot { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; font-size: 12px; color: var(--muted); }
.cover-head { border-bottom: 1px solid var(--line); }
.cover-foot { border-top: 1px solid var(--line); }
.cover-lights { display: flex; gap: 5px; }
.cover-lights i { width: 7px; height: 7px; border-radius: 50%; background: #846759; }
.cover-lights i:first-child { background: var(--accent); }
.cover-chart { height: clamp(165px, 25vw, 280px); }
.rules { display: grid; grid-template-columns: 1fr 1fr 1.3fr; border: 1px solid var(--line); border-radius: 13px; background: #191817; }
.rules > div { display: grid; gap: 3px; padding: 17px 21px; min-width: 0; }
.rules > div + div { border-left: 1px solid var(--line); }
.rules strong { font-size: 14px; }
.rules span { color: var(--muted); font-size: 12px; }

.play, .result, .ranking { max-width: 850px; margin-inline: auto; padding-top: clamp(14px, 3vh, 32px); }
.play-heading, .position, .chart-head, .trade, .result-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.play-heading h1 { font-size: clamp(20px, 4vw, 34px); letter-spacing: -.04em; }
.clock { display: flex; align-items: center; gap: 8px; color: var(--accent); font: 700 18px var(--number); font-variant-numeric: tabular-nums; }
.clock.urgent { color: #ffad80; }
.ticker { height: 3px; margin-top: 8px; border-radius: 20px; background: #352c27; overflow: hidden; }
.ticker div { height: 100%; background: var(--accent); transform-origin: left; }
.position { padding-block: 12px 14px; align-items: flex-end; }
.caption { color: var(--muted); font-size: 12px; }
.amount, .yield strong, .metrics dd { font-family: var(--number); font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.amount { display: block; font-size: clamp(31px, 7vw, 66px); line-height: 1.08; margin-top: 3px; }
.yield { text-align: right; flex: none; }
.yield strong { font-size: clamp(19px, 4vw, 34px); line-height: 1.08; }
.up { color: var(--green); }
.down { color: var(--accent); }
.chart-card { overflow: hidden; background: #181817; border: 1px solid var(--line); border-radius: 12px; }
.chart-head { min-height: 40px; padding: 7px 13px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13px; }
.faint, .day { color: var(--muted); font-weight: 400; }
.chart { height: clamp(176px, 40vh, 375px); }
.trade { margin-top: 13px; flex-direction: row-reverse; }
.trade p { color: var(--muted); font-size: 12px; }
.sell { min-width: min(100%, 280px); min-height: 57px; font-size: 18px; justify-content: space-between; }
.sell span { font-size: 22px; }

.result-summary { align-items: flex-end; margin-bottom: 15px; }
.result-intro { min-width: 0; }
.result h1, .ranking h1 { font-size: clamp(30px, 6.8vw, 60px); line-height: 1.12; margin-block: 4px 6px; letter-spacing: -.055em; }
.asset { font-weight: 700; font-size: clamp(13px, 3vw, 17px); overflow-wrap: anywhere; }
.asset-dates { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.grade { text-align: right; flex: none; color: var(--muted); font-size: 12px; }
.grade div { white-space: nowrap; }
.grade strong { color: var(--accent); font: 800 clamp(46px, 9vw, 90px)/.95 var(--number); letter-spacing: -.075em; }
.metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-bottom: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.metrics > div { padding: 11px 13px; min-width: 0; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics dt, .metrics .detail { color: var(--muted); font-size: 11px; }
.metrics dd { font-size: clamp(15px, 3.8vw, 28px); font-weight: 700; overflow-wrap: anywhere; }
.metrics .detail { font-family: var(--display); letter-spacing: normal; font-weight: 400; }
.metrics .missed { color: #ffd0a3; }
.legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--green); border-radius: 2px; }
.legend > span:last-child i { background: #ffbf72; }
.review .chart { height: clamp(135px, 32vh, 300px); }
.review-detail { color: var(--muted); font-size: 11px; padding: 6px 13px; border-top: 1px solid var(--line); }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.result-actions button:disabled { opacity: .65; }

.ranking { max-width: 620px; }
.back { color: var(--accent); border: 0; background: none; padding: 5px 0; }
.rank-list { list-style: none; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.rank-list li span:first-child { color: var(--accent); }
.toast { position: fixed; z-index: 2; bottom: calc(16px + var(--bottom)); left: 50%; width: max-content; max-width: calc(100% - 40px); transform: translateX(-50%); padding: 9px 13px; border: 1px solid #746256; border-radius: 8px; background: #2a2420; color: var(--text); font-size: 13px; }

@media (max-width: 680px) {
  .shell { width: calc(100% - 32px); }
  .mast { min-height: 52px; }
  .wordmark { font-size: 14px; }
  .brand-icon { width: 25px; height: 25px; border-radius: 6px; }
  .hero { grid-template-columns: 1fr; gap: 12px; padding: 24px 0 13px; }
  .hero h1 { margin-block: 5px 7px; font-size: clamp(55px, 15vw, 82px); }
  .hero-description { margin: 6px 0 14px; font-size: 13px; }
  .start { width: 100%; }
  .cover { padding: 8px 5px; }
  .cover::before { inset: 7px 11px; }
  .cover-chart { height: clamp(99px, 21vh, 145px); }
  .cover-head, .cover-foot { padding: 5px 12px; font-size: 10px; }
  .rules { grid-template-columns: 1fr; }
  .rules > div { display: flex; justify-content: space-between; gap: 4px 9px; flex-wrap: wrap; align-items: baseline; padding: 6px 10px; }
  .rules > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .rules strong { font-size: 12px; }
  .rules span { font-size: 10px; }
  .trade { flex-direction: column; gap: 6px; }
  .sell { width: 100%; }
  .play .chart { height: clamp(128px, calc(100vh - var(--top) - var(--bottom) - 320px), 360px); }
  .review .chart { height: clamp(117px, calc(100vh - var(--top) - var(--bottom) - 440px), 240px); }
  .footer { padding-block: 12px; font-size: 10px; flex-wrap: wrap; }
  .metrics > div { padding-inline: 7px; }
  .asset-dates { font-size: 11px; }
  .result-actions .button { padding-inline: 8px; }
}

@media (max-height: 530px) {
  .mast { min-height: 46px; }
  .play { padding-top: 6px; }
  .position { padding-block: 6px; }
  .play .chart { height: clamp(100px, calc(100vh - var(--top) - var(--bottom) - 245px), 260px); }
  .chart-head { min-height: 32px; }
  .trade { margin-top: 8px; }
  .sell { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
