/* ═══════════════════════════════════════════════════════════════════════════
   ARENA ENGINE — modal full-screen, HUD, inventário lateral, result screen
   ═══════════════════════════════════════════════════════════════════════════ */

.arena-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 22, 0.92);
  z-index: 5000;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  animation: arena-fade-in 0.22s ease-out;
}
@keyframes arena-fade-in { from { opacity: 0; } to { opacity: 1; } }

.arena-modal {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #15102d 0%, #0c0820 100%);
  color: var(--ink, #e7ecff);
  overflow: hidden;
}

/* ───── HUD ───── */
.arena-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.arena-close {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 0.78rem;
  cursor: pointer;
}
.arena-close:hover { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); }
.arena-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
  background: linear-gradient(135deg, var(--gold, #f5c842), #e8a82a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.arena-stats {
  display: flex;
  gap: 14px;
  align-items: center;
}
.arena-stat {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.86rem;
  padding: 5px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
}
.arena-stat b { color: var(--gold, #f5c842); font-weight: 800; }

/* ───── BODY ───── */
.arena-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.arena-stage {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ───── INVENTORY (lateral) ───── */
.arena-inv {
  width: 200px;
  background: rgba(0,0,0,0.30);
  border-left: 1px solid rgba(255,255,255,0.08);
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arena-inv-head {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--gold, #f5c842);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 6px;
}
.arena-inv-empty {
  font-size: 0.74rem;
  color: var(--muted2, #94a3b8);
  text-align: center;
  padding: 20px 8px;
}
.arena-inv-item {
  display: grid;
  grid-template-columns: 32px 24px 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--ink, #e7ecff);
  cursor: pointer;
  font-size: 0.74rem;
  text-align: left;
}
.arena-inv-item:hover { background: rgba(245,200,66,0.12); border-color: rgba(245,200,66,0.40); }
.arena-inv-item img { width: 28px; height: 28px; image-rendering: pixelated; }
.arena-inv-qty { font-weight: 800; color: var(--gold, #f5c842); }
.arena-inv-name { font-size: 0.7rem; opacity: 0.9; }

/* ───── RESULT SCREEN ───── */
.arena-result {
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
  padding: 32px 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
}
.arena-result-win { border-color: rgba(34,211,238,0.5); box-shadow: 0 0 60px rgba(34,211,238,0.25); }
.arena-result-lose { border-color: rgba(239,68,68,0.4); }
.arena-rs-em { font-size: 4rem; margin-bottom: 12px; animation: arena-bounce 0.5s ease-out; }
@keyframes arena-bounce {
  0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(8deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.arena-rs-title { font-family: 'Cinzel Decorative', serif; font-size: 1.6rem; margin-bottom: 8px; color: var(--gold, #f5c842); }
.arena-rs-score { font-size: 0.95rem; margin-bottom: 16px; }
.arena-rs-rewards { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.arena-rs-row {
  background: rgba(245,200,66,0.10);
  border: 1px solid rgba(245,200,66,0.25);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
}
.arena-rs-sub { font-size: 0.78rem; color: var(--muted2, #94a3b8); margin: 12px 0 16px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TEMPLATE STAGES — estilos compartilhados pelos templates de jogo
   ═══════════════════════════════════════════════════════════════════════════ */

/* Quiz / Turn Battle — área de pergunta */
.arena-q-card {
  max-width: 620px;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 22px;
}
.arena-q-statement {
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.arena-q-alts {
  display: grid;
  gap: 8px;
}
.arena-q-alt {
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--ink, #e7ecff);
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.arena-q-alt:hover { background: rgba(245,200,66,0.15); border-color: rgba(245,200,66,0.5); }
.arena-q-alt.correct { background: rgba(34,197,94,0.20); border-color: rgba(34,197,94,0.6); }
.arena-q-alt.wrong   { background: rgba(239,68,68,0.20);  border-color: rgba(239,68,68,0.6); opacity: 0.7; }
.arena-q-alt:disabled { cursor: not-allowed; }

.arena-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  max-width: 720px;
  width: 100%;
  margin-bottom: 18px;
}
.arena-fighter {
  text-align: center;
  padding: 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
}
.arena-fighter-name { font-size: 0.86rem; font-weight: 700; margin-top: 8px; }
.arena-fighter-hp {
  height: 8px;
  background: rgba(239,68,68,0.20);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.arena-fighter-hp .arena-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f87171);
  transition: width 0.3s ease;
}
.arena-vs-sep {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.5rem;
  color: var(--gold, #f5c842);
}

/* Dungeon — grid de salas */
.arena-dungeon-map {
  display: grid;
  gap: 12px;
  max-width: 700px;
  margin-bottom: 20px;
}
.arena-room {
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  display: flex;
  gap: 12px;
  align-items: center;
}
.arena-room.locked    { opacity: 0.35; cursor: not-allowed; }
.arena-room.available { cursor: pointer; }
.arena-room.available:hover { background: rgba(245,200,66,0.10); border-color: rgba(245,200,66,0.4); }
.arena-room.completed { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.3); }
.arena-room-em { font-size: 1.8rem; }
.arena-room-info { flex: 1; }
.arena-room-name { font-weight: 700; font-size: 0.9rem; }
.arena-room-sub  { font-size: 0.72rem; color: var(--muted2, #94a3b8); }
.arena-room-boss { border-color: rgba(245,200,66,0.5); background: rgba(245,200,66,0.08); }

/* Memory */
.arena-memory-grid {
  display: grid;
  gap: 8px;
  max-width: 480px;
}
.arena-card {
  aspect-ratio: 3/4;
  background: rgba(108,63,197,0.30);
  border: 1px solid rgba(108,63,197,0.50);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
}
.arena-card.flipped { background: rgba(255,255,255,0.10); }
.arena-card.matched { background: rgba(34,197,94,0.20); border-color: rgba(34,197,94,0.5); opacity: 0.7; }

/* Exploration — escolhas em árvore */
.arena-narrative {
  max-width: 620px;
  background: rgba(255,255,255,0.05);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
}
.arena-narrative-text { font-size: 0.94rem; line-height: 1.6; margin-bottom: 18px; }
.arena-choices { display: flex; flex-direction: column; gap: 8px; }
.arena-choice {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(245,200,66,0.06);
  color: var(--ink, #e7ecff);
  cursor: pointer;
  text-align: left;
}
.arena-choice:hover { background: rgba(245,200,66,0.18); border-color: rgba(245,200,66,0.5); }

/* ═══════════════════════════════════════════════════════════════════════════
   BUILDER (professor) + ARENA LIST (aluno)
   ═══════════════════════════════════════════════════════════════════════════ */
.arena-builder-wizard { max-width: 760px; }
.arena-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.arena-tpl-card {
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
}
.arena-tpl-card:hover { background: rgba(245,200,66,0.10); border-color: rgba(245,200,66,0.4); transform: translateY(-2px); }
.arena-tpl-card.selected { background: rgba(245,200,66,0.20); border-color: rgba(245,200,66,0.7); }
.arena-tpl-em { font-size: 2rem; margin-bottom: 6px; }
.arena-tpl-name { font-weight: 700; font-size: 0.84rem; margin-bottom: 4px; }
.arena-tpl-desc { font-size: 0.66rem; color: var(--muted2, #94a3b8); line-height: 1.3; }
.arena-tpl-meta { font-size: 0.62rem; color: var(--muted2, #94a3b8); margin-top: 6px; opacity: 0.7; }

.arena-runs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.arena-run-card {
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arena-run-card.draft { opacity: 0.6; }
.arena-run-title { font-weight: 700; font-size: 0.92rem; }
.arena-run-meta { font-size: 0.68rem; color: var(--muted2, #94a3b8); display: flex; flex-wrap: wrap; gap: 8px; }
.arena-run-actions { display: flex; gap: 6px; margin-top: 6px; }

/* Aluno — Arena list */
.arena-pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.arena-pl-card {
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(108,63,197,0.18), rgba(34,211,238,0.10));
  border: 1px solid rgba(255,255,255,0.10);
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arena-pl-card:hover { transform: translateY(-3px); border-color: rgba(245,200,66,0.6); box-shadow: 0 4px 16px rgba(245,200,66,0.15); }
.arena-pl-card.completed { opacity: 0.7; background: linear-gradient(160deg, rgba(34,197,94,0.18), rgba(34,211,238,0.06)); }
.arena-pl-em { font-size: 2rem; }
.arena-pl-title { font-weight: 700; font-size: 0.96rem; }
.arena-pl-rewards { display: flex; gap: 6px; flex-wrap: wrap; }
.arena-pl-rwd-chip {
  font-size: 0.66rem;
  background: rgba(245,200,66,0.18);
  border: 1px solid rgba(245,200,66,0.35);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--gold, #f5c842);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ARENA ITEMS — admin grid + cards
   ═══════════════════════════════════════════════════════════════════════════ */
.ai-cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.ai-cat-card {
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  text-align: center;
}
.ai-cat-em { font-size: 1.4rem; }
.ai-cat-lab { font-size: 0.7rem; color: var(--muted2, #94a3b8); margin-top: 2px; }
.ai-cat-num { font-size: 1.4rem; font-weight: 800; color: var(--gold, #f5c842); margin-top: 4px; }

.ai-list { display: flex; flex-direction: column; gap: 8px; }
.ai-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
}
.ai-sprite { display: flex; align-items: center; justify-content: center; }
.ai-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ai-name { font-weight: 700; font-size: 0.92rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-meta { font-size: 0.72rem; color: var(--muted2, #94a3b8); }
.ai-desc { font-size: 0.78rem; opacity: 0.85; }
.ai-effects { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.ai-effect-chip {
  background: rgba(34,211,238,0.12);
  border: 1px solid rgba(34,211,238,0.30);
  color: #67e8f9;
  font-size: 0.66rem;
  padding: 1px 7px;
  border-radius: 8px;
  font-weight: 700;
}
.ai-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   INVENTÁRIO DO ALUNO (portal — aba 🎒 Inventário)
   ═══════════════════════════════════════════════════════════════════════════ */
.sp-inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.sp-inv-card {
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}
.sp-inv-card:hover { border-color: rgba(245,200,66,0.5); background: rgba(245,200,66,0.08); }
.sp-inv-card .ai-sprite { margin-bottom: 8px; }
.sp-inv-card.equipped { border-color: rgba(34,211,238,0.6); background: rgba(34,211,238,0.10); }
.sp-inv-equip-badge {
  background: rgba(34,211,238,0.25);
  color: #67e8f9;
  border: 1px solid rgba(34,211,238,0.5);
  padding: 1px 7px;
  font-size: 0.66rem;
  border-radius: 8px;
  margin-left: 4px;
}
.sp-inv-qty {
  display: inline-block;
  background: rgba(108,63,197,0.30);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
  margin-top: 4px;
}
.sp-inv-empty { text-align: center; padding: 30px 16px; color: var(--muted2, #94a3b8); }

/* Slots equipados (visualização no inventário) */
.sp-eq-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
}
.sp-eq-slot {
  text-align: center;
  padding: 8px 4px;
  border: 1px dashed rgba(255,255,255,0.20);
  border-radius: 8px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.sp-eq-slot.filled { border-style: solid; border-color: rgba(245,200,66,0.4); background: rgba(245,200,66,0.06); }
.sp-eq-slot-lab { font-size: 0.6rem; color: var(--muted2, #94a3b8); }

/* ═══════════════════════════════════════════════════════════════════════════
   SPRITE PICKER — form + modal
   ═══════════════════════════════════════════════════════════════════════════ */

/* Campo de sprite no formulário de item */
.spr-form-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2, rgba(255,255,255,0.1));
  border-radius: 10px;
}
.spr-form-thumb {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  flex-shrink: 0;
}
.spr-thumb-empty {
  font-size: 1.4rem;
  opacity: 0.3;
  font-weight: 700;
}
.spr-form-info { flex: 1; min-width: 0; }
.spr-form-label-text {
  font-size: 0.78rem;
  color: var(--muted2, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal do picker */
.spr-picker-modal { max-width: 800px !important; }

.spr-cfg-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.spr-cfg-path { flex: 1; min-width: 200px; }

.spr-grid-scroll {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border2, rgba(255,255,255,0.1));
  border-radius: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  margin-bottom: 14px;
}
.spr-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.spr-grid-hint {
  padding: 24px;
  color: var(--muted2, #94a3b8);
  font-size: 0.82rem;
  text-align: center;
  width: 100%;
}

.spr-cell {
  padding: 2px;
  background: rgba(0,0,0,0.3);
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  line-height: 0;
}
.spr-cell:hover { border-color: rgba(245,200,66,0.5); background: rgba(245,200,66,0.1); }
.spr-cell.selected { border-color: #f5c842; background: rgba(245,200,66,0.18); }
.spr-cell canvas { display: block; }

/* Área de seleção + variador de cor */
.spr-selection-area {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2, rgba(255,255,255,0.1));
  border-radius: 10px;
  margin-bottom: 14px;
}
.spr-sel-left { text-align: center; }
.spr-sel-label {
  font-size: 0.7rem;
  color: var(--muted2, #94a3b8);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.spr-sel-canvas {
  border: 1px solid var(--border2, rgba(255,255,255,0.15));
  border-radius: 6px;
  background: repeating-conic-gradient(#1e1e2e 0% 25%, #2a2a3d 0% 50%) 0 0 / 16px 16px;
}
.spr-sel-right { display: flex; flex-direction: column; gap: 8px; }

.spr-color-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.spr-color-col { display: flex; flex-direction: column; gap: 4px; }
.spr-color-lab { font-size: 0.72rem; color: var(--muted2, #94a3b8); }

.spr-dom-swatch {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.2);
}
.spr-color-input {
  width: 36px;
  height: 36px;
  padding: 1px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

/* Eyedropper */
.spr-eyedrop-cursor { cursor: crosshair; }
.spr-eyedrop-hint {
  font-size: 0.64rem;
  color: var(--muted2, #94a3b8);
  text-align: center;
  margin-top: 5px;
  line-height: 1.3;
}
.spr-hover-swatch {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 3px 7px;
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  border: 1px solid var(--border2, rgba(255,255,255,0.1));
}
.spr-hover-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

/* Lista de pares de cores */
.spr-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.spr-pairs-empty {
  font-size: 0.74rem;
  color: var(--muted2, #94a3b8);
  padding: 8px 4px;
  font-style: italic;
}
.spr-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border2, rgba(255,255,255,0.08));
  border-radius: 8px;
}
.spr-pair-src-swatch {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  cursor: default;
}
.spr-pair-arrow {
  font-size: 1rem;
  color: var(--muted2, #94a3b8);
  flex-shrink: 0;
}
.spr-pair-tol {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 70px;
  gap: 2px;
}
.spr-tol-badge {
  font-size: 0.62rem;
  color: var(--muted2, #94a3b8);
  font-family: monospace;
  align-self: flex-end;
}
.spr-pair-tol input[type=range] { width: 100%; }
.spr-pair-del {
  padding: 2px 7px !important;
  font-size: 0.7rem !important;
  flex-shrink: 0;
  opacity: 0.7;
}
.spr-pair-del:hover { opacity: 1; }
