/* =========================
   DUO GAME ZONE — 난장 카드게임 CSS v20260515_1
   ========================= */

/* multi-avatar.js helper의 .duo-avatar base — cardgame은 이 파일만 import해서
   다른 게임처럼 자체 정의 누락 시 inline width/height가 안 먹혀 사진이 본래 크기로 표시되는 버그 방지 */
.duo-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
  vertical-align: middle;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.duo-avatar .duo-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cg-app { display: flex; flex-direction: column; gap: 12px; }

/* ===== Lobby team grouping ===== */
.cg-team-roster {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cg-team-section {
  background: #161b29;
  border: 1px solid #2c3445;
  border-radius: 10px;
  padding: 10px;
}
.cg-team-section.cg-team-0 { border-left: 4px solid #ef4444; }
.cg-team-section.cg-team-1 { border-left: 4px solid #3b82f6; }
.cg-team-section.cg-team-2 { border-left: 4px solid #22c55e; }
.cg-team-section.cg-team-3 { border-left: 4px solid #facc15; }
.cg-team-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #c2c8d4;
}
.cg-team-tag { font-weight: 700; }
.cg-team-tag-0 { color: #ef4444; }
.cg-team-tag-1 { color: #3b82f6; }
.cg-team-tag-2 { color: #22c55e; }
.cg-team-tag-3 { color: #facc15; }
.cg-team-count {
  background: #2c3445;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}
.cg-team-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.cg-pcard-discon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 14px;
}

/* ===== Players strip (인게임) ===== */
.cg-players-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

/* 인게임 플레이어 카드 — 프로필 + HP + 상태이상 */
.cg-player {
  position: relative;
  background: linear-gradient(155deg, #1a2030 0%, #232a3e 100%);
  border: 2px solid var(--team-color, #2c3445);
  border-radius: 12px;
  padding: 10px 12px 8px;
  min-height: 108px;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.cg-player.current {
  box-shadow: 0 0 0 3px var(--team-color, #facc15), 0 0 28px var(--team-color, rgba(250,204,21,0.7)), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-3px) scale(1.04);
  animation: cgTurnGlow 1.6s ease-in-out infinite;
  z-index: 5;
}
@keyframes cgTurnGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--team-color, #facc15), 0 0 18px var(--team-color, rgba(250,204,21,0.6)); }
  50%      { box-shadow: 0 0 0 5px var(--team-color, #facc15), 0 0 36px var(--team-color, rgba(250,204,21,0.95)); }
}
.cg-player.down { opacity: 0.55; }
.cg-player.is-me { background: linear-gradient(180deg, #1f2a40 0%, #1a2030 100%); }
.cg-player-head {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cg-pavatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid var(--team-color, #2c3445);
}
.cg-pavatar.guest { background: linear-gradient(135deg, #4b5563, #1f2937); }
.cg-player-head-text { flex: 1; min-width: 0; }
.cg-player-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cg-player-me {
  display: inline-block;
  font-size: 9px;
  background: #facc15;
  color: #1a2030;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 800;
  margin-left: 4px;
}
.cg-player-hpbar {
  height: 9px;
  background: #0a1018;
  border-radius: 5px;
  overflow: hidden;
  margin: 6px 0 3px;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.cg-player-hpfill {
  height: 100%;
  transition: width .45s cubic-bezier(.34,1.56,.64,1);
  background: linear-gradient(90deg, var(--hp-color, #22c55e) 0%, var(--hp-color-2, #4ade80) 100%);
  box-shadow: 0 0 8px var(--hp-color, rgba(34,197,94,0.5)), inset 0 1px 0 rgba(255,255,255,0.3);
}
.cg-player[data-hp-pct="low"] .cg-player-hpfill {
  --hp-color: #ef4444; --hp-color-2: #f87171;
  animation: cgHpCrit 0.8s ease-in-out infinite;
}
.cg-player[data-hp-pct="mid"] .cg-player-hpfill {
  --hp-color: #facc15; --hp-color-2: #fde047;
}
@keyframes cgHpCrit {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}
.cg-player-hpnum { font-size: 11px; color: #d8dfee; font-weight: 700; font-variant-numeric: tabular-nums; }

.cg-player-foot {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.cg-hand-chip {
  font-size: 11px;
  color: #c2c8d4;
  background: #2c3445;
  padding: 2px 6px;
  border-radius: 6px;
}
.cg-status-row { display: flex; gap: 4px; flex-wrap: wrap; }
.cg-status {
  font-size: 12px;
  background: rgba(0,0,0,0.4);
  padding: 1px 5px;
  border-radius: 6px;
  border: 1px solid #2c3445;
}
.cg-status b { font-size: 10px; margin-left: 2px; }
.cg-status-poison { color: #84cc16; border-color: #4d7c0f; }
.cg-status-burn { color: #f97316; border-color: #c2410c; }
.cg-status-bleed { color: #ef4444; border-color: #b91c1c; }
.cg-status-stun { color: #facc15; border-color: #a16207; }
.cg-status-silence { color: #94a3b8; border-color: #475569; }
.cg-status-rage { color: #f87171; border-color: #b91c1c; background: rgba(248,113,113,0.12); }
.cg-status-charge { color: #94a3b8; border-color: #475569; background: rgba(148,163,184,0.12); }
.cg-status-ward { color: #c084fc; border-color: #7c3aed; background: rgba(192,132,252,0.12); }
.cg-status-lifesteal { color: #e879f9; border-color: #a21caf; background: rgba(232,121,249,0.12); }

.cg-player-down-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
  color: #ef4444;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
}

/* 카드 흔들림 */
.cg-player-shake { animation: cgShake 0.32s linear; }
@keyframes cgShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 데미지/힐 popup */
.cg-dmg-pop {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 900;
  pointer-events: none;
  animation: cgDmgPop 1s ease-out forwards;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  z-index: 10;
}
.cg-dmg-pop.cg-dmg-dmg { color: #ef4444; }
.cg-dmg-pop.cg-dmg-heal { color: #22c55e; }
.cg-dmg-pop.cg-dmg-status { color: #facc15; font-size: 20px; }
@keyframes cgDmgPop {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -10px) scale(1.15); }
  60%  { opacity: 1; transform: translate(-50%, -28px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(0.95); }
}

/* 타이머 색 변화 */
.cg-timer.warn { color: #facc15; }
.cg-timer.critical {
  color: #ef4444;
  animation: cgTimerCrit 0.6s ease-in-out infinite;
}
@keyframes cgTimerCrit { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* plays 인디케이터 */
.cg-plays-indicator {
  margin-left: 8px;
  font-size: 11px;
  color: #facc15;
  background: rgba(250,204,21,0.12);
  padding: 2px 8px;
  border-radius: 6px;
}

/* 드로우 버튼 */
.cg-btn-draw {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 6px;
  transition: transform .12s;
}
.cg-btn-draw:hover { transform: translateY(-1px); }

/* 전투 연출 오버레이 — 중앙 큰 텍스트 */
.cg-effect-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1500;
}
.cg-effect-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 36px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  animation: cgEffectIn 0.35s cubic-bezier(.18,1.27,.66,.99);
  position: relative;
  overflow: hidden;
}
.cg-effect-center::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.2) 0%, transparent 60%);
  pointer-events: none;
}
.cg-effect-center.out { animation: cgEffectOut 0.45s ease-in forwards; }
.cg-effect-center.attack {
  background: linear-gradient(135deg, rgba(239,68,68,0.92), rgba(180,28,28,0.92));
  box-shadow: 0 8px 48px rgba(239,68,68,0.6), 0 0 0 2px rgba(239,68,68,0.4);
  animation: cgEffectIn 0.35s cubic-bezier(.18,1.27,.66,.99), cgShakeImpact 0.6s ease-out;
}
.cg-effect-center.defense {
  background: linear-gradient(135deg, rgba(59,130,246,0.92), rgba(37,99,235,0.92));
  box-shadow: 0 8px 48px rgba(59,130,246,0.6), 0 0 0 2px rgba(59,130,246,0.4);
}
.cg-effect-center.support {
  background: linear-gradient(135deg, rgba(34,197,94,0.92), rgba(22,163,74,0.92));
  box-shadow: 0 8px 48px rgba(34,197,94,0.6), 0 0 0 2px rgba(34,197,94,0.4);
}
.cg-effect-center.ko {
  background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(80,0,0,0.95));
  box-shadow: 0 8px 48px rgba(239,68,68,0.8), 0 0 0 3px rgba(239,68,68,0.5);
  animation: cgEffectIn 0.35s cubic-bezier(.18,1.27,.66,.99), cgShakeImpact 0.8s ease-out;
}
.cg-effect-emoji {
  font-size: 72px; line-height: 1;
  text-shadow: 0 4px 16px rgba(0,0,0,0.5);
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.3));
}
.cg-effect-label {
  color: #fff; font-weight: 900; font-size: 22px;
  margin-top: 8px; letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
@keyframes cgEffectIn {
  0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
@keyframes cgEffectOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5) translateY(-40px); opacity: 0; }
}
@keyframes cgShakeImpact {
  0%,100% { transform: scale(1) translateX(0); }
  20% { transform: scale(1.05) translateX(-6px); }
  40% { transform: scale(1) translateX(6px); }
  60% { transform: scale(1.02) translateX(-4px); }
  80% { transform: scale(1) translateX(4px); }
}

/* ===== 액션 모먼트 — 시전자 ▶ 카드 ▶ 타깃 (아바타로 시각화) ===== */
.cg-action-moment{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  animation: cgActionIn 0.32s cubic-bezier(.18,1.27,.66,.99);
  border: 1.5px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.55);
}
.cg-action-moment.out{ animation: cgActionOut 0.4s ease-in forwards; }
.cg-action-moment.cg-action-attack{
  border-color: rgba(239,68,68,0.55);
  box-shadow: 0 12px 44px rgba(239,68,68,0.45), 0 0 0 1px rgba(239,68,68,0.3);
}
.cg-action-moment.cg-action-defense{
  border-color: rgba(59,130,246,0.55);
  box-shadow: 0 12px 44px rgba(59,130,246,0.45), 0 0 0 1px rgba(59,130,246,0.3);
}
.cg-action-moment.cg-action-support{
  border-color: rgba(34,197,94,0.55);
  box-shadow: 0 12px 44px rgba(34,197,94,0.45), 0 0 0 1px rgba(34,197,94,0.3);
}
.cg-action-side{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
  max-width: 90px;
}
.cg-action-side .cg-action-avatar{
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.cg-action-side-actor .cg-action-avatar{
  border-color: rgba(255,209,102,0.7);
  animation: cgActionActorGlow 0.9s ease-out;
}
.cg-action-side-target .cg-action-avatar{
  border-color: rgba(239,68,68,0.7);
  animation: cgActionTargetHit 0.9s ease-out;
}
.cg-action-moment.cg-action-support .cg-action-side-target .cg-action-avatar{
  border-color: rgba(34,197,94,0.7);
  animation: cgActionTargetHeal 0.9s ease-out;
}
.cg-action-moment.cg-action-defense .cg-action-side-target .cg-action-avatar{
  border-color: rgba(59,130,246,0.7);
}
.cg-action-name{
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 84px;
}
.cg-action-arrow{
  font-size: 30px;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251,191,36,0.7);
  animation: cgActionArrow 0.6s ease-out;
}
.cg-action-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  animation: cgActionCardPop 0.5s cubic-bezier(.18,1.27,.66,.99);
}
.cg-action-card-attack{ background: linear-gradient(135deg, rgba(239,68,68,0.28), rgba(180,28,28,0.18)); border-color: rgba(239,68,68,0.5); }
.cg-action-card-defense{ background: linear-gradient(135deg, rgba(59,130,246,0.28), rgba(37,99,235,0.18)); border-color: rgba(59,130,246,0.5); }
.cg-action-card-support{ background: linear-gradient(135deg, rgba(34,197,94,0.28), rgba(22,163,74,0.18)); border-color: rgba(34,197,94,0.5); }
.cg-action-emoji{
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.25));
}
.cg-action-label{
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
}
@keyframes cgActionIn{
  0%{ transform: scale(0.55) translateY(20px); opacity: 0; }
  60%{ transform: scale(1.08); opacity: 1; }
  100%{ transform: scale(1) translateY(0); }
}
@keyframes cgActionOut{
  0%{ transform: scale(1); opacity: 1; }
  100%{ transform: scale(0.92) translateY(-26px); opacity: 0; }
}
@keyframes cgActionActorGlow{
  0%{ box-shadow: 0 0 0 0 rgba(255,209,102,0); }
  40%{ box-shadow: 0 0 20px 6px rgba(255,209,102,0.6); }
  100%{ box-shadow: 0 0 0 0 rgba(255,209,102,0); }
}
@keyframes cgActionTargetHit{
  0%{ transform: scale(1); }
  20%{ transform: scale(1.15); box-shadow: 0 0 24px 8px rgba(239,68,68,0.7); }
  40%{ transform: scale(0.95) translateX(-4px); }
  60%{ transform: scale(1.02) translateX(4px); }
  100%{ transform: scale(1) translateX(0); }
}
@keyframes cgActionTargetHeal{
  0%{ transform: scale(1); }
  40%{ transform: scale(1.12); box-shadow: 0 0 22px 6px rgba(34,197,94,0.7); }
  100%{ transform: scale(1); }
}
@keyframes cgActionArrow{
  0%{ transform: translateX(-14px) scale(0.5); opacity: 0; }
  60%{ transform: translateX(0) scale(1.2); opacity: 1; }
  100%{ transform: translateX(0) scale(1); }
}
@keyframes cgActionCardPop{
  0%{ transform: scale(0.4) rotate(-12deg); opacity: 0; }
  60%{ transform: scale(1.15) rotate(4deg); opacity: 1; }
  100%{ transform: scale(1) rotate(0); }
}

/* 플레이어 스트립 펄스 — 시전자/타깃 강조 */
.cg-player.cg-player-pulse-actor{
  animation: cgPlayerPulseActor 0.85s ease-out;
}
.cg-player.cg-player-pulse-target{
  animation: cgPlayerPulseTarget 0.85s ease-out;
}
.cg-player.cg-player-pulse-target.cg-player-pulse-support{
  animation: cgPlayerPulseSupport 0.85s ease-out;
}
.cg-player.cg-player-pulse-target.cg-player-pulse-defense{
  animation: cgPlayerPulseDefense 0.85s ease-out;
}
@keyframes cgPlayerPulseActor{
  0%, 100%{ box-shadow: none; }
  50%{ box-shadow: 0 0 0 3px rgba(255,209,102,0.7), 0 0 20px rgba(255,209,102,0.55); }
}
@keyframes cgPlayerPulseTarget{
  0%, 100%{ box-shadow: none; transform: translateX(0); }
  25%{ box-shadow: 0 0 0 3px rgba(239,68,68,0.7), 0 0 24px rgba(239,68,68,0.55); transform: translateX(-3px); }
  50%{ transform: translateX(3px); }
  75%{ transform: translateX(-2px); }
}
@keyframes cgPlayerPulseSupport{
  0%, 100%{ box-shadow: none; }
  50%{ box-shadow: 0 0 0 3px rgba(34,197,94,0.7), 0 0 22px rgba(34,197,94,0.55); }
}
@keyframes cgPlayerPulseDefense{
  0%, 100%{ box-shadow: none; }
  50%{ box-shadow: 0 0 0 3px rgba(59,130,246,0.7), 0 0 22px rgba(59,130,246,0.55); }
}

@media (max-width: 640px){
  .cg-action-moment{ gap: 8px; padding: 10px 12px; }
  .cg-action-side{ min-width: 56px; max-width: 70px; }
  .cg-action-side .cg-action-avatar{ width: 42px !important; height: 42px !important; font-size: 19px !important; }
  .cg-action-name{ font-size: 10px; max-width: 64px; }
  .cg-action-arrow{ font-size: 22px; }
  .cg-action-emoji{ font-size: 28px; }
  .cg-action-label{ font-size: 11px; }
  .cg-action-card{ padding: 6px 10px; }
}
.cg-players-grouped {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cg-team-block {
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  padding: 6px 8px;
  border: 1px solid #2c3445;
}
.cg-team-block-0 { border-left: 3px solid #ef4444; }
.cg-team-block-1 { border-left: 3px solid #3b82f6; }
.cg-team-block-2 { border-left: 3px solid #22c55e; }
.cg-team-block-3 { border-left: 3px solid #facc15; }
.cg-team-block-head {
  font-size: 11px;
  color: #9aa7bd;
  margin-bottom: 6px;
  font-weight: 700;
}
.cg-team-block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}
/* (.cg-player 정의는 상단으로 통합 — 중복 제거) */

/* ===== Turn bar ===== */
.cg-turn-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a2030;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #2c3445;
}
.cg-turn-info { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.cg-turn-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.cg-deck-chip { color: #9aa7bd; }
.cg-timer {
  background: #2c3445;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
}

/* ===== Stack area ===== */
.cg-stack-area {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}
.cg-stack-area:not(:empty) {
  padding: 14px;
  background:
    radial-gradient(ellipse at center, rgba(250, 204, 21, 0.12) 0%, transparent 70%),
    rgba(250, 204, 21, 0.04);
  border: 2px dashed rgba(250, 204, 21, 0.5);
  border-radius: 14px;
  box-shadow: inset 0 0 30px rgba(250, 204, 21, 0.08);
  animation: cgStackGlow 2s ease-in-out infinite;
}
@keyframes cgStackGlow {
  0%,100% { box-shadow: inset 0 0 30px rgba(250, 204, 21, 0.08), 0 0 0 0 rgba(250, 204, 21, 0); }
  50% { box-shadow: inset 0 0 40px rgba(250, 204, 21, 0.15), 0 0 0 4px rgba(250, 204, 21, 0.1); }
}
.cg-stack-frame {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1a2030 0%, #232a3e 100%);
  border-radius: 10px;
  font-size: 13px;
  flex-wrap: wrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: cgStackFrameIn 0.4s cubic-bezier(.34,1.56,.64,1);
  position: relative;
}
@keyframes cgStackFrameIn {
  0% { transform: translateY(-15px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.cg-stack-attack {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, #2a1620 0%, #1a2030 50%);
}
.cg-stack-attack::before {
  content: "⚔️"; position: absolute; top: 6px; right: 8px; font-size: 14px; opacity: 0.4;
}
.cg-stack-reaction {
  border-left: 4px solid #22c55e;
  background: linear-gradient(135deg, #16241c 0%, #1a2030 50%);
}
.cg-stack-reaction::before {
  content: "🛡"; position: absolute; top: 6px; right: 8px; font-size: 14px; opacity: 0.4;
}
.cg-stack-actor, .cg-stack-target { font-weight: 700; }
.cg-stack-card { color: #facc15; font-weight: 800; text-shadow: 0 0 8px rgba(250, 204, 21, 0.4); }
.cg-stack-arrow { color: #9aa7bd; font-size: 16px; }
.cg-stack-mods { font-size: 11px; padding: 3px 9px; background: #2c3445; border-radius: 6px; color: #d8dfee; font-weight: 600; }
.cg-stack-reaction-hint {
  font-size: 13px;
  font-weight: 700;
  color: #facc15;
  text-align: center;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(250, 204, 21, 0.1);
  border-radius: 8px;
  animation: cgPulse 1s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}
@keyframes cgPulse { 0%,100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.02); } }

/* ===== Event toast ===== */
.cg-event-toast {
  position: relative;
  margin: 8px 0;
  padding: 16px 18px;
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 50%, #ea580c 100%);
  color: #1a2030;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(250, 204, 21, 0.45), inset 0 1px 0 rgba(255,255,255,0.3);
  animation: cgEventIn .5s cubic-bezier(.34,1.56,.64,1);
  letter-spacing: 0.3px;
  overflow: hidden;
}
.cg-event-toast::before {
  content: "";
  position: absolute; top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: cgEventShine 2s ease-in-out infinite;
}
@keyframes cgEventIn {
  0% { transform: translateY(-20px) scale(0.8); opacity: 0; }
  60% { transform: translateY(0) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
@keyframes cgEventShine {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

/* ===== Hand ===== */
.cg-hand-wrap {
  margin-top: 12px;
  padding: 14px 12px 18px;
  background: linear-gradient(180deg, #161b29 0%, #1f263a 100%);
  border-radius: 14px;
  border: 1px solid #2c3445;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.cg-hand-label {
  font-size: 12px; color: #b8c4dd;
  margin-bottom: 12px; font-weight: 800;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.cg-hand {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 4px 8px;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
  perspective: 800px;
}
/* 부채꼴 효과 — 카드 수에 따라 살짝 회전 */
.cg-hand .cg-card:nth-child(1) { transform: rotate(-3deg); }
.cg-hand .cg-card:nth-child(2) { transform: rotate(-1.5deg); }
.cg-hand .cg-card:nth-child(3) { transform: rotate(0deg); }
.cg-hand .cg-card:nth-child(4) { transform: rotate(1.5deg); }
.cg-hand .cg-card:nth-child(5) { transform: rotate(3deg); }
.cg-hand .cg-card:nth-child(6) { transform: rotate(4.5deg); }
.cg-hand .cg-card:nth-child(7) { transform: rotate(6deg); }
/* 데스크탑은 부채꼴, 모바일은 가로 스크롤 평면 */
@media (max-width: 720px) {
  .cg-hand { justify-content: flex-start; perspective: none; }
  .cg-hand .cg-card { transform: none !important; }
}
.cg-card {
  flex: 0 0 auto;
  width: 116px;
  min-height: 160px;
  padding: 12px 10px 10px;
  background: linear-gradient(155deg, #1a2030 0%, #232a3e 100%);
  border: 2px solid #2c3445;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, filter .15s;
  user-select: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: cgCardSpawn 0.4s cubic-bezier(.34,1.56,.64,1);
}
/* 카드 등장 spawn */
@keyframes cgCardSpawn {
  0% { transform: translateY(40px) scale(0.6) rotate(-8deg); opacity: 0; }
  60% { transform: translateY(-4px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); }
}
/* 카드 안쪽 빛 효과 */
.cg-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at top, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.cg-card:not(.disabled):hover {
  transform: translateY(-10px) scale(1.04) rotate(0deg) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,0.5), 0 0 0 2px var(--cg-card-accent, #facc15), inset 0 1px 0 rgba(255,255,255,0.1);
  filter: brightness(1.08);
  z-index: 10;
}
.cg-card.disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.5); }
.cg-card-emoji {
  font-size: 36px;
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  filter: drop-shadow(0 0 6px var(--cg-card-glow, rgba(255,255,255,0.15)));
}
.cg-card-name {
  font-size: 13px; font-weight: 800; margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.cg-card-text {
  font-size: 10px; color: #d8dfee; line-height: 1.35; flex: 1;
  opacity: 0.95;
}
.cg-card-type {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(0,0,0,0.35);
  color: var(--cg-card-accent, #9aa7bd);
  margin-top: 8px;
  letter-spacing: 1px;
  font-weight: 800;
  border: 1px solid var(--cg-card-accent, #2c3445);
}

/* 카드 종류별 그라데이션 + 글로우 */
.cg-card-attack {
  --cg-card-accent: #ff6b6b;
  --cg-card-glow: rgba(255, 107, 107, 0.4);
  border-color: rgba(239, 68, 68, 0.65);
  background: linear-gradient(155deg, #2a1820 0%, #3a1a24 50%, #2a1820 100%);
}
.cg-card-defense {
  --cg-card-accent: #4ecdc4;
  --cg-card-glow: rgba(78, 205, 196, 0.4);
  border-color: rgba(59, 130, 246, 0.75);
  background: linear-gradient(155deg, #16242e 0%, #1a3140 50%, #16242e 100%);
}
.cg-card-reaction {
  --cg-card-accent: #66e9a8;
  --cg-card-glow: rgba(102, 233, 168, 0.4);
  border-color: rgba(34, 197, 94, 0.75);
  background: linear-gradient(155deg, #16261d 0%, #1a3d2a 50%, #16261d 100%);
}
.cg-card-support {
  --cg-card-accent: #8be0a8;
  --cg-card-glow: rgba(139, 224, 168, 0.35);
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(155deg, #19281f 0%, #1d3325 50%, #19281f 100%);
}
.cg-card-special {
  --cg-card-accent: #c084fc;
  --cg-card-glow: rgba(192, 132, 252, 0.45);
  border-color: rgba(168, 85, 247, 0.75);
  background: linear-gradient(155deg, #261a30 0%, #36213e 50%, #261a30 100%);
}

/* 카드 사용 시 던지는 모션 */
.cg-card.cg-card-throwing {
  animation: cgCardThrow 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes cgCardThrow {
  0% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
  60% { transform: translateY(-100px) scale(1.2) rotate(-12deg); opacity: 1; filter: brightness(1.4); }
  100% { transform: translateY(-200px) scale(0.7) rotate(-25deg); opacity: 0; }
}

.cg-card-pass-btn {
  flex: 0 0 auto;
  align-self: center;
  padding: 10px 16px;
  background: #2c3445;
  color: #e6ebf5;
  border: 1px solid #3b4356;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}

.cg-hand-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.cg-hand-actions button {
  padding: 8px 14px;
  background: #2c3445;
  color: #e6ebf5;
  border: 1px solid #3b4356;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* ===== Target picker ===== */
.cg-target-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.cg-target-modal {
  background: #1a2030;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  border: 1px solid #2c3445;
}
.cg-target-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.cg-target-card-preview {
  background: #161b29;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.cg-target-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.cg-target-btn {
  padding: 12px;
  background: #161b29;
  color: #e6ebf5;
  border: 2px solid #2c3445;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.cg-target-btn span { font-size: 11px; color: #9aa7bd; }
.cg-target-btn:hover { transform: translateY(-1px); }
.cg-target-cancel {
  width: 100%;
  padding: 10px;
  background: #2c3445;
  color: #e6ebf5;
  border: 1px solid #3b4356;
  border-radius: 8px;
  cursor: pointer;
}

/* ===== Ending ===== */
.cg-winner-card {
  background: #1a2030;
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
}
.cg-result-row {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #161b29;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* 결과 팀 블록 (팀전) */
.cg-result-team {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.cg-result-team.winner {
  background: linear-gradient(135deg, rgba(250,204,21,0.14), rgba(250,204,21,0.04));
  border-color: rgba(250,204,21,0.55);
  box-shadow: 0 0 20px rgba(250,204,21,0.2);
}
.cg-result-team-0 { border-left: 4px solid #ef4444; }
.cg-result-team-1 { border-left: 4px solid #3b82f6; }
.cg-result-team-2 { border-left: 4px solid #22c55e; }
.cg-result-team-3 { border-left: 4px solid #fbbf24; }
.cg-result-team-head {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  color: #fff;
}
.cg-result-team.winner .cg-result-team-head {
  color: #fde68a;
  text-shadow: 0 0 8px rgba(250,204,21,0.4);
}
.cg-result-team-rows .cg-result-row {
  background: rgba(0,0,0,0.25);
  margin-bottom: 4px;
}
.cg-result-team-rows .cg-result-row:last-child { margin-bottom: 0; }
.cg-result-avatar {
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  flex: 0 0 auto;
}
.cg-result-row.winner .cg-result-avatar {
  border-color: rgba(250, 204, 21, 0.7);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.35);
}
.cg-result-row.me .cg-result-avatar {
  border-color: rgba(56, 189, 248, 0.65);
}
.cg-result-row.winner.me .cg-result-avatar {
  border-color: rgba(250, 204, 21, 0.75);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.4);
}
.cg-result-row.winner {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.18) 0%, rgba(250, 204, 21, 0.06) 100%);
  border: 1px solid rgba(250, 204, 21, 0.45);
}
.cg-result-row.me {
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.22);
}
.cg-result-row.winner.me {
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.32), 0 0 12px rgba(56, 189, 248, 0.2);
}
.cg-result-me-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: rgba(56,189,248,0.18);
  border: 1px solid rgba(56,189,248,0.5);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #7dd3fc;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .cg-card { width: 96px; min-height: 132px; padding: 8px 6px; }
  .cg-card-emoji { font-size: 26px; }
  .cg-card-name { font-size: 12px; }
  .cg-card-text { font-size: 9px; }
  .cg-target-list { grid-template-columns: 1fr; }
  .cg-players-strip { grid-template-columns: repeat(2, 1fr); }
  .cg-team-block-grid { grid-template-columns: repeat(2, 1fr); }
  .cg-team-roster-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 궁극기 게이지 + 모달 ===== */
.cg-gauge-wrap {
  margin-top: 10px; padding: 8px 12px;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(155,89,182,0.4);
  border-radius: 10px;
}
.cg-gauge-bar {
  height: 10px; background: rgba(0,0,0,0.5);
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(155,89,182,0.5);
  position: relative;
}
.cg-gauge-fill {
  height: 100%; transition: width 0.35s ease-out;
  background: linear-gradient(90deg, #9b59b6 0%, #c084fc 50%, #ffd166 100%);
}
.cg-gauge-fill.cg-gauge-ready { animation: cg-gauge-pulse 0.8s ease-in-out infinite; }
@keyframes cg-gauge-pulse {
  0%,100% { box-shadow: 0 0 6px rgba(255,209,102,0.5); filter: brightness(1); }
  50%     { box-shadow: 0 0 24px rgba(255,209,102,0.95); filter: brightness(1.4); }
}
.cg-gauge-text { font-size: 11px; font-weight: 700; color: #c084fc; margin-top: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.cg-gauge-text-ready { color: #ffd166; font-size: 13px; font-weight: 900; animation: cg-gauge-pulse 0.8s ease-in-out infinite; }

.cg-btn-ultimate {
  background: linear-gradient(135deg, #9b59b6, #c084fc 50%, #ffd166 100%);
  color: #1a1f2e; border: 0; border-radius: 10px;
  padding: 10px 14px; font-weight: 900; font-size: 14px;
  cursor: pointer; box-shadow: 0 0 18px rgba(192,132,252,0.6);
  animation: cg-ult-btn-pulse 0.8s ease-in-out infinite;
}
@keyframes cg-ult-btn-pulse { 0%,100% { transform: scale(1); box-shadow: 0 0 18px rgba(192,132,252,0.6); } 50% { transform: scale(1.06); box-shadow: 0 0 30px rgba(255,209,102,0.85); } }

.cg-ult-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 2500;
}
.cg-ult-overlay.hidden { display: none; }
.cg-ult-modal {
  background: linear-gradient(145deg, #2a1a3d 0%, #1a0f24 100%);
  border: 2px solid #c084fc; border-radius: 16px;
  padding: 22px 18px; max-width: 480px; width: 90%;
  box-shadow: 0 0 60px rgba(192,132,252,0.5);
}
.cg-ult-title {
  font-size: 20px; font-weight: 900; text-align: center;
  background: linear-gradient(135deg, #c084fc, #ffd166);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 14px;
}
.cg-ult-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cg-ult-card {
  background: linear-gradient(145deg, #1f1230 0%, #0f0818 100%);
  border: 2px solid #6e44a3; border-radius: 12px;
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; color: #fff; transition: all 0.15s;
}
.cg-ult-card:hover {
  background: linear-gradient(145deg, #c084fc 0%, #9b59b6 100%);
  color: #1a1f2e; border-color: #ffd166;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(192,132,252,0.6);
}
.cg-ult-emoji { font-size: 32px; }
.cg-ult-name { font-size: 12px; font-weight: 900; }
.cg-ult-desc { font-size: 10px; line-height: 1.4; text-align: center; opacity: 0.85; }
.cg-ult-cancel {
  margin-top: 14px; width: 100%; padding: 10px;
  background: rgba(0,0,0,0.4); border: 1px solid #6e44a3; border-radius: 8px;
  color: #c084fc; font-weight: 800; cursor: pointer;
}
.cg-ult-cancel:hover { background: #6e44a3; color: #fff; }

.cg-ult-flash {
  position: fixed; inset: 0; z-index: 3000;
  background: radial-gradient(circle at center, rgba(192,132,252,0.6) 0%, rgba(155,89,182,0.3) 40%, transparent 75%);
  pointer-events: none; animation: cg-ult-flash 1.2s ease-out forwards;
}
@keyframes cg-ult-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.cg-ult-banner {
  position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
  font-size: 32px; font-weight: 900;
  background: linear-gradient(135deg, #ffd166, #c084fc 50%, #9b59b6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(255,209,102,0.7);
  z-index: 3001; pointer-events: none;
  animation: cg-ult-banner 1.6s ease-out forwards;
}
@keyframes cg-ult-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 640px) {
  .cg-ult-grid { grid-template-columns: repeat(2, 1fr); }
  .cg-ult-emoji { font-size: 26px; }
}

/* 본인 KO — 관전 모드 시각 처리 */
/* KO 시 손패 dim — 부모 opacity 대신 자식 개별 적용 (::after 칩이 같이 흐려지지 않게) */
.cg-play-ko .cg-hand-wrap{
  position: relative;
  pointer-events: none;
}
.cg-play-ko .cg-hand-label,
.cg-play-ko .cg-hand{
  opacity: 0.42;
  filter: grayscale(0.55);
}
.cg-play-ko .cg-hand-wrap::after{
  content: "💀  KO  ·  관전 중";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 22px;
  background: rgba(20, 14, 24, 0.94);
  color: #f87171;
  border: 1.5px solid rgba(248, 113, 113, 0.7);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 0 28px rgba(248, 113, 113, 0.35);
  z-index: 2;
}
.cg-play-ko .cg-action-area,
.cg-play-ko .cg-gauge-wrap{
  opacity: 0.5;
  filter: grayscale(0.5);
  pointer-events: none;
}

/* 짧은 뷰포트 컴팩트 — 손패/카드/HP 축소 */
@media (max-height: 720px){
  .cg-hand-label{ font-size: 11px; }
  .cg-ult-emoji{ font-size: 24px; }
}
@media (max-height: 560px){
  .cg-hand-wrap{ padding-top: 6px; }
  .cg-hand-label{ display: none; }
  .cg-ult-emoji{ font-size: 20px; }
}
