/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== AUDIO CONTROLS ===== */
#audio-controls {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 500;
  display: flex;
  gap: 6px;
}

.audio-btn {
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid var(--border);
  border-radius: 4px;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: border-color 0.15s;
}

.audio-btn:hover {
  border-color: var(--epic);
}

:root {
  --bg:        #0a0a1a;
  --surface:   #12122a;
  --surface2:  #1a1a3a;
  --border:    #2a2a5a;
  --text:      #e8e8ff;
  --text-dim:  #8888bb;
  --accent:    #ffcc00;
  --red:       #ff4444;
  --green:     #44ff88;
  --blue:      #4488ff;

  --common:    #9ca3af;
  --uncommon:  #22c55e;
  --rare:      #3b82f6;
  --epic:      #a855f7;
  --legendary: #f59e0b;

  --font: 'Press Start 2P', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  image-rendering: pixelated;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== WELCOME ===== */
.welcome-bg {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a3a 50%, #0a1a2a 100%);
  z-index: 0;
}
.welcome-bg::after {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,200,0,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(100,100,255,0.05) 0%, transparent 50%);
  z-index: 0;
}
.welcome-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  gap: 48px;
  padding: 32px;
}
.logo-block { text-align: center; }
.logo-top {
  font-size: clamp(3rem, 12vw, 6rem);
  color: var(--accent);
  text-shadow: 4px 4px 0 #b8860b, 8px 8px 0 #7a5c00;
  line-height: 1;
  letter-spacing: 0.1em;
}
.logo-bottom {
  font-size: clamp(3rem, 12vw, 6rem);
  color: #ff4444;
  text-shadow: 4px 4px 0 #aa2222, 8px 8px 0 #660000;
  line-height: 1;
  letter-spacing: 0.1em;
}
.logo-sub {
  font-size: clamp(0.4rem, 2vw, 0.65rem);
  color: var(--text-dim);
  margin-top: 16px;
  letter-spacing: 0.05em;
}

