/* ===== AURA DUEL — estética arcade neón ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d0b1a;
  --panel: #171331;
  --neon-p: #38bdf8;   /* jugador (cian) */
  --neon-c: #f43f5e;   /* rival (rojo) */
  --neon-y: #fde047;   /* aura / dorado */
  --ink: #e8e6ff;
}

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #241a4d 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-weight: bold;
  letter-spacing: 1px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#game {
  position: relative;
  width: min(100vw, 540px);
  height: 100vh;
  max-height: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  gap: 8px;
}

/* ---- HUD superior ---- */
#hud {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.meter { display: flex; flex-direction: column; gap: 2px; }
.meter--cpu { align-items: flex-end; }
.meter__name { font-size: 12px; opacity: .9; }
.meter--player .meter__name { color: var(--neon-p); }
.meter--cpu .meter__name { color: var(--neon-c); }
.meter__bar {
  width: 100%; height: 14px;
  background: #000; border: 2px solid #2a2450;
  border-radius: 3px; overflow: hidden;
}
.meter__fill {
  height: 100%; width: 0%;
  transition: width .5s cubic-bezier(.2,1.4,.4,1);
}
.meter--player .meter__fill { background: linear-gradient(90deg, #0ea5e9, var(--neon-p)); box-shadow: 0 0 10px var(--neon-p); }
.meter--cpu .meter__fill { background: linear-gradient(90deg, #e11d48, var(--neon-c)); box-shadow: 0 0 10px var(--neon-c); }
.meter__val { font-size: 15px; color: var(--neon-y); text-shadow: 0 0 6px rgba(253,224,71,.6); }

#turn-box {
  display: flex; flex-direction: column; align-items: center;
  font-size: 11px; color: #9d95d6; min-width: 60px;
}
.turn-label { font-size: 9px; opacity: .8; }
#turn-count { font-size: 20px; color: var(--ink); }
.turn-sep { opacity: .5; }
#turn-max { opacity: .6; }

/* ---- Escenario ---- */
#arena {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0818;
  border: 3px solid #2a2450;
  border-radius: 6px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 40px rgba(0,0,0,.8), 0 0 20px rgba(56,189,248,.15);
}

/* ---- Mensaje de fase ---- */
#phase-msg {
  font-size: 18px;
  text-align: center;
  min-height: 22px;
  color: var(--neon-y);
  text-shadow: 0 0 10px rgba(253,224,71,.5);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- Botones de postura ---- */
#controls {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stance {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px;
  background: var(--panel);
  border: 2px solid #3a3270;
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit; font-weight: bold;
  cursor: pointer;
  transition: transform .08s, border-color .15s, box-shadow .15s;
}
.stance:hover, .stance:focus { border-color: var(--neon-y); box-shadow: 0 0 14px rgba(253,224,71,.35); outline: none; }
.stance:active { transform: scale(.94); }
.stance__emoji { font-size: 30px; line-height: 1; }
.stance__name { font-size: 14px; color: var(--neon-y); }
.stance__beats { font-size: 10px; opacity: .7; }
.stance:disabled { opacity: .35; cursor: default; }

/* 6 movimientos reales: rejilla 3x2 compacta */
.move { padding: 8px 2px; gap: 1px; }
.move .stance__emoji { font-size: 24px; }
.move .stance__name { font-size: 11px; color: var(--ink); }
.mv-score { font-size: 11px; color: var(--neon-y); font-weight: bold; }
.mv-score--low { color: #7a72b0; text-decoration: line-through; }

/* botón de retar bloqueado por rango de aura */
#retar-btn.locked { background: #2a2450; color: #8b83c0; box-shadow: none; animation: none; cursor: default; }

/* bono acumulado en tienda */
.shop-bonus { font-size: 12px; color: #b9b2e8; text-align: center; padding: 6px; background: #100d24; border: 1px solid #2a2450; border-radius: 8px; }
.shop-bonus b { color: var(--neon-y); }
.shop-cat { font-size: 13px; color: var(--neon-p); font-weight: bold; padding: 6px 2px 2px; border-bottom: 1px solid #2a2450; }

#tour-badge { font-size: 11px; color: var(--neon-y); font-weight: bold; text-shadow: 0 0 6px rgba(253,224,71,.5); }

/* ===== Editor de personaje ===== */
#editor {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(6,4,20,.94); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.editor-panel {
  width: 100%; max-width: 440px; max-height: 96%; overflow-y: auto;
  background: var(--panel); border: 2px solid var(--neon-p); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.editor-panel h2 { font-size: 18px; color: var(--neon-y); text-align: center; }
#ed-canvas {
  image-rendering: pixelated; background: radial-gradient(circle at 50% 60%, #241a4d, #0d0b1a);
  border: 2px solid #3a3270; border-radius: 8px;
}
#ed-name {
  width: 100%; padding: 10px; font-family: inherit; font-weight: bold; font-size: 16px; text-align: center;
  color: var(--ink); background: #100d24; border: 2px solid #3a3270; border-radius: 8px;
}
#ed-name:focus { outline: none; border-color: var(--neon-y); }
#ed-name.bad { border-color: var(--neon-c); box-shadow: 0 0 10px rgba(244,63,94,.5); }
#ed-start:disabled { opacity: .4; cursor: default; box-shadow: none; }
.ed-row { width: 100%; display: flex; align-items: center; gap: 8px; }
.ed-label { font-size: 12px; color: #9d95d6; width: 62px; flex-shrink: 0; }
.ed-opts { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.ed-sw {
  width: 28px; height: 28px; border-radius: 6px; border: 2px solid #000; cursor: pointer; padding: 0;
}
.ed-sw.sel { border-color: var(--neon-y); box-shadow: 0 0 8px rgba(253,224,71,.6); transform: scale(1.1); }
.ed-tx {
  padding: 6px 10px; font-family: inherit; font-weight: bold; font-size: 12px;
  color: var(--ink); background: #100d24; border: 2px solid #3a3270; border-radius: 6px; cursor: pointer;
}
.ed-tx.sel { border-color: var(--neon-y); color: var(--neon-y); }
#ed-start {
  width: 100%; margin-top: 4px; padding: 14px; font-family: inherit; font-weight: bold; font-size: 18px;
  color: #0d0b1a; background: var(--neon-y); border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 0 16px rgba(253,224,71,.5);
}
#ed-start:active { transform: scale(.97); }

/* ---- Botón de timing ---- */
#lock-btn {
  width: 100%;
  padding: 16px;
  font-family: inherit; font-weight: bold; font-size: 20px;
  color: #0d0b1a;
  background: var(--neon-y);
  border: none; border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(253,224,71,.5);
  animation: pulse 0.6s ease-in-out infinite;
}
#lock-btn:active { transform: scale(.97); }

/* ---- Barra superior: MUNDO ---- */
#topbar { width: 100%; min-height: 48px; display: flex; align-items: center; }
#world-top {
  width: 100%; display: flex; flex-direction: column; gap: 5px;
  padding: 5px 10px 7px;
  background: var(--panel); border: 2px solid #3a3270; border-radius: 8px;
}
.wt-row { display: flex; align-items: center; justify-content: space-between; }
.wt-progress {
  position: relative; width: 100%; height: 15px;
  background: #0c0a1c; border: 1px solid #2a2450; border-radius: 8px; overflow: hidden;
}
.wt-progress__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #f59e0b, var(--neon-y));
  box-shadow: 0 0 8px rgba(253,224,71,.55);
  transition: width .5s cubic-bezier(.2,1.4,.4,1);
}
.wt-progress__label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: bold; color: var(--ink);
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}
.wt-aura { font-size: 15px; }
.wt-aura span { color: var(--neon-y); font-size: 20px; text-shadow: 0 0 8px rgba(253,224,71,.6); }
.wt-rank {
  font-size: 14px; color: var(--neon-p);
  text-shadow: 0 0 8px rgba(56,189,248,.5);
  padding: 3px 8px; border: 1px solid var(--neon-p); border-radius: 20px;
}
.wt-time { font-size: 20px; }
#duel-top { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }

