/* ==================== LOGIN PAGE — Dark Gold Copper Theme ==================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Philosopher:wght@400;700&display=swap');

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

/* ────────────────────────────────────────────
   BACKGROUND — Ultra-dark warm, subtle gradient
   ──────────────────────────────────────────── */
body {
    font-family: var(--font-body, 'Philosopher', sans-serif);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--app-dvh, 100vh);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background: #050302;
    position: relative;
    overflow: hidden;
    /* Safe areas for notch/browser chrome */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark warm tinted overlay — sits above both BG layers, below embers */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(
            ellipse 90% 80% at 40% 50%,
            rgba(14, 10, 4, 0.55) 0%,
            rgba(10, 7, 3, 0.72) 40%,
            rgba(5, 3, 1, 0.88) 100%
        );
    pointer-events: none;
}

body::after {
    display: none !important;
}

/* ────────────────────────────────────────────
   BACKGROUND LAYER — Empty scene (breathing blur)
   ──────────────────────────────────────────── */
.login-bg-empty {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}
.login-bg-empty img {
    width: 100vw;
    height: auto;
    max-height: 74vh;
    object-fit: contain;
    animation: bgBreathe 6s ease-in-out infinite;
}
@keyframes bgBreathe {
    0%, 100% { filter: blur(2.5px) brightness(0.85); }
    50%      { filter: blur(0.5px) brightness(1.0); }
}

/* ────────────────────────────────────────────
   CHARACTERS LAYER — Slow drift + zoom + gold glow
   ──────────────────────────────────────────── */
.login-bg-characters {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* PNG has real alpha — no blend mode needed */
}
.login-bg-characters img {
    width: auto;
    height: auto;
    max-height: 74vh;
    object-fit: contain;
    /* 35% larger */
    scale: 1.15;
    /* Gold edge glow around visible character silhouettes */
    filter: drop-shadow(0 0 6px rgba(212, 168, 41, 0.45))
            drop-shadow(0 0 14px rgba(212, 168, 41, 0.25))
            drop-shadow(0 0 28px rgba(180, 130, 30, 0.15));
    animation: charDrift 28s ease-in-out infinite;
    transform-origin: center center;
}
@keyframes charDrift {
    0%       { transform: translateX(12px) scale(1); }
    50%      { transform: translateX(-12px) scale(1.015); }
    100%     { transform: translateX(12px) scale(1); }
}

/* ────────────────────────────────────────────
   EMBER PARTICLE CANVASES
   ──────────────────────────────────────────── */
.ember-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Behind container — blurred (depth-of-field far layer) */
.ember-back {
    z-index: 3;
    filter: blur(3px);
}

/* In front of container — sharp foreground embers */
.ember-front {
    z-index: 10;
    filter: blur(0.5px);
}

/* ────────────────────────────────────────────
   CONTAINER
   ──────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 480px;
    padding: var(--spacing-lg, 24px);
    margin-left: clamp(24px, 6vw, 100px);
    position: relative;
    z-index: 5;
}

/* ────────────────────────────────────────────
   LOGIN BOX — Oscillating heat-glow emanation
   ──────────────────────────────────────────── */
.login-box {
    background: rgba(14, 12, 8, 0.88);
    border-radius: 16px;
    padding: 44px 38px 36px;
    border: 1px solid rgba(212, 168, 41, 0.18);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
    animation: fadeInScale 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    /* Multi-layer oscillating glow */
    box-shadow:
        0 0 30px rgba(212, 168, 41, 0.08),
        0 0 60px rgba(212, 168, 41, 0.06),
        0 0 120px rgba(212, 168, 41, 0.04),
        0 8px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(230, 190, 70, 0.08);
}

/* Animated glow halo around the box */
.login-box::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: transparent;
    box-shadow:
        0 0 40px rgba(212, 168, 41, 0.12),
        0 0 80px rgba(212, 168, 41, 0.08),
        0 0 160px rgba(180, 130, 30, 0.06);
    animation: heatPulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* Inner radiant glow (top-center warmth) */
.login-box::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 168, 41, 0.5) 30%,
        rgba(235, 195, 75, 0.7) 50%,
        rgba(212, 168, 41, 0.5) 70%,
        transparent 100%
    );
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(212, 168, 41, 0.4);
    animation: borderGlow 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes heatPulse {
    0%, 100% {
        box-shadow:
            0 0 40px rgba(212, 168, 41, 0.10),
            0 0 80px rgba(212, 168, 41, 0.06),
            0 0 160px rgba(180, 130, 30, 0.04);
    }
    50% {
        box-shadow:
            0 0 50px rgba(212, 168, 41, 0.20),
            0 0 100px rgba(212, 168, 41, 0.12),
            0 0 200px rgba(180, 130, 30, 0.08);
    }
}

