/* LYTHAË
 * Copyright (c) 2026 Famaelee. Tous droits réservés.
 * Toute reproduction, modification ou distribution de ce code sans autorisation est strictement interdite.
 * Concept, Design et Lore par Famaelee.
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Inter:wght@300;400;600&display=swap');

:root {
    --primary: #6f8bff;
    --primary-glow: rgba(111, 139, 255, 0.4);
    --accent: #7dffc8;
    --bg-dark: #050a18;
    --unlocked-gold: #ffd700;
}

/* --- BASE & LAYOUT --- */
body {
    margin: 0; padding: 0; min-height: 100vh;
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1e2a4a, transparent), var(--bg-dark);
    background-attachment: fixed;
    color: #eef1ff; overflow-x: hidden;
}

main {
    min-height: 600px; 
    transition: min-height 0.3s ease;
}

.container { max-width: 1000px; margin: auto; padding: 20px 20px 100px; }

/* --- SELECTION & SCROLLBAR --- */
::selection, ::-moz-selection {
    background: var(--accent);
    color: var(--bg-dark);
    text-shadow: none;
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #050a18; }
::-webkit-scrollbar-thumb {
    background: rgba(111, 139, 255, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(111, 139, 255, 0.05);
}
::-webkit-scrollbar-thumb:hover { background: rgba(111, 139, 255, 0.4); cursor: pointer; }

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(111, 139, 255, 0.2) #050a18;
    scrollbar-gutter: stable;
}

/* --- CHRONIQUES --- */
.chronicle-container { text-align: center; min-height: 60px; margin-bottom: 20px; font-style: italic; color: var(--accent); display: flex; align-items: center; justify-content: center; }
#chronicleText { transition: opacity 1s ease-in-out; opacity: 1; }
#chronicleText.fade-out { opacity: 0; }

/* --- ALTAR (COMPTEURS) --- */
.altar-wrapper { display: flex; justify-content: center; margin-bottom: 40px; }
.altar-header {
    padding: 50px 60px; 
    background: rgba(15, 23, 42, 0.85); 
    border: 1px solid rgba(111, 139, 255, 0.2);
    border-radius: 30px; 
    text-align: center;
    backdrop-filter: blur(10px); 
    width: 450px; 
    box-sizing: border-box;
}
.mana-value { 
    font-family: 'Inter', sans-serif; 
    font-weight: 800;
    font-size: 3.5em;
    letter-spacing: -2px;

    /* Stabilisation technique */
    font-variant-numeric: tabular-nums; 
    font-feature-settings: "tnum";
    
    display: inline-block;              
    min-width: 280px;                   
    white-space: nowrap;               

    background: linear-gradient(180deg, #ffffff 20%, var(--unlocked-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    
    filter: drop-shadow(0 0 15px rgba(111, 139, 255, 0.5));
}
.mana-label { font-size: 0.6em; letter-spacing: 4px; color: var(--primary); font-weight: 600; }
.stats-bar { margin: 12px 0; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 10px; }
.stat-number { font-family: 'Cinzel', sans-serif; color: var(--accent); }

/* --- BOUTON PRINCIPAL --- */
.canalize-btn {
    background: linear-gradient(180deg, rgba(111, 139, 255, 0.15), rgba(15, 23, 42, 0.4));
    border: 1px solid rgba(111, 139, 255, 0.3);
    border-radius: 50px;
    padding: 15px 40px;
    color: #eef1ff; 
    font-family: 'Cinzel', serif;
    font-weight: 700; 
    font-size: 0.95em; 
    letter-spacing: 2px; 
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px); 
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative; 
    overflow: hidden;
}
.canalize-btn:hover {
    background: linear-gradient(180deg, rgba(111, 139, 255, 0.25), rgba(15, 23, 42, 0.5));
    border-color: var(--primary);
    box-shadow: 0 0 25px var(--primary-glow), inset 0 0 20px rgba(111, 139, 255, 0.1);
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8); color: #fff;
}
.canalize-btn:active { transform: translateY(1px) scale(0.98); box-shadow: 0 0 10px var(--primary-glow); }

