/* ═══════════════════════════════════════════════════════════════════════════
   The Fathoming — Playmat-style UI
══════════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  --font-title: 'Libre Baskerville', Georgia, serif;
  --font-body:  'Inter', system-ui, sans-serif;
}

/* Libre Baskerville: titles, buttons, card names */
#header h1,
.btn, button,
.card-in-slot .card-name,
.detail-card-name,
#modal-title,
.mat-label {
  font-family: var(--font-title);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Green palette */
  --evergreen:     #161e13;
  --evergreen-2:   #1c2517;
  --evergreen-3:   #212b1b;
  --dark-spruce:   #2b3924;
  --hunter-green:  #35462c;

  --bg-deep:       #0e130d;
  --bg:            var(--evergreen);
  --bg-mat:        var(--evergreen-2);
  --bg-slot:       rgba(255,255,255,0.06);
  --bg-slot-hover: rgba(255,255,255,0.12);
  --bg-card:       var(--evergreen-3);
  --border:        rgba(255,255,255,0.15);
  --border-bright: rgba(255,255,255,0.35);
  --text:          #c8d0c0;
  --text-dim:      #6a7a62;
  --text-bright:   #ffffff;
  --gold:          #c9a84c;
  --blue:          #4a80d4;
  --red:           #c04040;
  --green:         #40a060;
  --purple:        #8040c0;
  --teal:          #30a0b0;

  /* Class colors */
  --fairy:    #f0a0c8;
  --pixie:    #e8c840;
  --vampire:  #c04040;
  --werewolf: #c08030;
  --mermaid:  #40b0d0;
  --wiccan:   #50b050;
  --human:    #a0a0a0;
  --goblin:   #8b6040;
  --action:   #5080a0;
  --item:     #c09040;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  overflow: hidden;
}
@media (max-width: 768px) {
  html, body { overflow: auto; height: auto; }
}

.hidden { display: none !important; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px; border: none; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; transition: opacity 0.15s;
}
.btn:hover:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary   { background: var(--gold);   color: #111; }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-secondary { background: #555;          color: #fff; }
.btn-green     { background: var(--green);  color: #fff; }
.btn-purple    { background: var(--purple); color: #fff; }
.btn-teal      { background: var(--teal);   color: #fff; }

/* ── Header ─────────────────────────────────────────────────────────────── */
#header {
  display: flex; align-items: center; gap: 16px;
  padding: 6px 16px; background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  height: 44px; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
#header h1 {
  font-size: 16px; font-weight: 800; letter-spacing: 2px;
  color: var(--gold); white-space: nowrap;
}
#header-controls { display: flex; gap: 8px; align-items: center; }
#difficulty-toggle { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
#speed-control { display: flex; align-items: center; gap: 6px; margin-left: 4px; }
#speed-slider { width: 80px; cursor: pointer; accent-color: var(--gold); }
#speed-label { font-size: 11px; color: #999; font-weight: 600; min-width: 28px; }
.difficulty-label { font-size: 11px; color: #999; font-weight: 600; }
.btn-difficulty {
  font-size: 11px; padding: 2px 10px; border-radius: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer;
  border: 1px solid; transition: all 0.2s;
}
.btn-difficulty.easy { background: rgba(64,160,96,0.2); color: #6fc; border-color: #6fc4; }
.btn-difficulty.hard { background: rgba(220,60,60,0.2); color: #f66; border-color: #f664; }
.btn-difficulty.easy:hover { background: rgba(64,160,96,0.35); }
.btn-difficulty.hard:hover { background: rgba(220,60,60,0.35); }
#turn-indicator {
  margin-left: auto; font-size: 12px; font-weight: 700;
  color: var(--gold); text-transform: uppercase;
}

/* ── Main Layout ────────────────────────────────────────────────────────── */
#main-layout {
  position: fixed; top: 44px; left: 0; right: 0; bottom: 0;
  display: flex;
}
#board {
  flex: 1; display: flex; flex-direction: column;
  padding: 8px 8px 92px 8px; gap: 6px; overflow-y: auto;
}
#sidebar {
  width: 260px; background: var(--evergreen); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}

/* ── Playmat ────────────────────────────────────────────────────────────── */
.playmat {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--bg-mat); border: 1px solid var(--border); border-radius: 8px;
  flex: 1; min-height: 0;
}
#opponent-mat { border-color: rgba(192,64,64,0.3); }
#player-mat   { border-color: rgba(74,128,212,0.3); }

/* Info bar: trackers + piles in a horizontal strip */
.mat-info-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 4px;
}
.tracker-group {
  display: flex; gap: 8px; align-items: center;
}
.tracker-pill {
  display: flex; align-items: baseline; gap: 4px;
  padding: 3px 8px; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border); border-radius: 12px;
}
.tracker-label { font-size: 9px; text-transform: uppercase; color: var(--text-dim); letter-spacing: 1px; }
.tracker-value { font-size: 16px; font-weight: 800; color: var(--text-bright); }
.tracker-sub   { font-size: 10px; color: var(--text-dim); }

