/* ============================================================
   STYLES.CSS — L'Autel / L'Abysse (app principale)
   ============================================================ */

/* FIX ULTIME iPHONE SAFARI & PWA */
html, body {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-ui);
    margin: 0; padding: 0;
    -webkit-user-select: none; user-select: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

#app-container {
    width: 100%; height: 100%; max-width: 430px; margin: 0 auto;
    position: relative; overflow: hidden; display: flex; flex-direction: column;
    background-image: radial-gradient(circle at 50% 0%, #1a0505 0%, var(--bg-deep) 70%);
    box-shadow: 0 0 50px rgba(138, 3, 3, 0.1);
}

/* --- SÉCURITÉ --- */
#login-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-deep); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity var(--dur-slow) ease; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#login-screen.hidden { opacity: 0; pointer-events: none; }
.login-title { font-family: var(--font-goth); color: var(--accent-pink); margin-bottom: var(--sp-6); font-size: var(--fs-lg); letter-spacing: 2px; text-shadow: 0px 0px 10px rgba(255, 182, 193, 0.3); }
.login-input { background: transparent; border: none; border-bottom: 1px solid var(--accent-blood); color: var(--text-main); text-align: center; font-family: var(--font-ui); font-size: var(--fs-lg); padding: var(--sp-3); margin-bottom: var(--sp-6); outline: none; width: 60%; letter-spacing: 5px; transition: border-color var(--dur-base) var(--ease-standard); }
.login-input::placeholder { color: var(--text-muted); letter-spacing: 2px; font-size: var(--fs-sm); }
.login-btn { background: var(--accent-blood-soft); border: 1px solid var(--accent-blood); color: var(--accent-blood); font-family: var(--font-goth); padding: 12px 30px; border-radius: var(--radius-pill); transition: all var(--dur-base) var(--ease-standard); cursor: pointer; box-shadow: var(--glow-blood); }
.login-btn:active { transform: scale(0.96); background: rgba(138, 3, 3, 0.25); }
#login-error { color: var(--accent-blood); font-size: var(--fs-sm); margin-top: var(--sp-4); opacity: 0; transition: opacity var(--dur-base); }
#login-error.visible { opacity: 1; }

@keyframes shake-error {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}
.login-input.shake { animation: shake-error 0.5s var(--ease-standard); border-color: var(--accent-blood); }

/* --- VUES (ONGLETS) --- */
.view {
    position: absolute; top: 0; left: 0; width: 100%;
    height: calc(100vh - (75px + env(safe-area-inset-bottom)));
    opacity: 0; pointer-events: none; visibility: hidden; z-index: 1;
    transition: opacity var(--dur-view) var(--ease-soft), transform var(--dur-view) var(--ease-soft), visibility var(--dur-view);
    overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
    transform: translateY(8px);
}
.view::-webkit-scrollbar { display: none; }
.view.active { opacity: 1; pointer-events: auto; visibility: visible; z-index: 5; transform: translateY(0); }

/* --- VUE 1 : L'AUTEL --- */
#view-ritual { display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.header-stats { width: 100%; text-align: center; z-index: 11; margin-top: max(40px, calc(env(safe-area-inset-top) + var(--sp-5))); transition: all 1s ease; position: relative; }
.streak-count { font-family: var(--font-goth); font-size: var(--fs-xxl); color: var(--accent-blood); text-shadow: 0px 0px 15px rgba(138, 3, 3, 0.8); line-height: 1; transition: color 1s; }
.streak-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; margin-top: var(--sp-1); }

