/* ============================================================
   assets/css/main.css — RPG Browser Game
   Tema medieval oscuro · Mobile-first · PWA ready
   Paleta: Fondo #1a0e00 · Dorado #c8a45a · Texto #f0e8d0
   Tipografías: Cinzel (títulos) + Lato (cuerpo)
   ============================================================ */

/* ── Google Fonts ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Lato:wght@300;400;700&display=swap');

/* ── Variables CSS globales ──────────────────────────────── */
:root {
    /* Colores principales */
    --gold:          #c8a45a;
    --gold-light:    #f0d080;
    --gold-dark:     #8a6a30;
    --gold-glow:     rgba(200, 164, 90, 0.3);

    /* Fondos */
    --bg:            #0d0700;
    --bg-panel:      #1a0e00;
    --bg-card:       #2a1a00;
    --bg-card-2:     #3a2a10;
    --bg-input:      #150a00;
    --bg-overlay:    rgba(0, 0, 0, 0.85);

    /* Bordes */
    --border:        rgba(200, 164, 90, 0.25);
    --border-hover:  rgba(200, 164, 90, 0.6);

    /* Texto */
    --text:          #f0e8d0;
    --text-muted:    #a09070;
    --text-dim:      #6a5a40;

    /* Estados */
    --red:           #c0392b;
    --red-light:     #ff6b6b;
    --red-bg:        rgba(139, 0, 0, 0.2);
    --green:         #27ae60;
    --green-light:   #5a9a3b;
    --green-bg:      rgba(45, 90, 27, 0.2);
    --blue:          #2980b9;
    --blue-light:    #5dade2;

    /* Premium */
    --premium:       #9b59b6;
    --premium-light: #c39bd3;
    --premium-bg:    rgba(155, 89, 182, 0.15);

    /* Tipografías */
    --font-title:    'Cinzel', Georgia, serif;
    --font-body:     'Lato', 'Segoe UI', sans-serif;

    /* Layout */
    --max-width:     430px;
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     16px;

    /* Espaciado */
    --gap:           12px;
    --gap-lg:        20px;

    /* Sombras */
    --shadow:        0 4px 20px rgba(0, 0, 0, 0.6);
    --shadow-gold:   0 0 20px rgba(200, 164, 90, 0.2);

    /* Transiciones */
    --transition:    0.2s ease;

    /* Bottom nav height */
    --nav-h:         64px;
    --header-h:      56px;
}