/* ── Progress bar trackers (Loot & Energy) ─────────────────────────────── */
.progress-tracker {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.progress-label {
  font-size: 9px; text-transform: uppercase; color: var(--text-dim);
  letter-spacing: 1px; white-space: nowrap;
}
.progress-bar-wrap {
  display: flex; gap: 2px; align-items: center;
}
.progress-seg {
  width: 10px; height: 14px;
  border-radius: 2px;
  transition: background 0.2s, box-shadow 0.2s;
}
/* Loot segments */
.loot-seg {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.loot-seg.filled {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 4px rgba(212, 175, 55, 0.5);
}
/* Energy segments */
.energy-seg {
  background: rgba(200, 50, 50, 0.15);
  border: 1px solid rgba(200, 50, 50, 0.25);
}
.energy-seg.filled {
  background: #c83232;
  border-color: #e04040;
  box-shadow: 0 0 4px rgba(200, 50, 50, 0.5);
}
.progress-text {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  white-space: nowrap; min-width: 28px; text-align: right;
}

/* Card row: terrain + warriors + action in one line */
.mat-card-row {
  display: flex; gap: 8px; justify-content: center; align-items: stretch;
  flex-wrap: nowrap; flex: 1; min-height: 0;
}

/* ── Slots ──────────────────────────────────────────────────────────────── */
.slot {
  flex: 1; min-width: 0;
  background: var(--bg-slot); border: 1px dashed var(--border);
  border-radius: 6px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  position: relative; transition: all 0.2s;
  overflow: hidden;
}
.slot-icon { font-size: 20px; opacity: 0.3; }
.slot-label { font-size: 9px; color: var(--text-dim); text-transform: uppercase; }

/* Effect/action slot is narrower */
.effect-slot {
  flex: 0.7;
}

/* Drop target highlighting */
.slot.drag-over {
  border-color: var(--gold) !important;
  border-style: solid !important;
  background: rgba(201,168,76,0.15) !important;
  box-shadow: 0 0 15px rgba(201,168,76,0.3);
}
.slot.drag-invalid {
  border-color: var(--red) !important;
  background: rgba(192,64,64,0.1) !important;
}

/* Filled slots */
.slot.filled {
  border-style: solid; padding: 6px; justify-content: flex-start;
}

/* ── Global Terrain Zone ────────────────────────────────────────────────── */
#global-zone {
  display: flex; justify-content: center; padding: 4px 0;
  flex-shrink: 0;
}
#global-zone .slot {
  flex: none; width: calc((100% - 40px) / 5.7);
  height: 196px;
  max-height: 196px;
}

/* ── Cards in slots ─────────────────────────────────────────────────────── */
.card-in-slot {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 5px; cursor: pointer;
}

/* Card header: image + gradient + overlaid name/stats */
.card-header {
  position: relative; flex-shrink: 0; line-height: 0;
}
.card-header .card-img {
  width: 100%; height: 108px; object-fit: cover;
  object-position: center 18%; display: block;
  border-radius: 4px 4px 0 0;
}
.card-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 52px;
  background: linear-gradient(to bottom, transparent, var(--evergreen-3));
  pointer-events: none; border-radius: 0 0 0 0;
}
.card-header .card-name-row {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1;
  padding: 0 10px 6px 8px;
}
.card-header .card-name {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,1), 0 0 10px rgba(0,0,0,0.8);
}


