/* ==========================================================================
   Tale of the Tape — Institutional Research 1v1 Artifact & Modal
   Shared between tapeModal.js (live modal) and graphic/studio.js (1:1 PNG).
   ========================================================================== */

.tot {
  --tot-bg: #ffffff;
  --tot-surface: #f8fafc;
  --tot-line: #e2e8f0;
  --tot-line-strong: #cbd5e1;
  --tot-ink: #0f172a;
  --tot-muted: #475569;
  --tot-dim: #64748b;
  --tot-a: #1d4ed8;
  --tot-a-soft: #eff6ff;
  --tot-a-tint: rgba(29, 78, 216, 0.26);
  --tot-a-line: #bfdbfe;
  --tot-a-ink: #1e40af;
  --tot-b: #d97706;
  --tot-b-soft: #fffbeb;
  --tot-b-tint: rgba(217, 119, 6, 0.26);
  --tot-b-line: #fde68a;
  --tot-b-ink: #b45309;
  --tot-track: #f1f5f9;
  --tot-mute-bar: #cbd5e1;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--tot-bg);
  color: var(--tot-ink);
  padding: 28px 34px 26px;
  border-radius: 12px;
  border-top: 4px solid var(--tot-ink);
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.tot--export {
  border-radius: 0;
  padding: 36px 46px 28px;
}

/* ── Face-Off Header ────────────────────────────────────── */
.tot-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--tot-line);
}

.tot-fighter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tot-fighter--b {
  align-items: flex-end;
  text-align: right;
}

.tot-fighter__top {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.tot-fighter__dot {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.tot-fighter__dot.is-a { background: var(--tot-a); }
.tot-fighter__dot.is-b { background: var(--tot-b); }

.tot-fighter__tk {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  white-space: nowrap;
}
.tot-fighter--a .tot-fighter__tk { color: var(--tot-a-ink); }
.tot-fighter--b .tot-fighter__tk { color: var(--tot-b-ink); }

.tot-fighter__kind {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--tot-track);
  color: var(--tot-dim);
  white-space: nowrap;
}

.tot-fighter__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tot-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tot-fighter__meta {
  font-size: 12px;
  color: var(--tot-dim);
  white-space: nowrap;
}

.tot-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tot-vs__badge {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 4px 13px;
  border-radius: 3px;
  background: var(--tot-ink);
  color: #ffffff;
  white-space: nowrap;
}

.tot-vs__tally {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
}

.tot-vs__chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tot-muted);
  background: var(--tot-surface);
  border: 1px solid var(--tot-line);
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.tot-vs__chip strong.is-a { color: var(--tot-a-ink); font-weight: 800; }
.tot-vs__chip strong.is-b { color: var(--tot-b-ink); font-weight: 800; }

/* ── Executive Thesis Headline ──────────────────────────── */
.tot-thesis {
  padding: 14px 0;
  border-bottom: 1px solid var(--tot-line);
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--tot-ink);
  line-height: 1.4;
}

/* ── Editorial Sections (Hairline-Divided, No Nested Boxes) ─ */
.tot-sec {
  padding: 16px 0;
  border-bottom: 1px solid var(--tot-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tot-sec__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.3;
}

.tot-sec__kicker {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--tot-ink);
  white-space: nowrap;
}

.tot-sec__verdict {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tot-ink);
  line-height: 1.45;
}

.tot-sec__hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--tot-dim);
}

.tot-sec__legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tot-muted);
  white-space: nowrap;
}
.tot-sec__legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: -5px;
}
.tot-sec__legend i.is-a { background: var(--tot-a); }
.tot-sec__legend i.is-b { background: var(--tot-b); }

.tot-sec__score {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--tot-muted);
  white-space: nowrap;
}
.tot-sec__score strong.is-a { color: var(--tot-a-ink); }
.tot-sec__score strong.is-b { color: var(--tot-b-ink); }

.tot-empty {
  margin: 4px 0;
  font-size: 12.5px;
  color: var(--tot-dim);
}

/* ── Section 1: Exposure & Themes ───────────────────────── */
.tot-rel {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
}
.tot-rel--substitute { background: #fef3c7; color: #92400e; }
.tot-rel--adjacent { background: #e0f2fe; color: #075985; }
.tot-rel--different { background: #f3e8ff; color: #6b21a8; }

.tot-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tot-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--tot-line);
  background: var(--tot-surface);
  color: var(--tot-muted);
  white-space: nowrap;
}
.tot-pill--shared {
  background: var(--tot-ink);
  border-color: var(--tot-ink);
  color: #ffffff;
}
.tot-pill--a {
  background: var(--tot-a-soft);
  border-color: var(--tot-a-line);
  color: var(--tot-a-ink);
}
.tot-pill--b {
  background: var(--tot-b-soft);
  border-color: var(--tot-b-line);
  color: var(--tot-b-ink);
}

/* ── Dual Multi-Period Proof Grid (Skyline + Crises) ────── */
.tot-proof-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--tot-line);
}