.name-entry-box {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  background: var(--surface);
  border: 3px solid var(--border);
  padding: 32px;
  image-rendering: pixelated;
}
.pixel-label { font-size: 0.6rem; color: var(--text-dim); margin-bottom: 4px; }
.pixel-input {
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--accent);
  border: 3px solid var(--border);
  padding: 12px 16px;
  text-align: center;
  outline: none;
  width: 280px;
  caret-color: var(--accent);
}
.pixel-input:focus { border-color: var(--accent); }
.pixel-input::placeholder { color: var(--text-dim); font-size: 0.6rem; }

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--font);
  font-size: 0.6rem;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 0.08s, box-shadow 0.08s;
  image-rendering: pixelated;
}
.btn:active { transform: translateY(2px); box-shadow: none !important; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 4px 0 #b8860b;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 0 #b8860b; transform: translateY(-2px); }

.btn-battle {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 0 #aa2222;
  font-size: 0.9rem;
  padding: 16px 32px;
}
.btn-battle:hover:not(:disabled) { box-shadow: 0 6px 0 #aa2222; transform: translateY(-2px); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: 0 4px 0 #0a0a1a;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); box-shadow: 0 6px 0 #0a0a1a; transform: translateY(-2px); }

.btn-back {
  background: var(--surface2);
  color: var(--text-dim);
  border: 2px solid var(--border);
  font-size: 0.5rem;
  padding: 8px 14px;
}
.btn-back:hover { color: var(--text); border-color: var(--text-dim); }

.btn-attack  { background: #dc2626; color: #fff; box-shadow: 0 3px 0 #7f1d1d; }
.btn-ability { background: #7c3aed; color: #fff; box-shadow: 0 3px 0 #4c1d95; }
.btn-switch  { background: #0369a1; color: #fff; box-shadow: 0 3px 0 #0c4a6e; }
.btn-attack:hover:not(:disabled), .btn-ability:hover:not(:disabled), .btn-switch:hover:not(:disabled) {
  filter: brightness(1.15); transform: translateY(-1px);
}

.btn-buy {
  background: var(--green);
  color: #000;
  box-shadow: 0 3px 0 #1a7a3a;
}
.btn-buy:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }

/* ===== MAIN MENU ===== */
#screen-menu {
  background: var(--bg);
  align-items: center;
  padding: 24px 16px;
  gap: 20px;
}
.menu-header { text-align: center; }
.menu-title {
  font-size: clamp(1rem, 5vw, 1.8rem);
  color: var(--accent);
  text-shadow: 3px 3px 0 #7a5c00;
  margin-bottom: 8px;
}
.menu-player-row {
  display: flex; gap: 20px; justify-content: center; align-items: center;
  font-size: 0.55rem; color: var(--text-dim);
}
.kkb-badge {
  background: var(--surface2);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 4px 10px;
  font-size: 0.55rem;
}

.menu-villain-banner {
  background: var(--surface);
  border: 3px solid var(--border);
  width: 100%; max-width: 500px;
  padding: 16px;
  display: flex; align-items: center; gap: 16px;
}
.villain-portrait {
  width: 80px; height: 80px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 2px solid var(--border);
  overflow: hidden;
}
.villain-portrait canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.villain-taunt { font-size: 0.45rem; color: var(--red); line-height: 1.8; font-style: italic; }

.menu-buttons {
  display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; align-items: center;
}
.menu-buttons .btn { width: 100%; }

.menu-stats {
  display: flex; gap: 20px;
  font-size: 0.5rem; color: var(--text-dim);
}

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  flex-shrink: 0;
}
.screen-title {
  flex: 1; text-align: center;
  font-size: clamp(0.6rem, 3vw, 1rem);
  color: var(--accent);
}
.card-count { font-size: 0.5rem; color: var(--text-dim); }

/* ===== CARDS GRID ===== */
.cards-grid {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 16px;
  justify-content: center;
  overflow-y: auto;
  flex: 1;
}

/* ===== CARD ===== */
.card {
  width: 120px;
  background: var(--surface2);
  border: 3px solid var(--common);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
  position: relative;
  user-select: none;
}
.card:hover { transform: translateY(-4px) scale(1.03); }
.card.rarity-common    { border-color: var(--common); }
.card.rarity-uncommon  { border-color: var(--uncommon); box-shadow: 0 0 6px rgba(34,197,94,0.3); }
.card.rarity-rare      { border-color: var(--rare);    box-shadow: 0 0 8px rgba(59,130,246,0.4); }
.card.rarity-epic      { border-color: var(--epic);    box-shadow: 0 0 10px rgba(168,85,247,0.5); }
.card.rarity-legendary { border-color: var(--legendary); box-shadow: 0 0 14px rgba(245,158,11,0.6); animation: legendaryPulse 2s infinite; }

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(245,158,11,0.6); }
  50% { box-shadow: 0 0 22px rgba(245,158,11,0.9); }
}