/* Class symbol indicator — top left */
.class-indicator {
  position: absolute; top: 4px; left: 4px; z-index: 5;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.class-indicator img {
  width: 22px; height: 22px;
  filter: brightness(0) invert(1);
}

.card-name-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 4px; width: 100%; flex-shrink: 0;
}
.card-in-slot .card-name {
  font-size: 14px; font-weight: 700; color: var(--text-bright);
  text-align: left; line-height: 1.2;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: calc(100% - 8px);
}
.card-in-slot .card-stats {
  display: flex; gap: 3px; flex-shrink: 0;
}
.card-in-slot .card-hp-bar {
  height: 18px; background: rgba(0,0,0,0.4); border-radius: 4px;
  width: 100%; position: relative; overflow: hidden; flex-shrink: 0;
}
.card-in-slot .card-hp-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  border-radius: 4px; transition: width 0.3s;
}
.card-in-slot .card-hp-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9); z-index: 1;
}
.stat-badge {
  font-size: 11px; font-weight: 700; padding: 10px; border-radius: 4px;
}
.stat-atk { background: rgba(110,25,25,0.9); color: #f09090; }
.stat-atc { background: rgba(25,55,130,0.9); color: #90b0f0; }

/* Buff / debuff stat highlights */
.stat-badge.buffed {
  outline: 1.5px solid #50e070;
  color: #60ff80;
  background: rgba(40,200,80,0.3);
}
.stat-badge.debuffed {
  outline: 1.5px solid #e05050;
  color: #ff6060;
  background: rgba(200,40,40,0.3);
}
.card-hp-text.buffed {
  color: #60ff80;
  text-shadow: 0 0 4px rgba(40,200,80,0.6);
}
.card-hp-text.debuffed {
  color: #ff6060;
  text-shadow: 0 0 4px rgba(200,40,40,0.6);
}
/* Effect indicator on warrior cards */
.effect-indicator {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 900; cursor: help;
  line-height: 1;
}
.effect-indicator.buff {
  background: rgba(40,200,80,0.85); color: #fff;
  box-shadow: 0 0 6px rgba(40,200,80,0.6);
}
.effect-indicator.debuff {
  background: rgba(200,40,40,0.85); color: #fff;
  box-shadow: 0 0 6px rgba(200,40,40,0.6);
}

/* Custom hover tooltip for effect indicator */
.effect-tooltip {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--bg-mat); border: 1px solid var(--border-bright); border-radius: 6px;
  padding: 6px 10px; min-width: 200px; max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6); z-index: 20;
  text-align: left; font-weight: 400;
}
.effect-indicator:hover .effect-tooltip { display: block; }
.tooltip-line {
  font-size: 11px; line-height: 1.4; padding: 2px 0;
  white-space: normal; word-wrap: break-word;
}
.tooltip-line.buff { color: #60ff80; }
.tooltip-line.debuff { color: #ff6060; }

.card-ability-type {
  font-size: 12px; font-weight: 700; font-style: italic;
  font-family: var(--font-body);
  color: var(--text-bright); line-height: 1;
  margin-top: 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
}
.card-ability-type .ability-type-label {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-ability-type .ability-used-tag {
  font-size: 10px; font-style: normal; font-weight: 400;
  color: var(--text-dim);
}
/* Constant ability status text */
.ability-status-text {
  font-size: 10px; font-weight: 400; font-style: normal;
  white-space: nowrap; flex-shrink: 0;
}
.ability-status-text.active { color: #60c878; }
.ability-status-text.disabled { color: var(--text-dim); }
/* Activate "Use" button on field card */
.ability-use-btn {
  font-size: 9px; font-weight: 700; font-style: normal;
  padding: 2px 6px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
  letter-spacing: 0.3px; text-transform: uppercase; cursor: pointer;
  border: 1px solid rgba(100, 180, 255, 0.6);
  background: rgba(40, 80, 160, 0.85); color: #90c8ff;
  transition: opacity 0.15s;
}
.ability-use-btn:hover:not(:disabled) { opacity: 0.8; }
.ability-use-btn:disabled {
  opacity: 0.35; cursor: not-allowed;
  border-color: rgba(100, 140, 180, 0.3); color: #6080a0;
}
.card-ability-recessed {
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 6px 8px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  width: 100%;
  box-sizing: border-box;
  flex: 1; min-height: 0; overflow: hidden;
}
.card-ability-recessed .card-ability-text {
  font-size: 11px; color: var(--text);
  line-height: 1.4;
  font-family: var(--font-body);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-indicator {
  position: absolute; top: 4px; right: 26px; left: auto; z-index: 3;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: help;
  background: rgba(140,110,30,0.95);
  box-shadow: 0 0 6px rgba(140,110,30,0.6);
}
.item-indicator .effect-tooltip {
  right: 0; left: auto;
}
.item-indicator:hover .effect-tooltip { display: block; }
.item-icon {
  width: 11px; height: 11px;
  filter: brightness(0) invert(1);
}
.item-icon-detail {
  width: 14px; height: 14px; vertical-align: middle;
  filter: brightness(0) saturate(100%) invert(82%) sepia(60%) saturate(400%) hue-rotate(5deg) brightness(105%);
}
.detail-items {
  margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px;
}
.detail-items-header {
  font-size: 11px; font-weight: 700; color: var(--item); margin-bottom: 6px;
}
.detail-item-card {
  display: flex; gap: 8px; align-items: flex-start;
  margin-bottom: 6px; padding: 4px;
  background: rgba(218,165,32,0.08); border-radius: 4px;
}
.detail-item-img {
  width: 50px; border-radius: 3px; flex-shrink: 0;
}
.detail-item-info { flex: 1; min-width: 0; }
.detail-item-name {
  font-size: 11px; font-weight: 700; color: var(--item);
}
.detail-item-text {
  font-size: 10px; color: var(--text-dim); margin-top: 2px;
}

/* Class border colors for filled slots */
.slot.class-Fairy    { border-color: var(--fairy); }
.slot.class-Pixie    { border-color: var(--pixie); }
.slot.class-Vampire  { border-color: var(--vampire); }
.slot.class-Werewolf { border-color: var(--werewolf); }
.slot.class-Mermaid  { border-color: var(--mermaid); }
.slot.class-Wiccan   { border-color: var(--wiccan); }
.slot.class-Human    { border-color: var(--human); }
.slot.class-Goblin   { border-color: var(--goblin); }

/* Warrior states */
.slot.exhausted { opacity: 0.5; }
.slot.selected-warrior {
  border-color: var(--gold) !important; border-style: solid !important;
  box-shadow: 0 0 12px rgba(201,168,76,0.5);
}
.slot.attacking-selected {
  border-color: var(--red) !important; border-style: solid !important;
  box-shadow: 0 0 12px rgba(192,64,64,0.6);
}
.slot.attack-target {
  cursor: crosshair;
}
.slot.attack-target:hover {
  border-color: var(--red) !important;
  box-shadow: 0 0 10px rgba(192,64,64,0.4);
}

/* ── Hand Zone ──────────────────────────────────────────────────────────── */
#hand-zone {
  position: fixed; bottom: 0; left: 0; right: 260px;
  height: 84px; /* how much of each card peeks above the bottom */
  overflow: visible;
  display: flex; justify-content: center; align-items: flex-start;
  z-index: 50;
}
#hand-label { display: none; }
#player-hand {
  display: flex; justify-content: center;
  overflow: visible;
}

/* Hand cards */
.hand-card {
  width: 140px; height: 196px; flex-shrink: 0;
  border: 2px solid var(--border); border-radius: 6px;
  cursor: grab; position: relative; overflow: hidden;
  transform-origin: bottom center;
  transition: transform 0.22s ease, border-color 0.15s, box-shadow 0.15s;
}
.hand-card.dragging { opacity: 0.4; }
.hand-card .card-img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 18%; display: block;
}
.hand-card .card-name,
.hand-card .card-type-badge,
.hand-card .card-stats,
.hand-card .card-ability-text { display: none; }
.hand-card .card-cost {
  position: absolute; top: 6px; right: 6px;
  font-size: 13px; font-weight: 900; color: var(--gold);
  background: rgba(0,0,0,0.75); border-radius: 4px; padding: 2px 6px; line-height: 1.4;
}

/* Hand card class borders */
.hand-card.class-Fairy    { border-top: 3px solid var(--fairy); }
.hand-card.class-Pixie    { border-top: 3px solid var(--pixie); }
.hand-card.class-Vampire  { border-top: 3px solid var(--vampire); }
.hand-card.class-Werewolf { border-top: 3px solid var(--werewolf); }
.hand-card.class-Mermaid  { border-top: 3px solid var(--mermaid); }
.hand-card.class-Wiccan   { border-top: 3px solid var(--wiccan); }
.hand-card.class-Human    { border-top: 3px solid var(--human); }
.hand-card.class-Goblin   { border-top: 3px solid var(--goblin); }
.hand-card.class-Action   { border-top: 3px solid var(--action); }
.hand-card.class-Item     { border-top: 3px solid var(--item); }

/* ── Report Issue button ───────────────────────────────────────────────── */
#btn-report-issue {
  font-size: 10px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--text-dim); color: var(--text-dim);
  text-decoration: none; font-weight: 600; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
#btn-report-issue:hover { color: var(--text); border-color: var(--text); }

/* ── Header auth indicator ──────────────────────────────────────────────── */
#header-auth {
  display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 8px;
  font-size: 11px; flex-shrink: 0;
}
.header-username { color: var(--gold); font-weight: 600; text-decoration: none; }
.header-username:hover { text-decoration: underline; }
.header-auth-link {
  color: var(--text-dim); text-decoration: none; padding: 2px 6px;
  border-radius: 3px; transition: color 0.15s;
}
.header-auth-link:hover { color: var(--text); }

