/* ============================================================================
 * Azuki TCG — board styles (board-ui agent). Prefix: .bd-
 * Palette tokens come from css/main.css; every var() carries the contract
 * fallback so #/boarddev renders standalone too.
 * ==========================================================================*/

.bd-root {
  --bd-bg: var(--bg, #0B0B0D);
  --bd-panel: var(--panel, #141417);
  --bd-panel2: var(--panel2, #1B1B20);
  --bd-line: var(--line, rgba(255, 245, 221, .14));
  --bd-red: var(--red, #DD323F);
  --bd-cream: var(--cream, #FFF5DD);
  --bd-cream-dim: var(--cream-dim, rgba(255, 245, 221, .55));
  --bd-good: var(--good, #38B26F);
  --bd-gold: var(--gold, #E8C36A);
  --bd-blue: #3B9EFF;

  position: relative;
  width: 100%;
  height: var(--bd-height, 100%);
  min-height: 620px;
  overflow: hidden;
  color: var(--bd-cream);
  font-family: Inter, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 640px at 50% 38%, #17171d 0%, var(--bd-bg) 70%),
    var(--bd-bg);
  user-select: none;
  -webkit-user-select: none;
}

/* fill the viewport when mounted straight into <body> (dev harness) */
#boarddev-root .bd-root { --bd-height: 100vh; }

/* ---------- table grid ---------------------------------------------------*/
.bd-table {
  display: grid;
  grid-template-rows: 9% 14% 19.5% 8% 19.5% 14% 16%;
  height: 100%;
  width: 100%;
}

/* ---------- rows & slots --------------------------------------------------*/
.bd-row,
.bd-gardenrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 12px;
  min-height: 0;
  position: relative;
  transition: background .2s ease, box-shadow .2s ease;
}
.bd-gardenrow {
  background: linear-gradient(180deg, rgba(255, 245, 221, .025), rgba(255, 245, 221, 0));
  border-top: 1px solid rgba(255, 245, 221, .05);
  border-bottom: 1px solid rgba(255, 245, 221, .05);
}
.bd-row-alley { opacity: .96; }

.bd-slots {
  display: flex;
  gap: 10px;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
}
.bd-slot {
  height: 94%;
  aspect-ratio: 63 / 88;
  border: 1px dashed rgba(255, 245, 221, .08);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bd-slot > .bd-cardwrap { height: 100%; }

/* zone highlight (choose a row to play into) */
.bd-zone-hl {
  background: rgba(56, 178, 111, .07);
  box-shadow: inset 0 0 0 1px rgba(56, 178, 111, .45);
  border-radius: 10px;
  cursor: pointer;
}
.bd-zone-hl .bd-slot { border-color: rgba(56, 178, 111, .55); }
.bd-zone-replace {
  background: rgba(232, 195, 106, .06);
  box-shadow: inset 0 0 0 1px rgba(232, 195, 106, .5);
  border-radius: 10px;
}

/* stations flanking the garden row */
.bd-station {
  width: clamp(100px, 11vw, 158px);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: none;
}
.bd-station > .bd-cardwrap { height: 78%; }
.bd-station-name {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--bd-cream-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-transform: uppercase;
}
.bd-station.bd-used .bd-station-name { color: rgba(255, 245, 221, .3); }
.bd-station.bd-ghost { justify-content: center; }
.bd-rowtag {
  font-size: 10px;
  letter-spacing: .28em;
  color: rgba(255, 245, 221, .18);
  transform: rotate(-90deg);
}

.bd-gate-used .bd-card { filter: grayscale(.55) brightness(.7); }

/* leader HP */
.bd-leader-hp {
  position: absolute;
  bottom: -8px;
  left: -8px;
  z-index: 5;
  min-width: 30px;
  height: 30px;
  padding: 0 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2a31, #121215);
  border: 2px solid var(--bd-red);
  color: var(--bd-cream);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
.bd-hp-tick { animation: bdPop .22s ease; }
.bd-hpbar {
  width: 82%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 245, 221, .1);
  overflow: hidden;
}
.bd-hpbar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--bd-good), #6fd29a);
  transition: width .22s ease;
}
.bd-hpbar-low { background: linear-gradient(90deg, var(--bd-red), #f0707a); }

/* ---------- card ----------------------------------------------------------*/
.bd-cardwrap {
  position: relative;
  height: 100%;
  aspect-ratio: 63 / 88;
  flex: none;
}
.bd-card {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--bd-panel2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 245, 221, .07);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  cursor: pointer;
}
.bd-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  pointer-events: none;
}
.bd-mini .bd-card { border-radius: 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 245, 221, .08); }
.bd-mini .bd-art { border-radius: 5px; }

.bd-tapped { transform: rotate(90deg) scale(.82); }
.bd-anim-tap { animation: bdTap .2s ease; }
.bd-anim-untap { animation: bdUntap .2s ease; }
@keyframes bdTap { from { transform: rotate(0) scale(1); } to { transform: rotate(90deg) scale(.82); } }
@keyframes bdUntap { from { transform: rotate(90deg) scale(.82); } to { transform: rotate(0) scale(1); } }

.bd-enter { animation: bdEnter .24s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes bdEnter {
  from { transform: translateY(14px) scale(.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.bd-tapped.bd-enter { animation: none; }

.bd-hit { animation: bdShake .24s ease; }
@keyframes bdShake {
  0% { transform: translateX(0); }
  30% { transform: translateX(-5px) rotate(-2deg); }
  60% { transform: translateX(4px) rotate(1.5deg); }
  100% { transform: translateX(0); }
}
.bd-tapped.bd-hit { animation: bdShakeTapped .24s ease; }
@keyframes bdShakeTapped {
  0%, 100% { transform: rotate(90deg) scale(.82); }
  40% { transform: rotate(84deg) scale(.82); }
  70% { transform: rotate(94deg) scale(.82); }
}

/* cooldown / statuses */
.bd-cooldown { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(59, 158, 255, .55), 0 0 14px rgba(59, 158, 255, .35); }
.bd-st-frozen .bd-art { filter: saturate(.35) brightness(.85) hue-rotate(160deg); }
.bd-st-frozen { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(59, 158, 255, .8), inset 0 0 18px rgba(59, 158, 255, .35); }
.bd-st-rooted { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(70, 167, 88, .7); }
.bd-st-shocked { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(245, 217, 10, .6); }

/* badges */
.bd-badge {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.bd-cost {
  top: -6px;
  left: -6px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  color: #0B0B0D;
  background: radial-gradient(circle at 35% 30%, #fff9e8, var(--bd-gold));
  border: 1.5px solid var(--el, var(--bd-gold));
}
.bd-gp {
  top: 19px;
  left: -5px;
  width: 17px;
  height: 17px;
  font-size: 10px;
  color: var(--bd-cream);
  background: #26262d;
  border: 1.5px solid rgba(255, 245, 221, .35);
}
.bd-mini .bd-cost { width: 16px; height: 16px; font-size: 10px; top: -4px; left: -4px; }
.bd-mini .bd-gp { display: none; }

.bd-plates {
  position: absolute;
  right: -5px;
  bottom: -6px;
  z-index: 4;
  display: flex;
  gap: 3px;
}
.bd-plate {
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.bd-atk { background: linear-gradient(180deg, #e2555f, var(--bd-red)); color: #fff; }
.bd-hp { background: linear-gradient(180deg, #fffbee, var(--bd-cream)); color: #16161a; }
.bd-plate.bd-buffed { box-shadow: 0 0 8px rgba(56, 178, 111, .9), 0 1px 4px rgba(0, 0, 0, .6); text-shadow: 0 0 4px rgba(56, 178, 111, .8); }
.bd-plate.bd-nerfed { filter: saturate(.5) brightness(.8); }
.bd-mini .bd-plate { min-width: 15px; height: 15px; font-size: 10px; border-radius: 4px; }

/* keyword badges */
.bd-kws {
  position: absolute;
  top: -6px;
  right: -5px;
  z-index: 4;
  display: flex;
  gap: 2px;
}
.bd-kw {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #1d1d23;
  border: 1px solid var(--bd-gold);
  color: var(--bd-gold);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.bd-kw-defender { border-color: var(--bd-blue); color: var(--bd-blue); }
.bd-kw-taunt { border-color: var(--bd-red); color: var(--bd-red); }
.bd-kw-charge { border-color: #F5D90A; color: #F5D90A; }
.bd-kw-carapace { border-color: #46A758; color: #9fe0b0; }
.bd-mini .bd-kws { display: none; }

/* status chips */
.bd-chips {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  pointer-events: none;
}
.bd-chip {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(11, 11, 13, .82);
  border: 1px solid var(--bd-line);
  color: var(--bd-cream);
  white-space: nowrap;
}
.bd-chip-frozen { border-color: var(--bd-blue); color: #9ccdff; }
.bd-chip-shocked { border-color: #F5D90A; color: #F5D90A; }
.bd-chip-rooted { border-color: #46A758; color: #8fd6a0; }
.bd-chip-cd { border-color: rgba(59, 158, 255, .6); color: #7db8f5; }
.bd-chip-unscripted { border-color: rgba(255, 245, 221, .25); color: rgba(255, 245, 221, .45); font-style: italic; }
.bd-mini .bd-chips { display: none; }

/* weapons fanned under bearer */
.bd-weapons {
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  display: flex;
  z-index: 1;
}
.bd-weapon {
  position: relative;
  width: 26px;
  height: 36px;
  border-radius: 4px;
  overflow: visible;
  margin-left: -8px;
  transform: rotate(calc((var(--wi) - .5) * 14deg)) translateY(calc(var(--wi) * 1px));
  box-shadow: 0 2px 5px rgba(0, 0, 0, .6), 0 0 0 1px rgba(232, 195, 106, .5);
  background: var(--bd-panel2);
}
.bd-weapon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  pointer-events: none;
}
.bd-weapon-atk {
  position: absolute;
  right: -5px;
  bottom: -5px;
  font-size: 9px;
  font-weight: 800;
  background: var(--bd-red);
  color: #fff;
  border-radius: 5px;
  padding: 0 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* card back */
.bd-back {
  background:
    radial-gradient(circle at 50% 42%, #232329 0%, #141417 65%),
    var(--bd-panel2);
  border: 1px solid rgba(255, 245, 221, .1);
}
.bd-back-ring {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2.5px solid var(--bd-red);
  box-shadow: inset 0 0 10px rgba(221, 50, 63, .35), 0 0 10px rgba(221, 50, 63, .25);
}
.bd-back::after {
  content: "AZUKI";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12%;
  text-align: center;
  font-size: 8px;
  letter-spacing: .34em;
  color: rgba(255, 245, 221, .35);
}

/* ---------- highlights -----------------------------------------------------*/
.bd-hl-playable > .bd-card,
.bd-hl-playable.bd-weapon {
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(56, 178, 111, .8), 0 0 12px rgba(56, 178, 111, .35);
}
.bd-hl-usable > .bd-card,
.bd-hl-usable.bd-weapon {
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(255, 245, 221, .5), 0 0 10px rgba(255, 245, 221, .18);
}
.bd-hl-selected > .bd-card {
  transform: translateY(-6px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .6), 0 0 0 2px var(--bd-cream), 0 0 16px rgba(255, 245, 221, .35);
}
.bd-hl-selected.bd-hcard > .bd-card { transform: translateY(-14px) scale(1.05); }
.bd-hl-target > .bd-card,
.bd-hl-target.bd-weapon { animation: bdPulseGold 1s ease-in-out infinite; cursor: crosshair; }
.bd-hl-attack > .bd-card { animation: bdPulseRed .9s ease-in-out infinite; cursor: crosshair; }
.bd-hl-chosen > .bd-card,
.bd-hl-chosen.bd-weapon {
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 2.5px var(--bd-gold), 0 0 18px rgba(232, 195, 106, .6);
}
.bd-hl-replace > .bd-card { animation: bdPulseGold 1s ease-in-out infinite; }
.bd-hl-attacking > .bd-card {
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 2.5px var(--bd-red), 0 0 20px rgba(221, 50, 63, .65);
}
.bd-hl-attacked > .bd-card { animation: bdPulseRed .9s ease-in-out infinite; }

@keyframes bdPulseRed {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(221, 50, 63, .55), 0 0 8px rgba(221, 50, 63, .3); }
  50% { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 2.5px var(--bd-red), 0 0 20px rgba(221, 50, 63, .75); }
}
@keyframes bdPulseGold {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(232, 195, 106, .5), 0 0 8px rgba(232, 195, 106, .25); }
  50% { box-shadow: 0 3px 10px rgba(0, 0, 0, .55), 0 0 0 2.5px var(--bd-gold), 0 0 18px rgba(232, 195, 106, .65); }
}
@keyframes bdPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.bd-dim > .bd-card { filter: brightness(.55) saturate(.6); }

/* ---------- strips ----------------------------------------------------------*/
.bd-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 5px 16px;
  min-height: 0;
}
.bd-strip-opp {
  background: linear-gradient(180deg, rgba(20, 20, 23, .9), rgba(20, 20, 23, .2));
  border-bottom: 1px solid var(--bd-line);
}
.bd-strip-me {
  background: linear-gradient(0deg, rgba(20, 20, 23, .95), rgba(20, 20, 23, .25));
  border-top: 1px solid var(--bd-line);
}

.bd-nameplate {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 12px;
  border-radius: 9px;
  border: 1px solid var(--bd-line);
  background: var(--bd-panel);
  flex: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bd-active-plate { border-color: var(--bd-red); box-shadow: 0 0 10px rgba(221, 50, 63, .35); }
.bd-pname { font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.bd-php { font-size: 11px; color: var(--bd-cream-dim); }

/* IKZ tray */
.bd-ikz {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: none;
}
.bd-ikz-tokens { display: flex; gap: 5px; align-items: center; }
.bd-ikz-token {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  transform: rotate(45deg);
  background: radial-gradient(circle at 35% 30%, #ffe9ad, var(--bd-gold) 70%);
  box-shadow: 0 0 7px rgba(232, 195, 106, .5), inset 0 0 3px rgba(255, 255, 255, .5);
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
  font-size: 0;
}
.bd-ikz-token.bd-spent {
  transform: rotate(90deg) scale(.88);
  filter: grayscale(.85) brightness(.5);
  box-shadow: none;
}
.bd-ikz-bonus {
  border-radius: 50%;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #16161a;
  border: 1px solid #fff3cf;
}
.bd-ikz-label {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--bd-cream-dim);
  white-space: nowrap;
}

/* piles */
.bd-pile {
  position: relative;
  height: 86%;
  aspect-ratio: 63 / 88;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bd-pile .bd-cardwrap { height: 100%; pointer-events: none; }
.bd-pile-empty {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(255, 245, 221, .14);
  border-radius: 6px;
}
.bd-pile-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-weight: 800;
  font-size: 15px;
  color: var(--bd-cream);
  background: rgba(11, 11, 13, .78);
  border: 1px solid var(--bd-line);
  border-radius: 9px;
  padding: 1px 8px;
  pointer-events: none;
}
.bd-pile-label {
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8.5px;
  letter-spacing: .22em;
  color: rgba(255, 245, 221, .4);
  pointer-events: none;
}
.bd-discard:hover .bd-pile-count { border-color: var(--bd-gold); color: var(--bd-gold); }

/* ---------- hands -------------------------------------------------------------*/
.bd-hand {
  position: relative;
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bd-hand-count {
  font-size: 11px;
  color: var(--bd-cream-dim);
  letter-spacing: .08em;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* opponent: overlapping backs */
.bd-hand-backs .bd-back-fan {
  position: absolute;
  height: 78%;
  left: 50%;
  top: 4%;
  transform: translateX(calc(-50% + (var(--i) - (var(--n) - 1) / 2) * 22px)) rotate(calc((var(--i) - (var(--n) - 1) / 2) * 2.6deg));
}

/* own hand: fan of real cards */
.bd-hand-fan { overflow: visible; z-index: 20; }
.bd-hcard-outer {
  position: absolute;
  left: 50%;
  bottom: 4px;
  height: 88%;
  aspect-ratio: 63 / 88;
  transform-origin: 50% 100%;
}
.bd-hcard-outer:hover { z-index: 60 !important; }
.bd-hcard { height: 100%; }
.bd-hcard > .bd-card { transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
.bd-hcard:hover > .bd-card { transform: translateY(-16px) scale(1.07); }

/* ---------- center bar ----------------------------------------------------------*/
.bd-center {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 16px;
  background: linear-gradient(90deg, rgba(20, 20, 23, .55), rgba(27, 27, 32, .92) 25%, rgba(27, 27, 32, .92) 75%, rgba(20, 20, 23, .55));
  border-top: 1px solid var(--bd-line);
  border-bottom: 1px solid var(--bd-line);
  min-height: 0;
  z-index: 30;
  position: relative;
}
.bd-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.bd-turnnum {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--bd-cream-dim);
}
.bd-who {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  padding: 3px 12px;
  border-radius: 8px;
  border: 1px solid var(--bd-line);
  white-space: nowrap;
}
.bd-who-me { color: var(--bd-good); border-color: rgba(56, 178, 111, .55); background: rgba(56, 178, 111, .08); }
.bd-who-opp { color: var(--bd-red); border-color: rgba(221, 50, 63, .5); background: rgba(221, 50, 63, .07); }
.bd-who-resp { color: var(--bd-gold); border-color: rgba(232, 195, 106, .6); background: rgba(232, 195, 106, .08); animation: bdBlink 1s ease-in-out infinite; }
.bd-who-over { color: var(--bd-cream); }
.bd-who-spec { color: var(--bd-cream-dim); }
@keyframes bdBlink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.bd-phasechip {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--bd-gold);
  border: 1px solid rgba(232, 195, 106, .4);
  border-radius: 7px;
  padding: 2px 8px;
}
.bd-phasechip.bd-spec { color: var(--bd-cream-dim); border-color: var(--bd-line); }

.bd-prompt {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  text-align: center;
}
.bd-msg { font-size: 13px; color: var(--bd-cream); }
.bd-msg-big { font-size: 14px; font-weight: 700; }
.bd-msg-dim { color: var(--bd-cream-dim); font-weight: 400; font-size: 12px; }
.bd-msg-warn { color: var(--bd-gold); }
.bd-btnrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }

.bd-controls { display: flex; gap: 8px; flex: none; align-items: center; }

/* buttons */
.bd-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--bd-cream);
  background: var(--bd-panel2);
  border: 1px solid var(--bd-line);
  border-radius: 9px;
  padding: 6px 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.bd-btn:hover { border-color: var(--bd-cream-dim); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, .4); }
.bd-btn:active { transform: translateY(0); }
.bd-btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.bd-btn-good { border-color: rgba(56, 178, 111, .65); color: #7fd6a4; background: rgba(56, 178, 111, .1); }
.bd-btn-good:hover { border-color: var(--bd-good); }
.bd-btn-warn { border-color: rgba(232, 195, 106, .6); color: var(--bd-gold); background: rgba(232, 195, 106, .08); }
.bd-btn-cancel { color: var(--bd-cream-dim); }
.bd-btn-pass { border-color: rgba(221, 50, 63, .55); color: #f08790; background: rgba(221, 50, 63, .08); }
.bd-btn-pass:hover { border-color: var(--bd-red); }
.bd-btn-bigpass { font-size: 14px; padding: 7px 20px; animation: bdBlink 1.2s ease-in-out infinite; }
.bd-btn-opt { border-color: rgba(232, 195, 106, .5); }
.bd-btn-opt:hover { border-color: var(--bd-gold); color: var(--bd-gold); }
.bd-btn-end {
  background: linear-gradient(180deg, #e4525d, var(--bd-red));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(221, 50, 63, .35);
}
.bd-btn-end:hover { box-shadow: 0 5px 16px rgba(221, 50, 63, .55); border-color: transparent; }
.bd-btn-log.bd-on { border-color: var(--bd-gold); color: var(--bd-gold); }
.bd-btn-x { padding: 2px 9px; font-size: 14px; }
.bd-btn-ghostly { background: transparent; }
.bd-btn-pill { border-radius: 999px; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }

/* ---------- arrows / floats -------------------------------------------------------*/
.bd-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  overflow: visible;
}
.bd-arrow {
  fill: none;
  stroke: var(--bd-red, #DD323F);
  stroke-width: 3.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(221, 50, 63, .8));
  stroke-dasharray: 10 7;
  animation: bdMarch .5s linear infinite;
}
@keyframes bdMarch { to { stroke-dashoffset: -17; } }
.bd-arrow-dot { fill: var(--bd-red, #DD323F); filter: drop-shadow(0 0 5px rgba(221, 50, 63, .9)); }

.bd-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}
.bd-float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 900;
  animation: bdFloat .85s ease-out forwards;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
  pointer-events: none;
}
.bd-float-dmg { color: var(--bd-red); }
.bd-float-heal { color: var(--bd-good); }
@keyframes bdFloat {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, -62%) scale(1.18); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}

/* ---------- log drawer --------------------------------------------------------------*/
.bd-log {
  position: absolute;
  top: 8%;
  right: 0;
  bottom: 17%;
  width: min(330px, 34vw);
  background: rgba(17, 17, 20, .96);
  border-left: 1px solid var(--bd-line);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  transform: translateX(102%);
  transition: transform .22s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .5);
}
.bd-log.bd-open { transform: translateX(0); }
.bd-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bd-line);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
}
.bd-log-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bd-log-line {
  font-size: 11.5px;
  color: var(--bd-cream-dim);
  border-left: 2px solid rgba(255, 245, 221, .12);
  padding-left: 8px;
  line-height: 1.35;
}
.bd-log-line:last-child { color: var(--bd-cream); border-left-color: var(--bd-gold); }

/* ---------- inspector -----------------------------------------------------------------*/
.bd-inspector {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(.97);
  width: 216px;
  background: rgba(17, 17, 20, .97);
  border: 1px solid var(--bd-line);
  border-radius: 12px;
  padding: 10px;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  transition: opacity .14s ease, transform .14s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .6);
}
.bd-inspector.bd-open { opacity: 1; transform: translateY(-50%) scale(1); }
.bd-inspector.bd-dock-left { left: 14px; }
.bd-inspector.bd-dock-right { right: 14px; left: auto; }
.bd-ins-art {
  width: 100%;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .6);
}
.bd-ins-name { font-weight: 800; font-size: 14px; margin-top: 8px; }
.bd-ins-meta { font-size: 11px; color: var(--bd-cream-dim); margin-top: 2px; }
.bd-ins-stats { font-size: 12px; font-weight: 700; color: var(--bd-gold); margin-top: 4px; white-space: pre; }
.bd-ins-kws { font-size: 11px; color: var(--bd-gold); margin-top: 3px; }
.bd-ins-status { font-size: 11px; color: var(--bd-blue); margin-top: 3px; }
.bd-ins-text {
  font-size: 11px;
  line-height: 1.45;
  color: var(--bd-cream);
  margin-top: 6px;
  white-space: pre-wrap;
  max-height: 150px;
  overflow: hidden;
}
.bd-ins-unscripted {
  margin-top: 6px;
  font-size: 10px;
  font-style: italic;
  color: rgba(255, 245, 221, .45);
  border-top: 1px dashed var(--bd-line);
  padding-top: 5px;
}

/* ---------- modal layer (game over / discard browse) -----------------------------------*/
.bd-modal { position: absolute; inset: 0; z-index: 80; display: none; }
.bd-modal.bd-open { display: block; }
.bd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 9, .72);
  backdrop-filter: blur(3px);
}
.bd-over-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 340px;
  max-width: 84%;
  background: var(--bd-panel);
  border: 1px solid var(--bd-line);
  border-radius: 16px;
  padding: 34px 40px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
  animation: bdEnter .24s ease;
}
.bd-over-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: .1em;
}
.bd-won .bd-over-title { color: var(--bd-good); text-shadow: 0 0 24px rgba(56, 178, 111, .5); }
.bd-lost .bd-over-title { color: var(--bd-red); text-shadow: 0 0 24px rgba(221, 50, 63, .5); }
.bd-over-sub { margin-top: 8px; color: var(--bd-cream-dim); font-size: 14px; }
.bd-over-btns { margin-top: 22px; justify-content: center; }

.bd-result-pill { position: absolute; right: 14px; bottom: 14px; z-index: 62; }

.bd-browse-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, 88%);
  max-height: 76%;
  background: var(--bd-panel);
  border: 1px solid var(--bd-line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
  animation: bdEnter .2s ease;
}
.bd-browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bd-line);
  font-weight: 700;
  font-size: 14px;
}
.bd-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 86px);
  gap: 18px 12px;
  padding: 16px;
  overflow-y: auto;
  justify-content: center;
}
.bd-browse-grid .bd-cardwrap { height: 120px; }

/* ---------- dev harness chrome ------------------------------------------------------------*/
.bd-devbar {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 500;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 46vw;
  justify-content: flex-end;
}
.bd-devbtn {
  font: 600 10.5px Inter, sans-serif;
  color: rgba(255, 245, 221, .75);
  background: rgba(20, 20, 23, .9);
  border: 1px solid rgba(255, 245, 221, .2);
  border-radius: 7px;
  padding: 3px 8px;
  cursor: pointer;
}
.bd-devbtn:hover { border-color: #E8C36A; color: #E8C36A; }
.bd-devtoast {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  z-index: 500;
  background: rgba(20, 20, 23, .95);
  border: 1px solid rgba(232, 195, 106, .5);
  color: #E8C36A;
  border-radius: 9px;
  padding: 7px 14px;
  font: 500 12px ui-monospace, Menlo, monospace;
  max-width: 84vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform .2s ease;
  pointer-events: none;
}
.bd-devtoast.bd-on { transform: translateX(-50%) translateY(0); }

/* ---------- small screens -------------------------------------------------------------------*/
@media (max-width: 1024px) {
  .bd-station { width: clamp(84px, 10vw, 120px); }
  .bd-msg { font-size: 11.5px; }
  .bd-msg-big { font-size: 12.5px; }
  .bd-btn { font-size: 11px; padding: 5px 10px; }
  .bd-nameplate { padding: 4px 8px; }
}
@media (max-height: 760px) {
  .bd-leader-hp { width: 25px; height: 25px; font-size: 13px; }
  .bd-plate { min-width: 17px; height: 17px; font-size: 10.5px; }
  .bd-cost { width: 18px; height: 18px; font-size: 10.5px; }
  .bd-gp { top: 14px; width: 14px; height: 14px; font-size: 8.5px; }
}

/* ============================================================
   FULLSCREEN CARD (right-click)
   ============================================================ */
.bd-fullcard { position: absolute; inset: 0; z-index: 100; display: none; }
.bd-fullcard.bd-open { display: block; }
.bd-full-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 5, 7, .82);
  backdrop-filter: blur(6px);
}
.bd-full-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 4vh 4vw; cursor: zoom-out;
}
/* entrance animations only when newly opened — not on live state refreshes */
.bd-full-animate .bd-full-backdrop { animation: bdFullFade .18s ease-out; }
.bd-full-animate .bd-full-stage { animation: bdFullIn .22s cubic-bezier(.2, .9, .3, 1.1); }
.bd-full-art {
  height: min(92vh, 100%); max-width: min(62vw, calc(92vh * 63 / 88));
  aspect-ratio: 63 / 88; object-fit: contain;
  border-radius: 4.5% / 3.2%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .8), 0 0 0 1px var(--line, rgba(255,245,221,.14)),
    0 0 44px color-mix(in srgb, var(--el, #9BA1A6) 32%, transparent);
  user-select: none;
}
.bd-full-side {
  max-width: 340px; max-height: 88vh; overflow: auto;
  display: flex; flex-direction: column; gap: 10px;
  color: var(--cream, #FFF5DD); cursor: default;
}
.bd-full-name { font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.bd-full-meta { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-dim, rgba(255,245,221,.55)); }
.bd-full-stats { font-size: 14px; font-weight: 800; color: var(--gold, #E8C36A); }
.bd-full-kws { font-size: 12.5px; font-weight: 700; color: var(--cream-dim, rgba(255,245,221,.55)); }
.bd-full-status { font-size: 12.5px; font-weight: 800; color: #8ec8ff; }
.bd-full-text {
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
  background: var(--panel, #141417); border: 1px solid var(--line, rgba(255,245,221,.14));
  border-radius: 10px; padding: 12px 14px;
}
.bd-full-hint { margin-top: 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--cream-dim, rgba(255,245,221,.4)); }
@keyframes bdFullFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bdFullIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 900px) {
  .bd-full-stage { flex-direction: column; gap: 12px; }
  .bd-full-art { max-width: 88vw; height: auto; max-height: 62vh; }
  .bd-full-side { max-width: 88vw; max-height: 30vh; }
}
