/* =========================================================================
   ERYNDALE — sistema de diseño
   La paleta, la tipografía y el tema por facción vienen del juego original.
   ========================================================================= */

:root {
    /* Fondos, del más oscuro al más claro */
    --bg-deep: #140f0c;
    --bg-primary: #1a1410;
    --bg-secondary: #2a1f1a;
    --bg-tertiary: #3d2e24;

    --brown-dark: #4a3528;
    --brown-medium: #6b4e3d;
    --brown-light: #8b6f5c;

    --gold: #d4af37;
    --gold-light: #f4d06f;
    --gold-dark: #b8941f;

    --text-primary: #e8d5c4;
    --text-secondary: #c4b5a0;
    --text-muted: #8b7d6b;

    --danger: #c0532f;
    --success: #7fb069;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.8);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --border-soft: 1px solid rgba(212, 175, 55, 0.28);
    --border-strong: 2px solid var(--gold);

    --panel-bg: rgba(26, 20, 16, 0.74);
    --panel-bg-strong: rgba(18, 12, 10, 0.86);

    --sidebar-width: 250px;
    --content-max: 1180px;

    /* La facción del jugador tiñe el acento y el fondo. Sin facción, oro. */
    --accent: var(--gold);
    --faction-bg: none;

    --font-display: 'Cinzel', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body[data-faction='ignis'] {
    --accent: #d9542b;
    --faction-bg: url("../images/factions/ignis-TYp-mz9.webp");
}

body[data-faction='aurora'] {
    --accent: #d4af37;
    --faction-bg: url("../images/factions/aurora-OZDn1Ct.webp");
}

body[data-faction='sylva'] {
    --accent: #6aa84f;
    --faction-bg: url("../images/factions/sylva-mC3Ndnu.webp");
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
    margin: 0;
    padding: 0;
}

ul,
ol {
    list-style: none;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle at 20% 10%, rgba(212, 175, 55, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 82% 78%, rgba(212, 175, 55, 0.035) 0%, transparent 45%),
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 1px, transparent 1px 7px);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

a {
    color: var(--gold-light);
    text-decoration: none;
    transition: color 0.18s ease;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 3px;
}

/* =========================================================================
   Piezas reutilizables
   ========================================================================= */

.panel {
    background: var(--panel-bg);
    border: var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 22px 24px;
    backdrop-filter: blur(3px);
}

.panel--flush {
    padding: 0;
    overflow: hidden;
}

.panel__title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: var(--border-soft);
}

.panel__title h2,
.panel__title h3 {
    font-size: 1.15rem;
    color: var(--gold-light);
}

.eyebrow {
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.muted {
    color: var(--text-muted);
}

.lead {
    font-size: 1.08rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 22px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--bg-deep);
    background: linear-gradient(160deg, var(--gold-light), var(--gold-dark));
    border: 1px solid var(--gold-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn:hover:not(:disabled) {
    color: var(--bg-deep);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.28);
}

.btn:disabled,
.btn[aria-disabled='true'] {
    filter: grayscale(0.7);
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--ghost {
    color: var(--gold-light);
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.45);
}

.btn--ghost:hover {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.09);
}

.btn--block {
    width: 100%;
}

.btn--small {
    padding: 7px 14px;
    font-size: 0.8rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.32);
    border: var(--border-soft);
    border-radius: 999px;
}

.progress {
    height: 7px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.stack {
    display: grid;
    gap: 18px;
}

.stack--tight {
    gap: 10px;
}

.stack--loose {
    gap: 30px;
}

/* Avisos que aparecen tras una acción */
.flashes {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    font-size: 0.92rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--gold);
    background: rgba(212, 175, 55, 0.09);
}

.flash--error {
    border-left-color: var(--danger);
    background: rgba(192, 83, 47, 0.12);
}

.flash--success {
    border-left-color: var(--success);
    background: rgba(127, 176, 105, 0.12);
}

/* Formularios */
.field {
    display: grid;
    gap: 7px;
}

.field label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.field input {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 0.97rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--brown-medium);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s ease;
}

.field input:focus {
    border-color: var(--gold);
    outline: none;
}

.field__error {
    font-size: 0.82rem;
    color: var(--danger);
}
