/* THE PIT — full-viewport 3D floor with HUD overlays */

.pit-page .nav { background: linear-gradient(to bottom, rgba(4, 6, 7, 0.9), rgba(4, 6, 7, 0)); }

.stage {
  --hud-top: calc(var(--nav-h) + 10px);
  --glass: rgba(10, 13, 15, 0.72);
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(60% 50% at 50% 58%, rgba(63, 214, 200, 0.10), transparent 70%),
    radial-gradient(40% 35% at 50% 62%, rgba(255, 176, 0, 0.10), transparent 70%),
    #040607;
}
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; touch-action: none; outline: none; z-index: 0; }
/* phones: one-finger vertical swipes still scroll the page; sideways drag orbits, pinch zooms */
@media (pointer: coarse) { .stage-canvas { touch-action: pan-y; } }

/* key art as loading backdrop / no-WebGL fallback */
.stage-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url(/assets/img/keyart-1280.webp) center 40% / cover no-repeat;
  background-image: image-set(url(/assets/img/keyart-1280.avif) type('image/avif'), url(/assets/img/keyart-1280.webp) type('image/webp'));
  opacity: 0.22; filter: blur(6px) saturate(0.9); transform: scale(1.04);
  transition: opacity 1.2s ease;
}
.stage.is-3d .stage-bg { opacity: 0; }
.stage.no-webgl .stage-bg { opacity: 0.55; filter: none; transform: none; }
.stage.no-webgl .stage-canvas { display: none; }
.stage::after { /* vignette */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(42% 42% at 0% 14%, rgba(3, 5, 6, 0.78), transparent 75%),
    linear-gradient(to bottom, rgba(3, 5, 6, 0.55), transparent 18%),
    radial-gradient(120% 90% at 50% 55%, transparent 55%, rgba(0, 0, 0, 0.55));
}

.hud { position: absolute; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }

