:root {
    --bg: #061426;
    --panel: rgba(12, 35, 63, 0.94);
    --panel-light: #102d4f;
    --text: #f5f8fc;
    --muted: #aec1d5;
    --blue: #39a9ff;
    --blue-dark: #1677c8;
    --border: rgba(255, 255, 255, 0.13);
    --success: #2ecf83;
    --danger: #ff6b78;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(24, 119, 199, 0.28), transparent 38rem),
        linear-gradient(145deg, #04101f, var(--bg));
}

a {
    color: var(--blue);
}

.portal-header {
    border-bottom: 1px solid var(--border);
    background: rgba(4, 16, 31, 0.88);
    backdrop-filter: blur(14px);
}

.portal-nav {
    width: min(1120px, calc(100% - 32px));
    min-height: 76px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.portal-brand {
    color: var(--text);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.portal-brand span {
    color: var(--blue);
}

.portal-nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.portal-nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.portal-main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 54px 0 72px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 490px);
    gap: 42px;
    align-items: center;
}

.auth-intro h1 {
    max-width: 720px;
    margin: 0 0 18px;
    font-size: clamp(2.25rem, 6vw, 4.6rem);
    line-height: 0.98;
}

.auth-intro p {
    max-width: 660px;
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.7;
}

.benefit-list {
    display: grid;
    gap: 13px;
    margin-top: 26px;
}

.benefit {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: #dce8f4;
}

.benefit strong {
    color: var(--blue);
}

.card {
    padding: clamp(24px, 5vw, 40px);
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.card-subtitle {
    margin: 0 0 26px;
    color: var(--muted);
    line-height: 1.55;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.055);
    font: inherit;
}

.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(57, 169, 255, 0.16);
}

.checkbox-row {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    margin: 18px 0;
    color: var(--muted);
    line-height: 1.45;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.button {
    display: inline-flex;
    min-height: 50px;
    padding: 12px 21px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    font: inherit;
    font-weight: 800;
    text-decoration: none;
}

.button-block {
    width: 100%;
}

.form-note {
    margin: 20px 0 0;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}

.alert {
    margin-bottom: 22px;
    padding: 14px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.alert-danger {
    color: #ffd9de;
    border: 1px solid rgba(255, 107, 120, 0.38);
    background: rgba(255, 107, 120, 0.13);
}

.alert-success {
    color: #d6ffeb;
    border: 1px solid rgba(46, 207, 131, 0.35);
    background: rgba(46, 207, 131, 0.12);
}

.error-list {
    margin: 0;
    padding-left: 20px;
}

.small-print {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.portal-footer {
    padding: 28px 16px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    text-align: center;
}

@media (max-width: 820px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-intro {
        text-align: center;
    }

    .benefit-list {
        max-width: 540px;
        margin-right: auto;
        margin-left: auto;
        text-align: left;
    }
}

@media (max-width: 560px) {
    .portal-nav {
        min-height: 68px;
    }

    .portal-nav-links {
        gap: 12px;
        font-size: 0.9rem;
    }

    .portal-main {
        width: min(100% - 22px, 1120px);
        padding-top: 30px;
    }

    .card {
        border-radius: 18px;
    }
}

.library-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 34px;
}

.library-heading h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 5vw, 3.7rem);
}

.library-heading p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.volume-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    gap: 26px;
}

.volume-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.volume-cover {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(57, 169, 255, 0.34), transparent 65%),
        var(--panel-light);
}

.volume-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.volume-number {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    color: white;
    background: rgba(4, 16, 31, 0.86);
    backdrop-filter: blur(8px);
    font-size: 0.84rem;
    font-weight: 800;
}

.volume-content {
    padding: 24px;
}

.volume-content h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.volume-description {
    min-height: 52px;
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.55;
}

.volume-date {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.88rem;
}

.portal-promotion {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    margin-top: 42px;
    padding: 30px;
    border: 1px solid rgba(57, 169, 255, 0.35);
    border-radius: 22px;
    background:
        linear-gradient(
            135deg,
            rgba(57, 169, 255, 0.17),
            rgba(12, 35, 63, 0.9)
        );
}

.portal-promotion h2 {
    margin: 0 0 8px;
}

.portal-promotion p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.empty-library {
    padding: 50px 26px;
    border: 1px dashed var(--border);
    border-radius: 22px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 680px) {
    .library-heading,
    .portal-promotion {
        grid-template-columns: 1fr;
        display: grid;
        align-items: start;
    }

    .portal-promotion .button {
        width: 100%;
    }
}

/* Keep magazine covers at a comfortable desktop size */
.volume-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
    justify-content: start;
}

.volume-card {
    width: 100%;
    max-width: 320px;
}

.volume-cover {
    aspect-ratio: 4 / 5;
    max-height: 400px;
}

@media (max-width: 560px) {
    .volume-grid {
        grid-template-columns: 1fr;
    }

    .volume-card {
        max-width: 100%;
    }

    .volume-cover {
        max-height: none;
    }
}
