@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f7f8fb;
    --card: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --text: #111827;
    --muted: #6b7280;
    --primary: #3b82f6;
    --primary-strong: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --shadow: 0 10px 30px rgba(17, 24, 39, 0.10);
    --radius: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--text);
    background: radial-gradient(1200px 800px at 10% -10%, rgba(59, 130, 246, 0.10) 0%, rgba(59, 130, 246, 0) 60%),
        radial-gradient(900px 700px at 110% 0%, rgba(16, 185, 129, 0.10) 0%, rgba(16, 185, 129, 0) 55%),
        var(--bg);
    display: grid;
    place-items: center;
    padding: 24px;
}

.fonts-loaded body {
    font-family: "HiraWeb", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

.card {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius) + 2px);
    padding: 2px;
    background: linear-gradient(135deg, rgba(124, 156, 255, 0.3), rgba(32, 201, 151, 0.25));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

header {
    padding: 28px 28px 12px;
}

.title {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 0.2px;
}

.subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.95rem;
}

form {
    padding: 8px 28px 24px;
}

.field {
    margin-top: 16px;
}

label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.92rem;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 14px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input::placeholder {
    color: #9aa3b2;
}

input:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
    background: #fff;
}

.hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.83rem;
}

.actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

button[type="submit"] {
    appearance: none;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--primary), var(--primary-strong));
    color: white;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform .04s ease, filter .2s ease, box-shadow .2s ease;
    box-shadow: 0 8px 22px rgba(124, 156, 255, 0.25);
}

button[type="submit"]:hover {
    filter: brightness(1.05);
}

button[type="submit"]:active {
    transform: translateY(1px);
}

button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    margin: 0 28px 18px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: rgba(0, 0, 0, 0.10);
    flex: 1;
}

.google-auth-link {
    margin: 0 28px 24px;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: #fff;
    color: #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.94rem;
}

.google-auth-link:hover {
    background: #f8fafc;
}

.link {
    color: var(--primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.alert {
    margin: 0 28px 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    color: var(--text);
    display: none;
}

.alert.show {
    display: block;
}

.alert.success {
    border-color: rgba(16, 185, 129, 0.45);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.06));
}

.alert.error {
    border-color: rgba(239, 68, 68, 0.45);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.06));
}

footer {
    padding: 16px 28px 28px;
    color: var(--muted);
    font-size: 0.9rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    background: linear-gradient(90deg, #17191e, #232524);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: white;
    display: inline-block;
    vertical-align: -3px;
    animation: spin 0.7s linear infinite;
    margin-right: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 420px) {
    header {
        padding: 22px 20px 10px;
    }

    form {
        padding: 6px 20px 20px;
    }

    .alert {
        margin: 0 20px 14px;
    }

    footer {
        padding: 12px 20px 20px;
    }
}