/* ── Reset y base ────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Textura sutil de fondo */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(200,164,90,0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139,0,0,0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, textarea, select { font-family: var(--font-body); }

/* ── Contenedor principal (simula app móvil) ─────────────── */
.app-container {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-panel);
    position: relative;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

/* Decoración lateral en pantallas grandes */
@media (min-width: 500px) {
    body {
        background: var(--bg);
        background-image:
            repeating-linear-gradient(
                0deg,
                transparent,
                transparent 2px,
                rgba(200,164,90,0.015) 2px,
                rgba(200,164,90,0.015) 4px
            );
    }
}

/* ── Header fijo del juego ───────────────────────────────── */
.game-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--header-h);
    background: linear-gradient(180deg, #1a0e00 0%, rgba(26,14,0,0.95) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.game-header .char-name {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.game-header .header-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-stat i { font-size: 0.75rem; }
.header-stat .val { color: var(--text); font-weight: 700; }
.header-stat.gold-stat  .val { color: var(--gold); }
.header-stat.ruby-stat  .val { color: var(--premium-light); }
.header-stat.energy-stat .val { color: var(--blue-light); }

/* ── Barra de HP en header ───────────────────────────────── */
.hp-bar-mini {
    width: 60px;
    height: 6px;
    background: var(--bg-card-2);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.hp-bar-mini .fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--red), #e74c3c);
    transition: width 0.5s ease;
}
.hp-bar-mini .fill.high    { background: linear-gradient(90deg, var(--green), #2ecc71); }
.hp-bar-mini .fill.medium  { background: linear-gradient(90deg, #f39c12, #f1c40f); }

/* ── Contenido principal ─────────────────────────────────── */
.main-content {
    flex: 1;
    padding-top: var(--header-h);
    padding-bottom: calc(var(--nav-h) + 8px);
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* Página sin header/nav (login, instalador) */
.main-content.no-header { padding-top: 0; }
.main-content.no-nav    { padding-bottom: 0; }

/* ── Navegación inferior ─────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--nav-h);
    background: linear-gradient(0deg, #1a0e00 0%, rgba(26,14,0,0.98) 100%);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-dim);
    transition: color var(--transition);
    position: relative;
    padding: 8px 4px;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    color: var(--gold);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--gold);
    border-radius: 0 0 4px 4px;
}

.nav-item i   { font-size: 1.2rem; }
.nav-item span { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }

/* Badge de notificación en nav */
.nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    background: var(--red-light);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Cards / Paneles ─────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card-title {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--gold);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 16px; }
.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

/* Variantes de card */
.card.card-premium {
    border-color: rgba(155,89,182,0.4);
    background: linear-gradient(135deg, var(--bg-card), rgba(155,89,182,0.08));
}
.card.card-danger  { border-color: rgba(192,57,43,0.4); }
.card.card-success { border-color: rgba(39,174,96,0.4); }

/* ── Sección con padding ─────────────────────────────────── */
.section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.section-title {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Botones ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: all var(--transition);
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-full { width: 100%; }

/* Primario: dorado */
.btn-primary {
    background: linear-gradient(135deg, var(--gold), #b08030);
    color: #1a0e00;
    box-shadow: 0 2px 10px rgba(200,164,90,0.3);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    box-shadow: 0 4px 16px rgba(200,164,90,0.5);
    color: #1a0e00;
}

/* Secundario: borde dorado */
.btn-secondary {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--border-hover);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold-light);
}

/* Peligro: rojo */
.btn-danger {
    background: linear-gradient(135deg, var(--red), #922b21);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #e74c3c, var(--red));
}

/* Premium: violeta */
.btn-premium {
    background: linear-gradient(135deg, var(--premium), #7d3c98);
    color: #fff;
    box-shadow: 0 2px 10px rgba(155,89,182,0.3);
}
.btn-premium:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--premium-light), var(--premium));
}

/* Ghost */
.btn-ghost {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.08);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: var(--text); }

/* Tamaños */
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-lg { padding: 16px 28px; font-size: 1rem; }

/* ── Formularios ─────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.82rem;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: -2px;
}

.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-input::placeholder { color: var(--text-dim); }

.form-input.error {
    border-color: var(--red-light);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.2);
}

.form-error {
    font-size: 0.8rem;
    color: var(--red-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Barras de progreso ──────────────────────────────────── */
.progress-bar {
    height: 10px;
    background: var(--bg-card-2);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Brillo animado en la barra */
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%   { left: -100%; }
    100% { left: 100%;  }
}

.progress-fill.hp      { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.progress-fill.hp.high { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.progress-fill.hp.mid  { background: linear-gradient(90deg, #e67e22, #f39c12); }
.progress-fill.exp     { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.progress-fill.energy  { background: linear-gradient(90deg, #1a6fa8, var(--blue-light)); }
.progress-fill.premium { background: linear-gradient(90deg, #7d3c98, var(--premium-light)); }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ── Alertas / Mensajes ──────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 3px solid;
}

.alert i { margin-top: 1px; flex-shrink: 0; }

.alert-success {
    background: var(--green-bg);
    border-color: var(--green-light);
    color: #aaffaa;
}

.alert-error {
    background: var(--red-bg);
    border-color: var(--red-light);
    color: #ffaaaa;
}

.alert-warning {
    background: rgba(243,156,18,0.1);
    border-color: #f39c12;
    color: #ffd080;
}

.alert-info {
    background: rgba(41,128,185,0.1);
    border-color: var(--blue-light);
    color: #aaddff;
}

.alert-gold {
    background: rgba(200,164,90,0.1);
    border-color: var(--gold);
    color: var(--gold-light);
}

/* ── Badges / Etiquetas ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-gold    { background: rgba(200,164,90,0.2); color: var(--gold-light); border: 1px solid rgba(200,164,90,0.4); }
.badge-premium { background: var(--premium-bg); color: var(--premium-light); border: 1px solid rgba(155,89,182,0.4); }
.badge-danger  { background: var(--red-bg); color: var(--red-light); border: 1px solid rgba(192,57,43,0.4); }
.badge-success { background: var(--green-bg); color: #5a9a3b; border: 1px solid rgba(45,90,27,0.4); }
.badge-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.08); }

/* Rareza de items */
.badge-comun      { background: rgba(150,150,150,0.15); color: #ccc; border: 1px solid rgba(150,150,150,0.3); }
.badge-raro       { background: rgba(74,144,226,0.15); color: #5dade2; border: 1px solid rgba(74,144,226,0.4); }
.badge-epico      { background: rgba(155,89,182,0.15); color: var(--premium-light); border: 1px solid rgba(155,89,182,0.4); }
.badge-legendario { background: rgba(243,156,18,0.15); color: #f7dc6f; border: 1px solid rgba(243,156,18,0.5); }

/* ── Timer de mazmorra/misión ────────────────────────────── */
.timer-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-family: var(--font-title);
    color: var(--gold);
    font-weight: 700;
}

.timer-display.urgent { color: var(--red-light); animation: pulse 1s infinite; }

.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Stats del personaje ─────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-item {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-value {
    font-size: 1.3rem;
    font-family: var(--font-title);
    color: var(--gold);
    font-weight: 700;
    line-height: 1;
}

.stat-item.fuerza    .stat-value { color: #e74c3c; }
.stat-item.agilidad  .stat-value { color: #f39c12; }
.stat-item.astucia   .stat-value { color: #3498db; }
.stat-item.vitalidad .stat-value { color: #2ecc71; }

/* ── Lista de items ──────────────────────────────────────── */
.item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-2);
    border: 1px solid transparent;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}

.item-row:hover { border-color: var(--border-hover); background: var(--bg-card); }

.item-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--gold);
    flex-shrink: 0;
    border: 1px solid var(--border);
    overflow: hidden;
}

.item-icon img { width: 100%; height: 100%; object-fit: cover; }

.item-info { flex: 1; min-width: 0; }
.item-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Ranking row ─────────────────────────────────────────── */
.rank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-2);
    border: 1px solid transparent;
}

.rank-row.me {
    background: rgba(200,164,90,0.08);
    border-color: rgba(200,164,90,0.3);
}

.rank-pos {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 28px;
    text-align: center;
}

.rank-pos.gold   { color: #f7dc6f; }
.rank-pos.silver { color: #bdc3c7; }
.rank-pos.bronze { color: #cd853f; }

.rank-name { flex: 1; font-weight: 700; font-size: 0.9rem; }
.rank-val  { color: var(--gold); font-weight: 700; font-size: 0.9rem; }

/* ── Notificación de recompensa ──────────────────────────── */
.reward-popup {
    position: fixed;
    top: calc(var(--header-h) + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    max-width: calc(var(--max-width) - 32px);
    width: calc(100% - 32px);
    background: linear-gradient(135deg, #2a1a00, #3a2810);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 16px;
    z-index: 200;
    animation: slideDown 0.4s ease forwards, fadeOut 0.4s ease 3.5s forwards;
    box-shadow: var(--shadow-gold);
}

.reward-popup .reward-title {
    font-family: var(--font-title);
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reward-items {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 700;
}

.reward-item.exp   { color: #aaddff; }
.reward-item.gold  { color: var(--gold-light); }
.reward-item.level { color: #aaffaa; }

/* ── Diálogo de creación de personaje ───────────────────── */
.dialog-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
}

.dialog-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
}

.dialog-narrator {
    font-size: 0.78rem;
    color: var(--gold);
    font-family: var(--font-title);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dialog-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 20px;
}

/* Texto que aparece letra a letra */
.dialog-text.typing::after {
    content: '|';
    animation: blink 0.8s infinite;
    color: var(--gold);
}

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Selector de clase ───────────────────────────────────── */
.class-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.class-card {
    background: var(--bg-card-2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-user-select: none;
    user-select: none;
}

.class-card:hover,
.class-card.selected {
    border-color: var(--gold);
    background: rgba(200,164,90,0.08);
    box-shadow: 0 0 0 1px var(--gold-glow);
}

.class-card.selected {
    background: rgba(200,164,90,0.12);
}

.class-icon {
    width: 52px;
    height: 52px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gold);
    flex-shrink: 0;
    border: 2px solid var(--border);
    overflow: hidden;
}

.class-icon img { width: 100%; height: 100%; object-fit: cover; }

.class-info { flex: 1; min-width: 0; }
.class-name {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 4px;
}
.class-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

.class-stats-mini {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.class-stat-pill {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── Distribuir atributos ────────────────────────────────── */
.attr-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.attr-row:last-child { border-bottom: none; }

.attr-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.attr-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attr-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    color: var(--gold);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.attr-btn:hover:not(:disabled) {
    background: var(--gold-glow);
    border-color: var(--gold);
}

.attr-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.attr-val {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--gold);
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

.points-left {
    background: var(--bg-card-2);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: 700;
    text-align: center;
    display: inline-block;
}

/* ── Misiones / Mazmorras list ───────────────────────────── */
.quest-card {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
}

.quest-card:hover { border-color: var(--border-hover); }

.quest-card-header {
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.quest-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
}

.quest-icon img { width: 100%; height: 100%; object-fit: cover; }

.quest-info { flex: 1; min-width: 0; }
.quest-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; color: var(--text); }
.quest-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

.quest-rewards {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.quest-reward {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.quest-reward.exp   i { color: var(--blue-light); }
.quest-reward.gold  i { color: var(--gold); }
.quest-reward.time  i { color: #a09070; }
.quest-reward.energy i { color: var(--red-light); }

.quest-action {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

/* ── Separadores ─────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 4px 0;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Modales ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    width: 100%;
    max-width: var(--max-width);
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle {
    width: 40px; height: 4px;
    background: var(--bg-card-2);
    border-radius: 2px;
    margin: 12px auto 0;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--gold);
    font-weight: 700;
}

.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover { color: var(--text); border-color: var(--border-hover); }
.modal-body { padding: 20px; }

/* ── Animaciones globales ────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);     opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

@keyframes levelUp {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(1);   opacity: 1; }
}

@keyframes goldGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(200,164,90,0.2); }
    50%       { box-shadow: 0 0 25px rgba(200,164,90,0.5); }
}

.animate-fadein  { animation: fadeIn  0.4s ease; }
.animate-slideup { animation: slideUp 0.4s ease; }
.animate-pulse   { animation: pulse   1.5s infinite; }
.animate-glow    { animation: goldGlow 2s infinite; }

/* ── Utilidades ──────────────────────────────────────────── */
.flex      { display: flex; }
.flex-col  { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm    { gap: 8px; }
.gap-md    { gap: 12px; }
.gap-lg    { gap: 20px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--text-muted); }
.text-red    { color: var(--red-light); }
.text-green  { color: var(--green-light); }
.text-premium { color: var(--premium-light); }
.font-title  { font-family: var(--font-title); }
.font-bold   { font-weight: 700; }
.font-sm     { font-size: 0.82rem; }
.font-xs     { font-size: 0.72rem; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar personalizado ─────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner-lg {
    width: 40px; height: 40px;
    border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: block;
}

.empty-state p { font-size: 0.9rem; line-height: 1.6; }

/* ── Safe area para iPhone con notch ─────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    }
    .main-content {
        padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
    }
}
