/* ============================================================
   NIAKAN - login screen (dark-niakan default)
   card on the RIGHT (desktop) / bottom (mobile)
   ============================================================ */

/* Force dark-niakan theme on login page */
[data-theme="light"] body,
[data-theme="night"] body {
    --bg: #07120d;
    --panel: #0d231a;
    --panel-glass: rgba(13, 35, 26, 0.82);
    --panel-2: #123024;
    --text: #e8f5ee;
    --text-2: #9dc4b2;
    --muted: #6f9884;
    --border: #1d4433;
    --border-soft: #173a2b;
    --gold: #f5c542;
    --gold-shine: linear-gradient(135deg, #c49a12, #e8c547, #d5a417);
    --emerald: #10b981;
    --danger: #ef4444;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-card .field label {
    text-align: right;
    display: block;
}

.login-card .input-wrap {
    direction: ltr;
    position: relative;
}

.login-card .input-wrap .input {
    text-align: left;
    padding-left: 44px;
    padding-right: 44px;
}

.login-bg,
.login-bg-mobile {
    position: fixed;
    inset: 0;
    z-index: 0;
}
.login-bg img,
.login-bg-mobile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.login-bg-tint {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(
            900px 600px at 12% 110%,
            rgba(16, 185, 129, 0.16),
            transparent 60%
        ),
        radial-gradient(
            800px 520px at 88% -10%,
            rgba(213, 164, 23, 0.14),
            transparent 55%
        ),
        linear-gradient(160deg, rgba(7, 18, 13, 0.55), rgba(7, 18, 13, 0.7));
}
[data-theme="light"] .login-bg-tint {
    background:
        radial-gradient(
            900px 600px at 12% 110%,
            rgba(63, 174, 131, 0.25),
            transparent 60%
        ),
        radial-gradient(
            800px 520px at 88% -10%,
            rgba(201, 155, 47, 0.22),
            transparent 55%
        ),
        linear-gradient(
            160deg,
            rgba(246, 241, 228, 0.9),
            rgba(246, 241, 228, 0.96)
        );
}
[data-theme="night"] .login-bg-tint {
    background: linear-gradient(
        160deg,
        rgba(0, 0, 0, 0.82),
        rgba(0, 0, 0, 0.93)
    );
}
.login-bg-mobile {
    display: none;
}

/* coins */
#coin-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.coin {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45))
        drop-shadow(0 0 6px rgba(213, 164, 23, 0.35));
    will-change: transform;
}
.coin-fallback {
    border-radius: 50%;
    background: var(--gold-shine);
    box-shadow:
        inset 0 -3px 6px rgba(120, 80, 0, 0.55),
        inset 0 3px 5px rgba(255, 245, 200, 0.9);
}
.coin-glitch {
    animation: coinglitch 0.22s steps(2) 2;
    filter: drop-shadow(0 0 9px #ff3636)
        drop-shadow(-2px 0 0 rgba(0, 255, 170, 0.7));
}
@keyframes coinglitch {
    0% {
        transform: translate(var(--tx, 0), var(--ty, 0)) skewX(0);
    }
    50% {
        transform: translate(-3px, 2px) skewX(14deg);
    }
    100% {
        transform: translate(3px, -2px) skewX(-10deg);
    }
}

/* stage: card position */
.login-stage {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    pointer-events: none;
}
[dir="rtl"] .login-stage {
    justify-content: flex-end;
} /* card on the RIGHT */
[dir="ltr"] .login-stage {
    justify-content: flex-end;
} /* physical right in both */

.login-card {
    pointer-events: all;
    position: relative;
    width: min(400px, 94vw);
    background: var(--panel-glass);
    backdrop-filter: blur(18px) saturate(1.25);
    border: 1px solid rgba(213, 164, 23, 0.45);
    border-radius: 28px;
    padding: 30px 28px 22px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardin 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    overflow: hidden;
}
@keyframes cardin {
    from {
        opacity: 0;
        transform: translateY(26px) scale(0.96);
    }
    to {
        opacity: 1;
    }
}

.login-card-glow {
    position: absolute;
    inset: -40%;
    background: conic-gradient(
        from 180deg,
        transparent 60%,
        rgba(213, 164, 23, 0.12),
        transparent 80%
    );
    animation: glowspin 9s linear infinite;
    pointer-events: none;
}
@keyframes glowspin {
    to {
        transform: rotate(360deg);
    }
}

.login-head {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}
.logo-ring {
    width: 76px;
    height: 76px;
    margin: 0 auto 10px;
    border-radius: 50%;
    padding: 3px;
    background: var(--gold-shine);
    box-shadow:
        0 0 22px rgba(213, 164, 23, 0.45),
        inset 0 0 8px rgba(255, 240, 180, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--panel);
    border: 3px solid var(--panel);
}
.logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--panel);
    border: 3px solid var(--panel);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}
