:root {
    --bg: #ffffff;
    --stroke: rgba(15, 23, 42, .12);
    --shadow: 0 24px 60px rgba(15, 23, 42, .14);
    --shadow-soft: 0 14px 34px rgba(15, 23, 42, .12);

    --radius-xl: 30px;
    --radius: 22px;

    /* Maple-ish Blue */
    --blue1: #4da3ff;
    --blue2: #2f7de1;
    --blue3: #1f5fb8;

    --text: #0f172a;
    --muted: rgba(15, 23, 42, .60);

    --input-bg: rgba(249, 251, 255, .92);
    --input-stroke: rgba(207, 226, 255, .95);

    --badge-bg: rgba(237, 244, 255, .92);
    --badge-text: #2f7de1;

    /* 전체 배경 이미지 경로(페이지 공통 관리) */
    --page-bg: url("/assets/img/login/background/login-hero.png");
    /* 로그인 히어로 이미지 경로(페이지별/컴포넌트별 관리) */
    --hero-bg: url("/assets/img/login/background/page-bg.jpg");
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    color: var(--text);
    overflow-x: hidden;
    position: relative;
}

/* =========================
   FULL PAGE BACKGROUND
   ========================= */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--page-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.02);
    z-index: -3;
    filter: saturate(1.02);
}

/* 가독성용 오버레이 (밝은 이미지도 안정적으로) */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(1000px 700px at 20% 10%, rgba(255, 255, 255, .70), rgba(255, 255, 255, .10) 60%, rgba(255, 255, 255, .25)),
        linear-gradient(180deg, rgba(255, 255, 255, .65), rgba(255, 255, 255, .35));
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: -2;
}

/* safe-area padding */
.page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding:
        calc(24px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
    position: relative;
    z-index: 1;
}

/* ===== Responsive Scene Layout ===== */
.scene {
    width: min(1100px, 100%);
    display: grid;
    gap: 18px;
    align-items: center;
}

/* Desktop grid */
@media (min-width: 992px) {
    .scene {
        grid-template-columns: 1.7fr 1fr;
        gap: 0;
        position: relative;
        min-height: 640px;
    }
}

/* ===== Background Card ===== */
.bg-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--stroke);
    background: #f2f4f7;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 220px;
    max-height: 520px;

    /* hero 이미지를 <img> 대신 배경으로도 관리 가능 */
    background-image: var(--hero-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (min-width: 576px) {
    .bg-card {
        min-height: 260px;
    }
}

@media (min-width: 992px) {
    .bg-card {
        aspect-ratio: auto;
        height: 520px;
        width: 100%;
    }
}

.bg-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .06);
    pointer-events: none;
}

.bg-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .12);
    pointer-events: none;
}

/* ===== Login Panel ===== */
.login-panel {
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .10);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    padding: clamp(16px, 3vw, 28px);
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    position: relative;
    z-index: 2;

    /* mobile/tablet overlap */
    margin-top: -22px;
}

@media (min-width: 768px) {
    .login-panel {
        margin-top: -28px;
    }
}

@media (min-width: 992px) {
    .login-panel {
        max-width: 380px;
        margin-top: 0;
        margin-left: -60px;
        align-self: center;
    }
}

/* Mobile: overlap more (더 위로) */
@media (max-width: 576px) {
    .login-panel {
        margin-top: -64px;
    }
}

/* ===== Badge / Title ===== */
.guild-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
    border: 1px solid rgba(47, 125, 225, .20);

    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title {
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0 0 6px 0;
    line-height: 1.15;
    word-break: keep-all;
}

.sub {
    margin: 0 0 18px 0;
    color: var(--muted);
    font-size: clamp(13px, 1.6vw, 14px);
    line-height: 1.45;
}

/* ===== Inputs ===== */
.form-control {
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--input-stroke);
    background: var(--input-bg);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04) inset;
    padding: 12px 14px;
    font-size: 15px;
}

.form-control:focus {
    border-color: rgba(77, 163, 255, .70);
    box-shadow: 0 0 0 .25rem rgba(77, 163, 255, .22);
    background: #fff;
}

/* iOS zoom 방지 */
input,
button {
    font-size: 16px;
}

/* ===== Button ===== */
.btn-login {
    height: 48px;
    border-radius: 14px;
    font-weight: 800;
    border: none;
    background: linear-gradient(180deg, var(--blue1), var(--blue2));
    box-shadow: 0 8px 0 var(--blue3), 0 18px 32px rgba(47, 125, 225, .18);
    transition: transform .08s ease, box-shadow .08s ease, filter .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-login:hover {
    filter: brightness(.98);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(2px);
    box-shadow: 0 6px 0 var(--blue3), 0 14px 28px rgba(47, 125, 225, .16);
}

.btn-login:disabled {
    opacity: .8;
    transform: none !important;
    box-shadow: 0 8px 0 var(--blue3), 0 18px 32px rgba(47, 125, 225, .12);
}

/* ===== Footer line ===== */
.help-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 13px;
    color: rgba(15, 23, 42, .55);
    gap: 10px;
    flex-wrap: wrap;
}

.help-row span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-text {
    display: none;
    margin-top: 10px;
    font-size: 13px;
    color: #dc2626;
    font-weight: 700;
    line-height: 1.35;
}

/* ===== Ultra Small (<= 360px) ===== */
@media (max-width: 360px) {
    .page {
        padding:
            calc(18px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    }

    .bg-card {
        min-height: 200px;
        border-radius: 22px;
    }

    .login-panel {
        border-radius: 24px;
        margin-top: -56px;
        /* 더 위로 */
        padding: 14px;
        max-width: 100%;
    }

    .guild-badge {
        font-size: 12px;
        padding: 6px 12px;
        margin-bottom: 10px;
    }

    .title {
        font-size: 18px;
        line-height: 1.18;
    }

    .sub {
        font-size: 12.5px;
        margin-bottom: 14px;
    }

    .form-control {
        height: 44px;
        border-radius: 12px;
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-login {
        height: 44px;
        border-radius: 12px;
        box-shadow: 0 7px 0 var(--blue3), 0 14px 24px rgba(47, 125, 225, .16);
    }

    .help-row {
        margin-top: 12px;
        font-size: 12px;
    }
}

/* ===== Ultra Ultra Small (<= 320px) ===== */
@media (max-width: 320px) {
    .bg-card {
        min-height: 190px;
    }

    .login-panel {
        padding: 12px;
        margin-top: -48px;
        /* 더 위로 */
    }

    .guild-badge {
        font-size: 11.5px;
        padding: 6px 10px;
    }

    .title {
        font-size: 17px;
        letter-spacing: -0.03em;
    }

    .sub {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .help-row {
        font-size: 11.5px;
        gap: 6px;
    }

    .help-row span {
        white-space: normal;
        line-height: 1.3;
    }

    .error-text {
        font-size: 12px;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* ===== NEXON Copyright (bottom-right) ===== */
.nexon-copyright {
    position: fixed;
    right: calc(14px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 10;

    font-size: 12px;
    line-height: 1.2;
    color: rgba(15, 23, 42, .45);
    letter-spacing: .01em;

    user-select: none;
    pointer-events: none;

    /* 배경이 밝거나 복잡해도 가독성 유지 */
    text-shadow: 0 1px 2px rgba(255, 255, 255, .55);
}