:root {
    --primary: #315fe8;
    --primary-dark: #2348c7;
    --primary-soft: #eaf0ff;
    --accent: #22b8a7;
    --text: #15213a;
    --text-soft: #62708a;
    --line: #dce3f0;
    --background: #f4f7fc;
    --white: #ffffff;
    --danger: #dc3f4f;
    --success: #138a64;
    --warning: #a86800;
    --shadow:
        0 24px 70px rgba(32, 54, 101, 0.13),
        0 4px 18px rgba(32, 54, 101, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at 8% 18%,
            rgba(49, 95, 232, 0.1),
            transparent 27rem
        ),
        radial-gradient(
            circle at 90% 84%,
            rgba(34, 184, 167, 0.09),
            transparent 24rem
        ),
        var(--background);
    font-family:
        Pretendard,
        "Noto Sans KR",
        "Apple SD Gothic Neo",
        "Malgun Gothic",
        sans-serif;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-page {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
}

.login-header {
    display: flex;
    width: 100%;
    height: 76px;
    align-items: center;
    padding:
        max(12px, env(safe-area-inset-top))
        clamp(20px, 5vw, 72px)
        12px;
    border-bottom: 1px solid rgba(214, 223, 239, 0.8);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.login-brand__icon {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border-radius: 14px;
    color: var(--white);
    background:
        linear-gradient(145deg, #4075ff, #244dcc);
    box-shadow: 0 8px 22px rgba(49, 95, 232, 0.25);
}

.login-brand__icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-brand__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-brand__text strong {
    color: #2453d7;
    font-size: 1.14rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.login-brand__text small {
    color: #8490a6;
    font-size: 0.72rem;
    font-weight: 600;
}

.login-main {
    display: grid;
    width: min(1180px, calc(100% - 48px));
    min-height: 650px;
    margin: auto;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
    overflow: hidden;
    border: 1px solid rgba(219, 226, 240, 0.9);
    border-radius: 30px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.login-visual {
    position: relative;
    display: flex;
    min-height: 650px;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(46px, 5vw, 72px);
    isolation: isolate;
    background:
        linear-gradient(
            145deg,
            #173a9e 0%,
            #315fe8 55%,
            #3983f0 100%
        );
}

.login-visual::before,
.login-visual::after {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    content: "";
}

.login-visual::before {
    top: -130px;
    right: -80px;
    width: 380px;
    height: 380px;
    background: rgba(255, 255, 255, 0.08);
}

.login-visual::after {
    bottom: -180px;
    left: -140px;
    width: 430px;
    height: 430px;
    background: rgba(20, 35, 112, 0.24);
}

.login-visual__content {
    position: relative;
    z-index: 2;
    max-width: 500px;
    color: var(--white);
}

.login-visual__badge {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #dce7ff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.login-visual h1 {
    margin: 28px 0 18px;
    font-size: clamp(2.2rem, 4vw, 3.55rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.055em;
}

.login-visual h1 span {
    color: #9af2df;
}

.login-visual__content > p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.85;
}

.login-benefits {
    display: grid;
    margin: 32px 0 0;
    padding: 0;
    gap: 14px;
    list-style: none;
}

.login-benefits li {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-benefits__icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 13px;
    color: #dffcf7;
    background: rgba(255, 255, 255, 0.13);
    font-size: 0.73rem;
    font-weight: 800;
}

.login-benefits div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.login-benefits strong {
    font-size: 0.95rem;
    font-weight: 750;
}

.login-benefits small {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.77rem;
}

.study-illustration {
    position: absolute;
    right: 28px;
    bottom: 0;
    width: min(78%, 520px);
    height: 330px;
    pointer-events: none;
}

.study-illustration__glow {
    position: absolute;
    right: 30px;
    bottom: -80px;
    width: 360px;
    height: 260px;
    border-radius: 50%;
    background: rgba(114, 227, 211, 0.16);
    filter: blur(30px);
}

.study-desk {
    position: absolute;
    right: 15px;
    bottom: 0;
    width: 355px;
    height: 235px;
}

.study-desk__surface {
    position: absolute;
    right: 0;
    bottom: 33px;
    width: 355px;
    height: 18px;
    border-radius: 9px;
    background: #9dd6e5;
    box-shadow: 0 16px 0 #14348f;
}

.study-desk__surface::before,
.study-desk__surface::after {
    position: absolute;
    top: 15px;
    width: 13px;
    height: 54px;
    border-radius: 5px;
    background: #173583;
    content: "";
}

.study-desk__surface::before {
    left: 30px;
}

.study-desk__surface::after {
    right: 30px;
}

.study-desk__monitor {
    position: absolute;
    right: 85px;
    bottom: 48px;
    width: 185px;
    height: 132px;
    border: 9px solid #173583;
    border-radius: 15px;
    background: #f8fbff;
    box-shadow: 0 18px 35px rgba(10, 29, 94, 0.28);
}

.study-desk__monitor::before {
    position: absolute;
    bottom: -39px;
    left: 50%;
    width: 13px;
    height: 31px;
    background: #173583;
    content: "";
    transform: translateX(-50%);
}

.study-desk__monitor::after {
    position: absolute;
    bottom: -42px;
    left: 50%;
    width: 68px;
    height: 8px;
    border-radius: 6px;
    background: #173583;
    content: "";
    transform: translateX(-50%);
}

.monitor-header {
    display: flex;
    height: 25px;
    align-items: center;
    padding: 0 10px;
    gap: 5px;
    border-bottom: 1px solid #e1e8f7;
}

.monitor-header i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #b8c7e6;
}

.monitor-chart {
    display: flex;
    height: 64px;
    align-items: flex-end;
    padding: 13px 15px 5px;
    gap: 8px;
}

.monitor-chart span {
    width: 14px;
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(to top, #315fe8, #54c9bd);
}

.monitor-line {
    width: 70%;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 9px;
    background: #dce5f6;
}

.study-desk__books {
    position: absolute;
    right: 0;
    bottom: 51px;
    width: 70px;
    height: 70px;
}

.study-desk__books span {
    position: absolute;
    right: 0;
    width: 65px;
    height: 14px;
    border: 3px solid #15337f;
    border-radius: 4px;
}

.study-desk__books span:nth-child(1) {
    bottom: 0;
    background: #ffc668;
}

.study-desk__books span:nth-child(2) {
    right: 5px;
    bottom: 14px;
    background: #9af2df;
}

.study-desk__books span:nth-child(3) {
    right: 1px;
    bottom: 28px;
    background: #ff8e9c;
}

.study-desk__lamp {
    position: absolute;
    bottom: 49px;
    left: 6px;
    width: 85px;
    height: 145px;
}

.study-desk__lamp::before {
    position: absolute;
    bottom: 0;
    left: 21px;
    width: 55px;
    height: 12px;
    border-radius: 50%;
    background: #173583;
    content: "";
}

.study-desk__lamp::after {
    position: absolute;
    bottom: 10px;
    left: 46px;
    width: 7px;
    height: 99px;
    border-radius: 8px;
    background: #173583;
    content: "";
    transform: rotate(14deg);
    transform-origin: bottom;
}

.study-desk__lamp span {
    position: absolute;
    z-index: 2;
    top: 3px;
    left: 25px;
    width: 63px;
    height: 43px;
    border: 6px solid #173583;
    border-radius: 50% 50% 12px 12px;
    background: #ffe08c;
    transform: rotate(15deg);
}

.study-card {
    position: absolute;
    z-index: 3;
    min-width: 145px;
    padding: 15px 17px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 14px 35px rgba(12, 35, 107, 0.2);
    backdrop-filter: blur(12px);
}

.study-card span {
    display: block;
    margin-bottom: 6px;
    color: #6b7893;
    font-size: 0.7rem;
    font-weight: 700;
}

.study-card strong {
    color: #1f3e9e;
    font-size: 1.08rem;
    font-weight: 850;
}

.study-card--time {
    top: 15px;
    right: 4px;
}

.study-card--goal {
    top: 78px;
    left: 20px;
}

.study-card__bar {
    width: 100%;
    height: 5px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 10px;
    background: #e3eafa;
}

.study-card__bar i {
    display: block;
    width: 82%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #315fe8, #35bea9);
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(38px, 5vw, 70px);
    background: var(--white);
}

.login-panel__inner {
    width: min(100%, 420px);
}

.login-heading__eyebrow {
    display: block;
    margin-bottom: 11px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.14em;
}

.login-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(2rem, 3vw, 2.55rem);
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: -0.055em;
}

.login-heading p {
    margin: 12px 0 0;
    color: var(--text-soft);
    font-size: 0.93rem;
    line-height: 1.65;
}

.flash-list {
    display: grid;
    margin-top: 22px;
    gap: 8px;
}

.flash-message {
    padding: 12px 14px;
    border: 1px solid #d9e2f4;
    border-radius: 12px;
    color: #3f4d68;
    background: #f4f7fd;
    font-size: 0.85rem;
    font-weight: 650;
    line-height: 1.5;
}

.flash-message--danger {
    border-color: #ffd2d7;
    color: #a92838;
    background: #fff2f4;
}

.flash-message--success {
    border-color: #bcebdc;
    color: #087153;
    background: #edfbf6;
}

.flash-message--warning {
    border-color: #f6dcac;
    color: #8b5700;
    background: #fff8ea;
}

.login-form {
    display: grid;
    margin-top: 32px;
    gap: 21px;
}

.form-field {
    display: grid;
    gap: 9px;
}

.form-field label {
    color: #283550;
    font-size: 0.86rem;
    font-weight: 750;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    height: 56px;
    padding: 0 52px 0 48px;
    border: 1px solid var(--line);
    outline: none;
    border-radius: 14px;
    color: var(--text);
    background: #fbfcff;
    font-size: 0.94rem;
    font-weight: 550;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.input-wrap input::placeholder {
    color: #a3adbf;
}

.input-wrap input:hover {
    border-color: #b7c4dc;
}

.input-wrap input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(49, 95, 232, 0.11);
}

.input-wrap__icon {
    position: absolute;
    top: 50%;
    left: 17px;
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    color: #8492ad;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-wrap__icon svg,
.password-toggle svg,
.login-button svg,
.login-help__icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 0;
    border-radius: 10px;
    color: #7c89a2;
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--primary);
    background: var(--primary-soft);
    outline: none;
}

.login-button,
.register-button {
    display: flex;
    width: 100%;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 800;
    transition:
        transform 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

.login-button {
    margin-top: 3px;
    padding: 0 20px;
    gap: 9px;
    border: 0;
    color: var(--white);
    background: linear-gradient(135deg, #386cf2, #2854d2);
    box-shadow: 0 13px 26px rgba(49, 95, 232, 0.24);
    cursor: pointer;
}

.login-button svg {
    width: 20px;
    height: 20px;
}

.login-button:hover {
    background: linear-gradient(135deg, #315fe8, #2048c7);
    box-shadow: 0 15px 30px rgba(49, 95, 232, 0.3);
    transform: translateY(-1px);
}

.login-button:active,
.register-button:active {
    transform: translateY(1px);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0 15px;
    gap: 13px;
    color: #8a96ab;
    font-size: 0.76rem;
    font-weight: 600;
}

.login-divider::before,
.login-divider::after {
    height: 1px;
    flex: 1;
    background: #e1e6ef;
    content: "";
}

.register-button {
    border: 1px solid #cad4e7;
    color: #3155ba;
    background: var(--white);
}

.register-button:hover {
    border-color: #91a9e5;
    background: #f5f8ff;
}

.login-help {
    display: flex;
    margin-top: 22px;
    align-items: flex-start;
    padding: 14px;
    gap: 10px;
    border-radius: 13px;
    background: #f5f7fb;
}

.login-help__icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-top: 1px;
    color: #74829c;
}

.login-help p {
    margin: 0;
    color: #748099;
    font-size: 0.75rem;
    line-height: 1.55;
}

.login-footer {
    padding:
        18px
        20px
        max(18px, env(safe-area-inset-bottom));
    color: #8c97aa;
    text-align: center;
    font-size: 0.72rem;
}

/* 태블릿 가로·작은 노트북 */
@media (max-width: 1024px) {
    .login-main {
        width: min(920px, calc(100% - 36px));
        grid-template-columns: 0.92fr 1.08fr;
    }

    .login-visual {
        padding: 48px 38px;
    }

    .login-visual h1 {
        font-size: 2.45rem;
    }

    .login-benefits small {
        display: none;
    }

    .study-illustration {
        right: -50px;
        transform: scale(0.83);
        transform-origin: right bottom;
    }

    .login-panel {
        padding: 48px 40px;
    }
}

/* 태블릿 세로 */
@media (max-width: 820px) {
    body {
        background: #f5f7fc;
    }

    .login-header {
        height: 68px;
        padding-right: 24px;
        padding-left: 24px;
    }

    .login-brand__text small {
        display: none;
    }

    .login-main {
        width: min(650px, calc(100% - 32px));
        min-height: auto;
        margin: 30px auto;
        grid-template-columns: 1fr;
        border-radius: 24px;
    }

    .login-visual {
        min-height: 250px;
        padding: 34px 38px;
    }

    .login-visual__content {
        max-width: 430px;
    }

    .login-visual h1 {
        margin: 18px 0 12px;
        font-size: 2.15rem;
    }

    .login-visual__content > p {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .login-benefits {
        display: none;
    }

    .study-illustration {
        right: -45px;
        bottom: -52px;
        width: 360px;
        transform: scale(0.68);
        transform-origin: right bottom;
        opacity: 0.88;
    }

    .study-card {
        display: none;
    }

    .login-panel {
        padding: 44px 52px 48px;
    }

    .login-panel__inner {
        max-width: none;
    }
}

/* 모바일 */
@media (max-width: 560px) {
    .login-header {
        height: 62px;
        padding:
            max(9px, env(safe-area-inset-top))
            18px
            9px;
    }

    .login-brand {
        gap: 9px;
    }

    .login-brand__icon {
        width: 37px;
        height: 37px;
        border-radius: 11px;
    }

    .login-brand__icon svg {
        width: 24px;
        height: 24px;
    }

    .login-brand__text strong {
        font-size: 1.03rem;
    }

    .login-main {
        width: 100%;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-visual {
        min-height: 188px;
        padding: 27px 22px 29px;
    }

    .login-visual__badge {
        min-height: 27px;
        padding: 0 10px;
        font-size: 0.58rem;
    }

    .login-visual h1 {
        margin: 14px 0 0;
        font-size: clamp(1.75rem, 8vw, 2.15rem);
        line-height: 1.22;
    }

    .login-visual__content > p,
    .study-illustration {
        display: none;
    }

    .login-panel {
        padding:
            36px
            22px
            max(42px, env(safe-area-inset-bottom));
    }

    .login-heading__eyebrow {
        margin-bottom: 8px;
        font-size: 0.65rem;
    }

    .login-heading h2 {
        font-size: 1.9rem;
    }

    .login-heading p {
        margin-top: 8px;
        font-size: 0.86rem;
    }

    .login-form {
        margin-top: 27px;
        gap: 18px;
    }

    .input-wrap input {
        height: 54px;
        border-radius: 13px;
        font-size: 1rem;
    }

    .login-button,
    .register-button {
        min-height: 54px;
        border-radius: 13px;
    }

    .login-footer {
        display: none;
    }
}

/* 작은 모바일 */
@media (max-width: 370px) {
    .login-panel {
        padding-right: 17px;
        padding-left: 17px;
    }

    .login-visual {
        padding-right: 18px;
        padding-left: 18px;
    }

    .login-visual h1 {
        font-size: 1.66rem;
    }
}

/* 가로가 낮은 PC 및 태블릿 */
@media (min-width: 821px) and (max-height: 760px) {
    .login-main {
        min-height: 590px;
        margin-top: 25px;
        margin-bottom: 25px;
    }

    .login-visual {
        min-height: 590px;
        padding-top: 42px;
        padding-bottom: 42px;
    }

    .login-visual h1 {
        margin-top: 20px;
        font-size: 2.65rem;
    }

    .login-benefits {
        margin-top: 24px;
        gap: 10px;
    }

    .study-illustration {
        transform: scale(0.82);
        transform-origin: right bottom;
    }

    .login-panel {
        padding-top: 38px;
        padding-bottom: 38px;
    }

    .login-form {
        margin-top: 24px;
        gap: 16px;
    }
}

/* 접근성: 모션 최소화 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