/* ── Mobile hamburger — hidden on desktop ───────────────────────────────── */
#mobile-menu-btn { display: none; }
#sidebar-close-btn { display: none; }
#sidebar-backdrop { display: none; }

/* ── Sidebar mobile controls — hidden on desktop ────────────────────────── */
#sidebar-mobile-controls { display: none; }
#sidebar-auth { display: none; }

/* ── Sidebar (action log only) ──────────────────────────────────────────── */
#log-header {
  padding: 6px 12px; font-size: 11px; font-weight: 700;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
#action-log {
  flex: 1; overflow-y: auto; padding: 4px 12px; font-size: 11px; line-height: 1.5;
}

/* ── Card Detail Modal ──────────────────────────────────────────────────── */
#card-detail-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 600; display: flex; align-items: center; justify-content: center;
}
#card-detail-modal-box {
  background: var(--evergreen-3); border: 1px solid var(--border-bright);
  border-radius: 10px; width: 720px; max-width: 96vw; max-height: 92vh;
  overflow-y: auto; position: relative;
  display: flex; flex-direction: column;
}
.card-detail-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  background: transparent; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.card-detail-close:hover { color: var(--text-bright); background: rgba(255,255,255,0.1); }

/* Two-column layout: image left, info right */
#card-detail-content {
  display: flex; gap: 0; min-height: 0;
}
.cdm-image-col {
  width: 300px; flex-shrink: 0; position: relative;
}
.cdm-image-col img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 10px 0 0 10px;
}
.cdm-info-col {
  flex: 1; min-width: 0; padding: 22px 22px 22px 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.cdm-name {
  font-size: 20px; font-weight: 700; color: var(--text-bright);
  font-family: var(--font-title); padding-right: 28px;
}
.cdm-meta { font-size: 13px; color: var(--text-dim); }
.cdm-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.cdm-ability-type {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  color: var(--purple); font-family: var(--font-body);
}
.cdm-ability-text {
  font-size: 14px; color: var(--text); line-height: 1.55;
  background: rgba(0,0,0,0.25); padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--border);
}
.cdm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.cdm-actions .btn { padding: 10px 18px; font-size: 13px; }

