@font-face {
    font-family: "ZenMaruGothic";
    src: url("/resource/font/ZenMaruGothic-Regular.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: "ZenMaruGothic";
    src: url("/resource/font/ZenMaruGothic-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "ZenMaruGothic", "Microsoft YaHei", sans-serif;
    color: #5d4867;
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 220, 242, 0.6), transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(213, 230, 255, 0.7), transparent 35%),
        linear-gradient(160deg, #fef7ff 0%, #f5f8ff 45%, #eef6ff 100%);
}

.bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.cursor-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    left: 0;
    top: 0;
    border-radius: 50%;
    opacity: 0.45;
    filter: blur(22px);
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 174, 212, 0.45) 0%, rgba(255, 174, 212, 0) 68%);
}

.petal-field {
    position: absolute;
    inset: 0;
}

.petal {
    --size: 14px;
    --x: 50vw;
    --duration: 14s;
    --delay: 0s;
    --drift: 70px;
    position: absolute;
    top: -40px;
    left: var(--x);
    width: var(--size);
    height: calc(var(--size) * 0.75);
    border-radius: 65% 35% 65% 35%;
    background: rgba(255, 179, 214, 0.45);
    box-shadow: 0 0 10px rgba(255, 179, 214, 0.3);
    animation: petal-fall var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.login-page {
    min-height: 100vh;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    width: min(460px, 92vw);
    padding: 34px 30px 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 221, 242, 0.9);
    box-shadow: 0 20px 45px rgba(167, 160, 230, 0.2);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    transition: opacity 0.45s ease, transform 0.45s ease, box-shadow 0.25s ease;
}

.login-card.is-ready {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.login-card.is-active {
    box-shadow: 0 24px 54px rgba(167, 160, 230, 0.28);
}

.login-header {
    margin-bottom: 22px;
    text-align: center;
}

.kawaii-tag {
    margin: 0 auto 10px;
    width: fit-content;
    padding: 6px 12px;
    border-radius: 999px;
    color: #ff7faa;
    background: #ffe8f4;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

.login-header h1 {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    color: #80599a;
}

.subtitle {
    margin: 10px 0 0;
    color: #8a7896;
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-error {
    margin: 0;
    min-height: 1.1rem;
    font-size: 0.85rem;
    color: #de4f88;
}

.field-error {
    margin: -4px 0 2px;
    min-height: 1.05rem;
    font-size: 0.8rem;
    color: #de4f88;
}

.login-form label {
    font-size: 0.9rem;
    color: #7a6288;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e8d8f3;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 74px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f3dbe8;
    border-radius: 999px;
    background: linear-gradient(180deg, #fffafc 0%, #fff2f8 100%);
    color: #cd8baa;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(236, 174, 206, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease, opacity 0.16s ease;
    transform: translateY(-50%) scale(0.92);
}

.password-wrap:focus-within .password-toggle {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.password-toggle:hover {
    background: linear-gradient(180deg, #fff7fc 0%, #ffeaf4 100%);
    box-shadow: 0 4px 10px rgba(236, 174, 206, 0.22);
}

.password-toggle:focus-visible {
    outline: 2px solid #caa7f5;
    outline-offset: 1px;
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.97);
}

.eye-icon {
    width: 16px;
    height: 10px;
    border: 1.5px solid #cd8baa;
    border-radius: 80% 80% 70% 70%;
    position: relative;
    background: rgba(255, 255, 255, 0.75);
}

.eye-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cd8baa;
    transform: translate(-50%, -50%);
}

.password-toggle.is-revealed .eye-icon {
    border-radius: 999px;
    height: 2px;
    background: transparent;
}

.password-toggle.is-revealed .eye-icon::before {
    opacity: 0;
}

.password-toggle.is-revealed .eye-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 2px;
    background: #cd8baa;
    transform: translate(-50%, -50%) rotate(-26deg);
    border-radius: 999px;
}

.login-form input[type="text"]::placeholder,
.login-form input[type="email"]::placeholder,
.login-form input[type="password"]::placeholder {
    color: #b8a8c5;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    border-color: #caa7f5;
    box-shadow: 0 0 0 4px rgba(222, 202, 255, 0.4);
    transform: translateY(-1px);
}

.login-form input.is-invalid {
    border-color: #f18cb4;
    box-shadow: 0 0 0 3px rgba(252, 202, 223, 0.45);
}


.form-row {
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    color: #816f8d;
}

.remember input {
    accent-color: #f78ebe;
}

.text-link {
    color: #ff7fab;
    text-decoration: none;
    font-size: 0.86rem;
}

.text-link:hover {
    color: #eb5f95;
    text-decoration: none;
}

.login-btn {
    margin-top: 8px;
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9ec6, #b898ff);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(209, 153, 255, 0.35);
}

.login-btn.is-pressed {
    transform: translateY(0);
    box-shadow: 0 5px 14px rgba(209, 153, 255, 0.25);
}

.signup-hint {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: #8b7995;
}

/* Keep keyboard navigation visible and soft. */
.text-link:focus-visible,
.login-btn:focus-visible,
.remember input:focus-visible {
    outline: 2px solid #caa7f5;
    outline-offset: 2px;
    border-radius: 8px;
}

@media (max-width: 560px) {
    .login-page {
        padding: 26px 16px;
    }

    .login-card {
        padding: 26px 18px 22px;
        border-radius: 20px;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@keyframes petal-fall {
    0% {
        transform: translate3d(0, -40px, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift), calc(100vh + 80px), 0) rotate(330deg);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cursor-glow,
    .petal,
    .login-card,
    .login-btn {
        animation: none !important;
        transition: none !important;
    }
}