.card-name {
  font-size: 0.35rem;
  text-align: center;
  padding: 5px 4px 3px;
  color: var(--text);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  min-height: 22px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1.4;
}
.card-art {
  width: 100%; height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  position: relative;
  overflow: hidden;
}
.card-art canvas {
  width: 90px; height: 90px;
  image-rendering: pixelated;
}
.card-rarity-strip {
  font-size: 0.3rem;
  text-align: center;
  padding: 3px;
  letter-spacing: 0.1em;
}
.rarity-common    .card-rarity-strip { background: #374151; color: var(--common); }
.rarity-uncommon  .card-rarity-strip { background: #14532d; color: var(--uncommon); }
.rarity-rare      .card-rarity-strip { background: #1e3a5f; color: var(--rare); }
.rarity-epic      .card-rarity-strip { background: #3b0764; color: var(--epic); }
.rarity-legendary .card-rarity-strip { background: #451a03; color: var(--legendary); }

.card-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  font-size: 0.32rem;
  border-top: 2px solid var(--border);
}
.card-stat {
  padding: 4px 6px;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
}
.card-stat:last-child { border-right: none; }
.stat-label { color: var(--text-dim); }
.stat-value { color: var(--text); }
.stat-value.hp-val { color: var(--green); }
.stat-value.atk-val { color: var(--red); }

.card-ability {
  font-size: 0.28rem;
  padding: 4px 6px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  line-height: 1.6;
  background: rgba(0,0,0,0.2);
}
.ability-name { color: var(--epic); font-size: 0.32rem; }

.card-copies {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.8);
  color: var(--accent);
  font-size: 0.3rem;
  padding: 2px 5px;
  border: 1px solid var(--accent);
}

/* Selected state (team selection) */
.card.selected {
  box-shadow: 0 0 0 3px var(--accent), 0 0 16px rgba(255,204,0,0.5) !important;
  transform: translateY(-4px) scale(1.05);
}
.card.selected::after {
  content: 'SELECTED';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,204,0,0.12);
  display: flex; align-items: flex-start; justify-content: flex-end;
  font-size: 0.25rem;
  color: var(--accent);
  padding: 4px;
  pointer-events: none;
}

/* KO'd state */
.card.ko {
  opacity: 0.35;
  filter: grayscale(1);
  transform: none !important;
  cursor: default;
}

/* Active card (larger display on battlefield) */
.card.active-card {
  width: 140px;
  cursor: default;
}
.card.active-card:hover { transform: none; }
.card.active-card .card-art { height: 120px; }

/* Card HP bar (for active cards in battle) */
.card-hp-bar-wrap {
  height: 8px; background: #1a1a2a; margin: 0 4px 4px;
  border: 1px solid var(--border);
}
.card-hp-bar {
  height: 100%; background: var(--green);
  transition: width 0.4s ease;
}
.card-hp-bar.danger { background: var(--red); }
.card-hp-bar.warning { background: var(--accent); }

/* Ability ready badge */
.ability-badge {
  font-size: 0.28rem;
  padding: 2px 5px;
  margin: 2px 4px;
  text-align: center;
  background: #4c1d95;
  color: #c4b5fd;
  border: 1px solid #7c3aed;
}
.ability-badge.used {
  background: #1a1a2a;
  color: var(--text-dim);
  border-color: var(--border);
}
.ability-badge.cooldown { background: #1c1917; color: #78716c; border-color: #44403c; }

/* ===== TEAM SELECT ===== */
#screen-team { background: var(--bg); }
.team-instructions { text-align: center; font-size: 0.45rem; color: var(--text-dim); padding: 12px; }
.select-count { font-size: 0.5rem; color: var(--accent); }
.team-footer { padding: 16px; display: flex; justify-content: center; }

/* ===== BATTLE ===== */
#screen-battle {
  background: var(--bg);
  display: none;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
#screen-battle.active { display: flex; }

.battle-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}
.combatant-info { flex: 1; }
.combatant-name { font-size: 0.4rem; color: var(--text-dim); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.villain-info .combatant-name { color: var(--red); }
.player-info .combatant-name { color: var(--green); text-align: right; }
.hp-row { display: flex; align-items: center; gap: 6px; }
.player-info .hp-row { flex-direction: row-reverse; }
.hp-bar-wrap { flex: 1; height: 10px; background: #1a1a2a; border: 1px solid var(--border); }
.hp-bar { height: 100%; transition: width 0.4s ease; }
.villain-bar { background: var(--red); }
.player-bar { background: var(--green); }
.hp-text { font-size: 0.38rem; color: var(--text); white-space: nowrap; }
.cards-left { font-size: 0.35rem; color: var(--text-dim); margin-top: 3px; }
.player-info .cards-left { text-align: right; }

.battlefield {
  display: flex;
  gap: 8px;
  padding: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.field-side {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  width: 160px; flex-shrink: 0;
}
.field-label { font-size: 0.32rem; color: var(--text-dim); }
.active-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 220px;
}
.empty-slot-msg { font-size: 0.4rem; color: var(--text-dim); text-align: center; }

.battle-mid {
  flex: 1; display: flex; flex-direction: column;
  gap: 8px; min-width: 0;
}
.battle-log {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 10px;
  overflow-y: auto;
  font-size: 0.38rem;
  line-height: 2;
}
.log-entry { color: var(--text-dim); border-bottom: 1px solid var(--surface2); padding-bottom: 3px; margin-bottom: 3px; }
.log-entry.player-action { color: var(--green); }
.log-entry.villain-action { color: var(--red); }
.log-entry.ability-action { color: #c4b5fd; }
.log-entry.ko-action { color: var(--accent); font-style: italic; }
.log-entry.system { color: var(--text-dim); font-style: italic; }

.battle-actions { display: flex; gap: 8px; flex-shrink: 0; }
.battle-actions .btn { flex: 1; font-size: 0.45rem; padding: 10px 6px; }

.player-hand-area {
  background: var(--surface);
  border-top: 3px solid var(--border);
  padding: 8px;
  flex-shrink: 0;
}
.hand-label { font-size: 0.32rem; color: var(--text-dim); margin-bottom: 6px; text-align: center; }
.player-hand {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  justify-content: center;
}
.player-hand .card { width: 100px; cursor: pointer; }
.player-hand .card .card-art { height: 80px; }

/* Highlight available switch targets */
.player-hand .card.can-switch {
  border-color: var(--blue);
  box-shadow: 0 0 8px rgba(68,136,255,0.5);
  animation: switchPulse 1s infinite;
}
@keyframes switchPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(68,136,255,0.5); }
  50% { box-shadow: 0 0 16px rgba(68,136,255,0.8); }
}

/* ===== COLLECTION ===== */
#screen-collection { background: var(--bg); }
.rarity-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 10px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}
.tab {
  font-family: var(--font);
  font-size: 0.38rem;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text-dim);
  border: 2px solid var(--border);
  cursor: pointer;
}
.tab.active { background: var(--surface2); color: var(--text); border-color: var(--accent); }

/* ===== SHOP ===== */
#screen-shop { background: var(--bg); }
.packs-row {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 20px; justify-content: center;
}
.pack-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 20px 16px;
  background: var(--surface);
  border: 3px solid var(--border);
  width: 180px;
  transition: border-color 0.2s;
}
.pack-item:hover { border-color: var(--accent); }