.btn-settings { position: absolute; top: 0; right: var(--sp-5); background: transparent; border: 1px solid #2a1414; color: var(--text-muted); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--dur-base) var(--ease-standard); }
.btn-settings:active { transform: scale(0.9) rotate(45deg); border-color: var(--accent-pink); color: var(--accent-pink); }

.flower-stage { flex: 1; display: flex; justify-content: center; align-items: center; width: 100%; position: relative; perspective: 1000px; }

.lycoris-aura {
    position: absolute;
    bottom: 12%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle at center, var(--lp-glow, rgba(138, 3, 3, 0.35)) 0%, transparent 65%);
    border-radius: 50%;
    z-index: 1;
    transition: all 2.5s ease;
    pointer-events: none;
}
.lycoris-alive .lycoris-aura {
    background: radial-gradient(circle at center, rgba(255, 182, 193, 0.25) 0%, transparent 65%);
}
.lycoris-aura.night-bloom-aura {
    background: radial-gradient(circle at center, rgba(155, 89, 182, 0.35) 0%, transparent 65%) !important;
}
@keyframes aura-breathe {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}
.lycoris-aura.resonant-aura {
    animation: aura-breathe 6s infinite ease-in-out;
}

#lycoris-svg {
    width: 95%; max-width: 300px;
    transition: all 2.5s var(--ease-standard), transform 3s var(--ease-soft);
    transform-origin: bottom center; overflow: visible;
    z-index: 2; position: relative;
    --growth-scale: 0.82;
    --alive-boost: 1;
    --touch-tilt: rotateX(0deg) rotateY(0deg);
    transform: scale(calc(var(--growth-scale, 0.82) * var(--alive-boost, 1))) var(--touch-tilt);
}

/* --- Interaction tactile : la Lycoris réagit au toucher --- */
.touch-sparkles-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; overflow: hidden; }
.touch-sparkle {
    position: absolute; background: #fff; border-radius: 50%;
    box-shadow: 0 0 6px #fff, 0 0 12px var(--accent-pink);
    transform: translate(-50%, -50%) scale(0.6);
    animation: touch-sparkle-fade 0.9s ease-out forwards;
}
@keyframes touch-sparkle-fade {
    0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.6); }
    35% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
    100% { opacity: 0; transform: translate(-50%, -50%) translateY(-26px) scale(0.4); }
}
.lycoris-touched #lycoris-svg { transition: transform 0.12s ease-out; }
.lycoris-touched .lycoris-aura { filter: brightness(1.45); }

@keyframes plant-breathe {
    0%, 100% { transform: scaleY(1) scaleX(1) translate3d(0,0,0); }
    50% { transform: scaleY(1.03) scaleX(0.98) translate3d(0,-2px,0); }
}
.lycoris-living { animation: plant-breathe 7s infinite ease-in-out; }

.night-bloom {
    filter: hue-rotate(230deg) saturate(1.5) brightness(1.2) !important;
}

.svg-path { fill: none; stroke: var(--lp-petal, var(--accent-blood)); stroke-width: 0.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke 2.5s ease, all 1.5s ease; }
.svg-stem { stroke: #2a0a0a; stroke-width: 1.5; }
.svg-petal { fill: rgba(138, 3, 3, 0.1); stroke: var(--lp-petal, var(--accent-blood)); stroke-width: 0.7; transition: stroke 2.5s ease, all 1.5s ease; }
.svg-stamen { fill: none; stroke: var(--lp-stamen, var(--accent-pink)); stroke-width: 0.5; opacity: 0.75; transition: stroke 2.5s ease, all 1.5s ease; stroke-linecap: round; }

/* --- TIERS DE COULEUR : la Lycoris se réchauffe visuellement avec les cycles --- */
#flower-wrapper {
    --lp-petal: var(--accent-blood);
    --lp-stamen: var(--accent-pink);
    --lp-glow: rgba(138, 3, 3, 0.35);
}
#flower-wrapper.lycoris-tier-eveil { --lp-petal: #6b0202; }
#flower-wrapper.lycoris-tier-eclosion { --lp-petal: #8a0303; }
#flower-wrapper.lycoris-tier-floraison { --lp-petal: #a30404; --lp-glow: rgba(163, 4, 4, 0.35); }
#flower-wrapper.lycoris-tier-splendeur { --lp-petal: #c2185b; --lp-glow: rgba(194, 24, 91, 0.32); }
#flower-wrapper.lycoris-tier-magnificence { --lp-petal: #e0356f; --lp-stamen: #ffd7e2; --lp-glow: rgba(224, 53, 111, 0.35); }
#flower-wrapper.lycoris-tier-incandescence,
#flower-wrapper.lycoris-tier-resonance { --lp-petal: #ff6f91; --lp-stamen: #ffe1ea; --lp-glow: rgba(255, 111, 145, 0.4); }
#flower-wrapper.lycoris-tier-racines,
#flower-wrapper.lycoris-tier-spectrale,
#flower-wrapper.lycoris-tier-familier { --lp-petal: #ff85a8; --lp-stamen: #fff0f4; --lp-glow: rgba(255, 133, 168, 0.4); }
#flower-wrapper.lycoris-tier-couronne { --lp-petal: #ffb3c6; --lp-stamen: #fff6da; --lp-glow: rgba(212, 175, 55, 0.35); }
#flower-wrapper.lycoris-tier-echo { --lp-petal: #ffc9d8; --lp-glow: rgba(212, 175, 55, 0.4); }
#flower-wrapper.lycoris-tier-eternite { --lp-petal: #ffe3c2; --lp-stamen: #fff6da; --lp-glow: rgba(255, 215, 0, 0.42); }
#flower-wrapper.lycoris-tier-eternite #lycoris-svg { filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.35)); }