/* Active effects in card detail modal */
.cdm-effects {
  padding: 8px 12px; background: rgba(0,0,0,0.2);
  border: 1px solid var(--border); border-radius: 6px;
}
.cdm-effects-header {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--text-dim); letter-spacing: 1px; margin-bottom: 4px;
}
.cdm-effect-row {
  font-size: 13px; line-height: 1.4; padding: 2px 0;
  display: flex; gap: 4px; align-items: baseline;
}
.cdm-effect-row.buff { color: #60ff80; }
.cdm-effect-row.debuff { color: #ff6060; }

/* Equipped items in card detail modal */
.cdm-items { margin-top: 2px; }
.cdm-items-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--item); letter-spacing: 0.5px; margin-bottom: 6px;
}
.cdm-item-card {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 6px; padding: 8px;
  background: rgba(218,165,32,0.08); border-radius: 6px;
  border: 1px solid rgba(218,165,32,0.2);
}
.cdm-item-img { width: 64px; border-radius: 4px; flex-shrink: 0; }
.cdm-item-name { font-size: 13px; font-weight: 700; color: var(--item); }
.cdm-item-text { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }

/* ── Active Effects (kept for backward compat) ───────────────────────────── */
.detail-effect-row { font-size: 11px; line-height: 1.4; padding: 2px 0; display: flex; gap: 4px; align-items: baseline; }
.detail-effect-row.buff { color: #60ff80; }
.detail-effect-row.debuff { color: #ff6060; }
.detail-effect-arrow { font-size: 9px; flex-shrink: 0; }

/* ── Warrior Action Buttons ─────────────────────────────────────────────── */
.detail-actions { display: flex; gap: 6px; margin-top: 8px; margin-bottom: 8px; }
.detail-actions .btn { flex: 1; padding: 8px 6px; font-size: 11px; }
.btn-attack { background: var(--red); color: #fff; }
.btn-play {
  background: rgba(64,160,96,0.2); color: var(--green);
  border: 1px solid var(--green); transition: all 0.2s;
}
.btn-play:not(:disabled) { background: var(--green); color: #fff; box-shadow: 0 0 8px rgba(64,160,96,0.4); }
.btn-play:not(:disabled):hover { box-shadow: 0 0 14px rgba(64,160,96,0.6); }
.btn-ability {
  background: rgba(128,64,192,0.2); color: var(--purple);
  border: 1px solid var(--purple); transition: all 0.2s;
}
.btn-ability:not(:disabled) { background: var(--purple); color: #fff; box-shadow: 0 0 8px rgba(128,64,192,0.4); }
.btn-ability:not(:disabled):hover { box-shadow: 0 0 14px rgba(128,64,192,0.6); }
.log-entry {
  padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-dim);
}
/* Category colors */
.log-entry.log-attack   { color: #c05050; }
.log-entry.log-destroy  { color: #c05050; }
.log-entry.log-play     { color: #40a8a0; }
.log-entry.log-draw     { color: #40a8a0; }
.log-entry.log-turn     { color: #a09050; font-style: italic; }
.log-entry.log-loot     { color: #c8a030; font-weight: 600; }
.log-entry.log-ability  { color: #9060c8; }
.log-entry.log-error    { color: #906060; font-style: italic; }
.log-entry.log-gameover { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.log-entry.log-default  { color: var(--text-dim); }
/* Most recent entry always full brightness */
.log-entry:last-child   { opacity: 1 !important; filter: brightness(1.25); }

/* ── Tutorial tooltip ──────────────────────────────────────────────────── */
#tutorial-tip {
  position: absolute;
  z-index: 450;
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 260px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  animation: tip-fade-in 0.25s ease;
  pointer-events: auto;
}
#tutorial-tip.hidden { display: none; }
/* Arrow — default points down */
#tutorial-tip::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  background: #ffffff;
  transform: rotate(45deg);
}
#tutorial-tip.arrow-down::after {
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
}
#tutorial-tip.arrow-up::after {
  top: -5px;
  left: 50%;
  margin-left: -5px;
}
#tutorial-tip.arrow-left::after {
  left: -5px;
  top: 50%;
  margin-top: -5px;
}
#tutorial-tip.arrow-right::after {
  right: -5px;
  top: 50%;
  margin-top: -5px;
}
#tutorial-tip-text {
  font-size: 0.82rem;
  color: #1a1a1a;
  line-height: 1.45;
  flex: 1;
}
#tutorial-tip-dismiss {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: transparent;
  color: #666;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.15s, border-color 0.15s;
}
#tutorial-tip-dismiss:hover {
  color: #333;
  border-color: #999;
}
@keyframes tip-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tutorial checkbox in modal */
.tutorial-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: var(--text-dim);
}
.tutorial-checkbox-wrap input[type="checkbox"] {
  accent-color: var(--gold);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 500; display: flex; align-items: center; justify-content: center;
}
#modal-box {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: 8px; padding: 20px; min-width: 300px; max-width: 500px;
  max-height: 80vh; overflow-y: auto;
}
#modal-title { font-size: 15px; font-weight: 700; color: var(--gold); margin-bottom: 12px; }
#modal-body { margin-bottom: 12px; }
#modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.modal-option {
  padding: 8px 12px; margin: 4px 0;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; color: var(--text); font-size: 12px;
  width: 100%; text-align: left; transition: background 0.15s;
}
.modal-option:hover { background: rgba(255,255,255,0.1); border-color: var(--gold); }

/* ── Search Modal ───────────────────────────────────────────────────────── */
#modal-box:has(.search-grid) { max-width: 720px; }
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  justify-items: center;
}
.search-card {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  width: 120px;
}
.search-card img {
  width: 100%;
  height: auto;
  display: block;
}
.search-card:hover {
  border-color: var(--gold);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}
