@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --bg: #100d18;
  --bg-elevated: #17131f;
  --ink: #eae6f0;
  --ink-dim: #a89fb8;
  --gold: #c9a35a;
  --gold-bright: #e8c77e;
  --violet: #7b2ff7;
  --danger: #d1453b;
  --ok: #3fa796;
  --border: #382f4a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% -10%, #241a38 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: 'Rajdhani', sans-serif;
}

h1, h2, h3, .brand {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  margin: 0;
}

a { color: var(--gold-bright); }

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 48px);
}

.topbar {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar .brand { font-size: clamp(1.1rem, 3vw, 1.5rem); }

.topbar nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Componente insignia: la "carta de duelo" --- */
.duel-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--bg-elevated), #14101d);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 32px);
  box-shadow: 0 0 0 1px rgba(201, 163, 90, 0.15), 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

.duel-card::before {
  content: '';
  position: absolute;
  inset: -60% -60% auto auto;
  width: 140%;
  height: 140%;
  background: linear-gradient(115deg, transparent 40%, rgba(123, 47, 247, 0.18) 48%, rgba(232, 199, 126, 0.25) 52%, transparent 60%);
  pointer-events: none;
  animation: sheen 6s ease-in-out infinite;
}

@keyframes sheen {
  0%, 100% { transform: translate(-8%, -4%); }
  50% { transform: translate(4%, 6%); }
}

@media (prefers-reduced-motion: reduce) {
  .duel-card::before { animation: none; }
}

.duel-card.wide { max-width: 720px; }

.card-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

/* Tabs de login/registro estilo tipo-de-carta */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 4px;
  position: relative;
  z-index: 1;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-dim);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.tab.active {
  background: var(--gold);
  color: #1c1420;
}

.form { display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }

label { font-size: 0.85rem; color: var(--ink-dim); font-weight: 600; }

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  background: #1c1728;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  margin-top: 4px;
}

textarea { resize: vertical; }

.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 4px;
  width: 100%;
  max-width: 900px;
}

.section-tabs .tab { flex: 1; }

input:focus, select:focus, button:focus, .tab:focus {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

button, .btn {
  padding: 11px 18px;
  border-radius: 6px;
  border: none;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn-primary { background: var(--gold); color: #1c1420; }
.btn-primary:hover { background: var(--gold-bright); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-small { padding: 6px 10px; font-size: 0.85rem; }

.msg {
  min-height: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* Perfil: filas de estadística estilo ATK/DEF */
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

.stat-label {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  align-self: center;
}

.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--gold-bright);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.admin { background: rgba(123, 47, 247, 0.25); color: #c9a6ff; border: 1px solid var(--violet); }
.badge.player { background: rgba(63, 167, 150, 0.2); color: var(--ok); border: 1px solid var(--ok); }

/* Tabla de administración */
table {
  width: 100%;
  border-collapse: collapse;
  position: relative;
  z-index: 1;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  color: var(--ink-dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

td input, td select { padding: 6px 8px; font-size: 0.85rem; }

.table-wrap { overflow-x: auto; width: 100%; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.hidden { display: none !important; }

.empty-state {
  text-align: center;
  color: var(--ink-dim);
  padding: 24px;
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; gap: 2px; }
}


/* --- Selector de avatar y avatar del perfil --- */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 6px; }
.avatar-option {
  font-size: 1.6rem; line-height: 1; padding: 10px 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 10px;
}
.avatar-option.selected { border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--gold-bright) inset; }
.avatar-large {
  font-size: 2.4rem; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, 0.04);
}

/* Paginación (administración de cartas) */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 12px 0; font-size: 0.85rem; color: var(--muted); }
.thumb { width: 36px; height: auto; border-radius: 4px; display: block; }