/* --- Palier 150 : Couronne Stellaire --- */
.crown-ring { transform-box: fill-box; transform-origin: center; animation: crown-rotate 60s linear infinite; }
@keyframes crown-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.crown-star { fill: var(--accent-gold); opacity: 0.12; transform-box: fill-box; transform-origin: center; transition: opacity 1.5s ease; }
.crown-star.lit { animation: crown-twinkle 3.4s ease-in-out infinite; }
.crown-star.lit:nth-of-type(2) { animation-delay: 0.4s; }
.crown-star.lit:nth-of-type(3) { animation-delay: 0.8s; }
.crown-star.lit:nth-of-type(4) { animation-delay: 1.2s; }
.crown-star.lit:nth-of-type(5) { animation-delay: 1.6s; }
.crown-star.lit:nth-of-type(6) { animation-delay: 2s; }
@keyframes crown-twinkle { 0%, 100% { opacity: 0.35; transform: scale(0.75); } 50% { opacity: 1; transform: scale(1.15); } }

/* --- Palier 100-150 : lueur du Familier --- */
.familiar-eye { fill: rgba(255, 182, 193, 0.12); transition: fill 2.5s ease, opacity 2.5s ease; }
.familiar-eye.lit { fill: var(--accent-pink); animation: eye-pulse 4s ease-in-out infinite; }
@keyframes eye-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* --- Palier 200 : Écho Jumeau (émerge progressivement jusqu'à 300) --- */
.twin-bloom use { animation: plant-breathe 9s infinite ease-in-out; }

/* --- Palier 365 : Éternité (aperçu progressif dès 320) --- */
.eternity-halo circle { animation: aura-breathe 10s infinite ease-in-out; }

/* --- Bannière de nouvelle ère --- */
.tier-banner {
    position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 50%;
    transform: translateX(-50%) translateY(-14px);
    z-index: 50; background: rgba(10, 5, 5, 0.94); border: 1px solid var(--accent-pink);
    border-radius: var(--radius-pill); padding: 8px 20px; font-family: var(--font-goth);
    font-size: var(--fs-sm); color: var(--accent-pink); box-shadow: var(--glow-pink);
    opacity: 0; pointer-events: none; white-space: nowrap;
    transition: opacity var(--dur-slow) var(--ease-soft), transform var(--dur-slow) var(--ease-soft);
}
.tier-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.evolution-part { opacity: 0; transition: opacity 3s ease, transform 3s ease; transform: translateY(10px); }
.evo-active { opacity: 1 !important; transform: translateY(0) !important; }

.resonant { animation: plant-breathe 7s infinite ease-in-out; }
.lycoris-alive #lycoris-svg { --alive-boost: 1.03; }
.lycoris-alive .svg-path, .lycoris-alive .svg-petal { stroke: var(--accent-pink); stroke-width: 1; }
.lycoris-alive .svg-stamen { opacity: 1; stroke-width: 0.8; stroke: #fff; }

#flower-spores-container { position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; z-index: 3; }
.magic-spore { position: absolute; background: #fff; border-radius: 50%; opacity: 0; box-shadow: 0 0 8px #fff, 0 0 15px var(--accent-pink); animation: spore-float 8s infinite ease-in; }
@keyframes spore-float { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 20% { opacity: 0.8; } 80% { opacity: 0; } 100% { transform: translateY(-150px) scale(1.5) translateX(20px); opacity: 0; } }

.action-zone { height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 11; width: 100%; margin-bottom: var(--sp-5);}
.btn-ritual { background: var(--accent-blood-soft); border: 1px solid var(--accent-blood); color: var(--accent-blood); font-family: var(--font-goth); padding: 15px 40px; border-radius: var(--radius-pill); font-size: var(--fs-lg); transition: all var(--dur-base) var(--ease-standard); box-shadow: var(--glow-blood); backdrop-filter: blur(5px); cursor: pointer; }
.btn-primary { border-color: var(--accent-blood); color: var(--accent-blood); background: rgba(138, 3, 3, 0.05); border: 1px solid #333; font-family: var(--font-ui); border-radius: var(--radius-sm); transition: all var(--dur-base); cursor: pointer; }
.btn-primary:active { transform: scale(0.98); background: rgba(255,255,255,0.1); }
.btn-ritual:active { transform: scale(0.95); background: var(--accent-blood); color: var(--text-main); }
.btn-ritual.hidden { display: none; }
.countdown-container { text-align: center; }
.countdown-container.hidden { display: none; }
.countdown-timer { font-family: var(--font-goth); font-size: var(--fs-xl); color: var(--accent-pink); letter-spacing: 2px; text-shadow: 0px 0px 10px rgba(255, 182, 193, 0.3); }
.countdown-label { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-1); }

/* --- VUE 2 : L'ABYSSE --- */
#view-abyss { display: flex; flex-direction: column; }

.audio-bar {
    width: 100%; padding: max(10px, env(safe-area-inset-top)) var(--sp-5) 10px var(--sp-5);
    background: rgba(10, 5, 5, 0.8); border-bottom: 1px solid #1a0a0a;
    display: flex; justify-content: center; gap: var(--sp-4); z-index: 50; flex-shrink: 0;
}
.audio-btn { font-size: 1.5rem; background: none; border: none; color: #555; cursor: pointer; transition: all var(--dur-base); filter: grayscale(100%); padding: var(--sp-1); border-radius: 50%; }
.audio-btn.active { filter: grayscale(0%); transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(255, 182, 193, 0.5)); }

.abyss-content {
    flex: 1; display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.abyss-content::-webkit-scrollbar { display: none; }

.card-container { flex: 0 0 100%; min-width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; scroll-snap-align: center; padding: var(--sp-5); }
.card { width: 100%; height: 75%; background: var(--bg-glass); backdrop-filter: blur(15px); border: 1px solid rgba(255, 182, 193, 0.15); border-radius: var(--radius-lg); padding: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: var(--shadow-deep); position: relative; }
.card-title { font-family: var(--font-goth); color: var(--text-main); font-size: var(--fs-lg); margin-bottom: var(--sp-5); letter-spacing: 1px; }

.scratch-wrapper { position: relative; width: 100%; height: 200px; border: 1px solid #333; border-radius: var(--radius-md); overflow: hidden; }
.scratch-secret { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; padding: var(--sp-5); font-family: var(--font-hand); font-size: 1.3rem; color: var(--accent-pink); background: #0a0a0a; z-index: 1; }
#scratch-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; }

.breathe-circle { width: 130px; height: 130px; border-radius: 50%; border: 1px solid var(--accent-blood); display: flex; justify-content: center; align-items: center; font-family: var(--font-goth); color: var(--accent-pink); animation: breathe 8s infinite ease-in-out; box-shadow: 0 0 20px rgba(138, 3, 3, 0.3) inset; }
@keyframes breathe { 0%, 100% { transform: scale(1); border-color: var(--accent-blood); } 50% { transform: scale(1.5); border-color: var(--accent-pink); box-shadow: 0 0 40px rgba(255, 182, 193, 0.2) inset; } }

.swipe-hint { position: absolute; bottom: 15px; font-size: var(--fs-xs); color: #555; letter-spacing: 3px; animation: pulse-text 2s infinite; }

/* --- Carte Journal (nouvelle) --- */
.journal-list { width: 100%; height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding-right: 5px; }
.journal-list::-webkit-scrollbar { display: none; }
.journal-entry { text-align: left; background: rgba(0,0,0,0.3); border-left: 2px solid var(--accent-blood); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); }
.journal-entry-text { font-family: var(--font-hand); color: var(--accent-pink); font-size: 1.05rem; line-height: 1.4; }
.journal-entry-date { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: var(--sp-1); }
.journal-empty { color: var(--text-muted); font-size: var(--fs-sm); text-align: center; margin-top: 20%; }

/* --- VUE 3 : JEU (PASSERELLE) --- */
#view-game { background: var(--bg-deep); overflow: hidden; display: flex; flex-direction: column; padding: 0; }
#game-frame { width: 100%; height: 100%; border: none; }

/* --- PARTICULES GLOBALES --- */
#particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; z-index: 5; }
.spore { position: absolute; background: #ffb6c1; border-radius: 50%; opacity: 0; pointer-events: none; box-shadow: 0 0 10px #ffb6c1, 0 0 5px #ffb6c1; animation: float 10s infinite linear; }
@keyframes float { 0% { transform: translateY(100%) scale(0); opacity: 0; } 50% { opacity: 0.3; } 100% { transform: translateY(-20%) scale(1.5); opacity: 0; } }

/* --- NAVIGATION INFÉRIEURE --- */
nav {
    position: absolute; bottom: 0; left: 0; width: 100%;
    height: calc(75px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10, 5, 5, 0.95); backdrop-filter: blur(15px);
    border-top: 1px solid #1a0a0a; display: flex; justify-content: space-around; align-items: center;
    z-index: 100;
}
.nav-item { color: #555; font-family: var(--font-goth); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 1.5px; transition: color 0.4s ease, transform var(--dur-base) var(--ease-standard); padding: var(--sp-3); cursor: pointer; text-align: center; }
.nav-item.active { color: var(--accent-pink); text-shadow: 0 0 10px rgba(255, 182, 193, 0.4); transform: translateY(-2px); }

/* --- MODAL RÉGLAGES (nouveau) --- */
#settings-modal { position: absolute; inset: 0; z-index: 200; background: rgba(3,1,1,0.85); backdrop-filter: blur(8px); display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-standard); }
#settings-modal.open { opacity: 1; pointer-events: auto; }
.settings-sheet { width: 100%; background: #0c0606; border-top: 1px solid var(--accent-blood); border-radius: 22px 22px 0 0; padding: var(--sp-5) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom)) var(--sp-5); transform: translateY(20px); transition: transform var(--dur-base) var(--ease-soft); box-shadow: 0 -20px 50px rgba(0,0,0,0.6); }
#settings-modal.open .settings-sheet { transform: translateY(0); }
.settings-title { font-family: var(--font-goth); color: var(--accent-pink); font-size: var(--fs-lg); text-align: center; margin-bottom: var(--sp-5); letter-spacing: 1px; }
.settings-row { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.settings-btn { width: 100%; padding: 13px; border-radius: var(--radius-sm); font-family: var(--font-ui); font-size: var(--fs-sm); cursor: pointer; border: 1px solid #332222; background: rgba(255,255,255,0.03); color: var(--text-main); text-align: center; }
.settings-btn.danger { border-color: var(--accent-blood); color: #ff8080; }
.settings-btn.accent { border-color: var(--accent-pink); color: var(--accent-pink); }
.settings-version { text-align: center; font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-4); }
.settings-close { display: block; margin: 0 auto var(--sp-4) auto; width: 40px; height: 4px; border-radius: 4px; background: #332222; border: none; }