.tot-proof-grid--stacked {
  grid-template-columns: 1fr;
}

.tot-proof-grid > .tot-sec {
  border-bottom: 0;
}
.tot-proof-grid > .tot-sec--skyline {
  padding-right: 26px;
  border-right: 1px solid var(--tot-line);
}
.tot-proof-grid > .tot-sec--crises {
  padding-left: 26px;
}

.tot-proof-grid--stacked > .tot-sec--skyline {
  padding-right: 0;
  border-right: 0;
  border-bottom: 1px solid var(--tot-line);
}
.tot-proof-grid--stacked > .tot-sec--crises {
  padding-left: 0;
}

.tot-sky-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tot-sky__svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  margin-top: 4px;
}

.tot-sky__col.is-click {
  cursor: pointer;
}
.tot-sky__col.is-click:hover rect {
  opacity: 0.85;
}

.tot-crisis-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--tot-surface);
  border: 1px dashed var(--tot-line-strong);
  font-size: 12px;
  color: var(--tot-muted);
}
.tot-crisis-lock__cta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tot-a-ink);
  text-decoration: none;
  white-space: nowrap;
}
.tot-crisis-lock__cta:hover {
  text-decoration: underline;
}

/* ── Section 4: Center-Spine Tug-of-War ─────────────────── */
.tot-tug {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 6px;
}

.tot-tug__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--tot-line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tot-tug__head-a { color: var(--tot-a-ink); text-align: left; }
.tot-tug__head-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--tot-dim);
  font-weight: 700;
  white-space: nowrap;
}
.tot-tug__head-dots {
  display: inline-grid;
  grid-template-columns: repeat(4, 22px);
  text-align: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--tot-dim);
}
.tot-tug__head-b { color: var(--tot-b-ink); text-align: right; }

.tot-tug__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--tot-line-soft, rgba(148, 163, 184, 0.16));
}
.tot-tug__row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.tot-tug__side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tot-tug__val {
  font-size: 14px;
  font-weight: 600;
  min-width: 58px;
  color: var(--tot-dim);
  white-space: nowrap;
}
.tot-tug__side--a .tot-tug__val { text-align: right; }
.tot-tug__side--b .tot-tug__val { text-align: left; }
.tot-tug__side.is-win .tot-tug__val {
  font-weight: 800;
  color: var(--tot-ink);
}

.tot-tug__track {
  flex: 1;
  height: 11px;
  border-radius: 3px;
  background: var(--tot-track);
  display: flex;
  overflow: hidden;
}
.tot-tug__track--a { justify-content: flex-end; }
.tot-tug__track--b { justify-content: flex-start; }

.tot-tug__track i {
  display: block;
  height: 100%;
  border-radius: 3px;
}
.tot-tug__side--a.is-win .tot-tug__track i { background: var(--tot-a); }
.tot-tug__side--b.is-win .tot-tug__track i { background: var(--tot-b); }
.tot-tug__side--a.is-lose .tot-tug__track i { background: var(--tot-a-tint); }
.tot-tug__side--b.is-lose .tot-tug__track i { background: var(--tot-b-tint); }

.tot-tug__mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tot-tug__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.tot-tug__lbl {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--tot-ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.tot-tug__sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--tot-dim);
  line-height: 1.2;
  white-space: nowrap;
}

.tot-tug__dots {
  display: inline-grid;
  grid-template-columns: repeat(4, 22px);
  align-items: center;
  justify-items: center;
  flex: none;
}

.tot-hdot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tot-hdot i {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--tot-line);
}
.tot-hdot.is-a i { background: var(--tot-a); }
.tot-hdot.is-a span { color: var(--tot-a-ink); }
.tot-hdot.is-b i { background: var(--tot-b); }
.tot-hdot.is-b span { color: var(--tot-b-ink); }
.tot-hdot.is-tie i { background: var(--tot-dim); }
.tot-hdot.is-na i { background: transparent; border: 1px dashed var(--tot-line); }

/* ── Section 5: Institutional Bottom Line ───────────────── */
.tot-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 16px;
}

.tot-pick {
  padding: 12px 16px;
  background: var(--tot-surface);
  border: 1px solid var(--tot-line);
  border-radius: 4px;
  border-left-width: 4px;
}
.tot-pick--a { border-left-color: var(--tot-a); }
.tot-pick--b { border-left-color: var(--tot-b); }

.tot-pick__lbl {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  white-space: nowrap;
}
.tot-pick--a .tot-pick__lbl { color: var(--tot-a-ink); }
.tot-pick--b .tot-pick__lbl { color: var(--tot-b-ink); }

.tot-pick p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--tot-ink);
}

.tot-pair-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--tot-muted);
  background: var(--tot-surface);
  border: 1px dashed var(--tot-line-strong);
  border-radius: 4px;
  padding: 9px 14px;
}

/* ── Export Footer ──────────────────────────────────────── */
.tot-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--tot-line);
}

