/* ============================================
   FIGHT ARENA — estilo neon anime/cyberpunk
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: #06070d;
  color: #e7ecf3;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}
body { position: relative; }
a { color: inherit; text-decoration: none; }

/* ======== BACKGROUND ======== */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(120,180,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,180,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 35%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(231,76,60,0.18), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(155,89,182,0.18), transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(41,167,99,0.12), transparent 50%);
  animation: glowShift 12s ease-in-out infinite alternate;
}
@keyframes glowShift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(30deg); }
}

/* ======== TOPBAR ======== */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(120,180,255,0.12);
  backdrop-filter: blur(8px);
  background: rgba(8,10,18,0.4);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 28px; filter: drop-shadow(0 0 8px rgba(231,76,60,0.6)); }
.brand h1 {
  font-size: 22px; letter-spacing: 4px; font-weight: 800;
  background: linear-gradient(90deg,#e74c3c,#9b59b6,#4a90e2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .tag { font-size: 11px; color: #6b7a90; letter-spacing: 1px; text-transform: uppercase; }
.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #6b7a90; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7a90; box-shadow: 0 0 8px currentColor; }
.dot.online { background: #27ae60; }
.dot.offline { background: #e74c3c; }

/* ======== LOBBY ======== */
.lobby-main {
  position: relative; z-index: 2;
  max-width: 1200px; margin: 32px auto;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px;
  padding: 0 22px;
}
.card {
  background: linear-gradient(180deg, rgba(15,18,28,0.85), rgba(10,12,20,0.85));
  border: 1px solid rgba(120,180,255,0.14);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(6px);
}
.card h2 { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: #8a98ad; margin-bottom: 14px; }
.card label { display: block; margin-bottom: 16px; font-size: 12px; color: #8a98ad; text-transform: uppercase; letter-spacing: 1px; }
.card input[type="text"] {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 14px; font-size: 15px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(120,180,255,0.18);
  border-radius: 8px; color: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.card input[type="text"]:focus {
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

/* ======== ARCHETYPE GRID ======== */
.arch-grid {
  display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin-top: 8px;
}
.arch {
  --c: #4a90e2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; cursor: pointer;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; color: #cfd8e3;
  transition: transform .12s, border-color .12s, background .12s;
  font-family: inherit;
}
.arch:hover { transform: translateY(-2px); border-color: var(--c); }
.arch.selected {
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 25%, transparent), transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 40%, transparent);
}
.arch .ico { font-size: 22px; filter: drop-shadow(0 0 6px var(--c)); }
.arch strong { font-size: 12px; letter-spacing: 1px; }
.arch small { font-size: 10px; color: #6b7a90; text-align: center; }

/* ======== ROOMS ======== */
.room-actions { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.room-actions input {
  flex: 0 0 130px; padding: 10px 14px; font-size: 14px; letter-spacing: 2px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(120,180,255,0.18);
  border-radius: 8px; color: #fff; outline: none; text-transform: uppercase;
}
.room-list {
  list-style: none; max-height: 260px; overflow-y: auto;
  border: 1px solid rgba(120,180,255,0.08); border-radius: 8px;
  background: rgba(0,0,0,0.2);
}
.room-list .empty { padding: 22px; text-align: center; color: #6b7a90; font-style: italic; }
.room-list li.room {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(120,180,255,0.06);
  cursor: pointer; transition: background .12s;
}
.room-list li.room:last-child { border-bottom: none; }
.room-list li.room:hover { background: rgba(74,144,226,0.08); }
.room-list .code {
  font-size: 16px; font-weight: 700; letter-spacing: 4px;
  color: #4a90e2; text-shadow: 0 0 8px rgba(74,144,226,0.5);
}
.room-list .meta { font-size: 12px; color: #6b7a90; }
.room-list .count { font-size: 13px; color: #27ae60; font-weight: 600; }
.room-list .count.full { color: #e74c3c; }
.room-list .theme { font-size: 11px; color: #9b59b6; font-style: italic; }

/* ======== BUTTONS ======== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border: none; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn.primary {
  background: linear-gradient(135deg,#e74c3c,#9b59b6);
  color: #fff; box-shadow: 0 4px 16px rgba(231,76,60,0.3);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(231,76,60,0.5); }
.btn.ghost {
  background: rgba(120,180,255,0.06);
  border: 1px solid rgba(120,180,255,0.18);
  color: #cfd8e3;
}
.btn.ghost:hover { background: rgba(120,180,255,0.12); }
.btn.small { padding: 6px 12px; font-size: 11px; }

/* ======== RANKING ======== */
.rank { grid-column: 1 / -1; }
.rank-list { list-style: none; counter-reset: rank; }
.rank-list li.empty { padding: 22px; text-align: center; color: #6b7a90; font-style: italic; }
.rank-list li {
  display: grid; grid-template-columns: 36px 1fr 80px 80px 100px;
  gap: 12px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid rgba(120,180,255,0.06);
  counter-increment: rank;
}
.rank-list li:last-child { border-bottom: none; }
.rank-list li::before {
  content: counter(rank);
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(120,180,255,0.08); color: #6b7a90;
  font-size: 12px; font-weight: 700;
}
.rank-list li:nth-child(1)::before { background: linear-gradient(135deg,#ffd700,#ffa500); color: #000; box-shadow: 0 0 12px rgba(255,215,0,0.5); }
.rank-list li:nth-child(2)::before { background: linear-gradient(135deg,#c0c0c0,#888); color: #000; }
.rank-list li:nth-child(3)::before { background: linear-gradient(135deg,#cd7f32,#8b4513); color: #fff; }
.rank-list .rnick { font-weight: 600; color: #cfd8e3; }
.rank-list .rstat { font-size: 12px; color: #6b7a90; }
.rank-list .rpts { color: #4a90e2; font-weight: 700; text-align: right; }

/* ======== FOOTER ======== */
.footer {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; margin-top: 30px;
  border-top: 1px solid rgba(120,180,255,0.12);
  font-size: 11px; color: #6b7a90; letter-spacing: 1px;
}
.kbd {
  display: inline-block;
  padding: 2px 8px; margin: 0 2px;
  background: rgba(120,180,255,0.08); border: 1px solid rgba(120,180,255,0.18);
  border-radius: 4px; font-family: 'Courier New', monospace; font-size: 11px;
  color: #cfd8e3;
}

/* ======== TOAST ======== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(40px);
  background: rgba(15,18,28,0.95); border: 1px solid rgba(231,76,60,0.4);
  border-radius: 8px; padding: 10px 18px; font-size: 13px;
  color: #fff; opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================
   ARENA
   ============================================ */
body.arena { overflow: hidden; }
.arena-top {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center;
  padding: 12px 20px;
  background: rgba(8,10,18,0.6); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(120,180,255,0.12);
}
.arena-top .left, .arena-top .right { display: flex; gap: 8px; align-items: center; }
.arena-top .right { justify-content: flex-end; }
.badge {
  padding: 4px 10px; border-radius: 6px; font-size: 11px;
  background: rgba(120,180,255,0.08); border: 1px solid rgba(120,180,255,0.18);
  color: #cfd8e3; letter-spacing: 1px;
}
.badge.timer { font-family: 'Courier New', monospace; color: #f5a623; border-color: rgba(245,166,35,0.3); }
.badge.ghost { background: transparent; }
.narration {
  text-align: center; font-size: 13px; font-style: italic; color: #cfd8e3;
  min-height: 20px;
  text-shadow: 0 0 8px rgba(155,89,182,0.4);
  animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.arena-main {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 100px); padding: 20px;
}
.stage {
  position: relative;
  border: 2px solid rgba(120,180,255,0.2);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(231,76,60,0.15);
}
canvas { display: block; background: #06070d; }
.hud {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; gap: 8px; pointer-events: none;
}
.hp-bar {
  flex: 1; height: 22px; position: relative;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px; overflow: hidden;
}
.hp-bar .fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg,#27ae60,#f5a623,#e74c3c);
  transition: width .15s;
}
.hp-bar .label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.event-log {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: none; align-items: center;
}
.event-log .ev {
  padding: 4px 12px; border-radius: 14px;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(120,180,255,0.2);
  font-size: 12px; color: #cfd8e3;
  animation: slideUp .35s ease-out;
}
.event-log .ev.kill { border-color: #e74c3c; color: #ff8a80; }
.event-log .ev.crit { border-color: #f5a623; color: #ffd180; }
.event-log .ev.special { border-color: #9b59b6; color: #ce93d8; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.arena-foot {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3;
  background: rgba(8,10,18,0.85); border-top: 1px solid rgba(120,180,255,0.12);
  padding: 8px 20px; text-align: center; font-size: 11px; color: #6b7a90;
}

/* ======== OVERLAY ======== */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,7,13,0.85); backdrop-filter: blur(4px);
}
.overlay.hidden { display: none; }
.overlay-card {
  background: rgba(15,18,28,0.95);
  border: 1px solid rgba(231,76,60,0.4);
  border-radius: 14px; padding: 32px 36px;
  text-align: center; max-width: 420px;
  box-shadow: 0 0 60px rgba(231,76,60,0.3);
}
.overlay-card h2 {
  font-size: 22px; margin-bottom: 10px; letter-spacing: 2px;
  background: linear-gradient(90deg,#e74c3c,#9b59b6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.overlay-card p { color: #8a98ad; margin-bottom: 20px; }

/* ======== RESPONSIVE ======== */
@media (max-width: 900px) {
  .lobby-main { grid-template-columns: 1fr; }
  .arch-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 600px) {
  canvas { width: 100%; height: auto; }
  .arena-top { grid-template-columns: 1fr; gap: 8px; }
  .arena-top .right { justify-content: center; }
}
