* { box-sizing: border-box; }

:root {
  --bg-deep: #0b0d1a;
  --bg-panel: rgba(24, 27, 48, 0.85);
  --bg-panel-solid: #181b30;
  --line: #2c3152;
  --line-soft: #232744;
  --accent: #58c7ff;
  --accent-2: #a44fa4;
  --gold: #ffd75e;
  --danger: #ff5c5c;
  --text: #e8eaf6;
  --text-dim: #9aa0c3;
  --card-radius: 8px;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(88, 60, 160, 0.35), transparent 60%),
    radial-gradient(1000px 600px at 90% 110%, rgba(30, 100, 180, 0.3), transparent 60%),
    radial-gradient(2px 2px at 15% 30%, rgba(255,255,255,0.5), transparent 100%),
    radial-gradient(1.5px 1.5px at 65% 15%, rgba(255,255,255,0.4), transparent 100%),
    radial-gradient(2px 2px at 85% 55%, rgba(255,255,255,0.35), transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 75%, rgba(255,255,255,0.3), transparent 100%),
    var(--bg-deep);
  background-attachment: fixed;
}

h1 { font-size: 26px; }
.app-title { letter-spacing: 1px; }
.app-title .title-x { color: var(--accent); text-shadow: 0 0 18px rgba(88,199,255,0.6); }
.app-title .title-s { color: var(--gold); text-shadow: 0 0 18px rgba(255,215,94,0.5); }
.app-title small { font-size: 14px; color: var(--text-dim); font-weight: normal; margin-left: 8px; }
h2 { font-size: 17px; border-bottom: 1px solid var(--line); padding-bottom: 6px; letter-spacing: 0.5px; }
h3 { font-size: 13px; margin: 12px 0 5px; color: var(--text-dim); letter-spacing: 0.5px; }