/* ── top-left title ─────────────────────────────────── */
.hud-tl { top: var(--hud-top); left: var(--gutter); max-width: min(420px, 60vw); }
.hud-tl > * { pointer-events: none; }
.hud-title {
  margin: 8px 0 6px; font-size: clamp(56px, 7.2vw, 112px);
  color: var(--text); text-shadow: 0 0 40px rgba(255, 176, 0, 0.25), 0 2px 0 rgba(0, 0, 0, 0.6);
}
.hud-status { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); }
.hud-status .sep { color: var(--muted); }
.hud-status time { color: var(--muted); font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; position: relative; }
.live-dot::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid currentColor; opacity: 0; }
.live-dot[data-state='live'] { background: var(--up); color: var(--up); box-shadow: 0 0 12px var(--up); }
.live-dot[data-state='live']::after { animation: ping 1.8s ease-out infinite; }
.live-dot[data-state='stale'] { background: var(--amber); color: var(--amber); box-shadow: 0 0 10px var(--amber); }
.live-dot[data-state='down'] { background: var(--down); color: var(--down); box-shadow: 0 0 10px var(--down); }
.live-dot[data-state='wait'] { background: var(--amber); animation: blink 1s steps(2) infinite; }
@keyframes ping { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes blink { 50% { opacity: 0.25; } }

.hud-stats { display: flex; gap: 18px; margin: 14px 0 0; }
.hud-stats div { border-left: 2px solid rgba(255, 176, 0, 0.5); padding-left: 9px; }
.hud-stats dt { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.hud-stats dd { margin: 3px 0 0; font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── banner ─────────────────────────────────────────── */
.banner {
  position: absolute; z-index: 8; top: var(--hud-top); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 9px 9px 9px 16px; border-radius: 999px;
  background: rgba(40, 10, 10, 0.82); border: 1px solid rgba(255, 77, 77, 0.45);
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.banner[hidden] { display: none; }
.banner-retry { border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); border-radius: 999px; padding: 6px 12px; font: 700 11px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.banner-retry:hover { border-color: var(--amber); }

/* ── glass panels ───────────────────────────────────── */
.feed, .panel {
  position: absolute; z-index: 6; right: var(--gutter); top: var(--hud-top);
  background: var(--glass); border: 1px solid var(--line-2); border-radius: var(--r);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* tape */
.feed { width: 330px; max-height: min(520px, calc(100% - var(--hud-top) - 120px)); display: flex; flex-direction: column; transition: opacity 0.25s, transform 0.25s; }
.feed-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.feed-head h2 { margin: 0; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); }
.feed-count { font-size: 11px; color: var(--muted); margin-left: auto; }
.feed-toggle { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: none; }
.feed-toggle svg { width: 14px; height: 14px; transition: transform 0.2s; }
.feed.collapsed .feed-toggle svg { transform: rotate(180deg); }
.feed-list {
  list-style: none; margin: 0; padding: 6px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  mask-image: linear-gradient(to bottom, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 85%, transparent);
}
.feed.collapsed .feed-list { mask-image: none; -webkit-mask-image: none; }
.feed.collapsed .feed-list > li:not(:first-child) { display: none; }
.feed-list:empty::before { content: 'Waiting for the first fill…'; display: block; padding: 14px 10px; font-size: 12px; color: var(--muted); }
.tape-row > * {
  display: grid; grid-template-columns: 62px 42px 1fr auto; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 8px; border: 0; background: none; text-align: left; font: 500 12px/1.2 var(--f-mono);
}
.tape-row button:hover { background: rgba(255, 255, 255, 0.05); }
.tape-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.tape-row .side { font-weight: 800; font-size: 10px; letter-spacing: 0.08em; padding: 3px 0; text-align: center; border-radius: 4px; }
.tape-row.buy .side { color: var(--up); background: rgba(43, 227, 139, 0.12); }
.tape-row.sell .side { color: var(--down); background: rgba(255, 77, 77, 0.12); }
.tape-row .sym { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape-row .amt { color: #ffe2a8; font-variant-numeric: tabular-nums; }
.tape-row.big .amt { color: var(--amber); font-weight: 800; text-shadow: 0 0 10px var(--amber-glow); }
.tape-row.fresh { animation: tape-in 0.6s ease-out; }
@keyframes tape-in { from { opacity: 0; transform: translateY(-6px); background: rgba(255, 176, 0, 0.18); } to { opacity: 1; transform: none; background: transparent; } }

/* booth panel */
.panel {
  width: 360px; max-height: calc(100% - var(--hud-top) - 92px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 20px 20px 18px; opacity: 0; transform: translateX(24px); transition: opacity 0.25s, transform 0.3s cubic-bezier(.2, .8, .2, 1);
}
.panel[hidden] { display: none; }
.panel.open { opacity: 1; transform: none; }
.stage.has-panel .feed { opacity: 0; transform: translateX(24px); pointer-events: none; }
.panel-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); }
.panel-close:hover { border-color: var(--amber); }
.panel-close svg { width: 16px; height: 16px; }
.bp-id { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.bp-id img[hidden], .quip img[hidden] { display: none; }
.bp-id img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--amber); background: #1c1406; flex: none; }
.bp-sym { margin: 0; font-size: clamp(44px, 5vw, 60px); overflow-wrap: anywhere; }
.bp-name { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.3; }
.bp-price { margin: 14px 0 0; font-size: 30px; font-weight: 800; color: var(--amber); text-shadow: 0 0 22px var(--amber-glow); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.bp-grid div { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; }
.bp-grid dt { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.bp-grid dd { margin: 4px 0 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bp-actions { display: flex; gap: 8px; margin-top: 16px; }
.bp-actions .btn { flex: 1 1 auto; height: 44px; padding: 0 14px; }
.bp-actions .btn[hidden] { display: none; }
.bp-ask { width: 100%; margin-top: 8px; height: 44px; border-style: dashed; border-color: rgba(255, 176, 0, 0.45); color: var(--amber); }
.quip { display: grid; grid-template-columns: 72px 1fr; gap: 4px 12px; align-items: center; margin: 14px 0 0; padding: 12px; border-radius: var(--r-sm); background: rgba(241, 232, 214, 0.06); border: 1px solid rgba(241, 232, 214, 0.14); }
.quip[hidden] { display: none; }
.quip.pop { animation: quip-pop 0.4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes quip-pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
.quip img { width: 72px; height: 72px; object-fit: contain; grid-row: span 2; }
.quip blockquote { margin: 0; }
.quip p { margin: 0; font: 800 19px/1.15 var(--f-display); letter-spacing: 0.01em; text-transform: uppercase; color: var(--paper); }
.quip figcaption { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.bp-recent { margin-top: 16px; }
.bp-recent h3 { margin: 0 0 6px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.bp-recent ol { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.bp-recent li { display: grid; grid-template-columns: 70px 44px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.bp-recent li.muted { display: block; }
.bp-recent .side { font-weight: 800; font-size: 10px; letter-spacing: 0.08em; }
.bp-recent .buy .side { color: var(--up); }
.bp-recent .sell .side { color: var(--down); }
.bp-recent time { color: var(--muted); }

/* ── booth board: hidden until focused (keyboard) or as no-WebGL fallback ── */
.board { position: absolute; z-index: 7; left: var(--gutter); right: var(--gutter); bottom: 86px; padding: 12px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.board:not(:focus-within) { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; padding: 0; border: 0; }
.board-title { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.board ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.board-btn { display: inline-flex; gap: 8px; align-items: baseline; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); font: 600 12px/1 var(--f-mono); }
.board-btn.stock b { color: var(--teal); }
.board-btn.coin b { color: var(--amber); }
.board-btn:hover { border-color: var(--amber); }
.stage.no-webgl .board { clip-path: none; width: auto; height: auto; overflow: auto; padding: 16px; border: 1px solid var(--line-2); top: auto; bottom: 96px; max-height: calc(100% - var(--hud-top) - 300px); min-height: 120px; }

/* ── bottom HUD ─────────────────────────────────────── */
.hud-bottom { left: var(--gutter); right: var(--gutter); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; flex-wrap: wrap; }
.legend li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .muted { text-transform: none; letter-spacing: 0; }
.lg { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-stock { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.lg-coin { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lg-slip { background: var(--paper); transform: rotate(-12deg); border-right: 4px solid var(--up); }
.pit-ca { margin-left: auto; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; padding: 5px 5px 5px 14px; }
.pit-ca .ca-addr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.pit-ca .btn { height: 30px; }
.hud-btns { display: flex; gap: 8px; flex: none; }
.hud-btns .btn { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#sound .snd-on { display: none; }
#sound.on { border-color: var(--amber); color: var(--amber); }
#sound.on .snd-on { display: inline; }
#sound.on .snd-off { display: none; }

.hint {
  position: absolute; z-index: 4; left: 50%; bottom: 74px; transform: translateX(-50%); margin: 0;
  padding: 7px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line);
  font-size: 11px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; white-space: nowrap;
  transition: opacity 0.6s; pointer-events: none;
}
.hint.gone, .stage:not(.is-3d) .hint { opacity: 0; }

.pit-page .foot { margin-top: 0; }

/* ── tablet ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .legend .muted { display: none; }
  .feed { width: 300px; }
}
@media (max-width: 960px) {
  .legend { display: none; }
  .pit-ca { margin-left: 0; flex: 1 1 auto; }
}

/* ── phone ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .stage { --hud-top: calc(var(--nav-h) + 2px); min-height: 520px; }
  .hud-tl { max-width: calc(100% - 2 * var(--gutter)); }
  .hud-tl .eyebrow { display: none; }
  .hud-title { font-size: 52px; margin: 4px 0 4px; }
  .hud-status { font-size: 11px; }
  .hud-stats { gap: 12px; margin-top: 10px; }
  .hud-stats dd { font-size: 13px; }
  .hud-stats dt { font-size: 9px; }

  .banner { top: auto; bottom: 206px; left: var(--gutter); right: var(--gutter); transform: none; width: fit-content; margin: 0 auto; font-size: 10px; letter-spacing: 0.03em; max-width: calc(100% - 2 * var(--gutter)); white-space: normal; padding: 7px 7px 7px 12px; }
  .banner-retry { flex: none; }

  .feed { top: auto; left: var(--gutter); right: var(--gutter); width: auto; bottom: 112px; max-height: 44%; }
  .feed-head { padding: 8px 8px 8px 14px; }
  .feed.collapsed .feed-head { border-bottom-color: transparent; padding-bottom: 2px; }
  .feed.collapsed .feed-list { padding-top: 0; }
  .tape-row > * { grid-template-columns: 58px 38px 1fr auto; padding: 6px 8px; }
  .stage.has-panel .feed { transform: translateY(12px); }
  .hud-tl { transition: opacity 0.3s; }
  .stage.has-panel .hud-tl { opacity: 0; }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 56%;
    border-radius: 20px 20px 0 0; border-bottom: 0; padding: 18px var(--gutter) max(18px, env(safe-area-inset-bottom));
    transform: translateY(100%); z-index: 9;
  }
  .panel::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-2); }
  .bp-sym { font-size: 44px; }
  .bp-price { font-size: 24px; margin-top: 10px; }
  .bp-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
  .bp-grid div { padding: 7px 8px; }
  .bp-grid dd { font-size: 13px; }

  .hud-bottom { flex-wrap: wrap; gap: 8px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .legend { display: flex; order: -1; width: 100%; gap: 12px; font-size: 10px; }
  .pit-ca { flex: 1 1 0; padding-left: 12px; gap: 6px; }
  .pit-ca .ca-addr { font-size: 11px; }
  .pit-ca .btn span { display: none; }
  .pit-ca .btn { width: 30px; padding: 0; }
  .hud-btns .btn { width: 36px; height: 36px; padding: 0; }
  .hud-btns .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hint { bottom: auto; top: calc(var(--hud-top) + 150px); }
  .board { bottom: 110px; }
}
@media (max-width: 380px) {
  .bp-grid { grid-template-columns: repeat(3, 1fr); }
  .bp-grid dd { font-size: 12px; }
  .legend li:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot[data-state='live']::after { animation: none; }
}
