:root {
    --auth-bg-top: #f5efe6;
    --auth-bg-bottom: #d8e5ea;
    --auth-card-border: rgba(15, 23, 42, 0.08);
    --auth-card-shadow: 0 28px 70px rgba(17, 34, 49, 0.16);
    --auth-accent-soft: rgba(215, 107, 43, 0.14);
}

body.auth-page,
body.entry-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 36%),
        radial-gradient(circle at bottom right, rgba(18, 52, 69, 0.15), transparent 28%),
        linear-gradient(180deg, var(--auth-bg-top) 0%, var(--auth-bg-bottom) 100%);
    color: var(--text);
}

.auth-shell {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 0;
}

.auth-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--auth-card-border);
    border-radius: 28px;
    box-shadow: var(--auth-card-shadow);
    padding: 36px;
    backdrop-filter: blur(18px);
}

.auth-card--compact {
    max-width: 560px;
}

.auth-card__brand {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--auth-accent-soft);
    color: #9d4e1f;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-card__header h1,
.auth-card__header h2 {
    margin: 18px 0 10px;
    font-family: 'M PLUS 1p', 'Noto Sans JP', sans-serif;
    font-size: clamp(1.9rem, 2.4vw, 2.5rem);
    line-height: 1.2;
}

.auth-card__header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.auth-form--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-form--grid .auth-field--full,
.auth-form--grid .auth-form__actions,
.auth-form--grid .form-message {
    grid-column: 1 / -1;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field[data-disabled='true'] label,
.auth-field[data-disabled='true'] .auth-field__hint {
    color: #8d98a5;
}

.auth-field label,
.auth-field__label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #41505f;
}

.auth-input,
.auth-select {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid #c6d3df;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input {
    padding-right: 72px;
}

.auth-input:focus,
.auth-select:focus {
    outline: none;
    border-color: rgba(36, 87, 155, 0.78);
    box-shadow: 0 0 0 4px rgba(36, 87, 155, 0.12);
    transform: translateY(-1px);
}

.auth-input[aria-invalid='true'],
.auth-select[aria-invalid='true'] {
    border-color: #c84c2d;
    box-shadow: 0 0 0 4px rgba(200, 76, 45, 0.12);
}

.auth-input[readonly] {
    background: #edf1f5;
    color: #7b8794;
    border-color: #d6dde5;
    cursor: not-allowed;
}

.auth-input:disabled,
.auth-select:disabled {
    background: #edf1f5;
    color: #7b8794;
    border-color: #d6dde5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.auth-field__hint,
.auth-form__footnote {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

.auth-form__actions {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}

.btn-auth {
    min-height: 50px;
    border: 0;
    border-radius: 14px;
    font-weight: 700;
}

.btn-auth.btn-primary {
    background: linear-gradient(135deg, #24579b 0%, #2f79c7 100%);
    box-shadow: 0 16px 26px rgba(36, 87, 155, 0.22);
}

.btn-auth.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-auth.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.38);
    border-top-color: #fff;
    border-radius: 999px;
    animation: auth-spin 0.8s linear infinite;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.auth-row__links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.auth-inline-link {
    color: #24579b;
    font-weight: 700;
}

.auth-inline-link:hover {
    color: #163d70;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 6px 8px;
    border: 0;
    background: transparent;
    color: #24579b;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.auth-password-toggle:hover {
    color: #163d70;
}

.auth-password-toggle:disabled {
    color: #8d98a5;
    cursor: not-allowed;
}

.auth-card__footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(140, 155, 170, 0.28);
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.8;
}

.auth-card__meta {
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.entry-shell {
    width: min(620px, calc(100% - 40px));
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.entry-card {
    width: 100%;
    padding: 34px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--auth-card-border);
    box-shadow: var(--auth-card-shadow);
    text-align: center;
}

.entry-loader {
    width: 52px;
    height: 52px;
    margin: 22px auto 0;
    border-radius: 999px;
    border: 4px solid rgba(36, 87, 155, 0.16);
    border-top-color: #24579b;
    animation: auth-spin 0.9s linear infinite;
}

.entry-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

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

@media (max-width: 960px) {
    .auth-shell {
        width: min(760px, calc(100% - 32px));
        padding: 24px 0 28px;
    }
}

@media (max-width: 640px) {
    .auth-shell,
    .entry-shell {
        width: min(100%, calc(100% - 20px));
    }

    .auth-card,
    .entry-card {
        padding: 24px 20px;
        border-radius: 22px;
    }

    .auth-form--grid {
        grid-template-columns: 1fr;
    }
}