button {
  background: linear-gradient(180deg, #333853, #262a44);
  color: var(--text); border: 1px solid #4a5078;
  border-radius: 8px; padding: 7px 16px; cursor: pointer; font-size: 14px;
  transition: filter .12s, transform .12s, box-shadow .12s;
}
button:hover { filter: brightness(1.2); box-shadow: 0 0 10px rgba(88,199,255,0.25); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(180deg, #b04fd4, #7c2d9c);
  border-color: #c86fe0;
  box-shadow: 0 2px 10px rgba(160, 70, 200, 0.35);
}
button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
select, input {
  background: #1a1d33; color: var(--text); border: 1px solid #3a4066;
  border-radius: 6px; padding: 6px 9px; font-size: 14px;
}
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(88,199,255,0.2); }
.note { color: #8a90b5; font-size: 12px; }
.warn { color: #f5a623; font-size: 12px; }

.screen { padding: 16px; max-width: 1400px; margin: 0 auto; }
/* `hidden` must always win over the per-screen `display` rules below. */
[hidden] { display: none !important; }
.panel {
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 18px; margin: 14px 0;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-dim); }
.deck-row { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px dashed var(--line-soft); align-items: center; }
.deck-row button { margin-left: 6px; padding: 3px 10px; font-size: 12px; }

/* ---- cards ---- */
.card {
  width: 130px; height: 182px; border-radius: var(--card-radius); overflow: hidden;
  background: #20233c; position: relative; flex: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-drag: none; user-select: none; /* keep native drag from hijacking pointer D&D */
}
.card.small { width: 92px; height: 129px; }
/* face-down card: sleeve art */
.card.back { background: #20233c; }
.card.back img { width: 100%; height: 100%; object-fit: cover; }
.card.back .back-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #262a44, #262a44 8px, #20233c 8px, #20233c 16px);
  color: #565c85; font-weight: bold; letter-spacing: 1px;
}
.card.noimg { padding: 6px; font-size: 11px; }
.card.noimg .ph-name { font-weight: bold; margin: 4px 0; font-size: 12px; }
.card.noimg .ph-type { color: #9ad; }
.card.noimg .ph-cost { color: #fc6; }
.card.noimg .ph-text { color: #aaa; font-size: 9px; overflow: hidden; }
.card .rarity-chip {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  font-size: 9px; font-weight: bold; letter-spacing: 0.5px;
  padding: 1px 5px; border-radius: 6px; pointer-events: none;
  background: rgba(0, 0, 0, 0.65); color: var(--gold); border: 1px solid rgba(255,215,94,0.6);
}
.card.selectable { outline: 3px solid var(--accent); cursor: pointer; }
.card.selectable:hover { outline-color: #9fe0ff; transform: translateY(-4px); transition: 0.1s; }
/* playable hand cards breathe a soft glow */
.hand .card.selectable { animation: hand-glow 1.8s ease-in-out infinite; }
@keyframes hand-glow {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(88, 199, 255, 0.25); }
  50% { box-shadow: 0 0 14px 4px rgba(88, 199, 255, 0.6); }
}
.card.picked { outline: 3px solid var(--gold); }
.card.deny-shake { animation: deny-shake 0.3s ease-in-out; }
@keyframes deny-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* picked-cards tray inside the chooser modal: click a tray card to deselect.
   The slot area is reserved from the start (min-height = one small card) so
   the buttons below never shift as cards are picked. */
#modal-picked {
  margin-top: 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 215, 94, 0.07); border: 1px dashed rgba(255, 215, 94, 0.45);
}
#modal-picked .picked-label { font-size: 12px; color: var(--gold); margin-bottom: 6px; }
#modal-picked-cards { justify-content: center; }
/* empty slot: the exact .card.small box, so picking never changes the height */
#modal-picked .tray-placeholder {
  background: transparent; border: 2px dashed rgba(255, 215, 94, 0.35);
  box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  color: #7a7f9f; font-size: 12px;
}
#modal-picked .tray-card { cursor: pointer; }
#modal-picked .tray-card:hover { outline: 3px solid #ff6a6a; opacity: 0.85; }
.card.disabled { opacity: 0.5; }
.card.facedown-mine { filter: brightness(0.7); }
/* エコー (BP04): sideways card waiting to replay at the next own main phase */
.card.echo-rotated { transform: rotate(90deg) scale(0.9); filter: saturate(0.85); }
.card-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* dragging (pointer D&D): the card itself appears to lift off — the source
   element goes fully invisible (its slot stays reserved) while the ghost
   follows the cursor; on a failed drop the ghost glides back. */
.card.drag-source { opacity: 0 !important; animation: none; }
.drag-ghost.returning { transition: left .18s ease, top .18s ease, transform .18s ease; transform: rotate(0deg) scale(1); }
.drag-ghost {
  position: fixed; z-index: 400; pointer-events: none;
  width: 110px; height: 154px; border-radius: var(--card-radius); overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), 0 0 18px rgba(88, 199, 255, 0.5);
  transform: rotate(4deg) scale(1.05);
  transition: transform .08s;
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- deck builder ---- */
.builder-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.builder-head input { flex: 1; max-width: 300px; }
.builder-body { display: flex; gap: 16px; }
.builder-pool { flex: 1; min-width: 0; }
.builder-pool .card-grid { max-height: 78vh; overflow-y: auto; padding: 4px; }
.builder-pool .card:hover { transform: translateY(-3px); transition: .12s; box-shadow: 0 8px 18px rgba(0,0,0,0.5); cursor: pointer; }
.builder-deck {
  width: 340px; flex: none; background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; max-height: 82vh; overflow-y: auto;
}
.filters { display: flex; gap: 8px; margin-bottom: 10px; }
.deck-lines { font-size: 13px; }
.deck-card-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line-soft); }
.deck-card-row .deck-mini { width: 48px; height: 67px; flex: none; }
.deck-card-meta { flex: 1; min-width: 0; font-size: 13px; }
.deck-card-meta .qty { color: var(--gold); font-weight: bold; }
.deck-card-meta .nm { color: var(--text); }
.deck-card-meta small { color: #888; display: block; font-size: 11px; }
.deck-card-row button { margin-left: auto; padding: 0 10px; font-size: 12px; }

.card-grid.deck-leaders { flex-wrap: nowrap; justify-content: center; margin-bottom: 8px; }
.card-grid.deck-leaders .card { width: 70px; height: 98px; }

/* PP design / sleeve selectors */
.pp-selector { display: flex; gap: 6px; flex-wrap: wrap; }
.pp-selector .pp-choice { width: 56px; height: 80px; cursor: pointer; border-radius: 6px; }
.pp-selector .pp-choice.selected { outline: 3px solid var(--gold); box-shadow: 0 0 10px 2px rgba(255, 215, 94, 0.5); }
.sleeve-selector .pp-choice img { border-radius: 6px; }

/* variant picker in the card-detail modal */
#detail-variants { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#detail-variants .variant-choice {
  width: 64px; height: 90px; border-radius: 6px; overflow: hidden; cursor: pointer;
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
#detail-variants .variant-choice img { width: 100%; height: 100%; object-fit: cover; display: block; }
#detail-variants .variant-choice.selected { outline: 3px solid var(--gold); }
#detail-variants .variant-choice .vr {
  position: absolute; bottom: 0; left: 0; right: 0; text-align: center;
  font-size: 9px; font-weight: bold; color: var(--gold); background: rgba(0, 0, 0, 0.7); padding: 1px 0;
}

