*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg-dark: #08080f;
  --bg-panel: rgba(22, 22, 40, 0.85);
  --bg-card: #16213e;
  --accent-gold: #f5a623;
  --accent-red: #e94560;
  --accent-blue: #4fc3f7;
  --accent-green: #66bb6a;
  --accent-purple: #ab47bc;
  --accent-orange: #ff7043;
  --text-primary: #fffffe;
  --text-secondary: #8b8da8;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --card-width: 118px;
  --card-height: 168px;
  --glass: rgba(255, 255, 255, 0.04);
}
body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(233, 69, 96, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(79, 195, 247, 0.08) 0%, transparent 50%);
}
body.defeat-vignette::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 90;
  animation: vignetteIn 0.8s forwards;
}
@keyframes vignetteIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* Ambient canvas */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
/* FX Layer */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 75;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
.screen-flash.active {
  opacity: 1;
  transition: opacity 0.05s ease-in;
}
#app {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Header */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 12px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245,166,35,0.2), rgba(233,69,96,0.2));
  border: 1px solid rgba(245,166,35,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.header h1 {
  font-size: 1.25rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
}
.header-center {
  text-align: center;
}
.turn-counter {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--accent-gold);
  letter-spacing: 3px;
  margin-bottom: 2px;
}
#turn-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--glass);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover {
  background: rgba(255,255,255,0.08);
  transform: scale(1.05);
}
.icon-btn.muted {
  opacity: 0.5;
}
.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge.player-turn {
  background: rgba(79, 195, 247, 0.2);
  color: var(--accent-blue);
  border: 1px solid rgba(79, 195, 247, 0.3);
}
.badge.enemy-turn {
  background: rgba(233, 69, 96, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(233, 69, 96, 0.3);
}
.badge-pulse {
  animation: badgePulse 0.8s ease;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.15); box-shadow: 0 0 16px currentColor; }
  60% { transform: scale(0.95); }
}
/* Battlefield */
.battlefield {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fighter-area {
  border-radius: 18px;
  padding: 18px 20px;
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s;
  box-shadow: var(--shadow);
}
.area-label {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 6px;
  opacity: 0.7;
}
.enemy-label {
  color: var(--accent-red);
  background: rgba(233,69,96,0.12);
  border: 1px solid rgba(233,69,96,0.2);
}
.player-label {
  color: var(--accent-blue);
  background: rgba(79,195,247,0.12);
  border: 1px solid rgba(79,195,247,0.2);
}
.hand-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin: 10px 0 6px;
  letter-spacing: 1px;
}
.hand-label span {
  color: var(--accent-gold);
  font-weight: 700;
}
.fighter-area.buff-aura {
  box-shadow: 0 0 30px rgba(171, 71, 188, 0.4), inset 0 0 20px rgba(171, 71, 188, 0.1);
}
.fighter-area.buff-aura::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 2px solid rgba(171, 71, 188, 0.5);
  animation: auraPulse 1.2s ease-out;
  pointer-events: none;
}
@keyframes auraPulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}
.enemy-area {
  background: linear-gradient(180deg, rgba(233, 69, 96, 0.08) 0%, var(--bg-panel) 60%);
}
.enemy-area::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
  opacity: 0.5;
}
.player-area {
  background: linear-gradient(0deg, rgba(79, 195, 247, 0.08) 0%, var(--bg-panel) 60%);
}
.player-area::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0.5;
}
.fighter-info, .player-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.player-top-row {
  margin-bottom: 4px;
}
.player-stats-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.stat-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fighter-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.avatar-emoji {
  font-size: 2rem;
  z-index: 1;
}
.avatar-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid;
  opacity: 0.5;
}
.enemy-avatar {
  background: rgba(233, 69, 96, 0.15);
}
.enemy-avatar .avatar-ring {
  border-color: var(--accent-red);
  animation: ringPulse 3s infinite;
}
.player-avatar {
  background: rgba(79, 195, 247, 0.15);
}
.player-avatar .avatar-ring {
  border-color: var(--accent-blue);
  animation: ringPulse 3s infinite 1.5s;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.08); opacity: 0.8; }
}
.fighter-avatar.avatar-hit {
  animation: avatarHit 0.5s ease;
}
@keyframes avatarHit {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-10deg); }
  40% { transform: translateX(8px) rotate(10deg); }
  60% { transform: translateX(-4px) rotate(-5deg); }
  80% { transform: translateX(4px) rotate(5deg); }
}
/* HP Bar */
.hp-bar-container {
  position: relative;
  height: 24px;
  margin: 2px 0;
  min-width: 160px;
}
.hp-bar-container.small,
.stat-block .hp-bar-container {
  height: 22px;
}
.hp-bar-track {
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.hp-bar {
  height: 100%;
  border-radius: 11px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.hp-bar.hp-critical {
  animation: hpCritical 1s infinite;
}
@keyframes hpCritical {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}
.hp-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: hpShine 3s infinite;
}
@keyframes hpShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
.enemy-hp {
  background: linear-gradient(90deg, #c62828, var(--accent-red));
}
.player-hp {
  background: linear-gradient(90deg, #2e7d32, var(--accent-green));
}
.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.fighter-stats h2 {
  font-size: 1.1rem;
  font-weight: 700;
}
.status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.status-pill.active {
  color: var(--text-primary);
}
.status-pill.shield.active {
  background: rgba(79,195,247,0.15);
  border-color: rgba(79,195,247,0.3);
  color: var(--accent-blue);
}
.status-pill.buff.active {
  background: rgba(171,71,188,0.15);
  border-color: rgba(171,71,188,0.3);
  color: var(--accent-purple);
}
.status-pill.deck.active {
  color: var(--accent-gold);
}
.pill-val {
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
}
/* Player stats - legacy cleanup */
.player-stats-bar,
.status-group {
  display: flex;
  gap: 10px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.energy-display {
  display: flex;
  gap: 4px;
}
.energy-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(245, 166, 35, 0.3);
  transition: all 0.3s;
}
.energy-orb.active {
  background: radial-gradient(circle at 35% 35%, #ffe082, var(--accent-gold));
  border-color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.5);
}
.energy-orb.energy-spend {
  animation: energySpend 0.4s ease forwards;
}
@keyframes energySpend {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; box-shadow: 0 0 20px var(--accent-gold); }
  100% { transform: scale(0); opacity: 0; }
}
/* Center area */
.center-area {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
  padding: 4px 0;
}
.center-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.battle-log-header {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.vs-badge {
  align-self: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245,166,35,0.15);
  border: 1px solid rgba(245,166,35,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--accent-gold);
  animation: vsPulse 2s infinite;
  margin-bottom: 4px;
}
.battle-log {
  flex: 1;
  height: 72px;
  overflow-y: auto;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  font-size: 0.78rem;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
/* Card preview */
.card-preview {
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  min-height: 160px;
}
.preview-placeholder {
  text-align: center;
  color: var(--text-secondary);
}
.preview-placeholder .preview-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.4;
}
.preview-placeholder p {
  font-size: 0.82rem;
}
.preview-hint {
  font-size: 0.68rem !important;
  margin-top: 6px;
  opacity: 0.6;
}
.preview-card {
  width: 100%;
  text-align: center;
}
.preview-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 8px;
}
.preview-type {
  color: var(--text-secondary);
  letter-spacing: 1px;
}
.preview-cost {
  color: var(--accent-gold);
  font-weight: 700;
}
.preview-icon-lg {
  font-size: 2.2rem;
  margin: 6px 0;
}
.preview-name {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 4px;
}
.preview-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  margin: 6px 0;
}
.preview-card.type-attack .preview-value { color: var(--accent-red); }
.preview-card.type-shield .preview-value { color: var(--accent-blue); }
.preview-card.type-heal .preview-value { color: var(--accent-green); }
.preview-card.type-buff .preview-value { color: var(--accent-purple); }
.preview-card.type-draw .preview-value { color: var(--accent-orange); }
.preview-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.preview-rarity {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
}
.preview-rarity.rarity-rare { color: var(--accent-blue); }
.preview-rarity.rarity-epic { color: var(--accent-purple); }
.btn-preview-play {
  width: 100%;
  margin-top: 10px;
  padding: 8px !important;
  font-size: 0.85rem !important;
  justify-content: center;
}
.log-entry {
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}
.log-entry.attack { color: var(--accent-red); }
.log-entry.shield { color: var(--accent-blue); }
.log-entry.heal { color: var(--accent-green); }
.log-entry.buff { color: var(--accent-purple); }
.log-entry.draw { color: var(--accent-orange); }
.log-entry.turn { color: var(--accent-gold); font-weight: 700; }
.log-entry.system { color: var(--text-secondary); }
.log-entry.victory { color: var(--accent-gold); font-weight: 700; }
.log-entry.defeat { color: var(--accent-red); font-weight: 700; }
.log-entry.error { color: var(--accent-red); }
@keyframes vsPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
/* Hand area */
.hand-area {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: calc(var(--card-height) + 20px);
  padding: 10px 8px 4px;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.06);
}
.player-hand .card {
  transform: translateY(var(--fan-y, 0)) rotate(var(--fan-rotate, 0deg));
}
.player-hand .card:hover {
  transform: translateY(calc(var(--fan-y, 0px) - 12px)) rotate(var(--fan-rotate, 0deg)) scale(1.04);
  z-index: 10;
}
.player-hand .card.selected {
  transform: translateY(calc(var(--fan-y, 0px) - 20px)) rotate(var(--fan-rotate, 0deg)) scale(1.06);
}
.enemy-hand .card {
  opacity: 0.7;
}
.enemy-hand .card .card-info,
.enemy-hand .card .card-cover-art {
  visibility: hidden;
}
.enemy-hand .card .card-back {
  display: flex;
}
.card-face.card-back {
  background: linear-gradient(135deg, #1a1035, #0d0820);
  border-color: rgba(171, 71, 188, 0.4);
  align-items: center;
  justify-content: center;
}
.card-back-pattern {
  position: absolute;
  inset: 8px;
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(171, 71, 188, 0.08) 6px,
    rgba(171, 71, 188, 0.08) 12px
  );
  border: 1px solid rgba(171, 71, 188, 0.2);
}
.card-back-icon {
  font-size: 2rem;
  opacity: 0.3;
  z-index: 1;
}
.card-back-logo {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.5;
  z-index: 1;
}
/* Card cover art */
.card-cover {
  position: relative;
  flex: 1;
  min-height: 72px;
  margin: 22px 0 4px;
  border-radius: 6px;
  overflow: hidden;
}
.card-cover-bg {
  position: absolute;
  inset: 0;
  opacity: 0.85;
}
.cover-attack .card-cover-bg { background: linear-gradient(160deg, #4a1010, #1a0505); }
.cover-shield .card-cover-bg { background: linear-gradient(160deg, #0a2540, #051525); }
.cover-heal .card-cover-bg { background: linear-gradient(160deg, #0a3015, #051a0a); }
.cover-buff .card-cover-bg { background: linear-gradient(160deg, #2a1040, #150820); }
.cover-draw .card-cover-bg { background: linear-gradient(160deg, #3a2010, #1a1008); }
.card-cover-art {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.cover-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.card-cover-frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  pointer-events: none;
}
.card-cover-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.cover-rare .card-cover-frame {
  border-color: rgba(79, 195, 247, 0.4);
  box-shadow: inset 0 0 8px rgba(79,195,247,0.15);
}
.cover-epic .card-cover-frame {
  border-color: rgba(171, 71, 188, 0.5);
  box-shadow: inset 0 0 12px rgba(171,71,188,0.2);
  animation: epicShimmer 3s infinite;
}
.card-info {
  text-align: center;
  padding-top: 2px;
  position: relative;
  z-index: 2;
}
.card-info .card-name {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-info .card-value {
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.2;
}
.card-info .card-desc {
  font-size: 0.58rem;
  color: var(--text-secondary);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-icon {
  display: none;
}
/* Cards */
.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  flex-shrink: 0;
  animation: cardDeal 0.4s ease backwards;
}
@keyframes cardDeal {
  from { opacity: 0; transform: translateY(30px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card .card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card.type-attack .card-glow { box-shadow: 0 0 20px rgba(233,69,96,0.5); }
.card.type-shield .card-glow { box-shadow: 0 0 20px rgba(79,195,247,0.5); }
.card.type-heal .card-glow { box-shadow: 0 0 20px rgba(102,187,106,0.5); }
.card.type-buff .card-glow { box-shadow: 0 0 20px rgba(171,71,188,0.5); }
.card.type-draw .card-glow { box-shadow: 0 0 20px rgba(255,112,67,0.5); }
.card:hover .card-glow,
.card.selected .card-glow {
  opacity: 1;
}
.card.rarity-rare .card-face {
  box-shadow: inset 0 0 12px rgba(79,195,247,0.2);
}
.card.rarity-epic .card-face {
  box-shadow: inset 0 0 16px rgba(171,71,188,0.3);
  animation: epicShimmer 3s infinite;
}
@keyframes epicShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}
.card:hover {
  z-index: 10;
}
.card.selected {
  box-shadow: 0 0 24px rgba(245, 166, 35, 0.5);
}
.card.unplayable {
  opacity: 0.45;
  cursor: not-allowed;
}
.card.unplayable:hover {
  transform: none;
}
.card.playing {
  animation: playCard 0.5s forwards;
}
@keyframes playCard {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2) translateY(-30px); opacity: 0.8; }
  100% { transform: scale(0) translateY(-60px); opacity: 0; }
}
.card-face {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  border: 2px solid;
  position: relative;
  overflow: hidden;
}
.card-face::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background: radial-gradient(circle at 50% 0%, white, transparent 70%);
}
.card.type-attack .card-face {
  background: linear-gradient(135deg, #3e1515, #1a0a0a);
  border-color: var(--accent-red);
}
.card.type-shield .card-face {
  background: linear-gradient(135deg, #0d2137, #0a1628);
  border-color: var(--accent-blue);
}
.card.type-heal .card-face {
  background: linear-gradient(135deg, #0d2e14, #0a1f0d);
  border-color: var(--accent-green);
}
.card.type-buff .card-face {
  background: linear-gradient(135deg, #2d1045, #1a0a2e);
  border-color: var(--accent-purple);
}
.card.type-draw .card-face {
  background: linear-gradient(135deg, #3e2010, #1f1008);
  border-color: var(--accent-orange);
}
.card-type-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.55rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0,0,0,0.4);
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  z-index: 3;
}
.card-cost {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe082, var(--accent-gold));
  color: #1a1a2e;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 3;
}
.card-icon {
  text-align: center;
  font-size: 2rem;
  margin: 12px 0 4px;
}
.card-name {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.card-value {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  margin: auto 0 4px;
}
.card-desc {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-secondary);
  line-height: 1.3;
}
.card-back-icon {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  height: 100%;
  opacity: 0.4;
}
.card-rarity {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.6rem;
  opacity: 0.5;
}
.rarity-rare::after { content: '★'; color: var(--accent-blue); }
.rarity-epic::after { content: '★★'; color: var(--accent-purple); }
/* Action bar */
.action-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #e68a00);
  color: #1a1a2e;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.4);
}
.btn-secondary {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(79, 195, 247, 0.3);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(79, 195, 247, 0.25);
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-large {
  padding: 14px 40px;
  font-size: 1.1rem;
}
/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: modalIn 0.4s ease;
}
@keyframes modalIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}
.modal h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.modal p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}
/* Damage flash */
.damage-flash {
  animation: damageFlash 0.6s;
}
@keyframes damageFlash {
  0%, 100% { filter: none; }
  15% { filter: brightness(2) saturate(3); background-color: rgba(233,69,96,0.15); }
  30% { filter: brightness(0.8); }
  45% { filter: brightness(1.5) saturate(2); }
}
.heal-flash {
  animation: healFlash 0.6s;
}
@keyframes healFlash {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.4) hue-rotate(60deg); background-color: rgba(102,187,106,0.1); }
}
/* Screen shake */
.screen-shake {
  animation: screenShake 0.45s ease;
}
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(calc(var(--shake-intensity) * -0.8), calc(var(--shake-intensity) * 0.5)); }
  20% { transform: translate(calc(var(--shake-intensity) * 0.6), calc(var(--shake-intensity) * -0.7)); }
  30% { transform: translate(calc(var(--shake-intensity) * -0.5), calc(var(--shake-intensity) * -0.4)); }
  40% { transform: translate(calc(var(--shake-intensity) * 0.7), calc(var(--shake-intensity) * 0.3)); }
  50% { transform: translate(calc(var(--shake-intensity) * -0.3), calc(var(--shake-intensity) * 0.6)); }
  60% { transform: translate(calc(var(--shake-intensity) * 0.4), calc(var(--shake-intensity) * -0.2)); }
  70% { transform: translate(calc(var(--shake-intensity) * -0.2), calc(var(--shake-intensity) * 0.1)); }
}
/* Floating numbers */
.float-number {
  position: fixed;
  font-size: 1.6rem;
  font-weight: 900;
  pointer-events: none;
  animation: floatUp 1s forwards;
  z-index: 85;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  transform: translateX(-50%);
}
.float-number.damage {
  color: var(--accent-red);
  font-size: 1.8rem;
}
.float-number.damage.crit {
  font-size: 2.4rem;
  color: #ff1744;
  animation: critFloat 1.4s forwards;
  text-shadow:0 0 24px #ff1744,0 2px 10px rgba(0,0,0,0.9);
}
.float-number.heal { color: var(--accent-green); }
.float-number.shield { color: var(--accent-blue); }
.float-number.buff { color: var(--accent-purple); }
@keyframes floatUp {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  20% { transform: translateX(-50%) translateY(-10px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(0.8); }
}
@keyframes critFloat {
  0% { opacity: 0; transform: translateX(-50%) scale(0.3); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.5); }
  30% { transform: translateX(-50%) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-80px) scale(1); }
}
/* Burst text */
.burst-text {
  position: fixed;
  font-size: 1.3rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 85;
  transform: translateX(-50%);
  animation: burstText 0.9s forwards;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.burst-text.crit { color: #ff1744; font-size: 1.8rem; }
.burst-text.buff { color: var(--accent-purple); }
.burst-text.draw { color: var(--accent-orange); }
@keyframes burstText {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.3); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(1); }
}
/* Particles */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 82;
  animation: particleBurst 0.8s ease-out forwards;
}
.particle-damage { animation-duration: 0.7s; }
.particle-heal { border-radius: 2px; animation: particleRise 1s ease-out forwards; }
.particle-shield { border-radius: 2px; animation: particleShield 0.9s ease-out forwards; }
.particle-buff { animation: particleSpark 0.9s ease-out forwards; }
@keyframes particleBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}
@keyframes particleRise {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.3); }
}
@keyframes particleShield {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(2) translateY(-20px); }
}
@keyframes particleSpark {
  0% { opacity: 1; transform: translate(0,0) scale(1); box-shadow: 0 0 6px currentColor; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}
/* FX Ring */
.fx-ring {
  position: fixed;
  border: 3px solid;
  border-radius: 50%;
  pointer-events: none;
  z-index: 83;
  animation: ringExpand 0.7s ease-out forwards;
}
@keyframes ringExpand {
  0% { opacity: 1; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(2); }
}
/* Heal orbs */
.fx-heal-orb {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 82;
  animation: healOrbRise 1.2s ease-out forwards;
  box-shadow: 0 0 8px currentColor;
}
@keyframes healOrbRise {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-100px) scale(0.2); }
}
/* Shield barrier */
.fx-shield-barrier {
  position: absolute;
  inset: 4px;
  border-radius: 14px;
  border: 2px solid rgba(79, 195, 247, 0.6);
  background: rgba(79, 195, 247, 0.08);
  pointer-events: none;
  z-index: 5;
  animation: shieldBarrier 0.9s ease-out forwards;
}
@keyframes shieldBarrier {
  0% { opacity: 0; transform: scale(0.95); }
  30% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}