/* ---- Botón de tienda (mundo) ---- */
#world-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
#shop-btn, #share-btn {
  padding: 12px 4px;
  font-family: inherit; font-weight: bold; font-size: 15px;
  background: var(--panel); border-radius: 8px; cursor: pointer;
}
#shop-btn { color: var(--neon-y); border: 2px solid var(--neon-y); }
#share-btn { color: var(--neon-p); border: 2px solid var(--neon-p); }
#shop-btn:active, #share-btn:active { transform: scale(.97); }

/* ---- Movimientos especiales (duelo) ---- */
#specials { display: flex; gap: 8px; }
.special {
  flex: 1; padding: 10px 4px;
  font-family: inherit; font-weight: bold; font-size: 13px;
  color: #0d0b1a; background: linear-gradient(180deg, #fb923c, #f97316);
  border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 0 12px rgba(249,115,22,.4);
}
.special b { color: #7f1d1d; }
.special:active { transform: scale(.95); }
.special:disabled { opacity: .35; cursor: default; box-shadow: none; }

/* ---- Overlay tienda ---- */
#shop {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(6,4,20,.9); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.shop-panel {
  width: 100%; max-width: 460px; max-height: 90%;
  background: var(--panel); border: 2px solid #3a3270; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.shop-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 2px solid #2a2450; background: #100d24;
}
.shop-head h2 { font-size: 16px; color: var(--neon-y); flex: 1; }
.shop-bal { font-size: 16px; color: var(--neon-y); }
#shop-close {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  background: var(--neon-c); color: #fff; font-weight: bold; font-size: 16px; cursor: pointer;
}
#shop-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.shop-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: #100d24; border: 1px solid #2a2450; border-radius: 8px;
}
.sw { width: 26px; height: 26px; border-radius: 6px; border: 2px solid #000; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; }
.sw--sp { background: #1e1b3a; font-size: 16px; }
.shop-info { flex: 1; display: flex; flex-direction: column; }
.shop-info b { font-size: 13px; color: var(--ink); }
.shop-info small { font-size: 10px; color: #8b83c0; }
.buy {
  padding: 8px 12px; font-family: inherit; font-weight: bold; font-size: 13px;
  color: #0d0b1a; background: var(--neon-y); border: none; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.buy:disabled { opacity: .35; cursor: default; }
.buy:active { transform: scale(.95); }
.tag { font-size: 11px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.tag--eq { background: var(--neon-p); color: #0d0b1a; font-weight: bold; }
.tag--own { background: #2a2450; color: #8b83c0; }

/* ---- Zona inferior ---- */
#bottom { width: 100%; }
#world-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#retar-btn {
  width: 100%; padding: 16px;
  font-family: inherit; font-weight: bold; font-size: 20px;
  color: #0d0b1a; background: var(--neon-c); border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 0 20px rgba(244,63,94,.55);
  animation: pulse 0.7s ease-in-out infinite;
}
#retar-btn:active { transform: scale(.97); }
#move-hint { font-size: 11px; color: #7a72b0; text-align: center; }
#duel-bottom { display: flex; flex-direction: column; gap: 8px; }

/* ---- Resultado de duelo ---- */
#result {
  position: absolute; inset: 0;
  background: rgba(6,4,20,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  z-index: 20;
  backdrop-filter: blur(3px);
}
#result-title {
  font-size: 40px; color: var(--neon-y); text-align: center; padding: 0 16px;
  text-shadow: 0 0 20px rgba(253,224,71,.7);
  animation: pop .4s cubic-bezier(.2,1.6,.4,1);
}
#result-sub { font-size: 16px; color: var(--ink); text-align: center; padding: 0 20px; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
#continue-btn {
  padding: 14px 30px; font-family: inherit; font-weight: bold; font-size: 18px;
  color: #0d0b1a; background: var(--neon-p); border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 0 16px rgba(56,189,248,.5);
}
#continue-btn:active { transform: scale(.96); }

/* ---- Audio toggle ---- */
#reset-btn {
  position: absolute; top: 8px; right: 50px;
  width: 34px; height: 34px;
  background: rgba(0,0,0,.4); border: 1px solid #3a3270; border-radius: 6px;
  color: var(--ink); font-size: 18px; cursor: pointer; z-index: 25;
}
#audio-btn {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px;
  background: rgba(0,0,0,.4); border: 1px solid #3a3270; border-radius: 6px;
  font-size: 16px; cursor: pointer; z-index: 25;
}

.hidden { display: none !important; }
