:root {
  --bg: #030716;
  --blue: #0866ff;
  --cyan: #48c6ff;
  --up: #1fe08a;
  --down: #ff3b5c;
  --ink: #dce8ff;
  --muted: #6b7ca8;
  --panel: rgba(8, 16, 40, .72);
  --line: rgba(72, 198, 255, .22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 40%, #0a1a4a 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
#market { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .55; }
header, main, footer, #tickerbar { position: relative; z-index: 2; }

/* opening bell gate */
#opening {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  text-align: center; padding: 20px; transition: opacity .6s;
}
#opening.gone { opacity: 0; pointer-events: none; }
.bell { font-size: 64px; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%,100% { transform: rotate(0) } 20% { transform: rotate(18deg) } 40% { transform: rotate(-16deg) } 60% { transform: rotate(8deg) } }
.open-title { font-family: Unbounded; font-weight: 900; font-size: clamp(22px, 4vw, 44px); }
.open-title span { color: var(--blue); text-shadow: 0 0 24px var(--blue); }
.open-sub { color: var(--muted); }
#opening button {
  font: 700 16px "JetBrains Mono"; padding: 14px 26px; border-radius: 6px; cursor: pointer;
  background: var(--blue); color: #fff; border: 0; box-shadow: 0 0 30px rgba(8,102,255,.6);
}
#opening button.ghost { background: none; color: var(--muted); box-shadow: none; text-decoration: underline; padding: 4px; font-size: 13px; }

/* header */
header {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: rgba(3,7,22,.6); backdrop-filter: blur(8px);
}
.brand b { font-family: Unbounded; font-weight: 900; font-size: 24px; color: var(--blue); text-shadow: 0 0 16px rgba(8,102,255,.8); }
.brand span { margin-left: 10px; color: var(--muted); font-size: 13px; }
#ca {
  margin-left: auto; display: flex; gap: 8px; align-items: center; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); padding: 8px 12px; border-radius: 6px;
  font: 12px "JetBrains Mono"; max-width: 340px; overflow: hidden;
}
#ca i { font-style: normal; color: var(--cyan); font-weight: 700; }
#ca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav { display: flex; gap: 8px; }
nav a, nav button {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); padding: 8px 12px; border-radius: 6px;
  font: 700 12px "JetBrains Mono"; text-decoration: none; cursor: pointer;
}
nav a.buy { background: var(--up); color: #022; border-color: var(--up); }
nav a:not([href]) { opacity: .4; pointer-events: none; }

/* scrolling ticker tape */
#tickerbar { overflow: hidden; white-space: nowrap; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.35); font-size: 12px; }
#tickertrack { display: inline-block; padding: 6px 0; animation: scroll 40s linear infinite; }
#tickertrack span { margin: 0 22px; }
#tickertrack .up { color: var(--up); } #tickertrack .down { color: var(--down); }
@keyframes scroll { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* layout */
main { flex: 1; display: grid; grid-template-columns: 290px 1fr 290px; gap: 18px; padding: 18px 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; backdrop-filter: blur(10px); }
.p-head { font-size: 11px; letter-spacing: .12em; color: var(--cyan); display: flex; gap: 8px; align-items: center; }
.p-head em { margin-left: auto; color: var(--muted); font-style: normal; }
.big { font-family: Unbounded; font-weight: 900; font-size: 54px; margin-top: 8px; line-height: 1; }
.big small { font-size: 22px; color: var(--muted); }
.chg { margin-top: 4px; font-weight: 700; }
.chg.up, .up { color: var(--up); } .chg.down, .down { color: var(--down); }
#spark { width: 100%; height: 70px; margin: 10px 0; }
.tier { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); }
.tier b { font-family: Unbounded; color: var(--ink); font-size: 15px; }
.nextbar { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
#next-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .6s; }
.muted { color: var(--muted); font-size: 11px; }
dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
dt { font-size: 10px; color: var(--muted); letter-spacing: .1em; }
dd { font-weight: 700; font-size: 15px; }

/* stage */
#stage { position: relative; height: min(78vh, 760px); display: flex; justify-content: center; align-items: flex-end; }
.ring {
  position: absolute; left: 50%; top: 50%; width: min(70vh, 640px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px solid rgba(72,198,255,.8);
  box-shadow: 0 0 40px rgba(8,102,255,.8), inset 0 0 60px rgba(8,102,255,.35);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 70px rgba(8,102,255,1), inset 0 0 90px rgba(8,102,255,.5); } }
.sign {
  position: absolute; top: 4%; right: 6%; font-family: Unbounded; font-weight: 900; font-size: clamp(36px, 6vw, 72px);
  color: #cfe0ff; letter-spacing: .06em;
  text-shadow: 0 0 10px var(--blue), 0 0 30px var(--blue), 0 0 60px var(--blue);
  animation: flicker 6s infinite;
}
@keyframes flicker { 0%,92%,100% { opacity: 1 } 93% { opacity: .3 } 94% { opacity: 1 } 96% { opacity: .5 } }
#girl { position: relative; height: 100%; max-width: 100%; filter: drop-shadow(0 0 24px rgba(8,102,255,.45)); }
#hips { transform-box: view-box; transform-origin: 205px 336px; transition: transform .9s cubic-bezier(.3,1.6,.5,1); }
#jiggle { transform-box: view-box; transform-origin: 205px 336px; }
#jiggle.bounce { animation: bounce .9s ease-out; }
#jiggle.wobble { animation: wobble .7s ease-out; }
@keyframes bounce {
  0% { transform: scale(1,1) } 18% { transform: scale(1.14,.9) } 36% { transform: scale(.94,1.07) }
  54% { transform: scale(1.06,.96) } 72% { transform: scale(.98,1.02) } 100% { transform: scale(1,1) }
}
@keyframes wobble { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-3deg) } 50% { transform: rotate(2.5deg) } 75% { transform: rotate(-1deg) } }
#head { transform-box: view-box; transform-origin: 205px 160px; animation: sway 5s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(-2.5deg) } }
#blush { transition: opacity .4s; }

