/* ============================================
   KingdomRP Loading Screen
   ============================================ */

:root {
    --gold: #d4a84b;
    --gold-bright: #f3cf72;
    --gold-dark: #8a6a26;
    --crimson: #7a1a1a;
    --crimson-dark: #420a0a;
    --parchment: #1a1208;
    --stone: #231a12;
    --flame-1: #ffdd66;
    --flame-2: #ff8a1f;
    --flame-3: #c42a00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Cinzel', serif;
    color: #e9d9a3;
    background:
        radial-gradient(ellipse at 50% 30%, #3a1f0a 0%, #1a0a05 55%, #000 100%),
        #000;
}

/* ====== Brouillard / parchemin ====== */
.fog {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(180,120,40,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(180,60,30,0.1) 0%, transparent 60%),
        repeating-linear-gradient(45deg, rgba(0,0,0,0.02) 0 2px, transparent 2px 6px);
    animation: fogDrift 24s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes fogDrift {
    0%   { transform: translateX(-2%) translateY(0); opacity: 0.8; }
    100% { transform: translateX(2%)  translateY(-1%); opacity: 1; }
}

.vignette {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.75) 100%);
    pointer-events: none;
    z-index: 2;
}

/* ====== Torches ====== */
.torch {
    position: fixed;
    top: 10%;
    width: 60px;
    height: 180px;
    z-index: 5;
}
.torch-left  { left: 6%;  }
.torch-right { right: 6%; }

.torch-stick {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 120px;
    background: linear-gradient(to bottom, #5a3818, #2a1808);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
}

.flame {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 70px;
    background: radial-gradient(ellipse at 50% 90%, var(--flame-1) 0%, var(--flame-2) 40%, var(--flame-3) 75%, transparent 100%);
    border-radius: 50% 50% 40% 40% / 70% 70% 30% 30%;
    filter: blur(1px);
    animation: flicker 0.15s infinite alternate;
    transform-origin: 50% 100%;
}

.flame-inner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 40px;
    background: radial-gradient(ellipse at 50% 90%, #fff 0%, var(--flame-1) 40%, transparent 80%);
    border-radius: 50% 50% 40% 40% / 70% 70% 30% 30%;
    animation: flicker2 0.2s infinite alternate;
}

.glow {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255,140,40,0.35) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes flicker {
    0%   { transform: translateX(-50%) scaleY(1)    scaleX(1);    opacity: 1; }
    100% { transform: translateX(-50%) scaleY(1.08) scaleX(0.95); opacity: 0.92; }
}
@keyframes flicker2 {
    0%   { transform: translateX(-50%) scale(1);    }
    100% { transform: translateX(-50%) scale(1.15) translateY(-3px); }
}
@keyframes glowPulse {
    0%   { opacity: 0.6; transform: translateX(-50%) scale(1); }
    100% { opacity: 1;   transform: translateX(-50%) scale(1.15); }
}

/* ====== Bannières ====== */
.banner {
    position: fixed;
    top: 0;
    width: 110px;
    z-index: 3;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.6));
}
.banner-left  { left: 14%;  }
.banner-right { right: 14%; }

.banner-top {
    width: 100%;
    height: 14px;
    background: linear-gradient(to bottom, var(--gold-bright), var(--gold-dark));
    border-bottom: 2px solid var(--gold-dark);
}

.banner-body {
    width: 100%;
    height: 280px;
    background:
        linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0 2px, transparent 2px 4px);
    border-left: 2px solid var(--gold-dark);
    border-right: 2px solid var(--gold-dark);
    position: relative;
    animation: bannerSway 4s ease-in-out infinite alternate;
    transform-origin: top center;
}

.banner-body::before {
    content: '';
    position: absolute;
    inset: 15px;
    border: 1px solid var(--gold);
    opacity: 0.4;
}

.crest {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    color: var(--gold-bright);
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.banner-bottom {
    width: 100%;
    height: 30px;
    background:
        linear-gradient(to bottom right, var(--crimson) 50%, transparent 50%) 0 0 / 50% 100% no-repeat,
        linear-gradient(to bottom left,  var(--crimson) 50%, transparent 50%) 100% 0 / 50% 100% no-repeat;
    animation: bannerSway 4s ease-in-out infinite alternate;
    transform-origin: top center;
}

@keyframes bannerSway {
    0%   { transform: rotate(-1.2deg); }
    100% { transform: rotate(1.2deg); }
}

/* ====== Scène principale ====== */
.stage {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ====== Blason principal ====== */
.crest-main {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 20px;
    animation: crestFloat 4s ease-in-out infinite alternate;
}

.crest-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--gold);
    border-radius: 50%;
    box-shadow:
        inset 0 0 20px rgba(212,168,75,0.4),
        0 0 30px rgba(212,168,75,0.3);
    animation: ringRotate 20s linear infinite;
}
.crest-ring::before,
.crest-ring::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    opacity: 0.5;
}
.crest-ring::after {
    inset: 16px;
    opacity: 0.25;
}