.pack-icon {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  font-family: monospace;
  font-weight: bold;
  border: 3px solid var(--border);
}
.basic-pack    { background: #374151; color: var(--common); border-color: var(--common); }
.kool-pack     { background: #14532d; color: var(--uncommon); border-color: var(--uncommon); }
.klass-pack    { background: #1e3a5f; color: var(--rare); border-color: var(--rare); }
.legendary-pack { background: #451a03; color: var(--legendary); border-color: var(--legendary); }

.pack-name { font-size: 0.5rem; color: var(--text); }
.pack-desc { font-size: 0.32rem; color: var(--text-dim); text-align: center; line-height: 1.6; }
.pack-price { font-size: 0.55rem; color: var(--accent); }

.pack-open-area {
  padding: 20px;
  text-align: center;
  background: var(--surface);
  border: 3px solid var(--accent);
  margin: 16px;
  animation: fadeIn 0.3s ease;
}
.pack-open-title { font-size: 0.7rem; color: var(--accent); margin-bottom: 16px; }
.opened-cards-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.opened-cards-row .card { animation: cardReveal 0.4s ease backwards; }
.opened-cards-row .card:nth-child(1) { animation-delay: 0.1s; }
.opened-cards-row .card:nth-child(2) { animation-delay: 0.3s; }
.opened-cards-row .card:nth-child(3) { animation-delay: 0.5s; }
@keyframes cardReveal {
  from { opacity: 0; transform: scale(0.5) rotateY(90deg); }
  to   { opacity: 1; transform: scale(1) rotateY(0deg); }
}

/* ===== RESULT ===== */
#screen-result {
  background: var(--bg);
  align-items: center; justify-content: center;
}
.result-box {
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
  padding: 40px;
  background: var(--surface);
  border: 4px solid var(--border);
  text-align: center;
  max-width: 480px; width: 90%;
}
.result-title {
  font-size: clamp(1.2rem, 6vw, 2rem);
  text-shadow: 4px 4px 0 currentColor;
}
.result-title.win  { color: var(--accent); text-shadow: 4px 4px 0 #7a5c00; }
.result-title.loss { color: var(--red);    text-shadow: 4px 4px 0 #7f0000; }
.result-villain-msg { font-size: 0.45rem; color: var(--text-dim); font-style: italic; line-height: 1.8; }
.result-kkb { font-size: 0.7rem; color: var(--green); }
.result-streak { font-size: 0.45rem; color: var(--epic); }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); }
.modal-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 3px solid var(--border);
}
.modal-content .card { width: 180px; cursor: default; }
.modal-content .card:hover { transform: none; }
.modal-content .card .card-art { height: 160px; }

/* ===== ANIMATIONS ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.bounce { animation: bounce 0.3s ease; }

@keyframes flash-green {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 20px var(--green); }
}
@keyframes flash-red {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 20px var(--red); }
}
.flash-heal { animation: flash-green 0.5s ease; }
.flash-hit  { animation: flash-red 0.4s ease; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
}
.loading-box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 48px;
  background: var(--surface);
  border: 3px solid var(--border);
}
.loading-text { font-size: 0.6rem; color: var(--text-dim); }
.loading-dots { display: flex; gap: 8px; }
.loading-dots span {
  width: 10px; height: 10px;
  background: var(--accent);
  animation: dotPulse 1.2s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ===== AUTH SCREENS ===== */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px;
  gap: 24px;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a3a 50%, #0a1a2a 100%);
}
.auth-logo { text-align: center; }
.auth-box {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  background: var(--surface);
  border: 3px solid var(--border);
  padding: 28px 24px;
  width: 100%; max-width: 400px;
}
.auth-box.wide { max-width: 520px; }
.auth-title {
  font-size: clamp(0.65rem, 3vw, 0.95rem);
  color: var(--accent);
  text-align: center;
}
.auth-subtitle {
  font-size: 0.42rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.8;
}
.auth-error {
  font-size: 0.42rem;
  color: var(--red);
  text-align: center;
  line-height: 1.8;
  padding: 6px 10px;
  background: rgba(220,38,38,0.1);
  border: 1px solid var(--red);
  width: 100%;
}
.auth-divider {
  font-size: 0.4rem;
  color: var(--text-dim);
  text-align: center;
}
.auth-note {
  font-size: 0.38rem;
  color: var(--accent);
  text-align: center;
  line-height: 1.8;
  padding: 8px 12px;
  background: rgba(255,204,0,0.08);
  border: 1px solid rgba(255,204,0,0.3);
  width: 100%;
}
.auth-box .btn { width: 100%; }

/* ===== AVATAR GRID ===== */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.avatar-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
  background: var(--bg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.1s, transform 0.1s;
}
.avatar-item:hover { border-color: var(--text-dim); transform: scale(1.04); }
.avatar-item.selected {
  border-color: var(--accent);
  background: rgba(255,204,0,0.08);
  box-shadow: 0 0 8px rgba(255,204,0,0.4);
}
.avatar-item canvas { width: 48px; height: 48px; image-rendering: pixelated; pointer-events: none; }
.avatar-item-label { font-size: 0.28rem; color: var(--text-dim); text-align: center; }
.avatar-item.selected .avatar-item-label { color: var(--accent); }

/* ===== COMBO PICKER ===== */
.combo-slots {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  justify-content: center;
  margin: 4px 0;
}
.combo-arrow { font-size: 0.7rem; color: var(--text-dim); }
.combo-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 72px; height: 72px;
  background: var(--bg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
  gap: 2px;
}
.combo-slot.empty { border-style: dashed; border-color: var(--border); }
.combo-slot.empty span { font-size: 1.4rem; color: var(--text-dim); }
.combo-slot:not(.empty) { border-color: var(--accent); background: rgba(255,204,0,0.08); }
.combo-slot:not(.empty):hover { border-color: var(--red); background: rgba(220,38,38,0.1); }
.combo-slot-emoji { font-size: 1.6rem; line-height: 1; }
.combo-slot-lbl { font-size: 0.25rem; color: var(--text-dim); }

.combo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}
.combo-sym-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px;
  background: var(--bg);
  border: 2px solid var(--border);
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.1s, transform 0.1s, background 0.1s;
}
.combo-sym-btn:hover { border-color: var(--accent); background: rgba(255,204,0,0.08); transform: scale(1.05); }
.combo-sym-btn:active { transform: scale(0.95); }
.combo-emoji { font-size: 1.5rem; line-height: 1; }
.combo-sym-label { font-size: 0.26rem; color: var(--text-dim); }

/* ===== COMBO REVEAL ===== */
.combo-reveal {
  display: flex; align-items: center; gap: 8px;
  padding: 16px;
  background: rgba(255,204,0,0.06);
  border: 2px solid rgba(255,204,0,0.4);
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.reveal-arrow { font-size: 1rem; color: var(--text-dim); }
.reveal-sym {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface2);
  border: 2px solid var(--accent);
  padding: 10px 12px;
}
.reveal-emoji { font-size: 2rem; line-height: 1; }
.reveal-label { font-size: 0.32rem; color: var(--accent); }

/* ===== MENU AVATAR ===== */
.menu-player-row {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  font-size: 0.55rem; color: var(--text-dim);
}
#menu-avatar-canvas {
  width: 48px; height: 48px;
  image-rendering: pixelated;
  border: 2px solid var(--border);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .battlefield { flex-direction: column; overflow-y: auto; }
  .field-side { width: 100%; flex-direction: row; min-height: auto; }
  .active-slot { min-height: 160px; }
  .battle-mid { min-height: 200px; }
  .player-hand-area { display: none; } /* on mobile, switch btn manages this */
}
