/* === INTRO OVERLAY === */
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 168, 76, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 85%, rgba(108, 52, 131, 0.09) 0%, transparent 45%),
        radial-gradient(ellipse at center, rgba(13, 27, 42, 0.3) 0%, rgba(0,0,0,0.96) 70%),
        radial-gradient(ellipse at 50% 105%, rgba(180, 50, 0, 0.45) 0%, rgba(100, 20, 0, 0.2) 35%, transparent 60%),
        linear-gradient(180deg, #060d18 0%, #0a0e20 40%, #0d0a1a 60%, #060d18 100%);
    animation: overlayAppear 1.8s ease forwards;
    transition: opacity 0.9s ease;
}

.intro-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes overlayAppear {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.intro-overlay-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    animation: fadeIn 2.5s ease forwards;
}

.intro-overlay-crest {
    font-size: 4rem;
    color: var(--gold);
    animation: crystalGlow 3s ease-in-out infinite;
    margin-bottom: 0.5rem;
}

@keyframes crystalGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(201, 168, 76, 0.5), 0 0 40px rgba(201, 168, 76, 0.2); }
    50%       { text-shadow: 0 0 50px rgba(201, 168, 76, 1),   0 0 90px rgba(108, 52, 131, 0.5); }
}

.intro-overlay-title {
    font-family: 'MedievalSharp', serif;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    color: var(--parchment);
    text-shadow: 0 2px 20px rgba(201, 168, 76, 0.3);
    margin: 0;
}

.intro-overlay-subtitle {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--gold-light);
    opacity: 0.75;
    margin: 0;
}

.intro-overlay-sep {
    color: var(--gold);
    opacity: 0.5;
    letter-spacing: 0.5rem;
    margin: 0.8rem 0;
}

.intro-overlay-prompt {
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    color: var(--parchment-dark);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 1.5rem;
    animation: promptBlink 2.2s ease-in-out infinite;
}

@keyframes promptBlink {
    0%, 100% { opacity: 0.3; }
    50%       { opacity: 0.9; }
}

/* === TITLE SCREEN === */
#title-screen {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 168, 76, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 85%, rgba(108, 52, 131, 0.09) 0%, transparent 45%),
        radial-gradient(ellipse at center, rgba(13, 27, 42, 0.3) 0%, rgba(0,0,0,0.96) 70%),
        radial-gradient(ellipse at 50% 105%, rgba(180, 50, 0, 0.45) 0%, rgba(100, 20, 0, 0.2) 35%, transparent 60%),
        linear-gradient(180deg, #060d18 0%, #0a0e20 40%, #0d0a1a 60%, #060d18 100%);
}

.title-content {
    text-align: center;
    animation: fadeIn 2s ease;
    padding: 2rem;
}

/* Crest avec lignes latérales */
.title-crest-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.8rem;
    margin-bottom: 1.2rem;
}

.title-crest-line {
    width: 90px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 168, 76, 0.55), transparent);
}

.title-crest {
    font-size: 3rem;
    color: var(--gold);
    filter: drop-shadow(0 0 18px rgba(201, 168, 76, 0.65));
    animation: crestPulse 5s ease-in-out infinite;
    display: block;
    line-height: 1;
}

@keyframes crestPulse {
    0%, 100% {
        filter: drop-shadow(0 0 18px rgba(201, 168, 76, 0.65));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 32px rgba(201, 168, 76, 1)) drop-shadow(0 0 60px rgba(201, 168, 76, 0.3));
        transform: scale(1.07);
    }
}

.title-content h1 {
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--gold);
    text-shadow:
        0 0 40px rgba(201, 168, 76, 0.35),
        0 0 80px rgba(201, 168, 76, 0.15),
        2px 2px 4px rgba(0, 0, 0, 0.9);
    letter-spacing: 4px;
}

.subtitle {
    font-style: italic;
    font-size: 1.2rem;
    color: var(--parchment-dark);
    margin: 0.6rem 0 0;
    letter-spacing: 0.03em;
    opacity: 0.85;
}

.title-lore {
    font-style: italic;
    font-size: 1rem;
    color: rgba(212, 196, 161, 0.42);
    margin: 1rem 0 0;
    letter-spacing: 0.02em;
}

.title-sep {
    margin: 1.8rem auto 1.2rem;
    color: rgba(201, 168, 76, 0.35);
    font-size: 0.7rem;
    letter-spacing: 0.55em;
}

.title-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
}