.brand {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 1px;
    background: var(--gold-shine);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 8px rgba(213, 164, 23, 0.25));
}
.slogan {
    color: var(--text-2);
    font-size: 12.5px;
    margin-top: 2px;
}

.pw-eye {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    padding: 4px;
}
[dir="rtl"] .pw-eye {
    left: 6px;
}
[dir="ltr"] .pw-eye {
    right: 6px;
}
.pw-eye:hover {
    color: var(--gold);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 12.5px;
    margin-bottom: 12px;
    animation: shake 0.35s ease;
}
@keyframes shake {
    25% {
        transform: translateX(5px);
    }
    50% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(3px);
    }
}

.login-submit {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border-radius: 16px;
    margin-top: 4px;
}

.login-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}
.foot-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.foot-brand {
    font-size: 10.5px;
    letter-spacing: 4px;
    color: var(--muted);
}

/* ---------------- MONTHLY GLITCH STORM ---------------- */
.glitch-storm {
    animation: bodyglitch 0.32s steps(2) infinite;
}
@keyframes bodyglitch {
    0% {
        filter: none;
    }
    25% {
        filter: invert(0.12) hue-rotate(40deg) saturate(1.6);
    }
    50% {
        filter: none;
    }
    75% {
        filter: hue-rotate(-60deg) contrast(1.3);
    }
}
#glitch-layer {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}
.glitch-msg {
    position: absolute;
    top: 34%;
    width: 100%;
    text-align: center;
    font-size: clamp(40px, 11vw, 130px);
    font-weight: 700;
    letter-spacing: 14px;
    color: transparent;
    background: var(--gold-shine);
    -webkit-background-clip: text;
    background-clip: text;
    animation: gmsg 0.18s steps(2) infinite;
    text-shadow:
        3px 0 rgba(255, 0, 80, 0.55),
        -3px 0 rgba(0, 255, 170, 0.55);
}
.glitch-sub {
    position: absolute;
    top: 52%;
    width: 100%;
    text-align: center;
    font-size: 44px;
}
@keyframes gmsg {
    0% {
        transform: translateX(0);
        clip-path: inset(0 0 0 0);
    }
    30% {
        transform: translateX(-8px);
        clip-path: inset(12% 0 40% 0);
    }
    60% {
        transform: translateX(9px);
        clip-path: inset(55% 0 8% 0);
    }
    100% {
        transform: translateX(0);
    }
}
#glitch-coins {
    position: absolute;
    inset: 0;
}
#glitch-coins .coin {
    animation: none;
}

/* ---------------- MOBILE login ---------------- */
@media (max-width: 760px) {
    .login-bg {
        display: none;
    }
    .login-bg-mobile {
        display: block;
    }
    .login-stage {
        align-items: flex-start;
        justify-content: center;
        min-height: 100dvh;
        height: auto;
        overflow-y: auto;
        padding: clamp(42px, 10vh, 86px) 12px calc(22px + env(safe-area-inset-bottom));
        box-sizing: border-box;
    }
    .login-card {
        width: min(400px, 100%);
        max-width: 400px;
        border-radius: 26px;
        border-bottom: 1px solid rgba(213, 164, 23, 0.45);
        padding: 24px 20px 20px;
        margin: 0 auto;
        animation: cardup 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    }
    @keyframes cardup {
        from {
            transform: translateY(60px);
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    .login-card-glow {
        display: none;
    }
    .brand {
        font-size: 26px;
    }
}

@media (max-width: 380px) {
    .login-stage {
        padding-inline: 8px;
        padding-top: 28px;
    }
    .login-card {
        padding: 20px 16px 16px;
    }
    .logo-ring {
        width: 64px;
        height: 64px;
    }
    .login-head {
        margin-bottom: 14px;
    }
    .login-foot {
        margin-top: 14px;
    }
}
/* FORCE LOGIN CARD TO RIGHT */
@media (min-width: 761px) {
    .login-stage {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        padding: 20px 5vw 20px 20px !important;
        direction: ltr !important;
    }
}
.login-stage {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
    pointer-events: none;
}

.login-card .input-lead {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.login-card .pw-eye {
    left: 14px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}