/* --- TABS --- */
.mystic-tabs-container { 
    position: relative; width: fit-content; margin: 0 auto 30px; 
    padding: 5px; background: rgba(15, 23, 42, 0.6);
    border-radius: 50px; border: 1px solid rgba(111, 139, 255, 0.1);
    backdrop-filter: blur(5px);
}
.mystic-tabs { display: flex; gap: 10px; position: relative; }
.tab { 
    padding: 12px 25px; font-family: 'Cinzel', serif; cursor: pointer; 
    opacity: 0.6; font-size: 0.9em; transition: all 0.4s ease;
    border-radius: 30px; color: #a0d2ff; position: relative; z-index: 2;
}
.tab:hover { opacity: 1; background: rgba(255, 255, 255, 0.05); color: #fff; text-shadow: 0 0 10px rgba(111, 139, 255, 0.5); }
.tab.active { opacity: 1; color: #fff; text-shadow: 0 0 15px var(--primary); }
.tab-indicator { 
    position: absolute; bottom: 0; top: 0; left: 0; height: 100%; 
    background: linear-gradient(90deg, rgba(111,139,255,0.1), rgba(111,139,255,0.25));
    border: 1px solid rgba(111, 139, 255, 0.3); border-radius: 30px;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: 0 0 15px rgba(111, 139, 255, 0.1); z-index: 1;
}
.notif-dot { 
    position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; 
    background: var(--unlocked-gold); border-radius: 50%; display: none; 
    box-shadow: 0 0 8px var(--unlocked-gold);
}

/* --- CARTES (STRUCTURE UNIFIÉE) --- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.card-wrapper { position: relative; height: 170px; }
.card {
    position: absolute; top: 0; left: 0; width: 100%; height: 170px;
    background-color: #0b1226; background-size: cover; background-position: center;
    border: 1px solid rgba(111, 139, 255, 0.2); border-radius: 20px;
    padding: 20px; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10; overflow: hidden; box-sizing: border-box; cursor: pointer;
}
.card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent, rgba(5,10,24,0.95)); z-index: 1; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

.producer-title { font-family: 'Cinzel', serif; font-size: 1.05em; color: #fff; position: relative; z-index: 2; transition: opacity 0.3s; }
.stat.qty { font-size: 0.75em; opacity: 0.6; position: relative; z-index: 2; margin-top: 4px; transition: opacity 0.3s; }
.stat-desc, .prod-val { font-size: 0.75em; color: var(--accent); margin-top: 4px; position: relative; z-index: 2; transition: opacity 0.3s; }
.stat-cost { position: absolute; bottom: 20px; left: 20px; font-family: 'Cinzel', serif; color: var(--accent); z-index: 2; font-size: 0.85em; transition: opacity 0.3s; }
.card-expanded { opacity: 0; transition: 0.3s; margin-top: 15px; position: relative; z-index: 2; pointer-events: none; }
.lore-text { font-size: 0.75em; font-style: italic; color: #a0d2ff; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; line-height: 1.4; }

/* États Carte */
.card.disabled, .card.unlocked.disabled {
    filter: none !important;
    border-color: rgba(111, 139, 255, 0.05) !important;
    box-shadow: none !important;
    cursor: default;
}
.card.disabled::before, .card.unlocked.disabled::before {
    background: linear-gradient(to bottom, rgba(5, 10, 24, 0.60), rgba(5, 10, 24, 0.85));
    backdrop-filter: grayscale(0.8);
    opacity: 0.8; 
}
.card.disabled .producer-title, .card.disabled .stat.qty, .card.disabled .stat-desc, .card.disabled .prod-val, .card.unlocked.disabled .producer-title, .card.unlocked.disabled .stat.qty {
    opacity: 1 !important;
    color: #e2e8f0;
    filter: none !important;
}
.card.disabled .stat-cost, .card.unlocked.disabled .stat-cost {
    opacity: 1 !important;
    color: #ff8080 !important;
}
.card.disabled:hover::before, 
.card.unlocked.disabled:hover::before {
    opacity: 0.4; 
    backdrop-filter: grayscale(0.2);
}
.card:not(.disabled) { filter: brightness(1.1); box-shadow: 0 0 15px rgba(0, 242, 255, 0.15); border-color: rgba(0, 242, 255, 0.3); }
.card:not(.disabled):hover {
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.8) !important; border-color: #00f2ff !important;
    transform: translateY(-5px) scale(1.02); z-index: 100; cursor: pointer;
}
.card.disabled:hover {
    transform: none;
    box-shadow: none !important;
}
.card.unlocked:hover .card-expanded, .card.max-level:hover .card-expanded { opacity: 1; pointer-events: auto; }
.card.unlocked:hover, .card.max-level:hover { height: 280px; z-index: 100; }
.card.max-level { filter: brightness(1.2) !important; border-color: var(--unlocked-gold) !important; box-shadow: 0 0 15px rgba(255, 215, 0, 0.2); }

/* Barres de progression */
.progress-container { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; margin-top: 12px; overflow: hidden; }
.progress-fill { 
    height: 100%; background: var(--primary); width: 0%; transition: width 0.3s; position: relative; overflow: hidden; 
}
.progress-fill::after {
    content: ""; position: absolute; top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: translateX(-100%); animation: shimmerBar 2s infinite;
}
@keyframes shimmerBar { 100% { transform: translateX(100%); } }

/* Compteur de progression */
.progress-text {
    text-align: right;
    font-family: 'Cinzel', serif;
    font-size: 0.8em;
    margin-top: 4px;
    font-weight: 400;
    opacity: 0.8;
    transition: color 0.3s;
}

/* Brouillard de guerre */
.mystery-hidden { display: none !important; }

/* --- UTILITAIRES DE GRILLE --- */
.grid-break {
    grid-column: 1 / -1;
    height: 0;
    margin: 0;
}

/* --- PANNEAUX (Transitions) --- */
.panel { display: none; opacity: 0; }
.panel.active { display: block; animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.panel.closing { display: block; animation: slideOut 0.15s ease-in forwards; pointer-events: none; }
@keyframes slideIn { from { opacity: 0; transform: translateY(15px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }

/* --- PARAMÈTRES (Clean & Merged) --- */
.settings-card {
    position: fixed; top: 70px; right: 20px; width: 260px;
    background: rgba(10, 15, 30, 0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    padding: 20px; border-radius: 12px; z-index: 2950;
    opacity: 0; visibility: hidden; transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-card.active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.settings-title { margin-top: 0; font-family: 'Cinzel', serif; font-size: 0.9em; color: var(--accent); }
.settings-group { margin-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }

.sidepanel-btn {
    width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    padding: 10px; margin-top: 8px; cursor: pointer; border-radius: 6px;
    font-size: 0.8em; font-family: 'Inter', sans-serif; text-align: center;
    transition: all 0.2s ease; display: block; box-shadow: none;
}
.sidepanel-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); color: #fff; transform: translateY(-1px); box-shadow: 0 0 10px rgba(111, 139, 255, 0.1); }
.text-gold { color: var(--unlocked-gold); }
.text-blue { color: #a0d2ff; }
.text-red { color: #ff6b6b; }
.text-red-soft { color: #ffb1b1; }

/* --- BOUTONS FLOTTANTS --- */
.floating-pill-btn {
    position: fixed; right: 18px; display: flex; align-items: center; justify-content: flex-start;
    width: 35px; height: 35px; background: transparent !important; border: none !important;
    padding: 0; font-family: 'Inter', sans-serif; text-decoration: none; overflow: hidden; cursor: pointer;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.floating-pill-btn.pos-1 { top: 30px; z-index: 3000; }
.floating-pill-btn.pos-2 { top: 75px; right: 20px; z-index: 2900; }
.floating-icon {
    height: 22px; width: auto; margin-left: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); transition: transform 0.3s ease;
}
.floating-label {
    white-space: nowrap; margin-left: 12px; font-family: 'Inter', sans-serif; font-weight: 600; color: #a0d2ff;
    opacity: 0; transform: translateX(20px); transition: all 0.3s ease 0.1s; font-size: 0.9rem;
}
.floating-pill-btn:hover { width: 170px; }
.floating-pill-btn.pos-1:hover { width: 135px !important; }
.floating-pill-btn:hover .floating-icon { transform: scale(1.1) rotate(-10deg); }
.floating-pill-btn.pos-1:hover .floating-icon svg { animation: spin-gear 3s linear infinite; }
.floating-pill-btn.pos-1:hover .floating-icon { transform: scale(1.1); }
.floating-pill-btn:hover .floating-label { opacity: 1; transform: translateX(0); color: #fff; }
@keyframes spin-gear { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- ACCORDIONS (Codex/Infos) --- */
.codex-container { background: transparent; padding: 10px; border: none; }
.codex-section-title {
    font-family: 'Cinzel', serif; color: var(--accent); border-bottom: 1px solid rgba(125, 255, 200, 0.1);
    padding-bottom: 8px; margin-top: 30px; margin-bottom: 15px; font-size: 1.0em;
    letter-spacing: 2px; text-shadow: 0 0 10px rgba(125, 255, 200, 0.2);
}
.accordion-item {
    background: rgba(10, 15, 30, 0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px; margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; overflow: hidden;
}
.accordion-item:hover { background: rgba(30, 40, 60, 0.5); border-color: rgba(255, 255, 255, 0.3); transform: translateY(-2px); cursor: pointer; }
.accordion-item.active {
    background: rgba(15, 20, 35, 0.85); border-color: rgba(0, 255, 127, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 127, 0.1); transform: none;
}
.accordion-header { 
    width: 100%; background: none; border: none; color: #a0d2ff; font-family: 'Inter', sans-serif;
    font-weight: 600; padding: 18px 25px; text-align: left; cursor: pointer; display: flex; align-items: center; 
}
.accordion-item.active .accordion-header { color: #fff; text-shadow: 0 0 10px var(--primary-glow); }
.title-text { flex-grow: 1; font-size: 1em; display: flex; align-items: center; }
.badge-new { 
    font-family: 'Cinzel', serif; font-size: 0.6em; background: linear-gradient(45deg, var(--unlocked-gold), #ffbf00); 
    color: #050a18; padding: 2px 8px; border-radius: 4px; margin-left: 12px; font-weight: 800; 
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); letter-spacing: 1px;
}
.accordion-icon { font-size: 0.8em; color: var(--primary); opacity: 0.5; transition: transform 0.4s; }
.accordion-item.active .accordion-icon { transform: rotate(180deg); opacity: 1; color: var(--unlocked-gold); }
.accordion-content { 
    max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s ease, opacity 0.5s ease, padding 0.5s ease; 
    padding: 0 25px; color: #cbd5e1; font-size: 0.9rem; line-height: 1.6; text-align: justify;
}
.accordion-item.active .accordion-content { max-height: 2000px; opacity: 1; padding-top: 15px; padding-bottom: 25px; }
.accordion-content p { margin: 0 0 15px 0; } .accordion-content p:last-child { margin-bottom: 0; }

/* --- MODALE VICTOIRE --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 5, 15, 0.0); backdrop-filter: blur(0px); z-index: 9999;
    display: none; align-items: center; justify-content: center; transition: all 1.5s ease-in-out;
}
.modal-overlay.active { display: flex; background: rgba(0, 5, 15, 0.9); backdrop-filter: blur(8px); }
.modal-content {
    background: linear-gradient(135deg, #0f172a, #1e2a4a); border: 2px solid var(--unlocked-gold);
    border-radius: 30px; padding: 50px; max-width: 600px; text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2); opacity: 0; transform: translateY(100px) scale(0.95);
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}
.modal-overlay.active .modal-content { opacity: 1; transform: translateY(0) scale(1); animation: shimmerBorder 3s infinite ease-in-out 1.5s; }
@keyframes shimmerBorder { 
    0%, 100% { box-shadow: 0 0 50px rgba(255, 215, 0, 0.2); border-color: rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 0 100px rgba(255, 215, 0, 0.5); border-color: #ffd700; } 
}
.victory-title { font-size: 2em; color: var(--unlocked-gold); margin-top: 0; text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.victory-text { font-size: 1.1em; line-height: 1.6; color: #eef1ff; margin-top: 20px; }

/* --- VFX (Particules & Textes flottants) --- */
.particle { 
    position: fixed; pointer-events: none; width: 4px; height: 4px; background: var(--accent); 
    border-radius: 50%; z-index: 9999; box-shadow: 0 0 10px var(--accent); 
}
.floating-text {
    position: absolute; pointer-events: none; font-weight: 700; font-size: 0.9rem; 
    font-family: 'Inter', sans-serif; user-select: none; z-index: 2000;
    animation: floatUp 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.ft-mana { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.ft-flow { color: var(--accent); font-size: 1rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-30px) scale(1); } }

#ambient-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; z-index: -1; }
.ambient-particle {
    position: absolute; background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
    border-radius: 50%; opacity: 0; animation: floatAmbient linear infinite;
}
@keyframes floatAmbient {
    0% { transform: translateY(10vh) translateX(0); opacity: 0; }
    10%, 80% { opacity: 0.8; }
    100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}
.version-tag { background: var(--primary); color: #fff; font-size: 0.75em; padding: 2px 6px; border-radius: 4px; font-weight: bold; margin-right: 10px; }

/* --- UX : EMPÊCHER LA SÉLECTION (ANTI-DOUBLE CLIC) --- */
.card, 
.canalize-btn, 
.floating-pill-btn, 
.tab, 
.accordion-header,
.altar-header,
.mana-value,
.stat-number,
.settings-content button {
    -webkit-user-select: none; /* Safari / Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Edge / IE */
    user-select: none;         /* Standard */
}