/* =============================================================
   turn-order-bar.css — BG3-style horizontal Turn Order Bar
   Floats top-center over the VTT canvas, combat only.
   ============================================================= */

/* Centering is left:50% + translateX(-50%) on this element alone. Its
   shrink-to-fit width must come from .tob-track ONLY — .tob-advance is
   positioned absolutely (see below) so the DM-only chevron never adds to
   that width and pulls the visible cell strip off-center. Do not make
   this a flex container with the track and button as siblings again. */
.turn-order-bar {
  position: absolute;
  top: 48px;
  left: 50%;
  z-index: 60;
  transform: translateX(-50%) translateY(-14px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition-panel), opacity var(--transition-panel);
}
.turn-order-bar[hidden] { display: none; }
.turn-order-bar--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.tob-track {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: min(78vw, 720px);
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x proximity;
  padding: 10px 8px 6px;
  background: rgba(59,47,30,0.92);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(196,146,42,0.35);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  scrollbar-width: thin;
}
.tob-track::-webkit-scrollbar { height: 5px; }
.tob-track::-webkit-scrollbar-thumb { background: rgba(196,146,42,0.4); border-radius: 3px; }

/* ── Cells ────────────────────────────────────────────────────── */

.tob-cell {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  scroll-snap-align: start;
  cursor: pointer;
  transition: width 200ms ease, height 200ms ease;
}

.tob-cell--active {
  width: 72px;
  height: 72px;
}

/* Fill is a fixed parchment surface for every cell -- disposition is
   carried ONLY by the border color below. Do not vary the fill per
   entry (e.g. a hashed hue); that's the mistake this rule replaced. */
.tob-portrait {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: var(--surface);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  border: 2px solid var(--disposition-hostile);
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.tob-cell--friendly .tob-portrait { border-color: var(--disposition-friendly); }
.tob-cell--neutral  .tob-portrait { border-color: var(--disposition-neutral); }
.tob-cell--hostile  .tob-portrait { border-color: var(--disposition-hostile); }

.tob-cell--active .tob-portrait {
  border-width: 3px;
}

/* Gold pulse ring on the active turn cell — same visual token as the
   active-turn ring the canvas draws on the map. */
.tob-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 9px;
  pointer-events: none;
  animation: tob-pulse 1.6s ease-out infinite;
}
@keyframes tob-pulse {
  0%   { box-shadow: 0 0 0 0px rgba(196,146,42,0.65); }
  70%  { box-shadow: 0 0 0 5px rgba(196,146,42,0); }
  100% { box-shadow: 0 0 0 0px rgba(196,146,42,0); }
}

.tob-hidden-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--gold);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Round divider ────────────────────────────────────────────── */

.tob-divider {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 14px;
  margin: 0 2px;
}
.tob-divider::before {
  content: '';
  flex: 1;
  width: 2px;
  margin-top: 18px;
  background: linear-gradient(to bottom, var(--gold), rgba(196,146,42,0.15));
  border-radius: 1px;
}
.tob-divider__round {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--gold);
  white-space: nowrap;
}

/* ── DM advance chevron ───────────────────────────────────────── */

.tob-advance {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: 10px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(196,146,42,0.4);
  background: var(--blood);
  color: var(--parchment);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.tob-advance:hover {
  background: var(--blood-dark);
  box-shadow: var(--shadow-glow-gold);
}

/* ── Mobile ───────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .tob-cell          { width: 44px;  height: 44px; }
  .tob-cell--active  { width: 56px;  height: 56px; }
  .turn-order-bar    { top: 40px; }
}