/* ---- play-by-play overlay ---- */
#announce-overlay {
  position: fixed; inset: 0; background: rgba(4, 5, 14, 0.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; z-index: 200; cursor: pointer; backdrop-filter: blur(2px);
}
#announce-overlay[hidden] { display: none !important; }
#announce-overlay.announce-run { animation: announce-dim 0.25s ease-out; }
#announce-card { width: 230px; filter: drop-shadow(0 0 26px rgba(88, 199, 255, 0.55)); }
#announce-overlay.announce-run #announce-card { animation: announce-pop 0.55s cubic-bezier(0.18, 1.25, 0.4, 1); }
#announce-card .card { width: 100%; height: auto; aspect-ratio: 5 / 7; }
/* text-only announcements (victory / defeat): free width so the banner never wraps */
#announce-card.text-only { width: auto; max-width: 92vw; filter: none; }
.announce-banner {
  font-size: clamp(2.4rem, 8vw, 4.2rem); font-weight: 900; text-align: center;
  white-space: nowrap; letter-spacing: 0.06em; padding: 0.15em 0.5em;
  background: linear-gradient(180deg, #fff3c4 0%, #ffd75e 45%, #e8a936 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(120, 70, 0, 0.55)) drop-shadow(0 0 28px rgba(255, 200, 80, 0.5));
}
#announce-text {
  background: rgba(0, 0, 0, 0.65); color: var(--gold); font-weight: bold; font-size: 1.05rem;
  padding: 8px 22px; border-radius: 12px; text-align: center; max-width: 86vw;
  border: 1px solid rgba(255, 215, 94, 0.4);
}
#announce-overlay.announce-run #announce-text { animation: announce-caption 0.45s 0.12s ease-out backwards; }
@keyframes announce-dim {
  from { background: rgba(4, 5, 14, 0); backdrop-filter: blur(0); }
  to { background: rgba(4, 5, 14, 0.55); backdrop-filter: blur(2px); }
}
@keyframes announce-pop {
  0% { transform: translateY(26px) scale(0.72); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes announce-caption {
  0% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---- match ---- */
#screen-match { display: flex; gap: 12px; max-width: none; padding: 6px 12px; height: 100vh; overflow: hidden; }
/* .board is auto-fitted to the viewport height via `zoom` (see fitMatchBoard
   in ui.js); these rules only define its natural (zoom=1) layout. */
.board { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; user-select: none; }

/* Each mat follows the official playmat; the opponent's is rotated 180°
   (their play area faces ours across the center bar). */
.mat {
  position: relative;
  border-radius: 14px; padding: 4px 10px;
  display: flex; flex-direction: column; gap: 3px;
  background:
    radial-gradient(700px 220px at 50% 50%, rgba(60, 70, 140, 0.18), transparent 75%),
    rgba(16, 18, 36, 0.7);
  border: 1px solid var(--line-soft);
}
.mat.my-mat.active-turn { border-color: rgba(88, 199, 255, 0.55); box-shadow: 0 0 18px rgba(88, 199, 255, 0.18) inset; }
.mat.opp-mat.active-turn { border-color: rgba(255, 92, 92, 0.45); box-shadow: 0 0 18px rgba(255, 92, 92, 0.14) inset; }

.mat-row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.play-row { min-height: 0; }
.resource-row { align-items: center; }

.leaders { display: flex; gap: 14px; justify-content: center; flex-wrap: nowrap; padding: 2px 0; }
.leader { position: relative; width: 84px; flex: none; min-width: 84px; }
.leader .card, .leader > .card.small { width: 84px; height: 118px; }
/* equipment: laid sideways behind the leader like the official mat slots */
.leader .equip-fan {
  position: absolute; top: 10px; left: -30px; width: 0; height: 0; z-index: -1;
}
.leader .equip-fan .card, .leader .equip-fan .card.small {
  position: absolute; width: 52px; height: 73px;
  transform: rotate(-90deg); transform-origin: center;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.5);
}
.leader .equip-fan .card:nth-child(2) { top: 22px; }
.leader .equip-fan .card:nth-child(3) { top: 44px; }
.leader.downed .card { transform: rotate(90deg) scale(0.8); filter: grayscale(0.85) brightness(0.7); }
.leader.awakened .card { box-shadow: 0 0 14px 3px var(--gold); }
.leader.awakened::after {
  content: "覚醒"; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: bold; color: #201500; background: linear-gradient(180deg, #ffe9a0, #ffc93d);
  padding: 1px 7px; border-radius: 8px; box-shadow: 0 0 8px rgba(255, 215, 94, 0.8); z-index: 3;
}
.leader.selectable { outline: 3px solid var(--accent); border-radius: var(--card-radius); cursor: pointer; }
.leader.selectable { animation: leader-pulse 1.2s ease-in-out infinite; }
@keyframes leader-pulse {
  0%, 100% { outline-color: rgba(88, 199, 255, 0.9); }
  50% { outline-color: rgba(88, 199, 255, 0.35); }
}
.leader.picked { outline: 3px solid var(--gold); }
.hpbar {
  position: relative; height: 15px; background: #101223; border-radius: 8px; margin-top: 3px;
  overflow: hidden; border: 1px solid #2a2f52;
}
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #35d07f, #7fe0a8); transition: width .35s ease; }
.hpbar.hp-low i { background: linear-gradient(90deg, #e0b23a, #ffd75e); }
.hpbar.hp-critical i { background: linear-gradient(90deg, #d0453a, #ff7a5e); }
.hpbar span {
  position: absolute; inset: 0; font-size: 10px; text-align: center; line-height: 15px;
  font-weight: bold; text-shadow: 0 1px 2px #000;
}

/* play area flanked by trash/deck stacks (mirrored on the opponent's mat) */
.playarea {
  position: relative;
  display: flex; gap: 6px; min-height: 94px; width: 100%; max-width: 780px;
  background: rgba(12, 14, 30, 0.75); border-radius: 10px; padding: 5px 8px;
  border: 1px dashed #3a4066;
  overflow-x: auto; transition: background 0.12s, box-shadow 0.12s, border-color .12s;
}
.playarea::before {
  content: attr(data-label);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; letter-spacing: 6px; color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.playarea.drop-target {
  background: rgba(34, 60, 100, 0.7); border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset, 0 0 16px 3px rgba(88, 199, 255, 0.4);
}
.playarea .card, .playarea .card.small { width: 60px; height: 84px; flex: none; }

.side-stack { width: 64px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.side-stack .res-label { font-size: 8px; color: #7f86b3; letter-spacing: 1px; font-weight: bold; white-space: nowrap; }
/* count rides on the pile as a badge so the stack column stays short */
.res-group { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.res-group .res-count {
  position: absolute; top: -6px; right: -10px; z-index: 3;
  font-size: 10px; color: var(--gold); font-weight: bold;
  background: rgba(10, 11, 24, 0.9); border: 1px solid rgba(255, 215, 94, 0.5);
  border-radius: 9px; padding: 0 6px; line-height: 15px;
}
.res-group .res-label { font-size: 8px; color: #7f86b3; letter-spacing: 1px; font-weight: bold; white-space: nowrap; }
.trash-stack, .deck-stack, .tacticsdeck-stack { justify-content: flex-start; }

.mini-stack { position: relative; width: 52px; height: 73px; }
.mini-stack .card, .mini-stack .card.small { width: 52px; height: 73px; position: absolute; top: 0; left: 0; }
.mini-stack.pile .card:nth-child(2) { top: 2px; left: 2px; }
.mini-stack.pile .card:nth-child(3) { top: 4px; left: 4px; }
.mini-stack.empty { border: 1px dashed #33395e; border-radius: 6px; }

/* PP cards laid in a row (PLAY POINT zone); used PP dims out */
.pp-cards {
  display: flex; gap: 4px; min-height: 72px; flex-wrap: nowrap; justify-content: center;
  background: rgba(12, 14, 30, 0.5); border-radius: 10px; padding: 2px 10px;
  border: 1px dashed #303659;
}
.pp-cards .pp-card { width: 54px; height: 76px; flex: none; position: relative; transition: opacity .25s, filter .25s; }
.pp-cards .pp-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; display: block; }
.pp-cards .pp-card.used { opacity: 0.35; filter: grayscale(0.8); }

.tactics-row {
  display: flex; gap: 6px; min-height: 72px; align-items: center; padding: 2px 8px;
  background: rgba(12, 14, 30, 0.5); border-radius: 10px; border: 1px dashed #303659;
  position: relative; min-width: 90px; justify-content: center;
}
.area-slot::before {
  content: attr(data-label);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: 3px; color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.tactics-row .card, .tactics-row .card.small { width: 54px; height: 76px; }
.tactics-row .card.faceup { outline: 2px solid var(--gold); }
/* set (unused) opponent tactics lie sideways per the official manner */
.tactics-row .card.facedown { transform: rotate(90deg) scale(0.85); }

.hand-wrap { display: flex; justify-content: center; min-height: 0; }
.hand { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center; min-height: 0; padding: 2px 0; }
.hand .card { width: 84px; height: 118px; transition: transform .15s ease, box-shadow .15s; }
.hand .card:hover { transform: translateY(-14px) scale(1.35); z-index: 50; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.6); }
.opp-hand { min-height: 0; }
.opp-hand .card, .opp-hand .card.small { width: 38px; height: 53px; }
.opp-hand .card:hover { transform: none; }

/* card move/arrival animation */
.card { transition: transform .35s ease, box-shadow .12s, outline-color .12s; }

#center-bar {
  display: flex; gap: 18px; align-items: center; justify-content: center; min-height: 36px;
  background: linear-gradient(90deg, transparent, rgba(40, 46, 90, 0.65) 20%, rgba(40, 46, 90, 0.65) 80%, transparent);
  border-radius: 8px;
}
#round-info { font-size: 13px; color: var(--text-dim); font-weight: bold; letter-spacing: 0.5px; }
#round-info b { color: var(--gold); }
#prompt-text { color: var(--gold); font-weight: bold; text-shadow: 0 0 10px rgba(255, 215, 94, 0.35); }
#btn-turn-end { padding: 4px 18px; background: linear-gradient(180deg, #3a68b0, #27498c); border-color: #5b8ad0; }

.side-info { position: absolute; right: 10px; top: 6px; color: #8a90b5; font-size: 11px; text-align: right; pointer-events: none; }

#log-panel {
  width: 260px; flex: none; background: rgba(10, 11, 24, 0.85); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px; font-size: 11px; color: #a8adcf; overflow-y: auto;
  height: calc(100vh - 20px);
}
#log-panel div { padding: 1px 0; border-bottom: 1px dotted #22264a; }

/* draw effect: the drawn card flies from the deck, pauses enlarged, lands in hand */
.draw-flyer {
  position: fixed; z-index: 350; pointer-events: none;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 24px 6px rgba(255, 215, 94, 0.55), 0 10px 30px rgba(0, 0, 0, 0.6);
}
.draw-flyer img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* the drawn card stays hidden until its flyer lands on the real hand slot */
.card.pending-draw { opacity: 0; }
/* freshly drawn hand cards keep a golden glow for a moment */
.card.just-drawn { animation: just-drawn 2s ease-out; }
@keyframes just-drawn {
  0% { box-shadow: 0 0 18px 5px rgba(255, 215, 94, 0.9); }
  70% { box-shadow: 0 0 12px 3px rgba(255, 215, 94, 0.5); }
  100% { box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45); }
}

/* attack/damage floaters */
.fx-flyer {
  position: fixed; z-index: 300; pointer-events: none;
  width: 64px; height: 90px; transition: transform .45s ease-out, opacity .45s ease-out;
}
.dmg-pop {
  position: fixed; z-index: 310; pointer-events: none; font-size: 24px; font-weight: 900;
  color: var(--danger); text-shadow: 0 0 8px rgba(255, 60, 40, 0.8), 0 1px 4px #000;
  animation: dmg-pop 0.7s ease-out forwards;
}
@keyframes dmg-pop {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  25% { transform: translateY(-12px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-44px) scale(1); opacity: 0; }
}
.leader.hit-flash .card { box-shadow: 0 0 18px 5px rgba(255, 80, 40, 0.9) !important; transition: box-shadow .08s; }

/* ---- card detail modal ---- */
#card-detail { z-index: 150; }
#card-detail .modal-box { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 460px; }
#detail-card .card { width: 240px; height: 336px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7); }
#detail-info { font-size: 13px; color: #b9bede; text-align: center; max-width: 340px; }
#detail-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(4, 5, 14, 0.65);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--bg-panel-solid); border: 1px solid #454b76; border-radius: 14px;
  padding: 18px; max-width: 720px; max-height: 82vh; overflow-y: auto;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}
#modal-prompt { margin-bottom: 12px; font-size: 15px; }
#modal-buttons { margin-top: 12px; display: flex; gap: 10px; justify-content: center; }