.search-card.selected {
  border-color: #4caf50;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.5);
}
.search-card-label {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text);
  background: rgba(0,0,0,0.4);
}
#search-confirm-btn {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Flash / AI thinking ────────────────────────────────────────────────── */
#message-flash {
  position: fixed; bottom: 50%; left: 50%; transform: translateX(-50%);
  background: rgba(74,128,212,0.9); color: white;
  padding: 8px 20px; border-radius: 4px; font-size: 13px; font-weight: 600;
  z-index: 300; pointer-events: none; opacity: 0; transition: opacity 0.3s;
}
#message-flash.show { opacity: 1; }

#ai-thinking {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%);
  background: var(--purple); color: white; padding: 6px 16px;
  border-radius: 0 0 6px 6px; font-size: 12px; font-weight: 700;
  z-index: 200; display: none;
}

/* ── Game Over ──────────────────────────────────────────────────────────── */
#game-over-banner {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 400; display: flex; align-items: center; justify-content: center;
}
#game-over-content { text-align: center; }
#game-over-text { font-size: 32px; font-weight: 800; margin-bottom: 16px; }

/* ── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════════════════
   DECK BUILDER
═══════════════════════════════════════════════════════════════════════════ */

#deck-builder-screen {
  position: fixed; inset: 44px 0 0 0;
  z-index: 150;
  background: var(--bg);
  display: flex; flex-direction: column;
}

/* Header */
#db-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#db-header h2 {
  font-size: 15px; font-weight: 800; letter-spacing: 2px;
  color: var(--gold); flex: 1;
}
#db-header-stats {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
}
#db-total-count { font-weight: 700; color: var(--text); }
#db-req-indicator { font-size: 12px; }
#db-header-actions { display: flex; gap: 8px; }

/* Body: two panels */
#db-body {
  display: flex; flex: 1; overflow: hidden;
}

/* Left: card browser */
#db-browser {
  flex: 0 0 63%;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#db-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-mat);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#db-search {
  flex: 1; min-width: 120px;
  padding: 5px 10px;
  border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px;
}
#db-search:focus { outline: none; border-color: var(--blue); }
#db-filter-type, #db-filter-class, #db-filter-cost {
  padding: 5px 8px;
  border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 12px; cursor: pointer;
}

#db-card-grid {
  flex: 1; overflow-y: auto; padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px; align-content: start;
}

.db-card-item {
  position: relative; cursor: pointer;
  border-radius: 6px; overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.12s;
  aspect-ratio: 2 / 3;
  background: var(--bg-slot);
}
.db-card-item:hover {
  border-color: var(--gold); transform: scale(1.04); z-index: 2;
}
.db-card-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.db-card-fallback {
  width: 100%; height: 100%; display: flex;
  align-items: center; justify-content: center;
  text-align: center; font-size: 10px; color: var(--text-dim); padding: 6px;
}
.db-card-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: var(--gold); color: #111;
  font-weight: 800; font-size: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Right: deck panel */
#db-deck-panel {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg-mat);
}
#db-deck-stats {
  display: flex; border-bottom: 2px solid var(--border); flex-shrink: 0;
}
.db-stat {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 10px 4px;
  border-right: 1px solid var(--border);
}
.db-stat:last-child { border-right: none; }
.db-stat-num { font-size: 22px; font-weight: 800; color: var(--text-bright); line-height: 1; }
.db-stat-label {
  font-size: 9px; text-transform: uppercase; color: var(--text-dim);
  letter-spacing: 0.5px; margin-top: 3px;
}
.db-stat-total .db-stat-num { color: var(--gold); }

#db-deck-list { flex: 1; overflow-y: auto; padding: 4px 0; }

.db-deck-group-header {
  padding: 8px 12px 3px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim);
  border-top: 1px solid var(--border); margin-top: 4px;
}
.db-deck-group-header:first-child { border-top: none; margin-top: 0; }

.db-deck-row {
  display: flex; align-items: center;
  padding: 5px 12px; cursor: pointer; gap: 8px;
  transition: background 0.1s;
}
.db-deck-row:hover { background: var(--bg-slot-hover); }
.db-deck-row-name {
  flex: 1; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-deck-row-controls { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.db-deck-row-qty { font-size: 12px; font-weight: 700; color: var(--gold); min-width: 22px; text-align: center; }
.db-inline-btn {
  width: 20px; height: 20px; border-radius: 3px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.db-inline-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.db-minus { background: var(--red); color: #fff; }
.db-plus  { background: var(--green); color: #fff; }

/* Card detail modal */
#db-card-modal {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
}
#db-card-modal-box {
  background: var(--bg-mat);
  border: 1px solid var(--border-bright);
  border-radius: 10px; padding: 20px;
  max-width: 560px; width: 90%;
  position: relative;
}
.db-modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: none;
  color: var(--text-dim); font-size: 18px; cursor: pointer; line-height: 1;
}
.db-modal-close:hover { color: var(--text-bright); }
#db-card-modal-content { display: flex; gap: 16px; align-items: flex-start; }
#db-card-modal-img-wrap { flex: 0 0 160px; }
#db-card-modal-img { width: 160px; border-radius: 6px; display: block; }
#db-card-modal-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
#db-card-modal-name { font-size: 18px; font-weight: 700; color: var(--text-bright); }
#db-card-modal-meta { font-size: 12px; color: var(--text-dim); }
#db-card-modal-stats { font-size: 13px; color: var(--gold); font-weight: 600; }
#db-card-modal-ability {
  font-size: 12px; color: var(--text);
  background: rgba(255,255,255,0.05);
  border-radius: 4px; padding: 8px; line-height: 1.5;
}
#db-card-modal-controls {
  display: flex; align-items: center; gap: 14px; margin-top: 4px;
}
.db-qty-btn {
  width: 38px; height: 38px; font-size: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
#db-card-modal-qty-label { font-size: 14px; color: var(--text); }
#db-card-modal-qty { font-size: 20px; font-weight: 800; color: var(--gold); }
#db-card-modal-limit { font-size: 11px; color: var(--text-dim); }

/* ── Warrior animations ──────────────────────────────────────────────────── */

@keyframes warrior-fade-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.85); }
}