/* Flying card */
.fx-flying-card {
  position: fixed;
  z-index: 84;
  border-radius: 10px;
  pointer-events: none;
  transition: transform 0.55s cubic‑bezier(0.18,0.8,0.22,1),opacity 0.55s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.fx-flying-card .card-face {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  border: 2px solid;
}
.fx-flying-card.type-attack .card-face {
  background: linear-gradient(135deg, #3e1515, #1a0a0a);
  border-color: var(--accent-red);
  box-shadow: 0 0 20px rgba(233,69,96,0.6);
}
/* Turn banner */
.turn-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 2.2rem;
  font-weight: 900;
  padding: 16px 48px;
  border-radius: 12px;
  pointer-events: none;
  z-index: 86;
  animation: turnBanner 1.4s ease forwards;
  letter-spacing: 4px;
  text-shadow:0 0 32px currentColor !important;
}
.turn-banner.player {
  color: var(--accent-blue);
  background: rgba(79, 195, 247, 0.15);
  border: 2px solid rgba(79, 195, 247, 0.4);
  text-shadow: 0 0 20px rgba(79, 195, 247, 0.5);
}
.turn-banner.enemy {
  color: var(--accent-red);
  background: rgba(233, 69, 96, 0.15);
  border: 2px solid rgba(233, 69, 96, 0.4);
  text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}
@keyframes turnBanner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}
/* Confetti */
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 87;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity:1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity:0.3; }
}
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