.tot-foot__meta {
  margin: 0;
  font-size: 10.5px;
  color: var(--tot-dim);
}

.tot-foot__subtle {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tot-muted);
  white-space: nowrap;
}

.tot-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tot-mark__svg { width: 22px; height: 22px; }
.tot-mark__name {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--tot-ink);
}
.tot-mark__name em { font-style: normal; color: #059669; }
.tot-mark__tld { font-weight: 600; color: var(--tot-dim); }

/* ==========================================================================
   Obsidian Dark Theme (.tot--dark)
   ========================================================================== */
.tot--dark {
  --tot-bg: #0b0f19;
  --tot-surface: #111827;
  --tot-line: #1f2937;
  --tot-line-strong: #334155;
  --tot-ink: #f8fafc;
  --tot-muted: #cbd5e1;
  --tot-dim: #94a3b8;
  --tot-a: #60a5fa;
  --tot-a-soft: rgba(96, 165, 250, 0.13);
  --tot-a-tint: rgba(96, 165, 250, 0.30);
  --tot-a-line: rgba(96, 165, 250, 0.34);
  --tot-a-ink: #93c5fd;
  --tot-b: #f59e0b;
  --tot-b-soft: rgba(245, 158, 11, 0.13);
  --tot-b-tint: rgba(245, 158, 11, 0.30);
  --tot-b-line: rgba(245, 158, 11, 0.36);
  --tot-b-ink: #fcd34d;
  --tot-track: #1e293b;
  --tot-mute-bar: #334155;
  border-top-color: #60a5fa;
}

.tot--dark .tot-vs__badge {
  background: #f8fafc;
  color: #0b0f19;
}
.tot--dark .tot-pill--shared {
  background: #f8fafc;
  border-color: #f8fafc;
  color: #0b0f19;
}
.tot--dark .tot-rel--substitute { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.tot--dark .tot-rel--adjacent { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.tot--dark .tot-rel--different { background: rgba(192, 132, 252, 0.18); color: #d8b4fe; }

/* ==========================================================================
   Row Entry Icon (.eb-tape-btn)
   ========================================================================== */
.eb-tape-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.03);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.09);
  color: var(--eb-ink-2, #3f3f46);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
  vertical-align: middle;
}
.eb-tape-btn:hover {
  background: var(--eb-beat-bg, #ecfdf5);
  box-shadow: inset 0 0 0 1px var(--eb-beat-ring, #a7f3d0);
  color: var(--eb-beat, #047857);
}
.eb-tape-btn svg {
  flex: none;
  width: 11.5px;
  height: 11.5px;
  color: var(--eb-beat, #047857);
}

/* ==========================================================================
   Interactive Modal (.eb-tape-modal)
   ========================================================================== */
.eb-tape-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.eb-tape-modal[hidden] { display: none; }

.eb-tape-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
}

.eb-tape-modal__dialog {
  position: relative;
  width: min(1220px, 100%);
  max-height: 92vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eb-tape-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.eb-tape-modal__opponents {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.eb-tape-modal__lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  margin-right: 2px;
}

.eb-tape-modal__chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}
.eb-tape-modal__chip:hover { border-color: #64748b; }
.eb-tape-modal__chip.is-on {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}
.eb-tape-modal__chip small {
  font-weight: 500;
  opacity: 0.78;
  margin-left: 3px;
}

.eb-tape-modal__search {
  width: 96px;
  height: 27px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #0f172a;
}

.eb-tape-modal__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.eb-tape-modal__btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.eb-tape-modal__btn:hover { background: #f1f5f9; }
.eb-tape-modal__btn--primary {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}
.eb-tape-modal__btn--primary:hover { background: #1e293b; }

.eb-tape-modal__x {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: transparent;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.eb-tape-modal__x:hover { background: #f1f5f9; color: #0f172a; }

.eb-tape-modal__body {
  overflow-y: auto;
  padding: 14px 18px 18px;
  background: #f1f5f9;
}

.eb-tape-modal__status {
  font-size: 11.5px;
  font-weight: 600;
  color: #059669;
}

@media (max-width: 820px) {
  .tot-proof-grid,
  .tot-bottom {
    grid-template-columns: 1fr;
  }
  .tot-proof-grid > .tot-sec--skyline {
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid var(--tot-line);
  }
  .tot-proof-grid > .tot-sec--crises {
    padding-left: 0;
  }
  .tot-head {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .tot-fighter,
  .tot-fighter--b {
    align-items: center;
    text-align: center;
  }
  .tot-tug__head,
  .tot-tug__row {
    grid-template-columns: minmax(0, 1fr) 142px minmax(0, 1fr);
    gap: 8px;
  }
  .tot-tug__head-mid {
    justify-content: center;
  }
  .tot-tug__head-dots { display: none; }
  .tot-tug__mid {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
  .tot-tug__meta { align-items: center; }
  .tot-tug__dots { grid-template-columns: repeat(4, 16px); }
}