.crest-shield {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 95px;
    background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
    clip-path: polygon(50% 0, 100% 0, 100% 60%, 50% 100%, 0 60%, 0 0);
    border: 2px solid var(--gold);
    box-shadow: 0 0 20px rgba(122,26,26,0.6);
}

.crest-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crest-sword {
    font-size: 36px;
    color: var(--gold-bright);
    text-shadow: 0 0 10px rgba(255,220,100,0.6);
}

@keyframes crestFloat {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}
@keyframes ringRotate {
    0%   { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

/* ====== Titre ====== */
.title {
    font-family: 'MedievalSharp', 'Cinzel', serif;
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--gold-bright);
    text-shadow:
        0 0 20px rgba(255,200,80,0.5),
        0 0 40px rgba(255,140,40,0.3),
        2px 2px 0 #000;
    margin-bottom: 8px;
    background: linear-gradient(to bottom, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.8));
}

.title-k, .title-rp {
    font-size: 84px;
    display: inline-block;
}

.subtitle {
    font-family: 'MedievalSharp', serif;
    font-size: 18px;
    letter-spacing: 8px;
    color: #c9a95a;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 40px;
}

/* ====== Infos ====== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 90%;
    max-width: 780px;
    margin-bottom: 36px;
}

.info-box {
    background:
        linear-gradient(to bottom, rgba(40,25,10,0.8), rgba(20,12,5,0.9));
    border: 1px solid var(--gold-dark);
    padding: 14px 18px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.5);
}
.info-box::before, .info-box::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--gold);
}
.info-box::before { top: 2px;    left: 2px;    border-right: none; border-bottom: none; }
.info-box::after  { bottom: 2px; right: 2px;   border-left:  none; border-top:    none; }

.info-label {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.8;
    margin-bottom: 6px;
}

.info-value {
    font-family: 'MedievalSharp', serif;
    font-size: 17px;
    color: #f5e8c0;
    letter-spacing: 1px;
}

/* ====== Barre de chargement ====== */
.loader-wrap {
    width: 90%;
    max-width: 720px;
    margin-bottom: 30px;
}

.loader-status {
    font-family: 'MedievalSharp', serif;
    text-align: center;
    font-size: 16px;
    color: var(--gold-bright);
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(212,168,75,0.4);
}

.loader-bar {
    position: relative;
    width: 100%;
    height: 18px;
    background: linear-gradient(to bottom, #0a0603, #1a1208);
    border: 2px solid var(--gold-dark);
    box-shadow:
        inset 0 0 10px rgba(0,0,0,0.9),
        0 0 15px rgba(212,168,75,0.2);
    overflow: hidden;
}

.loader-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right,
        var(--crimson-dark) 0%,
        var(--crimson) 30%,
        var(--gold-dark) 60%,
        var(--gold-bright) 100%);
    transition: width 0.35s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 15px rgba(255,180,60,0.5);
    position: relative;
}
.loader-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
        rgba(255,255,255,0.08) 0 6px,
        transparent 6px 12px);
    animation: barStripes 1s linear infinite;
}

.loader-sheen {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.15), transparent);
    animation: sheen 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes barStripes {
    0%   { transform: translateX(0); }
    100% { transform: translateX(17px); }
}
@keyframes sheen {
    0%   { left: -100%; }
    100% { left: 200%; }
}

.loader-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    letter-spacing: 2px;
    color: #b89758;
}
#pct {
    font-family: 'MedievalSharp', serif;
    font-size: 15px;
    color: var(--gold-bright);
}

/* ====== Tip ====== */
.tip {
    max-width: 720px;
    text-align: center;
    padding: 14px 24px;
    background: rgba(20,12,5,0.6);
    border-top: 1px solid rgba(212,168,75,0.3);
    border-bottom: 1px solid rgba(212,168,75,0.3);
}

.tip-label {
    display: inline-block;
    font-family: 'MedievalSharp', serif;
    color: var(--gold);
    margin-right: 10px;
    letter-spacing: 2px;
}

.tip-text {
    font-style: italic;
    font-size: 15px;
    color: #d4c08a;
    letter-spacing: 1px;
}

/* ====== Pied ====== */
.foot {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
}
.foot-line {
    font-family: 'MedievalSharp', serif;
    font-size: 13px;
    letter-spacing: 4px;
    color: var(--gold);
    opacity: 0.7;
}

/* ====== Braises ====== */
.embers {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}
.ember {
    position: absolute;
    bottom: -10px;
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, #ffcc55 0%, #ff6a1f 60%, transparent 100%);
    border-radius: 50%;
    opacity: 0;
    animation: emberRise linear infinite;
    box-shadow: 0 0 6px #ff8a1f;
}

@keyframes emberRise {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-105vh) translateX(var(--drift, 30px)); opacity: 0; }
}

/* ====== Responsive ====== */
@media (max-width: 760px) {
    .title { font-size: 48px; letter-spacing: 3px; }
    .title-k, .title-rp { font-size: 58px; }
    .subtitle { font-size: 14px; letter-spacing: 5px; }
    .info-grid { grid-template-columns: repeat(2, 1fr); max-width: 95%; }
    .banner { width: 70px; }
    .banner-body { height: 200px; }
    .torch { transform: scale(0.75); }
}
