:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #07111f;
  --panel: #0c1929;
  --line: rgba(255,255,255,.08);
  --green: #39e68a;
  --red: #ff5b69;
  --gold: #ffc857;
  --muted: #7f91a8;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #030912; color: #f6f8fb; overflow: hidden; }
button { font: inherit; }
.game-shell { width: min(100vw, 560px); height: 100dvh; margin: auto; display: grid; grid-template-rows: 45% 55%; background: var(--bg); overflow: hidden; }
.market-panel { position: relative; padding: max(14px, env(safe-area-inset-top)) 18px 10px; background: radial-gradient(circle at 80% 0, #183552 0, transparent 38%), linear-gradient(#0c1929, #081321); border-bottom: 1px solid var(--line); }
.topbar, .quote-row, .combo-strip, .play-heading { display: flex; align-items: center; justify-content: space-between; }
.topbar strong, .play-heading strong { display: block; font-size: 18px; }
.eyebrow, .quote-row span, .combo-strip span, .score span, .result-grid span { display: block; color: var(--muted); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 3px; }
.icon-button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); color: #fff; background: rgba(255,255,255,.05); }
.quote-row { margin-top: 12px; }
.quote-row > div { flex: 1; }
.quote-row > div:not(:first-child) { text-align: right; }
.quote-row strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.chart-wrap { height: calc(100% - 130px); min-height: 110px; position: relative; margin: 9px -8px 4px; overflow: hidden; }
#chart { width: 100%; height: 100%; display: block; }
.float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-text { position: absolute; left: 50%; top: 55%; transform: translate(-50%, 0); font-weight: 900; font-size: 22px; text-shadow: 0 3px 12px #000; white-space: nowrap; animation: floatUp 1.2s ease-out forwards; }
.float-text.up { color: var(--green); }
.float-text.down { color: var(--red); }
.float-text.gold { color: var(--gold); font-size: 27px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 15px) scale(.7); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 100% { opacity: 0; transform: translate(-50%, -55px) scale(1); } }
.combo-strip { height: 34px; }
.combo-strip strong { font-size: 13px; }
.combo-strip b { color: var(--green); font-size: 18px; }
.milestones { display: flex; gap: 6px; }
.milestones i { font-style: normal; display: grid; place-items: center; width: 27px; height: 22px; border-radius: 12px; background: rgba(255,255,255,.06); color: #607087; font-size: 10px; transition: .2s; }
.milestones i.active { background: var(--green); color: #042010; box-shadow: 0 0 14px rgba(57,230,138,.4); }
.play-panel { position: relative; padding: 13px 18px max(16px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 50% 100%, #143b38 0, transparent 55%), #07111f; }
.play-heading { height: 44px; }
.play-heading strong { font-size: 15px; }
.score { text-align: right; }
.score b { color: var(--gold); font-size: 20px; font-variant-numeric: tabular-nums; }
.holes { height: calc(100% - 50px); position: relative; margin: 0 -18px; overflow: hidden; touch-action: none; background: radial-gradient(ellipse at 50% 85%, rgba(19,110,91,.25), transparent 65%); }
#game3d { width: 100%; height: 100%; display: block; outline: none; }
.scene-badge { position: absolute; right: 12px; bottom: 8px; pointer-events: none; color: rgba(145,255,216,.52); font-size: 8px; letter-spacing: 1.4px; }
.hole { position: relative; aspect-ratio: 1.18; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; touch-action: manipulation; }
.hole::after { content: ""; position: absolute; z-index: 3; left: 4%; right: 4%; bottom: 3%; height: 30%; border-radius: 50%; background: #03080e; border: 5px solid #173142; box-shadow: inset 0 9px 10px #000, 0 5px 12px rgba(0,0,0,.5); }
.animal { position: absolute; z-index: 2; bottom: 10%; width: 74%; height: 76%; border: 0; border-radius: 50% 50% 40% 40%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; cursor: pointer; transform: translateY(112%); animation: popIn .16s ease-out forwards; filter: drop-shadow(0 5px 6px rgba(0,0,0,.4)); -webkit-tap-highlight-color: transparent; }
.animal.bull { background: linear-gradient(145deg, #20c873, #087243); }
.animal.bear { background: linear-gradient(145deg, #f35665, #922331); }
.animal .face { font-size: clamp(25px, 8vw, 43px); line-height: 1; }
.animal small { font-size: 9px; font-weight: 800; margin-top: 3px; background: rgba(0,0,0,.3); padding: 2px 5px; border-radius: 6px; }
.animal.hit { animation: hit .2s ease-in forwards; pointer-events: none; }
@keyframes popIn { to { transform: translateY(0); } }
@keyframes hit { to { transform: translateY(110%) scale(.65); opacity: .2; } }
.start-button { border: 0; border-radius: 14px; height: 50px; background: linear-gradient(135deg, #42ec91, #16b666); color: #03140b; font-weight: 900; font-size: 17px; box-shadow: 0 10px 30px rgba(34,213,126,.28); cursor: pointer; }
.play-panel > .start-button { position: absolute; left: 18px; right: 18px; top: 53%; transform: translateY(-50%); z-index: 10; width: calc(100% - 36px); }
.start-button.hidden { display: none; }
.circuit-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(70,5,10,.78); backdrop-filter: blur(3px); }
.circuit-overlay strong { font-size: 25px; color: var(--red); }
.circuit-overlay span { margin-top: 6px; }
.hidden { display: none !important; }
.result-dialog { width: min(calc(100% - 36px), 440px); color: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 28px; text-align: center; background: #0d1c2d; box-shadow: 0 25px 80px #000; }
.result-dialog::backdrop { background: rgba(0,0,0,.75); backdrop-filter: blur(6px); }
.result-dialog h2 { margin: 4px 0 18px; }
.result-price { font-size: 43px; font-weight: 900; }
.result-change { color: var(--green); font-weight: 800; margin-bottom: 22px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.result-grid div { padding: 13px; border-radius: 12px; background: rgba(255,255,255,.05); }
.result-grid strong { font-size: 20px; }
.result-dialog .start-button { width: 100%; }
body.shake .game-shell { animation: shake .28s linear; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

@media (min-width: 700px) { body { display: grid; place-items: center; } .game-shell { height: min(100dvh, 900px); box-shadow: 0 0 60px #000; } }