@keyframes warrior-damage-flash {
  0%   { box-shadow: inset 0 0 22px rgba(192,64,64,0); }
  30%  { box-shadow: inset 0 0 22px rgba(192,64,64,0.85); }
  100% { box-shadow: inset 0 0 22px rgba(192,64,64,0); }
}

@keyframes attack-ring-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(192,64,64,0.85),
                0 0 10px rgba(192,64,64,0.4);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(192,64,64,1),
                0 0 22px rgba(192,64,64,0.75);
  }
}

.warrior-fading {
  animation: warrior-fade-out 0.4s ease-out forwards;
  pointer-events: none;
}

.slot.warrior-damage-flash {
  animation: warrior-damage-flash 0.5s ease-out !important;
}

.slot.attack-ring {
  animation: attack-ring-pulse 0.9s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — applies only on screens ≤ 768px. Zero effect on desktop.
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Header ─────────────────────────────────────────────────────────── */
  #header {
    height: 44px; flex-wrap: nowrap; overflow: hidden;
    padding: 6px 10px; gap: 6px;
  }
  #header h1 { font-size: 13px; letter-spacing: 1px; }
  /* Hide desktop controls — they move into the hamburger menu */
  #speed-control { display: none; }
  #difficulty-toggle { display: none; }
  #turn-indicator { display: none; }
  #btn-report-issue { display: none; }
  #btn-report-issue-mobile {
    font-size: 10px; padding: 3px 10px; border-radius: 4px;
    border: 1px solid var(--text-dim); color: var(--text-dim);
    text-decoration: none; font-weight: 600; white-space: nowrap;
    margin-left: auto;
  }
  #header-auth { display: none; }
  /* Show hamburger button */
  #mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; background: transparent; border: 1px solid var(--border);
    color: var(--text); font-size: 18px; width: 34px; height: 30px;
    border-radius: 4px; flex-shrink: 0; cursor: pointer;
  }

  /* ── Sidebar backdrop ────────────────────────────────────────────────── */
  #sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.5);
  }
  #sidebar-backdrop.active { display: block; }

  /* ── Sidebar close button ────────────────────────────────────────────── */
  #sidebar-close-btn {
    display: flex; align-items: center; justify-content: center;
    margin-right: auto; background: transparent; border: 1px solid var(--border);
    color: var(--text); font-size: 16px; width: 30px; height: 26px;
    border-radius: 4px; cursor: pointer; flex-shrink: 0;
  }

  /* ── Main layout: hide sidebar by default, board fills full width ────── */
  #main-layout { top: auto; position: relative; padding-top: 44px; }
  #sidebar {
    display: none;
    position: fixed; top: 0; right: 0; bottom: 0; width: 80vw; max-width: 320px;
    z-index: 300; flex-direction: column;
    background: var(--evergreen);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
  }
  #sidebar.mobile-open { display: flex; }

  /* Sidebar mobile controls — shown inside sidebar on mobile */
  #sidebar-mobile-controls {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  #difficulty-toggle-mobile, #speed-control-mobile {
    display: flex; align-items: center; gap: 6px;
  }
  #speed-slider-mobile { flex: 1; accent-color: var(--gold); }
  #sidebar-auth {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
  }
  #sidebar-auth .auth-link-primary {
    border: 1px solid var(--gold-dark); color: var(--gold);
    padding: 3px 10px; border-radius: 4px;
  }

  /* Board: allow scrolling, remove bottom padding reserved for hand */
  #board { padding: 6px 6px 100px 6px; gap: 4px; overflow-y: auto; }

  /* ── Playmats ────────────────────────────────────────────────────────── */
  .playmat { padding: 5px; gap: 4px; }

  /* Info bars: stack vertically on small screens */
  .mat-info-bar {
    flex-direction: column; align-items: flex-start; gap: 4px;
  }
  .tracker-group { flex-wrap: wrap; gap: 4px; }

  /* Shrink progress bar segments */
  .progress-seg { width: 7px; height: 11px; }
  .progress-tracker { padding: 2px 6px; gap: 4px; }
  .tracker-pill { padding: 2px 6px; }
  .tracker-value { font-size: 13px; }

  /* ── Card rows: horizontal scroll so slots don't crush ─────────────── */
  .mat-card-row {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    justify-content: flex-start;
  }
  .slot { min-width: 72px; flex: 0 0 72px; }
  .effect-slot { min-width: 52px; flex: 0 0 52px; }

  /* Card image height reduced */
  .card-header .card-img { height: 80px; }

  /* Stat badges smaller */
  .stat-badge { font-size: 10px; padding: 6px 5px; }

  /* Hide ability type and text on field cards — saves significant vertical space */
  .card-ability-type { display: none; }
  .card-ability-recessed { display: none; }

  /* ── Global terrain ──────────────────────────────────────────────────── */
  #global-zone .slot {
    width: 80px; height: 140px; max-height: 140px;
  }

  /* ── Hand zone: full-width scrollable strip ─────────────────────────── */
  #hand-zone {
    right: 0; height: 160px;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start; align-items: flex-start;
    padding: 6px 8px; gap: 0;
  }
  #player-hand {
    justify-content: flex-start; gap: 6px;
    overflow: visible; flex-wrap: nowrap;
  }
  .hand-card { width: 106px; height: 150px; flex-shrink: 0; }
  /* Board needs more bottom padding to clear the taller hand zone */
  #board { padding-bottom: 170px; }

  /* ── Card detail modal: single column ───────────────────────────────── */
  #card-detail-modal-box { width: 96vw; }
  #card-detail-content { flex-direction: column; }
  .cdm-image-col { width: 100%; max-height: 220px; overflow: hidden; }
  .cdm-image-col img {
    width: 100%; height: 220px; object-fit: cover;
    object-position: center 15%;
    border-radius: 10px 10px 0 0;
  }
  .cdm-info-col { padding: 14px 16px; }
  .cdm-name { font-size: 17px; }

  /* ── Choice / search modal ───────────────────────────────────────────── */
  #modal-box { min-width: unset; width: 92vw; max-width: 92vw; padding: 14px; }
  #modal-box:has(.search-grid) { max-width: 96vw; }
  .search-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
  .search-card { width: auto; }

  /* ── Deck builder ────────────────────────────────────────────────────── */
  #deck-builder-screen { top: 0; }
  #db-header { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  #db-header h2 { font-size: 13px; }
  #db-header-stats { font-size: 11px; }
  #db-header-actions { gap: 5px; }
  #db-header-actions .btn { font-size: 10px; padding: 4px 8px; }

  /* Stack browser above deck panel */
  #db-body { flex-direction: column; }
  #db-browser {
    flex: none; height: 55vh;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  #db-deck-panel { flex: 1; min-height: 0; }

  /* Smaller card grid on mobile */
  #db-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px; padding: 8px;
  }

  /* Deck builder card modal: stack image above info */
  #db-card-modal-content { flex-direction: column; }
  #db-card-modal-img-wrap { flex: none; text-align: center; }
  #db-card-modal-img { width: 120px; }

  /* ── Flash / AI indicator ────────────────────────────────────────────── */
  #message-flash { font-size: 12px; padding: 6px 14px; bottom: 55%; }

  /* ── Tutorial tooltip ───────────────────────────────────────────────── */
  #tutorial-tip { max-width: 70vw; padding: 8px 12px; }
  #tutorial-tip-text { font-size: 0.75rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Holographic shimmer — Full Art cards