/* === BUTTONS === */
.btn-medieval {
    font-family: 'MedievalSharp', cursive;
    font-size: 1.2rem;
    padding: 12px 36px;
    background: linear-gradient(180deg, var(--gold) 0%, #a07830 100%);
    color: var(--ink);
    border: 2px solid var(--gold-light);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-medieval:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
}

.btn-medieval:active {
    transform: translateY(0);
}

.btn-medieval:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-medieval.secondary {
    background: linear-gradient(180deg, rgba(201, 168, 76, 0.12) 0%, rgba(160, 120, 48, 0.08) 100%);
    border-color: rgba(201, 168, 76, 0.45);
    color: var(--parchment);
    text-shadow: none;
}

.btn-medieval.secondary:hover {
    background: linear-gradient(180deg, rgba(201, 168, 76, 0.22) 0%, rgba(201, 168, 76, 0.12) 100%);
    border-color: var(--gold);
    color: var(--parchment);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* === CHARACTER SCREEN === */
#character-screen {
    background: linear-gradient(180deg, #1a0a00 0%, #0d0d2b 50%, #1a0a00 100%);
    overflow-y: auto;
    padding: 2rem;
}

#character-screen .panel {
    max-width: 1100px;
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-family: 'MedievalSharp', cursive;
    font-size: 1.2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 16px;
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    background: rgba(244, 228, 193, 0.1);
    border: 1px solid var(--gold);
    border-radius: 4px;
    color: var(--parchment);
    outline: none;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.3);
}

.class-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.class-card {
    background: rgba(244, 228, 193, 0.05);
    border: 2px solid rgba(201, 168, 76, 0.3);
    border-radius: 8px;
    padding: 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.class-card:hover {
    border-color: var(--gold);
    background: rgba(244, 228, 193, 0.1);
    transform: translateY(-3px);
}

.class-card.selected {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.15);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.2);
}

.class-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.class-card h3 {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold);
    margin-bottom: 0.3rem;
}

.class-card p {
    font-size: 0.9rem;
    color: var(--parchment-dark);
    margin-bottom: 0.5rem;
}

.class-stats {
    font-size: 0.8rem;
    color: var(--gold-light);
    font-weight: 600;
}

/* === STORY SELECTION === */
#story-selection-screen {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(201, 168, 76, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(108, 52, 131, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, #0a0608 0%, #100812 40%, #0d0818 70%, #060d18 100%);
    padding: 2rem;
    overflow-y: auto;
}

.selection-panel {
    max-width: 820px;
    width: 100%;
}

/* Header ornemental */
.selection-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.8rem;
    border-bottom: 1px solid rgba(201, 168, 76, 0.18);
}

.selection-ornament {
    font-size: 0.65rem;
    color: rgba(201, 168, 76, 0.45);
    letter-spacing: 0.55em;
    margin-bottom: 0.7rem;
}

.selection-header h2 {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold);
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    text-shadow: 0 0 30px rgba(201, 168, 76, 0.25);
    letter-spacing: 2px;
}

.selection-sub {
    font-style: italic;
    color: rgba(212, 196, 161, 0.45);
    font-size: 0.95rem;
    margin-top: 0.4rem;
    letter-spacing: 0.03em;
}

/* Grille et cartes */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.8rem;
    margin-bottom: 2rem;
}

.story-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    cursor: default;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(201, 168, 76, 0.12);
}

/* Bandeau accent en haut de la carte */
.story-card-accent {
    background: linear-gradient(135deg,
        rgba(201, 168, 76, 0.14) 0%,
        rgba(201, 168, 76, 0.04) 60%,
        transparent 100%);
    border-bottom: 1px solid rgba(201, 168, 76, 0.22);
    padding: 1.6rem 1.8rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.story-card-icon {
    font-size: 2.8rem;
    filter: drop-shadow(0 0 12px rgba(201, 168, 76, 0.55));
    line-height: 1;
    flex-shrink: 0;
}

.story-card-series {
    font-family: 'MedievalSharp', cursive;
    font-size: 0.78rem;
    color: rgba(201, 168, 76, 0.55);
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.story-info {
    padding: 1.6rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1;
}

.story-info h3 {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold);
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.story-info > p {
    font-size: 0.95rem;
    color: var(--parchment-dark);
    line-height: 1.6;
    flex: 1;
    opacity: 0.9;
}

/* Badges de métadonnées */
.story-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.story-meta-tag {
    font-size: 0.75rem;
    color: rgba(212, 196, 161, 0.58);
    background: rgba(201, 168, 76, 0.07);
    border: 1px solid rgba(201, 168, 76, 0.18);
    padding: 3px 10px;
    border-radius: 20px;
    font-style: italic;
    white-space: nowrap;
}

.select-story-btn {
    align-self: flex-start;
    padding: 10px 28px;
    font-size: 1rem;
    margin-top: 0.4rem;
}

/* === CHAPTER SELECTION === */
.chapter-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
}

.chapter-card {
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    cursor: default;
}

.chapter-card.locked {
    opacity: 0.5;
}

.chapter-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
}

.chapter-number {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold);
    font-size: 1.3rem;
    white-space: nowrap;
    min-width: 120px;
}

.chapter-subtitle {
    color: var(--parchment-dark);
    font-size: 1rem;
    font-style: italic;
    flex: 1;
}

.chapter-locked {
    color: var(--parchment-dark);
    font-style: italic;
    font-size: 0.9rem;
}

.select-chapter-btn {
    padding: 8px 24px;
    font-size: 1rem;
}