@keyframes borderGlow {
    0%, 100% {
        opacity: 0.5;
        box-shadow: 0 0 15px rgba(212, 168, 41, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 30px rgba(212, 168, 41, 0.6);
    }
}

@keyframes fadeInScale {
    from {
        transform: scale(0.92) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ────────────────────────────────────────────
   TITLE — "Welcome to" small + "Little Monsters Realm" glow
   ──────────────────────────────────────────── */
h1 {
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.2;
    position: relative;
}

h1::before,
h1::after {
    display: none;
}

.title-welcome {
    display: block;
    font-family: var(--sp-font-heading, 'Cinzel', serif);
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(212, 180, 100, 0.6);
    letter-spacing: 5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.title-game {
    font-family: var(--sp-font-title, 'Cinzel Decorative', 'Cinzel', serif);
    font-size: 2.4rem;
    font-weight: 700;
    color: #5eadff;
    letter-spacing: 3px;
    text-shadow:
        0 0 12px rgba(94, 173, 255, 0.6),
        0 0 30px rgba(94, 173, 255, 0.3),
        0 0 60px rgba(60, 140, 255, 0.15),
        0 2px 0 rgba(0, 0, 0, 0.5);
    animation: titleGlow 4s ease-in-out infinite;
}

.title-realm {
    font-family: var(--sp-font-title, 'Cinzel Decorative', 'Cinzel', serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(140, 190, 255, 0.7);
    letter-spacing: 6px;
    text-shadow:
        0 0 8px rgba(94, 173, 255, 0.3),
        0 0 20px rgba(94, 173, 255, 0.1);
    animation: titleGlow 4s ease-in-out infinite;
    animation-delay: 0.5s;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow:
            0 0 12px rgba(94, 173, 255, 0.5),
            0 0 30px rgba(94, 173, 255, 0.25),
            0 0 60px rgba(60, 140, 255, 0.1),
            0 2px 0 rgba(0, 0, 0, 0.5);
    }
    50% {
        text-shadow:
            0 0 18px rgba(94, 173, 255, 0.8),
            0 0 45px rgba(94, 173, 255, 0.4),
            0 0 90px rgba(60, 140, 255, 0.2),
            0 2px 0 rgba(0, 0, 0, 0.5);
    }
}

/* ────────────────────────────────────────────
   FORM HEADINGS
   ──────────────────────────────────────────── */
h2 {
    font-family: var(--sp-font-heading, 'Cinzel', serif);
    color: rgba(220, 190, 100, 0.8);
    font-size: 1.4em;
    text-align: center;
    margin-bottom: var(--spacing-lg, 20px);
    text-shadow: 0 0 8px rgba(212, 168, 41, 0.15);
    letter-spacing: 1px;
}

/* ────────────────────────────────────────────
   FORM CONTAINERS
   ──────────────────────────────────────────── */
.form-container {
    display: none;
}

.form-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ────────────────────────────────────────────
   INPUT FIELDS
   ──────────────────────────────────────────── */
.input-group {
    margin-bottom: var(--spacing-lg, 20px);
}

.input-group label {
    display: block;
    color: rgba(212, 180, 100, 0.7);
    font-family: var(--sp-font-heading, 'Cinzel', serif);
    font-size: 0.85em;
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    font-size: 1.3em;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    opacity: 0.5;
    filter: grayscale(100%);
}

.toggle-password:hover {
    opacity: 1;
    transform: scale(1.1);
    filter: grayscale(0%);
}

.toggle-password.active {
    opacity: 1;
    filter: grayscale(0%);
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    font-family: var(--sp-font-body, 'Philosopher', sans-serif);
    font-size: 1em;
    background: rgba(20, 15, 8, 0.7);
    border: 1px solid rgba(212, 168, 41, 0.15);
    border-radius: 10px;
    color: #f5e6c8;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.input-group input::placeholder {
    color: rgba(180, 150, 60, 0.3);
}

.input-group input:focus {
    border-color: rgba(212, 168, 41, 0.5);
    box-shadow:
        inset 0 2px 8px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(212, 168, 41, 0.15);
}

/* ────────────────────────────────────────────
   BUTTON
   ──────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 14px;
    font-family: var(--sp-font-heading, 'Cinzel', serif);
    font-size: 1.1em;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(180deg, #c89420 0%, #9a6e15 60%, #6b4c10 100%);
    border: 1px solid rgba(212, 168, 41, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.35s ease;
    box-shadow:
        0 4px 20px rgba(200, 148, 32, 0.25),
        0 0 30px rgba(200, 148, 32, 0.08);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    margin-top: var(--spacing-md, 16px);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #daa830 0%, #b07e1a 60%, #856014 100%);
    transform: translateY(-3px);
    box-shadow:
        0 8px 30px rgba(200, 148, 32, 0.4),
        0 0 50px rgba(200, 148, 32, 0.15);
}

.btn-primary:active {
    transform: translateY(-1px);
}

/* ────────────────────────────────────────────
   LINKS
   ──────────────────────────────────────────── */
.forgot-password {
    text-align: center;
    margin-top: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-md, 16px);
}

.forgot-password a {
    color: rgba(212, 180, 100, 0.5);
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.forgot-password a:hover {
    color: #d4a829;
    text-shadow: 0 0 8px rgba(212, 168, 41, 0.3);
}

.switch-form {
    text-align: center;
    margin-top: var(--spacing-lg, 20px);
    color: rgba(200, 175, 100, 0.5);
    font-size: 0.95em;
}

.switch-form a {
    color: #d4a829;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(212, 168, 41, 0.15);
}

.switch-form a:hover {
    color: #e8c34a;
    text-shadow: 0 0 12px rgba(212, 168, 41, 0.4);
}

.form-description {
    text-align: center;
    color: rgba(200, 175, 100, 0.5);
    font-size: 0.9em;
    margin-bottom: var(--spacing-lg, 20px);
    line-height: 1.5;
    padding: 0 var(--spacing-md, 16px);
}

/* ────────────────────────────────────────────
   SERVER / LOCAL-CACHE ACCOUNT NOTICE
   ──────────────────────────────────────────── */
.server-notice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: min(100%, 430px);
    margin: -6px auto 20px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.server-notice-icon {
    flex: 0 0 auto;
    font-size: 0.95em;
    line-height: 1.45;
    filter: drop-shadow(0 0 5px rgba(255, 196, 57, 0.45));
}

.server-notice-text {
    margin: 0;
    color: #fff;
    font-size: 0.76em;
    line-height: 1.45;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.server-notice-text strong {
    color: #fff;
    font-weight: 700;
}

/* ────────────────────────────────────────────
   ERROR / SUCCESS MESSAGES
   ──────────────────────────────────────────── */
.error-message {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    padding: var(--spacing-md, 16px);
    border-radius: 10px;
    margin-bottom: var(--spacing-md, 16px);
    text-align: center;
    font-weight: bold;
    border: 1px solid rgba(248, 113, 113, 0.25);
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

.success-message {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    padding: var(--spacing-md, 16px);
    border-radius: 10px;
    margin-bottom: var(--spacing-md, 16px);
    text-align: center;
    font-weight: bold;
    border: 1px solid rgba(74, 222, 128, 0.25);
    display: none;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ────────────────────────────────────────────
   DEV SKIP BUTTON
   ──────────────────────────────────────────── */
.dev-skip-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9999;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.2);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.dev-skip-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ────────────────────────────────────────────
   MOBILE — Full-width centered login box
   ──────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        justify-content: center;
        align-items: center;
        min-height: 100dvh;
        min-height: var(--app-dvh, 100vh);
    }

    .login-bg-empty,
    .login-bg-characters {
        align-items: flex-start;
    }

    .login-bg-empty img {
        max-height: var(--app-dvh, 100vh);
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    .login-bg-characters img {
        max-height: var(--app-dvh, 100vh);
        width: auto;
        height: 100%;
        object-fit: cover;
        scale: 1;
    }

    .container {
        margin-left: auto;
        margin-right: auto;
        max-width: 94vw;
        padding: 16px;
    }

    .login-box {
        padding: 28px 20px 24px;
        border-radius: 14px;
    }

    h1 {
        margin-bottom: 20px;
    }

    .title-game {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .title-realm {
        font-size: 1.1rem;
        letter-spacing: 4px;
    }

    h2 {
        font-size: 1.2em;
        margin-bottom: 14px;
    }

    .input-group {
        margin-bottom: 14px;
    }

    .input-group input {
        padding: 12px 14px;
        font-size: 1em;
    }

    .btn-primary {
        padding: 12px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .container {
        max-width: 100vw;
        padding: 10px;
    }

    .login-box {
        padding: 22px 16px 20px;
        border-radius: 12px;
    }

    .title-game {
        font-size: 1.5rem;
    }

    .title-realm {
        font-size: 0.95rem;
    }

    h2 {
        font-size: 1.05em;
    }

    .input-group input {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .btn-primary {
        padding: 10px;
        font-size: 0.9em;
    }

    .switch-form,
    .forgot-password {
        font-size: 0.85em;
    }
}

/* Very short viewport (browser chrome eating space) */
@media (max-height: 600px) {
    .login-box {
        padding: 18px 16px 16px;
    }

    h1 {
        margin-bottom: 12px;
    }

    .title-game {
        font-size: 1.3rem;
    }

    .input-group {
        margin-bottom: 10px;
    }

    .input-group input {
        padding: 8px 12px;
    }

    .btn-primary {
        padding: 8px;
        margin-top: 8px;
    }

    .forgot-password,
    .switch-form {
        margin-top: 8px;
    }
}