/* ====== 新增设置弹窗组件 ====== */
.tip-text{
    color:var(--text-secondary);
    font-size:0.8rem;
    margin:8px 0 16px;
}
.setting-row{
    margin:14px 0;
    text-align:left;
}
.setting-row label{
    display:block;
    margin-bottom:6px;
}
.setting-row input[type="range"]{
    width:100%;
}
.btn-large.danger{
    color:var(--accent-red);
    border:1px solid rgba(233,69,96,0.3);
}

/* 角色选择 */
.hero-list{
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
    gap:12px;
    margin:20px 0;
}
.hero-card{
    border:1px solid var(--border);
    border-radius:12px;
    padding:14px 8px;
    cursor:pointer;
    text-align:center;
    transition:0.2s;
}
.hero-card.active{
    border-color:var(--accent-gold);
    background:rgba(245,166,35,0.12);
}
.hero-avatar{
    font-size:2.4rem;
    margin-bottom:8px;
}
.hero-desc{
    font-size:0.72rem;
    color:var(--text-secondary);
}

/* 卡牌打出闪烁 */
.card-play-flash{
  animation:cardPlayFlash 0.35s;
}
@keyframes cardPlayFlash {
  0%{filter:brightness(1);}
  50%{filter:brightness(1.7);}
  100%{filter:brightness(1);}
}
.boss-entrance-darken{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.45);
    z-index:88;
    pointer-events:none;
    animation:fadeIn 0.6s;
}

/* ========== 移动端样式【核心】 ========== */
@media (max-width:768px){
:root {
    --card-width:92px;
    --card-height:132px;
}
.login-card{
    padding:24px 16px !important;
}
.level-grid {
    grid-template-columns:1fr;
}
.header{
    grid-template-columns:1fr;
    gap:10px;
    padding:10px;
}
.header-left,.header-right{
    justify-content:center;
}
.player-stats-grid {
    grid-template-columns:1fr;
    gap:8px;
}
.fighter-info,.player-top-row{
    flex-direction:column;
    text-align:center;
    gap:8px;
}
.center-area{
    grid-template-columns:1fr;
}
.battle-log{
    height:90px;
}
.action-bar{
    flex-wrap:wrap;
    gap:8px;
}
.action-bar .btn{
    padding:10px 12px;
    font-size:0.8rem;
}
.hero-list{
    grid-template-columns:1fr;
}
.modal{
    padding:20px 14px !important;
}
.modal h2{
    font-size:1.3rem;
}
/* 增大触摸点击区域 */
.icon-btn{
    width:44px;
    height:44px;
}
.hand-area{
    gap:4px;
}
.levels-header-actions{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    justify-content:flex-end;
}
}