#bubble {
  position: absolute; top: 14%; left: 6%; max-width: 240px; background: #fff; color: #0a1030; padding: 12px 16px;
  border-radius: 16px 16px 16px 4px; font-weight: 700; font-size: 14px; opacity: 0; transform: translateY(8px) scale(.95);
  transition: all .3s; box-shadow: 0 0 30px rgba(8,102,255,.5);
}
#bubble.show { opacity: 1; transform: none; }
#floaters { position: absolute; inset: 0; pointer-events: none; }
.float { position: absolute; font-weight: 700; font-size: 18px; animation: up 1.8s ease-out forwards; white-space: nowrap; }
.float.buy { color: var(--up); text-shadow: 0 0 12px var(--up); }
.float.sell { color: var(--down); text-shadow: 0 0 12px var(--down); }
@keyframes up { from { opacity: 1; transform: translateY(0) } to { opacity: 0; transform: translateY(-160px) } }

/* tape */
#dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
#dot.live { background: var(--up); box-shadow: 0 0 10px var(--up); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3 } }
#trades { list-style: none; margin-top: 12px; max-height: 52vh; overflow: hidden; font-size: 12px; }
#trades li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,.06); animation: slide .35s ease-out; }
#trades li b.buy { color: var(--up); } #trades li b.sell { color: var(--down); }
#trades li span { color: var(--muted); }
#trades li em { font-style: normal; white-space: nowrap; }
#tape { overflow: hidden; }
@keyframes slide { from { opacity: 0; transform: translateX(20px) } }
#demo { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
#demo .muted { width: 100%; }
#demo button { font: 700 11px "JetBrains Mono"; padding: 7px 10px; border-radius: 5px; border: 1px solid var(--up); background: rgba(31,224,138,.12); color: var(--up); cursor: pointer; }
#demo button.s { border-color: var(--down); background: rgba(255,59,92,.12); color: var(--down); }

#flash { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity .5s; }
#flash.buy { background: radial-gradient(circle, rgba(31,224,138,.25), transparent 60%); opacity: 1; transition: none; }
#flash.sell { background: radial-gradient(circle, rgba(255,59,92,.3), transparent 60%); opacity: 1; transition: none; }

footer { padding: 14px 20px 22px; text-align: center; color: var(--muted); font-size: 11px; }
footer b { color: var(--ink); }

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; }
  #stage { order: -1; height: 62vh; }
  #trades { max-height: 260px; }
  .brand span { display: none; }
}

/* icon-matched stage: corner signs + HUD panels */
.corner {
  position: absolute; font-family: Unbounded; font-weight: 900; font-size: clamp(22px, 3.4vw, 48px);
  color: #cfe8ff; letter-spacing: .04em; z-index: 1;
  text-shadow: 0 0 8px var(--cyan), 0 0 24px var(--blue), 0 0 48px var(--blue);
  animation: flicker 7s infinite;
}
.corner.tl { top: 0; left: 2%; } .corner.tr { top: 0; right: 2%; animation-delay: 1.3s; }
.corner.bl { bottom: 0; left: 2%; animation-delay: 2.1s; } .corner.br { bottom: 0; right: 2%; animation-delay: 3.4s; }
.hud {
  position: absolute; z-index: 1; background: rgba(4,12,34,.75); border: 1px solid rgba(72,198,255,.45);
  border-radius: 6px; padding: 8px 12px; font-size: 11px; color: #9fd8ff; box-shadow: 0 0 18px rgba(8,102,255,.35);
}
.hud small { display: block; letter-spacing: .08em; }
.hud.trend { left: 2%; top: 46%; }
.hud.trend b { display: block; font-family: Unbounded; font-size: 18px; color: #e6f4ff; margin: 2px 0; }
.hud.perf { right: 2%; top: 40%; min-width: 150px; }
#perf div { display: flex; justify-content: space-between; gap: 14px; margin-top: 3px; }
#perf b { color: var(--up); }
#girl { z-index: 2; }
#hips, #jiggle { transform-origin: 206px 336px; }
@media (max-width: 1000px) { .hud { display: none; } }
