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

/* Android WebView: overflow:hidden을 html에 적용해야 position:fixed 자식이 정상 렌더링됨 */
html {
  height: 100%;
  overflow: hidden;
}

/* Android WebView 호환 배경 레이어 */
#bg-layer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('../img/base_img_title.webp') no-repeat center center;
  background-size: cover;
  z-index: -1;
}

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* overflow:hidden 제거 — Android WebView에서 position:fixed 자식을 클리핑함 */
  font-size: 13px;
}

#game-wrap {
  display: flex;
  height: 100vh;
  gap: 6px;
  padding: 6px;
}

#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* ── PLAYER ZONES ── */
.player-zone {
  background: #161b22;
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid #30363d;
}

.zone-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.hp-badge {
  background: #21262d;
  border: 2px solid #f85149;
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: bold;
  font-size: 15px;
  color: #f85149;
}
.hp-badge.ai { border-color: #ff7b72; color: #ff7b72; }

.zone-label { font-size: 11px; color: #8b949e; font-weight: bold; letter-spacing: 1px; }

/* ── MANA DISPLAY ── */
.mana-row {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  margin-bottom: 4px;
}

.mana-gem {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(13,17,23,0.75);
  border-radius: 10px;
  padding: 2px 5px 2px 3px;
  font-size: 9px;
  font-weight: bold;
  border: 1px solid #30363d;
  backdrop-filter: blur(2px);
}
.mana-gem .mana-icon {
  width: 12px;
  height: 12px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.mana-gem.zero { opacity: 0.35; }
.mana-gem.red   { border-color: #f85149; color: #f85149; }
.mana-gem.blue  { border-color: #58a6ff; color: #58a6ff; }
.mana-gem.green { border-color: #3fb950; color: #3fb950; }
.mana-gem.black { border-color: #a5a5a5; color: #a5a5a5; }
.mana-gem.white { border-color: #e6c84a; color: #e6c84a; }

/* ── PERMANENTS ZONE ── */
.permanents-zone {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 0;
  padding: 2px 0;
}

/* ── BATTLEFIELD ── */
#battlefields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.battlefield {
  flex: 1;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  overflow-y: auto;
  min-height: 80px;
}

.bf-label {
  font-size: 10px;
  color: #30363d;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.bf-divider {
  height: 2px;
  background: linear-gradient(to right, transparent, #30363d, transparent);
  margin: 0 4px;
}

/* ── 마법진 전용 슬롯 ── */
.enchant-slot {
  width: 80px; min-height: 120px; flex-shrink: 0;
  border: 1.5px dashed #8878aa; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: rgba(136,120,170,0.07);
  margin-left: auto; /* 항상 오른쪽 끝에 */
}
.enchant-slot-empty {
  font-size: 18px; color: #8878aa; opacity: 0.5;
}
.enchant-slot-label {
  font-size: 8px; color: #8878aa; opacity: 0.6; letter-spacing: 0.5px;
}

/* ── CARDS ── */
.card {
  background: #161b22;
  border-radius: 8px;
  padding: 0;
  width: 80px;
  min-height: 120px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: none;
}
.card:hover { transform: translateY(-3px); }

.card.red   { background:#1a0303; box-shadow:0 0 0 1.5px #6b1a1a,0 0 0 3px #c84040,0 4px 16px rgba(180,0,0,0.4); }
.card.blue  { background:#03051a; box-shadow:0 0 0 1.5px #1a2d6b,0 0 0 3px #4060c8,0 4px 16px rgba(0,40,180,0.4); }
.card.green { background:#031a06; box-shadow:0 0 0 1.5px #1a4a1a,0 0 0 3px #3fb950,0 4px 16px rgba(0,120,30,0.4); }
.card.black { background:#0a0a0f; box-shadow:0 0 0 1.5px #2a2a3a,0 0 0 3px #8878aa,0 4px 16px rgba(30,20,50,0.6); }
.card.white { background:#1a1a0a; box-shadow:0 0 0 1.5px #4a4a1a,0 0 0 3px #c8c040,0 4px 16px rgba(180,160,0,0.35); }
.card.multi { background:#0e0e18; box-shadow:0 0 0 1.5px #3a2a1a,0 0 0 3px #c09040,0 4px 16px rgba(120,80,0,0.4); }

/* Enchantment cards look different */
.card.enchant-card {
  width: 68px;
  min-height: 80px;
  border-style: dashed;
  opacity: 0.92;
}
.card.enchant-card:hover { transform: translateY(-2px); }

.card.tapped { transform: rotate(6deg); opacity: 0.8; }
.card.tapped:hover { transform: rotate(6deg) translateY(-3px); }

.card.selected { border-color: #ffd700 !important; box-shadow: 0 0 12px #ffd70088; transform: translateY(-6px); }
.card.attacker { box-shadow: 0 0 0 2px #ff6b35, 0 0 0 4px #ffaa00, 0 0 18px #ff6b35cc !important; transform: translateY(-5px) scale(1.04); }
.card.blocker-selected { border-color: #00d4aa !important; box-shadow: 0 0 10px #00d4aa66; }

.card.valid-target {
  border-color: #d29922 !important;
  box-shadow: 0 0 10px #d2992255;
  animation: pulse-target 1s infinite alternate;
}
@keyframes pulse-target {
  from { box-shadow: 0 0 6px #d2992244; }
  to   { box-shadow: 0 0 14px #d29922aa; }
}

.card.summon-sick { opacity: 0.75; }

/* ── Small card internals (new dark-theme flex layout) ── */
/* 색 마나 pip: 겹쳐 보이도록 음수 마진 */
.cost-pip { width: 11px; height: 11px; border-radius: 50%; display: inline-block; object-fit: contain;
  flex-shrink: 0; margin-left: -4px; vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6); }
.cost-pip:first-child { margin-left: 0; }
/* 무색 마나: 숫자 배지로 분리 표기 — 컬러 pip과 약간 거리 */
.cost-pip-colorless { width: auto !important; height: auto !important; min-width: 12px; padding: 0 3px;
  border-radius: 6px; background: #3a4555; border: 1px solid #58a6ff44; color: #b8d0f0;
  font-size: 9px; font-weight: bold; line-height: 12px; text-align: center;
  box-shadow: 0 0 3px rgba(0,0,0,0.8); margin-left: 4px !important;
  vertical-align: middle; align-self: center; flex-shrink: 0; }

/* ── Card mini header strip ── */
.card-mini-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5px; flex: 0 0 14%; min-height: 14px; flex-shrink: 0;
  border-bottom-width: 1px; border-bottom-style: solid;
}
.card.red   .card-mini-header { background: linear-gradient(135deg,#3a0808,#6b1a1a); border-bottom-color:#c84040; }
.card.blue  .card-mini-header { background: linear-gradient(135deg,#08103a,#1a2d6b); border-bottom-color:#4060c8; }
.card.green .card-mini-header { background: linear-gradient(135deg,#082808,#1a4a1a); border-bottom-color:#3fb950; }
.card.black .card-mini-header { background: linear-gradient(135deg,#0a0a14,#1a1a2a); border-bottom-color:#8878aa; }
.card.white .card-mini-header { background: linear-gradient(135deg,#2a2808,#4a4a1a); border-bottom-color:#c8c040; }
.card.multi .card-mini-header { background: linear-gradient(135deg,#1a1206,#3a2a0e); border-bottom-color:#c09040; }

/* Card name */
.card-name {
  font-size: 9px; font-weight: bold; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 0 0 60%; min-width: 0; z-index: 2; line-height: 1;
}
.card.red   .card-name,.card.red   .card-name span { color:#ffe8d0; }
.card.blue  .card-name,.card.blue  .card-name span { color:#d0e8ff; }
.card.green .card-name,.card.green .card-name span { color:#d0ffd8; }
.card.black .card-name,.card.black .card-name span { color:#e8d8ff; }
.card.white .card-name,.card.white .card-name span { color:#ffffd0; }
.card.multi .card-name,.card.multi .card-name span { color:#ffe8b0; }

/* Mana pips in header */
.card-cost { display:flex; flex-direction:row; gap:0; flex-wrap:nowrap; flex: 0 0 40%; justify-content:flex-end; overflow:visible; }

/* ── Image area ── */
.card-img {
  flex: 0 0 55px; height: 55px; min-height: 55px; max-height: 55px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card-img img { width:100%; height:100%; object-fit:cover; object-position:center top; display:block; }
.card-emoji {
  font-size: 26px; display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

/* ── Type band ── */
.card-type-badge {
  font-size: 8px; font-weight: bold; letter-spacing: 0.5px;
  text-align: center; padding: 2px 4px; flex-shrink: 0;
  border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid;
  display: block !important;
}
.card.red   .card-type-badge { background:#2a0606; color:#ffc0a0; border-color:#c84040; }
.card.blue  .card-type-badge { background:#060a2a; color:#a0c8ff; border-color:#4060c8; }
.card.green .card-type-badge { background:#062806; color:#a0e0a8; border-color:#3fb950; }
.card.black .card-type-badge { background:#0a0a14; color:#c0b0e0; border-color:#8878aa; }
.card.white .card-type-badge { background:#282808; color:#e8e890; border-color:#c8c040; }
.card.multi .card-type-badge { background:#1a1206; color:#e8c880; border-color:#c09040; }

/* ── Effect text ── */
.card-text {
  font-size: 7px; text-align: center; padding: 3px 5px;
  line-height: 1.3; flex: 1; overflow: hidden; z-index: 2;
  white-space: nowrap; text-overflow: ellipsis; display: block;
  align-self: center;
}
.card.red   .card-text { color:#e8a890; }
.card.blue  .card-text { color:#90b8e8; }
.card.green .card-text { color:#90e098; }
.card.black .card-text { color:#c0a8e8; }
.card.white .card-text { color:#e8e890; }
.card.multi .card-text { color:#e8c880; }

/* ── Stats bar ── */
.card-stats {
  font-size: 10px; font-weight: bold; text-align: right;
  padding: 2px 7px; flex-shrink: 0; z-index: 3;
  border-top-width: 1.5px; border-top-style: solid;
}
.card.red   .card-stats { background:#1a0303; border-top-color:#c84040; color:#ffe8d0; }
.card.blue  .card-stats { background:#03051a; border-top-color:#4060c8; color:#d0e8ff; }
.card.green .card-stats { background:#031a06; border-top-color:#3fb950; color:#d0ffd8; }
.card.black .card-stats { background:#0a0a0f; border-top-color:#8878aa; color:#e8d8ff; }
.card.white .card-stats { background:#1a1a0a; border-top-color:#c8c040; color:#ffffd0; }
.card.multi .card-stats { background:#0e0e18; border-top-color:#c09040; color:#ffe8b0; }

/* hand card — 균일 고정 높이, 모든 섹션 동일하게 표시 */
.card.hand-card {
  width: 75px;
  height: 122px;
  min-height: 122px;
  max-height: 122px;
}
.card.hand-card .card-mini-header { flex: 0 0 18px; min-height: 18px; }
.card.hand-card .card-img         { flex: 0 0 38px; min-height: 38px; max-height: 38px; }
.card.hand-card .card-type-badge  { flex: 0 0 13px; min-height: 13px; }
.card.hand-card .card-text        { flex: 1 1 auto; min-height: 18px; max-height: 28px;
                                     overflow: hidden; white-space: normal;
                                     display: -webkit-box; -webkit-line-clamp: 2;
                                     -webkit-box-orient: vertical; }
.card.hand-card .card-stats       { flex: 0 0 16px; min-height: 16px; }

/* card-tile — 부모 컨테이너 폭에 맞춰 유동적으로 크기 조절되는 hand-card 변형.
   레이아웃 비율은 hand-card(75×122)와 동일하므로 도감·덱빌더 등 모든 위치에서
   손패 카드와 같은 시각적 구조를 가짐. */
.card.card-tile {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 75 / 122;
}
.card.card-tile .card-mini-header { flex: 0 0 14.7%; min-height: 0; padding: 0 6px; }
.card.card-tile .card-img         { flex: 0 0 31%; min-height: 0; max-height: none; height: auto; }
.card.card-tile .card-type-badge  { flex: 0 0 10.7%; min-height: 0; padding: 1px 4px; }
.card.card-tile .card-text        { flex: 1 1 auto; min-height: 0; max-height: none;
                                     overflow: hidden; white-space: normal;
                                     display: -webkit-box; -webkit-line-clamp: 2;
                                     -webkit-box-orient: vertical;
                                     padding: 3px 5px; }
.card.card-tile .card-stats       { flex: 0 0 13.1%; min-height: 0; padding: 2px 7px; }
/* card-tile 내부 폰트는 카드 가로폭에 비례하도록 컨테이너 쿼리 단위(cqw)와
   기존 px 폴백을 함께 지정 */
.card.card-tile { container-type: inline-size; }
.card.card-tile .card-name   { font-size: 11cqw; line-height: 1.05; }
.card.card-tile .card-text   { font-size: 8.5cqw; line-height: 1.25; }
.card.card-tile .card-stats  { font-size: 13cqw; }
.card.card-tile .card-type-badge { font-size: 9cqw; letter-spacing: 0; }
.card.card-tile .cost-pip { width: 13cqw; height: 13cqw; margin-left: -4cqw; }
.card.card-tile .cost-pip:first-child { margin-left: 0; }
.card.card-tile .cost-pip-colorless { min-width: 14cqw; padding: 0 4cqw; font-size: 10cqw; line-height: 1; }

.keyword-badge {
  font-size: 4.5px; background: #21262d; border-radius: 2px;
  padding: 0.5px 2px; color: #8b949e; margin: 1px 0; text-align: center;
}

/* buffed stat color */
.stat-buffed { color: #3fb950 !important; }
.stat-debuffed { color: #f85149 !important; }

/* Hand */
#player-hand-area {
  background: #161b22;
  border-radius: 8px;
  border: 1px solid #30363d;
  padding: 6px 10px;
}
#hand-row {
  display: flex; gap: 5px; overflow-x: auto;
  padding-bottom: 4px; min-height: 110px; align-items: center;
}

/* Action buttons */
#action-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn {
  padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 12px; font-weight: bold;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.btn-primary   { background: #238636; color: white; }
.btn-danger    { background: #da3633; color: white; }
.btn-warning   { background: #d29922; color: black; }
.btn-blue      { background: #1f6feb; color: white; }
.btn-secondary { background: #21262d; color: #e6edf3; border: 1px solid #30363d; }
.btn-cancel    { background: #30363d; color: #e6edf3; }

/* Phase bar */
#phase-bar { display: flex; gap: 3px; align-items: center; flex-shrink: 0; }
.phase-pip {
  padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: bold;
  background: #21262d; color: #8b949e; border: 1px solid #30363d; letter-spacing: 0.5px;
}
.phase-pip.active { background: #1f6feb; color: white; border-color: #58a6ff; }

/* ── LOG PANEL ── */
#log-panel {
  width: 200px; background: #161b22; border: 1px solid #30363d;
  border-radius: 8px; padding: 8px; display: flex; flex-direction: column; flex-shrink: 0;
}
#log-title { font-size: 11px; color: #8b949e; font-weight: bold; letter-spacing: 1px; margin-bottom: 6px; text-align: center; }
#log-entries { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.log-entry { font-size: 10px; color: #8b949e; line-height: 1.4; padding: 2px 4px; border-radius: 3px; word-break: keep-all; }
.log-entry.player { color: #58a6ff; background: #0d1f36; }
.log-entry.ai     { color: #f85149; background: #2d1616; }
.log-entry.combat { color: #d29922; background: #1f1a0d; }
.log-entry.system { color: #3fb950; background: #0d1f12; }
.log-entry.turn   { color: #e6edf3; font-weight: bold; background: #21262d; }

/* ── OVERLAY / MODAL ── */
#overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; justify-content: center; align-items: center; }
#overlay.show { display: flex; }
.modal { background: #161b22; border: 2px solid #30363d; border-radius: 12px; padding: 24px; max-width: 360px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.6); }
.modal h2 { font-size: 22px; margin-bottom: 10px; }
.modal p  { color: #8b949e; margin-bottom: 16px; font-size: 13px; }
.modal .btn-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── MULLIGAN & ABILITY OVERLAYS ── */
#mulligan-overlay, #ability-picker-overlay, #game-mode-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  z-index: 120; justify-content: center; align-items: center;
  /* 시스템 바(상시 내비 버튼) 영역 회피 — edge-to-edge 환경에서 하단 버튼 가림 방지 */
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px))
           max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
#mulligan-overlay.show, #ability-picker-overlay.show, #game-mode-overlay.show { display: flex; }
.mulligan-modal {
  background: #161b22; border: 2px solid #58a6ff; border-radius: 14px;
  padding: 24px 28px; text-align: center; max-width: 700px; width: 95%;
  /* 화면이 낮아도(3버튼 내비 등) 하단 확인 버튼에 항상 도달 가능하도록 */
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
}
.mulligan-modal h2 { font-size: 20px; margin-bottom: 6px; color: #58a6ff; }
.mulligan-modal p  { font-size: 12px; color: #8b949e; margin-bottom: 12px; }
#mulligan-hand { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; min-height: 110px; }

/* ── SACRIFICE POPUP ── */
#sacrifice-popup { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; justify-content: center; align-items: center; }
#sacrifice-popup.show { display: flex; }
.sacrifice-box { background: #161b22; border: 2px solid #d29922; border-radius: 10px; padding: 16px 20px; text-align: center; min-width: 220px; }
.sacrifice-box h3 { color: #d29922; margin-bottom: 8px; }
.sacrifice-box p  { font-size: 11px; color: #8b949e; margin-bottom: 12px; }
.color-btn-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.color-btn { padding: 5px 12px; border-radius: 20px; border: none; cursor: pointer; font-size: 12px; font-weight: bold; transition: transform 0.1s; }
.color-btn:hover { transform: scale(1.1); }
.color-btn.red   { background: #f85149; color: white; }
.color-btn.blue  { background: #1f6feb; color: white; }
.color-btn.green { background: #3a9d23; color: white; }
.color-btn.black { background: #4a4a5a; color: white; }
.color-btn.white { background: #b8952a; color: white; }

/* ── TARGETING BANNER ── */
#target-banner {
  display: none; position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  background: #d29922; color: #000; padding: 8px 16px;
  border-radius: 20px; font-weight: bold; font-size: 13px; z-index: 80;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: none; align-items: center; gap: 10px;
}
#target-banner.show { display: flex; }
#target-cancel-btn { background: #333; color: #e6edf3; border: none; border-radius: 10px; padding: 2px 10px; font-size: 11px; cursor: pointer; }

/* ── BLOCKING UI ── */
#block-banner {
  display: none; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  background: #161b22cc; border: 2px solid #f85149; border-top-left-radius: 10px; border-top-right-radius: 10px;
  padding: 10px 16px; z-index: 80; width: 100%; max-width: 600px; text-align: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
#block-banner.show { display: block; }

/* ── VALID BLOCKER HIGHLIGHT ── */
.card.valid-blocker {
  border-color: #00d4aa !important;
  box-shadow: 0 0 12px #00d4aa77;
  animation: pulse-target 1s infinite alternate;
}

/* ── CARD DETAIL OVERLAY (크게 보기) ── */
#card-detail-overlay .card {
  width: 100% !important;
  min-height: 360px;
  cursor: default;
}
#card-detail-overlay .card-img {
  flex: 0 0 180px !important;
  height: 180px !important;
  min-height: 180px !important;
  max-height: 180px !important;
}
#card-detail-overlay .card-text {
  white-space: normal !important;
  text-overflow: unset !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 11px !important;
  min-height: 36px;
  padding: 6px 8px !important;
}
#card-detail-overlay .card-name { font-size: 15px !important; white-space: normal !important; overflow: visible !important; text-overflow: unset !important; }
#card-detail-overlay .card-stats { font-size: 15px !important; padding: 5px 10px !important; }
#card-detail-overlay .card-type-badge { font-size: 11px !important; }
#card-detail-overlay .cost-pip { width: 16px !important; height: 16px !important; margin-left: -4px !important; }
#card-detail-overlay .cost-pip:first-child { margin-left: 0 !important; }
#card-detail-overlay .cost-pip-colorless { width: auto !important; height: auto !important; min-width: 18px !important; padding: 1px 4px !important; font-size: 14px !important; border-radius: 9px !important; }
#card-detail-overlay .card-mini-header { min-height: 30px !important; padding: 4px 8px !important; flex: 0 0 auto !important; }

/* ── ACTION CHOICE POPUP (손패) / UNIT VIEW POPUP (필드 카드 보기) ── */
#action-choice-popup, #unit-action-popup { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 210; justify-content: center; align-items: center; }
#action-choice-popup .action-box, #unit-action-popup .action-box { background: #161b22; border: 2px solid #58a6ff; border-radius: 12px; padding: 18px 22px; text-align: center; min-width: 240px; max-width: 90vw; }
#action-choice-popup .action-box h3, #unit-action-popup .action-box h3 { color: #58a6ff; margin-bottom: 8px; font-size: 15px; }
#action-choice-popup .action-box .card-name-label, #unit-action-popup .action-box .card-name-label { color: #e6edf3; font-weight: bold; margin: 6px 0 4px; font-size: 13px; }
#action-choice-popup .action-box .action-desc, #unit-action-popup .action-box .action-desc { font-size: 11px; color: #8b949e; margin-bottom: 14px; }
/* OVERLOAD TAX POPUP */
#overload-popup { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.82); z-index:250; justify-content:center; align-items:center; }
#overload-popup .overload-box { background:#161b22; border:2px solid #d29922; border-radius:14px; padding:20px 24px; text-align:center; min-width:280px; max-width:90vw; }
#overload-popup .overload-box h3 { color:#d29922; font-size:16px; margin-bottom:6px; }
#overload-popup .overload-remaining { font-size:32px; font-weight:bold; color:#f85149; margin:6px 0; }
#overload-popup .overload-desc { font-size:13px; color:#8b949e; margin-bottom:16px; }
#overload-popup .overload-mana-row { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:12px; }
#overload-popup .overload-note { font-size:10px; color:#6e7681; margin-top:8px; }
.action-btn-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── AI THINKING ── */
#ai-indicator {
  display: none; position: fixed; bottom: 20px; right: 20px;
  background: #21262d; border: 1px solid #f85149; border-radius: 20px;
  padding: 6px 16px; font-size: 12px; color: #f85149;
  animation: blink 0.8s infinite; z-index: 70;
}
@keyframes blink { 50% { opacity: 0.4; } }

/* ── MISC ── */
.hp-bar-wrap { background: #21262d; border-radius: 4px; height: 4px; width: 80px; overflow: hidden; margin-top: 2px; }
#log-scroll-area::-webkit-scrollbar { width: 4px; }
#log-scroll-area::-webkit-scrollbar-track { background: #0d1117; }
#log-scroll-area::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
#log-scroll-area::-webkit-scrollbar-thumb:hover { background: #58a6ff; }
.hp-bar { height: 100%; background: #3fb950; border-radius: 4px; transition: width 0.3s; }
.hp-bar.low { background: #f85149; }
#turn-indicator { text-align: center; font-size: 11px; color: #8b949e; }
.player-name { font-weight: bold; font-size: 14px; }
.player-name.you { color: #58a6ff; }
.player-name.ai  { color: #f85149; }
.deck-count { font-size: 10px; color: #8b949e; margin-left: auto; }
.hand-count-badge {
  font-size: 11px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 1px 6px;
  color: #e6edf3;
}

/* ══════════════════════════════════════════
   COMBAT ANIMATION (combat-anim.js)
   ══════════════════════════════════════════ */
.combat-hit-flash {
  animation: combat-hit-pulse 0.18s ease-out;
}
@keyframes combat-hit-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 80, 80, 0); }
  50%  { box-shadow: 0 0 14px 4px rgba(255, 80, 80, 0.85); }
  100% { box-shadow: 0 0 0 0 rgba(255, 80, 80, 0); }
}

#combat-anim-svg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 240;
  pointer-events: none;
  overflow: visible;
}

/* ── 튜토리얼 하이라이트 ── */
.tut-highlight {
  box-shadow: 0 0 0 3px #7c5cbf, 0 0 18px 4px rgba(124,92,191,0.5) !important;
  border-radius: 8px;
  transition: box-shadow 0.3s;
}