══════════════════════════════════════════════════════════════════════════════ */

@keyframes holo-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.holo-card {
  position: relative;
  overflow: hidden;
}

.holo-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 120, 200, 0.12) 30%,
    rgba(120, 200, 255, 0.15) 38%,
    rgba(200, 255, 120, 0.12) 44%,
    transparent 50%,
    transparent 60%,
    rgba(255, 200, 120, 0.12) 68%,
    rgba(120, 255, 200, 0.15) 74%,
    rgba(200, 120, 255, 0.12) 80%,
    transparent 88%
  );
  background-size: 200% 100%;
  animation: holo-shimmer 4s ease-in-out infinite;
  mix-blend-mode: screen;
  border-radius: inherit;
}

/* Stronger shimmer on hover for hand cards and deck builder */
.hand-card.holo-card:hover::after,
.db-card-item.holo-card:hover::after {
  background: linear-gradient(
    105deg,
    transparent 15%,
    rgba(255, 120, 200, 0.22) 26%,
    rgba(120, 200, 255, 0.28) 35%,
    rgba(200, 255, 120, 0.22) 42%,
    transparent 50%,
    transparent 58%,
    rgba(255, 200, 120, 0.22) 66%,
    rgba(120, 255, 200, 0.28) 74%,
    rgba(200, 120, 255, 0.22) 82%,
    transparent 90%
  );
  background-size: 200% 100%;
  animation: holo-shimmer 2.5s ease-in-out infinite;
}

/* Rainbow border glow for holo cards */
.holo-card {
  border-color: rgba(200, 180, 255, 0.4) !important;
  box-shadow: 0 0 6px rgba(200, 180, 255, 0.15), inset 0 0 4px rgba(200, 180, 255, 0.08);
}

.hand-card.holo-card:hover {
  box-shadow: 0 16px 36px rgba(0,0,0,0.8), 0 0 12px rgba(200, 180, 255, 0.3) !important;
}
