/* tape.css — The Pit. Written against the site's design tokens, with
   fallbacks so the component also works on a bare page. */

.tp-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .tp-wrap { grid-template-columns: minmax(0, 1fr); gap: 14px; } }

/* ---- the chart ---- */
.tp-stage {
  position: relative;
  height: min(46vh, 380px);
  border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: var(--radius, 14px);
  background: var(--code-bg, #0a0a0f);
  overflow: hidden;
  box-shadow: var(--shadow, 0 18px 50px -18px rgba(0,0,0,.75));
}
#tp-canvas { display: block; width: 100%; height: 100%; }

.tp-clockwrap {
  position: absolute; top: 10px; right: 12px;
  font: 600 .82rem var(--font-mono, ui-monospace, monospace);
  color: var(--text-dim, #a2a3ae);
  background: rgba(0,0,0,.42); border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: 999px; padding: .26em .7em;
}
.tp-toast {
  position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 8px);
  padding: .5em .9em; border-radius: 999px; background: rgba(0,0,0,.8); color: #fff;
  border: 1px solid var(--border-strong, rgba(255,255,255,.16));
  font: 500 .78rem var(--font-sans, system-ui, sans-serif);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  max-width: calc(100% - 28px); text-align: center;
}
.tp-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- the quote ---- */
.tp-exprrow { margin-top: 14px; }
.tp-exprrow label {
  display: block; margin-bottom: 6px;
  font: 500 .74rem var(--font-sans, system-ui, sans-serif);
  color: var(--text-faint, #6e6f7b);
}
.tp-input {
  display: flex; align-items: center;
  border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: var(--radius-sm, 8px);
  background: var(--code-bg, #0a0a0f);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tp-input:focus-within {
  border-color: var(--accent, #ffb020);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(255,176,32,.16));
}
.tp-input .tp-sigil {
  padding: 0 2px 0 12px; flex: none; user-select: none;
  font: 500 1rem var(--font-mono, ui-monospace, monospace);
  color: var(--text-faint, #6e6f7b);
}
#tp-expr {
  flex: 1 1 auto; min-width: 0; padding: 13px 12px 13px 6px;
  border: 0; outline: 0; background: transparent; color: var(--text, #ecedf1);
  font: 500 clamp(.9rem, .85rem + .25vw, 1.02rem) var(--font-mono, ui-monospace, monospace);
}
#tp-expr.bad { color: var(--red, #ff6b6b); }
.tp-err {
  margin: 8px 0 0; font: 500 .78rem var(--font-mono, ui-monospace, monospace);
  color: var(--red, #ff6b6b);
}
.tp-note {
  margin: 10px 0 0; font-size: .8rem; color: var(--text-faint, #6e6f7b); min-height: 1.2em;
}

/* ---- controls ---- */
.tp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px;
}
.tp-pill, .tp-btn {
  font: 500 .78rem var(--font-sans, system-ui, sans-serif);
  color: var(--text-dim, #a2a3ae); cursor: pointer; white-space: nowrap; text-align: center;
  background: var(--surface, rgba(255,255,255,.028));
  border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: 999px; padding: .44em .9em;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.tp-pill:hover, .tp-btn:hover:not(:disabled) {
  color: var(--text, #ecedf1);
  border-color: var(--border-strong, rgba(255,255,255,.16));
  background: var(--surface-2, rgba(255,255,255,.055));
}
.tp-pill.on { color: var(--accent-ink, #1a1204); background: var(--accent, #ffb020); border-color: var(--accent, #ffb020); }
.tp-btn:disabled { opacity: .45; cursor: default; }
.tp-btn.primary { color: var(--accent-ink, #1a1204); background: var(--accent, #ffb020); border-color: var(--accent, #ffb020); font-weight: 600; }
.tp-pill:focus-visible, .tp-btn:focus-visible { outline: 2px solid var(--accent, #ffb020); outline-offset: 2px; }

.tp-seedwrap {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 .76rem var(--font-sans, system-ui, sans-serif); color: var(--text-faint, #6e6f7b);
}
#tp-seed {
  width: 74px; padding: .38em .5em; text-align: center;
  border: 1px solid var(--border, rgba(255,255,255,.09)); border-radius: 999px;
  background: var(--code-bg, #0a0a0f); color: var(--text, #ecedf1);
  font: 500 .78rem var(--font-mono, ui-monospace, monospace);
}

/* ---- the panel ---- */
.tp-panel {
  border: 1px solid var(--border, rgba(255,255,255,.09));
  border-radius: var(--radius, 14px);
  background: var(--surface, rgba(255,255,255,.028));
  padding: 16px;
}
.tp-panel + .tp-panel { margin-top: 12px; }
.tp-panel h2 {
  margin: 0 0 10px; font: 600 .74rem var(--font-sans, system-ui, sans-serif);
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint, #6e6f7b);
}
.tp-big {
  font: 700 2.1rem var(--font-mono, ui-monospace, monospace);
  color: var(--text, #ecedf1); line-height: 1.1; letter-spacing: -.02em;
}
.tp-big.up { color: var(--green, #5ddba0); }
.tp-big.dn { color: var(--red, #ff6b6b); }

.tp-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0 0; }
.tp-stats dt { font-size: .78rem; color: var(--text-faint, #6e6f7b); }
.tp-stats dd {
  margin: 0; text-align: right;
  font: 500 .82rem var(--font-mono, ui-monospace, monospace); color: var(--text-dim, #a2a3ae);
}

.tp-invtrack {
  position: relative; height: 6px; margin-top: 8px; border-radius: 999px;
  background: var(--surface-2, rgba(255,255,255,.055)); overflow: hidden;
}
.tp-invtrack::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: var(--border-strong, rgba(255,255,255,.16));
}
#tp-invbar { position: absolute; top: 0; bottom: 0; width: 50%; background: var(--accent, #ffb020); }

/* ---- the tape ---- */
.tp-tape {
  max-height: 232px; overflow: hidden;
  font: 500 .76rem var(--font-mono, ui-monospace, monospace);
}
.tp-row-fill { display: grid; }
.tp-tape .tp-row {
  display: grid; grid-template-columns: 2.6em 2em 1fr 3.2em;
  gap: 6px; padding: 2px 0; color: var(--text-dim, #a2a3ae);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.tp-tape .tp-row.buy .tp-side { color: var(--accent, #ffb020); }
.tp-tape .tp-row.sell .tp-side { color: var(--cyan, #56d4dd); }
.tp-tape .tp-sz, .tp-tape .tp-vs { text-align: right; }
.tp-tape .tp-px { text-align: right; color: var(--text, #ecedf1); }

.tp-sum {
  margin: 0; white-space: pre; overflow-x: auto;
  font: 500 .72rem var(--font-mono, ui-monospace, monospace);
  color: var(--text-dim, #a2a3ae);
}

.tp-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 .74rem var(--font-mono, ui-monospace, monospace); color: var(--text-dim, #a2a3ae);
  border: 1px solid var(--border, rgba(255,255,255,.09));
  background: var(--surface, rgba(255,255,255,.028));
  border-radius: 999px; padding: .38em .8em; white-space: nowrap;
}
.tp-led { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint, #6e6f7b); flex: none; }
.tp-led.booting { background: var(--accent, #ffb020); animation: tpPulse 1.1s ease-in-out infinite; }
.tp-led.ready { background: var(--green, #5ddba0); box-shadow: 0 0 0 3px rgba(93,219,160,.22); }
.tp-led.error { background: var(--red, #ff6b6b); }
@keyframes tpPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

.tp-vars { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.tp-vars dt { font: 600 .8rem var(--font-mono, ui-monospace, monospace); color: var(--accent-soft, #ffcb6b); }
.tp-vars dd { margin: 0; font-size: .8rem; line-height: 1.45; color: var(--text-dim, #a2a3ae); }
.tp-hint { margin: 10px 0 0; font-size: .79rem; line-height: 1.55; color: var(--text-faint, #6e6f7b); }
.tp-hint code { font-family: var(--font-mono, ui-monospace, monospace); color: var(--text-dim, #a2a3ae); }

/* ---- legend under the controls ---- */
.tp-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  margin: 10px 0 0; font-size: .76rem; color: var(--text-faint, #6e6f7b);
}
.tp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tp-legend .tp-legend-sp { color: var(--text-faint, #6e6f7b); opacity: .85; }
.tp-key { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.tp-key.mid { height: 2px; border-radius: 2px; background: var(--text, #ecedf1); }
.tp-key.band { background: rgba(255,176,32,.28); border: 1px solid rgba(255,176,32,.5); }
.tp-key.buy { width: 9px; height: 9px; border-radius: 50%; background: var(--accent, #ffb020); }
.tp-key.sell { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan, #56d4dd); }

/* ---- the how-to section ---- */
.tp-howto { padding: 30px 0 10px; }
.tp-howto h2 {
  margin: 0 0 10px; font-size: clamp(1.3rem, 1.1rem + .7vw, 1.65rem);
  letter-spacing: -.01em;
}
.tp-howto .lead { max-width: 74ch; margin: 0; }
.tp-howto .card h3 {
  margin: 0 0 8px; font-size: .92rem; letter-spacing: .01em;
  color: var(--accent-soft, #ffcb6b);
}
.tp-howto .card p { margin: 0 0 8px; font-size: .88rem; line-height: 1.62; color: var(--text-dim, #a2a3ae); }
.tp-howto .card p:last-child { margin-bottom: 0; }
.tp-h3 {
  margin: 26px 0 10px; font: 600 .78rem var(--font-sans, system-ui, sans-serif);
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint, #6e6f7b);
}
.tp-list { margin: 0; padding-left: 1.15em; max-width: 78ch; }
.tp-list li { margin: 0 0 9px; font-size: .9rem; line-height: 1.62; color: var(--text-dim, #a2a3ae); }
.tp-list li strong { color: var(--text, #ecedf1); font-weight: 600; }
.tp-howto code {
  font-family: var(--font-mono, ui-monospace, monospace); font-size: .9em;
  color: var(--accent-soft, #ffcb6b);
}
.tp-howto p { color: var(--text-dim, #a2a3ae); }

/* Ligatures off: the symbols are distinct verbs, not a curly-brace language's
   operators, and JetBrains Mono merges pairs like #? != <= |> into one glyph. */
input, code, pre, .gf-test, .gf-cheat dt, .tp-tape, .tp-sum, .sw-src, .dots-vars dt {
  font-variant-ligatures: none !important;
  font-feature-settings: "liga" 0, "clig" 0, "calt" 0 !important;
}
