/* Tap Trading — in-page game view.
   Its own file so the co-edited style.css is never touched. Every class is tap-*
   and everything lives inside #tap-wrap / #pane-tap, so it cannot collide. */

.tap-wrap { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; background: var(--bg-1, #10151c); }
.tap-wrap.is-hidden { display: none; }

/* round strip — mirrors the High/Low period bar so the two games feel the same */
.tap-bar { display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 8px 14px; border-bottom: 1px solid var(--border, #1e2732); font-size: 12.5px; }
.tap-bar__dot { width: 8px; height: 8px; border-radius: 50%; background: #2b7cff;
  box-shadow: 0 0 0 0 rgba(43,124,255,.55); animation: tapPulse 1.6s ease-out infinite; }
.tap-bar.locked .tap-bar__dot { background: #f0b428; animation: none; }
.tap-bar__txt { font-weight: 800; font-variant-numeric: tabular-nums; color: #7fb0ff; }
.tap-bar.locked .tap-bar__txt { color: #f0b428; }
.tap-bar__sep { width: 1px; height: 12px; background: var(--border, #1e2732); }
.tap-bar__hint { color: var(--muted, #8b97a6); }
@keyframes tapPulse { 0% { box-shadow: 0 0 0 0 rgba(43,124,255,.5); }
  70% { box-shadow: 0 0 0 7px rgba(43,124,255,0); } 100% { box-shadow: 0 0 0 0 rgba(43,124,255,0); } }

.tap-chart-host { position: relative; flex: 1 1 auto; min-height: 300px; }
.tap-chart { position: absolute; inset: 0; }
/* z-index is load-bearing: Lightweight Charts' canvases carry their own positive
   z-index and .tap-chart makes no stacking context, so an auto-z overlay would be
   painted over and the entire grid would be invisible. */
.tap-grid { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }

/* Solid TILES that butt up against each other, not floating badges: the reference
   grid reads as one contiguous block. Inline background carries the per-cell
   intensity (set in tap-game.js); the hairline border draws the tile edges. */
.tap-cell { position: absolute; display: flex; align-items: center; justify-content: center;
  border-radius: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: #4ade80; pointer-events: auto; cursor: pointer;
  /* touch-action: manipulation kills the mobile browser's ~300ms tap→click delay (no
     double-tap-zoom to wait for) so a tap on a multiplier fires instantly. Kept on `click`
     (not pointerdown) so a vertical scroll-drag over the grid never fires an accidental bet. */
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; transition: filter .12s, box-shadow .12s;
  overflow: hidden; white-space: nowrap; line-height: 1.05; }
.tap-cell:hover { filter: brightness(1.35); box-shadow: inset 0 0 0 1px rgba(224,240,80,.7); z-index: 2; }
/* Instant press feedback: browsers paint :active on touch-DOWN, before JS runs or the network
   answers — so a tap reads as responsive even if the main thread is momentarily busy (spamming).
   transform+filter are GPU-composited (no layout), so this never adds to the per-tap cost. */
.tap-cell:active { filter: brightness(1.75); box-shadow: inset 0 0 0 2px rgba(224,240,80,.95); transform: scale(.96); z-index: 3; }
/* A placed tap: a solid bright tile with the stake over the multiplier, drawn on top of
   the block and kept on screen after its round rolls, drifting left with time. */
.tap-cell--mark { flex-direction: column; gap: 2px; background: #b8f04a; color: #14210a;
  font-weight: 800; font-size: 11px; pointer-events: none; z-index: 6;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.45); }
/* provisional: painted on the click frame, before the server has confirmed */
.tap-cell--mark.pending { opacity: .82; box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); }
.tap-cell--mark.won  { background: #12d18e; }
.tap-cell--mark.lost { background: #6b7280; color: #e5e7eb; }
.tap-cell__amt { display: none; font-size: 10.5px; font-weight: 800; line-height: 1; }
.tap-cell--mark .tap-cell__amt { display: block; }
.tap-cell.locked { pointer-events: none; opacity: .45; }
/* below the winnability floor: shown so the block stays solid, but not sellable */
.tap-cell.inert { pointer-events: none; }
/* overscan fill rows beyond the priced range: continuous look, not tappable */
.tap-cell.overscan { pointer-events: none; }
/* the reference draws no now-marker over the plot */
.tap-now { display: none; }

.tap-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(11,15,20,.82); color: var(--muted, #8b97a6); font-weight: 600;
  text-align: center; padding: 20px; z-index: 6; }
/* MUST come after: a class selector beats the UA `[hidden] { display: none }` rule, so
   without this the "unavailable" overlay stays displayed even when hidden and covers
   the whole grid with an 82%-opaque sheet — which is what made the tiles look faint
   and then invisible. */
.tap-msg[hidden] { display: none; }

/* =========================================================================
   TAP STAKE PANEL (#pane-tap) — clean amount card + percent slider.
   Tap-scoped only; never touches the shared .ticket / .amount-field rules.
   ========================================================================= */
.tap-amt-row { display: flex; align-items: center; gap: 10px; }
.tap-amt-input { flex: 1 1 auto; min-width: 0; background: var(--bg-0, #0b0f14);
  border: 1px solid var(--border, #1e2732); border-radius: 12px; color: var(--text, #eef2f7);
  font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .3px;
  padding: 10px 14px; outline: none; transition: border-color .12s, box-shadow .12s; }
.tap-amt-input:focus { border-color: var(--accent, #e0f050);
  box-shadow: 0 0 0 3px rgba(224,240,80,.12); }
.tap-amt-quick { display: flex; gap: 6px; flex: 0 0 auto; }
.tap-amt-quick button { background: var(--bg-1, #10151c); border: 1px solid var(--border, #1e2732);
  color: var(--muted, #8b97a6); border-radius: 10px; font-weight: 800; font-size: 13px;
  padding: 0 12px; height: 40px; cursor: pointer; transition: all .12s; }
.tap-amt-quick button:hover { color: var(--text, #eef2f7); border-color: var(--accent, #e0f050); }
.tap-amt-quick button:active { transform: scale(.94); }

/* percent slider: 0/25/50/75/100 of available balance */
.tap-pct { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 16px 0 4px;
  border-radius: 999px; background: var(--bg-0, #0b0f14); border: 1px solid var(--border, #1e2732);
  outline: none; cursor: pointer; }
.tap-pct::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent, #e0f050); border: 3px solid #0b0f14;
  box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.tap-pct::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent, #e0f050);
  border: 3px solid #0b0f14; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.tap-pct-marks { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700;
  color: var(--muted, #8b97a6); padding: 0 2px; }
.tap-pct-marks span { cursor: pointer; user-select: none; transition: color .12s; }
.tap-pct-marks span:hover { color: var(--accent, #e0f050); }
.tap-avail { margin-top: 10px; font-size: 12px; color: var(--muted, #8b97a6);
  font-variant-numeric: tabular-nums; }
.tap-avail #tap-avail-val { color: var(--text, #eef2f7); font-weight: 800; }

/* =========================================================================
   TAP LIVE-TRADING FEED — fills the sidebar ABOVE the stake panel (which is
   pinned to the bottom). Deterministic feed rendered by tap-game.js.
   ========================================================================= */
#pane-tap:not(.is-hidden) { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.tap-live { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-bottom: 12px; }
.tap-live__head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted, #8b97a6); padding: 2px 2px 9px; display: flex; align-items: center; gap: 7px; }
.tap-live__head::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #12d18e;
  box-shadow: 0 0 0 0 rgba(18,209,142,.55); animation: tapPulse 1.6s ease-out infinite; }
.tap-live__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  gap: 3px; padding-right: 3px; }
.tap-live__list::-webkit-scrollbar { width: 5px; }
.tap-live__list::-webkit-scrollbar-thumb { background: var(--border, #1e2732); border-radius: 3px; }
.tap-live__row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 9px;
  background: var(--bg-0, #0b0f14); font-size: 12.5px; }
.tap-live__av { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; display: flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.tap-live__nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: var(--text, #eef2f7); }
.tap-live__mx { flex: 0 0 auto; font-weight: 700; color: var(--muted, #8b97a6); font-variant-numeric: tabular-nums; }
.tap-live__amt { flex: 0 0 auto; min-width: 58px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.tap-live__amt.win { color: #12d18e; }
.tap-live__amt.lose { color: #f6465d; }
.tap-live__row.new { animation: tapLiveIn .4s ease; }
@keyframes tapLiveIn { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   TAP DOCK TABLES — injected by tap-game.js into #pane-open / #pane-closed.
   Reuse the shared .trades table look; shown ONLY while body.tap-active,
   with the High/Low tables + their empties hidden in the same state.
   ========================================================================= */
.tap-dock { display: none; }
body.tap-active .tap-dock { display: block; }
body.tap-active #pane-open > .trades,
body.tap-active #pane-open > #open-empty,
body.tap-active #pane-closed > .trades,
body.tap-active #pane-closed > #closed-empty { display: none; }

/* Symbol cell: reused app.js assetLogo() chip + the pair label */
.tap-sym { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.tap-sym .alogo { width: 20px; height: 20px; flex: 0 0 auto; }
.tap-sym .alogo__img, .tap-sym .alogo svg { width: 20px; height: 20px; border-radius: 50%; }
.tap-sym__t { font-variant-numeric: tabular-nums; }
.tap-ccy { color: var(--muted, #8b97a6); font-weight: 700; }
.tap-ref { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
  color: var(--muted, #8b97a6); letter-spacing: .4px; }
.tap-res { font-weight: 800; font-variant-numeric: tabular-nums; }
.tap-res.tap-win { color: #12d18e; }
.tap-res.tap-lose { color: #f6465d; }
.tap-share { text-align: center; }
.tap-share-btn { background: transparent; border: 1px solid var(--border, #1e2732); border-radius: 8px;
  color: var(--muted, #8b97a6); width: 28px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1;
  transition: all .12s; }
.tap-share-btn:hover { color: var(--accent, #e0f050); border-color: var(--accent, #e0f050); }

/* History (N) badge only meaningful on Tap; hidden for the other games */
body:not(.tap-active) #tap-hist-count { display: none; }

@media (max-width: 768px) {
  .tap-bar__hint { display: none; }
  .tap-cell { font-size: 11px; }
  .tap-amt-input { font-size: 22px; }
  /* the phone chart was 220px tall, which forced 9px tiles; give the grid real room */
  .tap-chart-host { min-height: 46vh; }
}
