:root {
    --bg: #0a0907;
    --bg-soft: #100e0a;
    --panel: #15120d;
    --panel-2: #1b1711;
    --panel-3: #211c14;
    --line: #302819;
    --line-soft: #241e14;
    --gold: #c9a45c;
    --gold-bright: #e9ce8c;
    --gold-dim: #8c7440;
    --accent-rgb: 201, 164, 92;
    --text: #eee7d8;
    --muted: #aea38c;
    --muted-2: #8d8270;
    --green: #7d9a63;
    --green-soft: rgba(125, 154, 99, 0.14);
    --red: #b45a4f;
    --red-soft: rgba(180, 90, 79, 0.13);
    --blue: #7f9db5;
    --blue-soft: rgba(127, 157, 181, 0.13);
    --purple: #b58ac9;
    --purple-soft: rgba(181, 138, 201, 0.12);
    --mythic: #d07b6a;
    --mythic-soft: rgba(208, 123, 106, 0.12);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --radius: 4px;
    --font-display: 'Forum', 'Cormorant Garamond', 'PT Serif', 'Times New Roman', Georgia, serif;
    --font-ui: 'Oswald', 'Manrope', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* На 1080p и ниже — 17px, на 2K/4K текст плавно растёт до 22px. */
    font-size: clamp(17px, 0.6vw + 6px, 22px);
    scroll-behavior: smooth;
}

body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin: 0;
    background-color: var(--bg);
    background-image:
        linear-gradient(180deg, rgba(6, 5, 4, 0.78), rgba(6, 5, 4, 0.94) 58%, rgba(6, 5, 4, 0.98)),
        var(--wallpaper);
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body.allegiance-loyalist {
    --wallpaper: url('/images/wh40k-marine.png');
}

body.allegiance-traitor {
    --wallpaper: url('/images/wh40k-chaos.png');
}

/* Хаос: багровая сталь вместо имперского золота */

body.allegiance-traitor {
    --bg: #080607;
    --bg-soft: #0f0a0b;
    --panel: #160e0f;
    --panel-2: #1d1213;
    --panel-3: #241618;
    --line: #3a2222;
    --line-soft: #29191a;
    --gold: #c05c4c;
    --gold-bright: #f08b6e;
    --gold-dim: #813b33;
    --accent-rgb: 192, 92, 76;
    --text: #eee2d8;
    --muted: #b0a092;
    --muted-2: #8f7b70;
    --green: #8f9a63;
    --red: #c44f43;
    --blue: #9a82b6;
}

body.allegiance-traitor .page-glow {
    background:
        radial-gradient(ellipse 60% 40% at 50% -10%, rgba(192, 92, 76, 0.16), transparent 70%),
        radial-gradient(ellipse 45% 35% at 88% 18%, rgba(118, 48, 102, 0.14), transparent 70%),
        radial-gradient(ellipse 50% 40% at 8% 82%, rgba(90, 32, 26, 0.11), transparent 70%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 4px);
}

body.allegiance-traitor .site-header {
    background: rgba(9, 5, 6, 0.9);
}

body.allegiance-traitor .button-gold {
    border-color: #c36a58;
    background: linear-gradient(180deg, #f2a084, #b34d3f);
    color: #180b08;
    box-shadow: 0 8px 24px rgba(192, 92, 76, 0.2);
}

body.allegiance-traitor .button-gold:hover {
    background: linear-gradient(180deg, #ffb59a, #c65b49);
    color: #120705;
}

body.allegiance-traitor .brand-mark {
    border-color: #9f4b3c;
    color: #ef9278;
    background: radial-gradient(circle at 50% 30%, rgba(192, 92, 76, 0.24), transparent 70%);
}

body.allegiance-traitor .toast {
    border-color: rgba(143, 154, 99, 0.35);
    background: #14170f;
}

body.allegiance-traitor .toast-achievement {
    border-color: rgba(192, 92, 76, 0.45);
    border-left-color: #c05c4c;
    background: #1b0f10;
}

body.allegiance-traitor .status-option.is-active.status-option-read {
    border-color: rgba(143, 154, 99, 0.45);
    background: rgba(143, 154, 99, 0.13);
    color: #c4d2a6;
}

main {
    flex: 1 0 auto;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    padding: 10px 16px;
    border: 1px solid var(--gold);
    border-radius: 3px;
    background: var(--panel-3);
    color: var(--gold-bright);
    transform: translateY(-160%);
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

::selection {
    background: rgba(var(--accent-rgb), 0.28);
    color: var(--text);
}

.page-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 40% at 50% -10%, rgba(var(--accent-rgb), 0.13), transparent 70%),
        radial-gradient(ellipse 45% 35% at 90% 15%, rgba(120, 60, 40, 0.09), transparent 70%),
        radial-gradient(ellipse 50% 40% at 10% 80%, rgba(80, 70, 40, 0.07), transparent 70%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 4px);
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.18s ease;
}

a:hover {
    color: var(--gold-bright);
}

h1, h2, h3, h4 {
    margin: 0 0 0.5em;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0.015em;
    color: var(--text);
}

p {
    margin: 0 0 1em;
}

code {
    padding: 0.1em 0.35em;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--panel-2);
    color: var(--gold-bright);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.88em;
}

.container {
    width: min(clamp(1180px, 66vw, 1560px), calc(100% - 40px));
    margin: 0 auto;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(10, 9, 7, 0.88);
    backdrop-filter: blur(14px);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 74px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold);
    font-size: 1.25rem;
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.18), transparent 70%);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-sub {
    color: var(--muted-2);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 3px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(var(--accent-rgb), 0.06);
}

.nav-link.is-active {
    color: var(--gold-bright);
    background: rgba(var(--accent-rgb), 0.1);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-meta {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.25;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    color: var(--muted-2);
    font-size: 0.72rem;
}

.settings-link {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--muted);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.settings-link:hover,
.settings-link.is-active {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.07);
    color: var(--gold-bright);
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-gold {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border-color: var(--gold);
    color: #191308;
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.16);
}

.button-gold:hover {
    background: linear-gradient(180deg, #f4dfa8, #d8b56c);
    color: #120d05;
}

.button-ghost {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--line);
    color: var(--text);
}

.button-ghost:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
    background: rgba(var(--accent-rgb), 0.06);
}

.button-small {
    padding: 7px 13px;
    font-size: 0.8rem;
}

.button-large {
    padding: 14px 26px;
    font-size: 0.98rem;
}

.button-block {
    width: 100%;
}

.text-link {
    color: var(--gold);
    font-size: 0.9rem;
    white-space: nowrap;
}

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

/* Уведомления */

.toast-stack {
    position: fixed;
    top: 88px;
    right: 20px;
    z-index: 90;
    display: flex;
    width: min(390px, calc(100% - 40px));
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 14px 14px 16px;
    border: 1px solid rgba(125, 154, 99, 0.4);
    border-left: 3px solid var(--green);
    border-radius: 3px;
    background: #182014;
    color: #dce7cf;
    font-size: 0.88rem;
    line-height: 1.5;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
    animation: toast-in 0.22s ease both;
}

.toast.is-hiding {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
    flex: 0 0 auto;
    color: var(--green);
    line-height: 1.5;
}

.toast-text {
    flex: 1;
}

.toast-close {
    flex: 0 0 auto;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--muted-2);
    font-size: 0.78rem;
    line-height: 1.6;
    cursor: pointer;
}

.toast-close:hover {
    color: var(--text);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography helpers */

.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 22px;
    height: 1px;
    flex: 0 0 auto;
    background: var(--gold-dim);
    content: '';
}

.lore-icon {
    filter: drop-shadow(0 0 7px rgba(var(--accent-rgb), 0.16));
}

.section-heading h2::after {
    display: block;
    width: 56px;
    height: 1px;
    margin-top: 10px;
    background: linear-gradient(90deg, var(--gold), transparent);
    content: '';
}

.page-head h1::after,
.page-banner h1::after {
    display: block;
    width: 74px;
    height: 1px;
    margin-top: 12px;
    background: linear-gradient(90deg, var(--gold), transparent);
    content: '';
}

.dot-sep {
    margin: 0 4px;
    color: var(--muted-2);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.045);
    color: #c1b393;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tag-small {
    padding: 2px 7px;
    font-size: 0.66rem;
}

/* Ratings & status */

.rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 600;
}

.rating-star {
    color: var(--gold);
}

.rating-global {
    color: var(--gold-bright);
}

.rating-personal {
    padding: 2px 7px;
    border: 1px solid rgba(125, 154, 99, 0.3);
    border-radius: 2px;
    background: var(--green-soft);
    color: #b7cda2;
    font-size: 0.72rem;
}

.rating-empty {
    color: var(--muted-2);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-dot {
    font-size: 0.72rem;
}

.status-unread {
    color: var(--muted);
    border-color: var(--line);
}

.status-reading {
    color: var(--gold-bright);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.09);
}

.status-read {
    color: #b7cda2;
    border-color: rgba(125, 154, 99, 0.38);
    background: var(--green-soft);
}

.status-dropped {
    color: #cf8f86;
    border-color: rgba(180, 90, 79, 0.36);
    background: var(--red-soft);
}

/* Home hero */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
    padding: clamp(56px, 8vw, 110px) 0 clamp(40px, 6vw, 80px);
}

.hero-title {
    margin-bottom: 22px;
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.005em;
    text-transform: uppercase;
}

.hero-title span {
    color: var(--gold);
}

.hero-lead {
    max-width: 620px;
    color: var(--muted);
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.hero-note {
    margin-top: 18px;
    color: var(--muted-2);
    font-size: 0.8rem;
}

.hero-visual {
    position: relative;
    min-height: 540px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 2px solid var(--gold-dim);
    border-radius: var(--radius);
    background: #050504;
    box-shadow: var(--shadow);
}

.hero-visual::after {
    position: absolute;
    inset: 10px;
    z-index: 2;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    content: '';
    pointer-events: none;
}

.hero-visual img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1.14) contrast(1.04);
}

.hero-visual-scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(4, 4, 4, 0) 38%, rgba(4, 4, 4, 0.82) 72%, #070605 100%),
        linear-gradient(90deg, rgba(4, 4, 4, 0.35), transparent 55%);
}

.hero-visual-content {
    position: absolute;
    right: 24px;
    bottom: 24px;
    left: 24px;
    z-index: 3;
}

.hero-visual-kicker {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-visual-quote {
    max-width: 380px;
    margin: 0 0 16px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-style: italic;
    line-height: 1.35;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.hero-visual-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--accent-rgb), 0.25);
}

.hero-visual-stats div {
    display: flex;
    flex-direction: column;
}

.hero-visual-stats strong {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1;
}

.hero-visual-stats span {
    margin-top: 4px;
    color: #b8ac96;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.profile-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, rgba(var(--accent-rgb), 0.25), transparent 70%);
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.profile-name {
    margin: 0;
    font-weight: 700;
}

.profile-job {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.8rem;
}

.profile-summary {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

/* Иллюстративный баннер */

.lore-banner {
    position: relative;
    display: flex;
    min-height: 440px;
    align-items: flex-end;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #050504;
    box-shadow: var(--shadow);
}

.lore-banner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 46%;
    filter: brightness(1.16) contrast(1.05);
}

.lore-banner-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(4, 4, 4, 0.9) 0%, rgba(4, 4, 4, 0.58) 45%, rgba(4, 4, 4, 0.12) 100%),
        linear-gradient(0deg, rgba(4, 4, 4, 0.72), transparent 55%);
}

.lore-banner-content {
    position: relative;
    z-index: 1;
    max-width: 640px;
    padding: clamp(26px, 4vw, 52px);
}

.lore-banner-title {
    margin: 0 0 8px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 3.2vw, 2.7rem);
    font-weight: 700;
    line-height: 1.1;
    text-shadow: 0 3px 24px rgba(0, 0, 0, 0.9);
}

.lore-banner-caption {
    margin: 0;
    color: #b9ad96;
    font-size: 0.82rem;
}

.cta-aquila {
    position: absolute;
    top: 50%;
    right: 14%;
    z-index: 0;
    color: var(--gold);
    opacity: 0.07;
    pointer-events: none;
    transform: translateY(-50%) rotate(-8deg);
}

.cta-band {
    position: relative;
    overflow: hidden;
}

.cta-band > div,
.cta-band > .button {
    position: relative;
    z-index: 1;
}

/* Маршрут на главной */

.stage-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.stage-level-1 {
    --stage-level-color: var(--green);
    --stage-level-rgb: 125, 154, 99;
}

.stage-level-2 {
    --stage-level-color: var(--gold);
    --stage-level-rgb: var(--accent-rgb);
}

.stage-level-3 {
    --stage-level-color: var(--purple);
    --stage-level-rgb: 181, 138, 201;
}

.stage-level-4 {
    --stage-level-color: var(--mythic);
    --stage-level-rgb: 208, 123, 106;
}

.stage-tile {
    position: relative;
    isolation: isolate;
    display: flex;
    min-height: 156px;
    flex-direction: column;
    gap: 7px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid rgba(var(--stage-level-rgb, var(--accent-rgb)), 0.36);
    border-left: 3px solid var(--stage-level-color, var(--gold-dim));
    border-radius: var(--radius);
    background: linear-gradient(165deg, rgba(var(--accent-rgb), 0.05), transparent 55%), var(--panel);
    color: var(--text);
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.stage-tile-art {
    position: absolute;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    background: var(--panel-2);
    pointer-events: none;
}

.stage-tile-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.46;
    filter: brightness(0.78) saturate(0.78);
    transition: transform 0.35s ease, opacity 0.2s ease;
}

.stage-tile::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(7, 6, 5, 0.12), rgba(7, 6, 5, 0.83) 58%, rgba(7, 6, 5, 0.95)),
        linear-gradient(90deg, rgba(7, 6, 5, 0.46), transparent 88%);
    content: '';
    pointer-events: none;
}

.stage-tile > :not(.stage-tile-art) {
    position: relative;
    z-index: 1;
}

.stage-tile::after {
    position: absolute;
    z-index: 1;
    right: -20px;
    bottom: -34px;
    width: 90px;
    height: 90px;
    border: 1px solid rgba(var(--accent-rgb), 0.12);
    border-radius: 50%;
    content: '';
    pointer-events: none;
}

.stage-tile:hover {
    border-color: rgba(var(--stage-level-rgb, var(--accent-rgb)), 0.72);
    color: var(--text);
    transform: translateY(-2px);
}

.stage-tile:hover .stage-tile-art img {
    opacity: 0.6;
    transform: scale(1.04);
}

.stage-tile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
}

.stage-tile-index {
    color: var(--stage-level-color, var(--gold-dim));
    font-family: var(--font-display);
    font-size: 1.12rem;
    line-height: 1;
}

.stage-tile-emblem {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8));
}

.stage-tile-level.level-badge {
    gap: 7px;
    width: max-content;
    max-width: 100%;
    margin: 0;
    padding: 4px 8px;
    border-color: rgba(var(--stage-level-rgb, var(--accent-rgb)), 0.48);
    background: rgba(7, 6, 5, 0.72);
    color: var(--stage-level-color, var(--gold));
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.stage-tile-level strong {
    padding-right: 6px;
    border-right: 1px solid rgba(var(--stage-level-rgb, var(--accent-rgb)), 0.4);
    font-family: var(--font-display);
    font-size: 0.76rem;
}

.stage-tile-title {
    margin-top: 1px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15;
}

.stage-tile-sub {
    flex: 1;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.45;
}

.stage-tile-count {
    color: var(--stage-level-color, var(--gold));
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Sections */

.section {
    padding: clamp(32px, 5vw, 64px) 0;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 30px;
}

.section-heading h2 {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.section-lead {
    color: var(--muted);
}

.section-heading-inline {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    max-width: none;
}

.section-block {
    margin-top: clamp(36px, 5vw, 60px);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.feature-card {
    position: relative;
    padding: 26px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), var(--bg-soft));
}

.feature-index {
    display: block;
    margin-bottom: 26px;
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 1.6rem;
}

.feature-icon {
    position: absolute;
    top: 22px;
    right: 22px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--gold-dim);
}

.feature-card h3 {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.cta-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: clamp(26px, 4vw, 46px);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    background:
        linear-gradient(100deg, rgba(var(--accent-rgb), 0.1), transparent 55%),
        var(--panel);
}

.cta-band h2 {
    margin-bottom: 6px;
}

.cta-band p {
    margin: 0;
    color: var(--muted);
}

.cta-band-compact {
    margin-top: 48px;
}

/* Book cards */

.book-grid {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.book-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), #110f0b);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card-art {
    position: relative;
    display: grid;
    height: clamp(104px, 12vw, 156px);
    flex: 0 0 auto;
    place-items: center;
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid rgba(var(--theme-rgb, var(--accent-rgb)), 0.28);
    border-radius: 2px;
    background:
        radial-gradient(ellipse at 50% 35%, rgba(var(--theme-rgb, var(--accent-rgb)), 0.2), transparent 60%),
        linear-gradient(145deg, var(--panel-3), var(--bg));
}

.book-card-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    transition: transform 0.3s ease;
}

.book-card-art-link {
    position: absolute;
    z-index: 1;
    inset: 0;
}

.book-card-art-link:focus-visible,
.book-story-art-cover-link:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
}

.book-card:hover .book-card-art img {
    transform: scale(1.035);
}

.book-card-art-placeholder {
    position: relative;
    z-index: 2;
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    border: 1px solid rgba(var(--theme-rgb, var(--accent-rgb)), 0.32);
    border-radius: 50%;
    color: var(--theme-color, var(--gold));
    background: rgba(7, 6, 5, 0.64);
}

.book-card-art-scrim {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: linear-gradient(0deg, rgba(7, 6, 5, 0.7), transparent 78%);
    pointer-events: none;
}

.book-card:hover {
    transform: translateY(-2px);
    border-color: var(--gold-dim);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.book-card:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25);
}

.book-card {
    scroll-margin-top: 96px;
}

.book-card-top {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.series-kicker {
    min-width: 0;
    overflow: hidden;
    color: var(--muted-2);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.book-title {
    margin-bottom: 4px;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.book-title a {
    color: var(--text);
}

.book-title a:hover {
    color: var(--gold-bright);
}

.book-meta {
    margin-bottom: 14px;
    color: var(--muted-2);
    font-size: 0.76rem;
}

.book-why {
    flex: 1;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-footer {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.book-card-footer .match-score {
    max-width: 52%;
}

.book-card-footer > *,
.status-control,
.status-option {
    min-width: 0;
}

.rating-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rating-caption {
    color: var(--muted-2);
    font-size: 0.62rem;
    font-weight: 500;
}

.match-score {
    padding: 4px 9px;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.07);
    color: var(--gold);
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.03em;
    text-align: right;
}

/* Переключатель статусов: подписи важнее иконок на мобильных */

.status-control {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.status-control form {
    display: contents;
}

.status-option {
    display: flex;
    min-width: 0;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 3px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.015);
    color: var(--muted-2);
    font-family: var(--font-body);
    font-size: 0.64rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.status-option-icon {
    flex: 0 0 auto;
    font-size: 0.72rem;
    line-height: 1;
}

.status-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-option:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
    background: rgba(var(--accent-rgb), 0.05);
}

.status-option:disabled {
    cursor: wait;
    opacity: 0.65;
}

.status-option.is-active.status-option-unread {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.status-option.is-active.status-option-reading {
    border-color: rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--gold-bright);
}

.status-option.is-active.status-option-read {
    border-color: rgba(125, 154, 99, 0.5);
    background: var(--green-soft);
    color: #c4d9ad;
}

.status-option.is-active.status-option-dropped {
    border-color: rgba(180, 90, 79, 0.45);
    background: var(--red-soft);
    color: #d99a91;
}

.book-card .status-control {
    margin-top: 13px;
}

/* Формы входа */

.input-wrap {
    position: relative;
    display: block;
}

.input-wrap input {
    padding-right: 78px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--panel-2);
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

/* Auth */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(30px, 5vw, 80px);
    align-items: center;
    padding: clamp(40px, 7vw, 90px) 0;
}

.auth-card {
    padding: clamp(24px, 4vw, 40px);
    border: 1px solid var(--line);
    border-top: 2px solid var(--gold-dim);
    border-radius: var(--radius);
    background: linear-gradient(165deg, rgba(var(--accent-rgb), 0.05), transparent 35%), var(--panel);
    box-shadow: var(--shadow);
}

.auth-title {
    margin-bottom: 8px;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.auth-lead {
    color: var(--muted);
    font-size: 0.9rem;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.field-hint {
    color: var(--muted-2);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.field-error {
    color: #d1897e;
    font-size: 0.76rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold-dim);
    background: #131009;
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--gold-dim) 50%), linear-gradient(135deg, var(--gold-dim) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    padding-right: 32px;
}

textarea {
    resize: vertical;
    min-height: 96px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
}

.checkbox input {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin: 0;
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--bg-soft);
    cursor: pointer;
}

.checkbox input:checked {
    border-color: var(--gold);
    background: var(--gold);
}

.checkbox input:checked::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #191308;
    content: '✓';
    font-size: 0.7rem;
    font-weight: 700;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-switch {
    margin: 20px 0 0;
    color: var(--muted-2);
    font-size: 0.84rem;
    text-align: center;
}

.auth-aside h2 {
    max-width: 440px;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.check-list {
    margin: 24px 0;
    padding: 0;
    list-style: none;
}

.check-list li {
    position: relative;
    padding: 9px 0 9px 28px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--muted);
}

.check-list li::before {
    position: absolute;
    top: 9px;
    left: 0;
    color: var(--gold);
    content: '✦';
    font-size: 0.8rem;
}

.auth-quote {
    margin-top: 30px;
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-style: italic;
}

/* Page scaffolding */

.page-section {
    padding: clamp(32px, 5vw, 56px) 0 64px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.page-head h1 {
    margin-bottom: 8px;
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
}

.page-lead {
    max-width: 700px;
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.page-head-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Stats */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 54px 18px 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 50%;
    color: var(--gold-dim);
}

.stat-label {
    color: var(--muted-2);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stat-value {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.1;
}

.stat-value span {
    color: var(--muted-2);
    font-size: 1rem;
}

.stat-accent {
    color: var(--gold-bright);
}

.stat-caption {
    color: var(--muted-2);
    font-size: 0.73rem;
}

/* Progress */

.progress-panel {
    margin-bottom: 22px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.06), transparent 50%), var(--panel);
}

.progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.progress-title {
    margin: 0 0 2px;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.progress-caption {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.78rem;
}

.progress-percent {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.7rem;
    line-height: 1;
}

.progress-track {
    height: 9px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.4);
}

.progress-track-compact {
    height: 6px;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
    box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.35);
}

.progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 12px;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.progress-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-2);
}

.legend-dot.status-read {
    background: var(--green);
}

.legend-dot.status-reading {
    background: var(--gold);
}

.legend-dot.status-dropped {
    background: var(--red);
}

.legend-dot.status-unread {
    background: var(--muted-2);
}

/* Dashboard panels */

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
    gap: 18px;
    margin-bottom: 20px;
}

.next-book {
    padding: 26px;
    scroll-margin-top: 96px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 60% 80% at 100% 0%, rgba(var(--accent-rgb), 0.08), transparent 70%),
        var(--panel);
}

.next-book-title {
    margin-bottom: 6px;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.next-book-title a {
    color: var(--text);
}

.next-book-title a:hover {
    color: var(--gold-bright);
}

.next-book-meta {
    margin-bottom: 16px;
    color: var(--muted-2);
    font-size: 0.78rem;
}

.next-book-text {
    max-width: 640px;
    color: var(--muted);
    font-size: 0.9rem;
}

.next-book-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.next-book-footer form {
    display: contents;
}

.upcoming {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}

.upcoming-title {
    margin: 0 0 6px;
    color: var(--muted-2);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.upcoming-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
}

.upcoming-row:last-child {
    border-bottom: 0;
}

.upcoming-row:hover {
    color: var(--gold-bright);
}

.upcoming-index {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 0.78rem;
}

.upcoming-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.upcoming-name {
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upcoming-series {
    color: var(--muted-2);
    font-size: 0.65rem;
}

.upcoming-arrow {
    color: var(--muted-2);
    font-size: 0.8rem;
}

.profile-panel {
    padding: 24px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.profile-panel .profile-avatar {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.profile-divider {
    margin: 18px 0;
    border-top: 1px solid var(--line-soft);
}

.profile-note {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.78rem;
    line-height: 1.55;
}

.profile-tips {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.profile-tips li {
    position: relative;
    padding: 5px 0 5px 16px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
}

.profile-tips li::before {
    position: absolute;
    left: 0;
    color: var(--gold-dim);
    content: '✦';
    font-size: 0.55rem;
    top: 8px;
}

/* Entry list */

.entry-list {
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.entry-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 13px 18px 13px 22px;
    border-bottom: 1px solid var(--line-soft);
    color: inherit;
}

.entry-row::before {
    position: absolute;
    top: 22%;
    bottom: 22%;
    left: 0;
    width: 2px;
    background: var(--gold);
    content: '';
    opacity: 0;
    transition: opacity 0.15s ease;
}

.entry-row:hover::before {
    opacity: 1;
}

.entry-row:last-child {
    border-bottom: none;
}

.entry-row:hover {
    background: rgba(var(--accent-rgb), 0.045);
    color: inherit;
}

.entry-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.entry-title {
    overflow: hidden;
    font-weight: 600;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-meta {
    color: var(--muted-2);
    font-size: 0.73rem;
}

.entry-rating {
    width: 44px;
    color: var(--gold);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
}

/* Plan */

.plan-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 28px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.07), transparent 60%), var(--panel);
}

.plan-summary-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 320px;
}

.plan-summary-profile {
    justify-self: end;
    max-width: 440px;
    text-align: right;
}

.plan-summary-label {
    margin: 0 0 4px;
    color: var(--gold);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.plan-summary-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.stage-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.stage-nav-link {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    padding: 10px 11px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    background: var(--panel);
    color: var(--text);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.stage-nav-link:hover {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.05);
    color: var(--text);
}

.stage-nav-index {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 0.9rem;
    line-height: 1;
}

.stage-nav-title {
    overflow: hidden;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
}

.stage-nav-count {
    color: var(--muted-2);
    font-size: 0.58rem;
}

.plan-hint {
    margin: 0 0 22px;
    color: var(--muted-2);
    font-size: 0.75rem;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.plan-stage,
.plan-row {
    scroll-margin-top: 96px;
}

.plan-stage {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.plan-stage-head {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 24px;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.055), transparent 70%);
}

.stage-index {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 1.9rem;
    line-height: 1;
}

.plan-stage-head h2 {
    margin: 0 0 2px;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.stage-subtitle {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: 0.8rem;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.level-badge::before {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}

.level-badge.level-1 {
    border-color: rgba(125, 154, 99, 0.35);
    color: #b7cda2;
}

.level-badge.level-2 {
    border-color: rgba(var(--accent-rgb), 0.3);
    color: var(--gold);
}

.level-badge.level-3 {
    border-color: rgba(181, 138, 201, 0.32);
    color: var(--purple);
}

.level-badge.level-4 {
    border-color: rgba(208, 123, 106, 0.35);
    color: var(--mythic);
}

.level-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.level-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    color: var(--muted-2);
    font-size: 0.63rem;
}

.level-legend-item strong {
    color: var(--muted);
    font-weight: 600;
}

.level-legend-item.level-1 strong {
    color: #b7cda2;
}

.level-legend-item.level-2 strong {
    color: var(--gold);
}

.level-legend-item.level-3 strong {
    color: var(--purple);
}

.level-legend-item.level-4 strong {
    color: var(--mythic);
}

.stage-description {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.6;
}

.stage-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-left: 18px;
    border-left: 1px solid var(--line-soft);
    white-space: nowrap;
}

.stage-progress strong {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.stage-progress span {
    color: var(--muted-2);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stage-mini-track {
    width: 76px;
    height: 4px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
}

.stage-mini-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
}

.plan-rows {
    display: flex;
    flex-direction: column;
}

.plan-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 118px 232px;
    gap: 16px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line-soft);
    transition: background 0.15s ease;
}

.plan-row:last-child {
    border-bottom: none;
}

.plan-row:hover {
    background: rgba(var(--accent-rgb), 0.035);
}

.plan-number {
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.95rem;
}

.plan-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.plan-title {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
}

.plan-title:hover {
    color: var(--gold-bright);
}

.essential-mark {
    display: inline-flex;
    padding: 2px 7px;
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--gold);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.entry-mark {
    display: inline-flex;
    padding: 2px 7px;
    border: 1px solid rgba(127, 157, 181, 0.32);
    border-radius: 2px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.plan-meta {
    margin: 0 0 7px;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.plan-main .tag-row {
    margin: 0;
}

.plan-ratings {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.plan-ratings .rating {
    font-size: 0.78rem;
}

.plan-rating-caption {
    color: var(--muted-2);
    font-size: 0.6rem;
}

.plan-row .status-control {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-row .status-option {
    font-size: 0.62rem;
}

/* Filters */

.filter-bar {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(115px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.library-stage-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
    gap: 8px;
    margin: 18px 0 12px;
    padding: 2px;
}

.library-stage-tab {
    display: flex;
    min-width: 0;
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.library-stage-tab img {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    object-fit: contain;
}

.library-stage-tab:hover,
.library-stage-tab:focus-visible {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.library-stage-tab:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.library-stage-tab.is-active {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--gold-bright);
}

.library-stage-tab-label {
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.filter-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.filter-field input,
.filter-field select {
    min-width: 0;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-actions .button {
    padding: 10px 16px;
    white-space: nowrap;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 20px;
    background: rgba(var(--accent-rgb), 0.07);
    color: var(--gold);
    font-size: 0.68rem;
}

.filter-chip:hover {
    border-color: var(--gold);
    color: var(--gold-bright);
}

.filter-chip-remove {
    font-size: 0.6rem;
    opacity: 0.7;
}

.filter-reset {
    margin-left: 4px;
    color: var(--muted-2);
    font-size: 0.68rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.filter-reset:hover {
    color: var(--gold-bright);
}

.results-total {
    color: var(--muted-2);
}

.results-count {
    margin: 18px 0;
    color: var(--muted-2);
    font-size: 0.8rem;
}

.results-count strong {
    color: var(--gold-bright);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 28px 0 8px;
}

.pagination-link {
    display: inline-flex;
    min-width: 38px;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--panel);
    color: var(--muted);
    font-size: 0.78rem;
    text-decoration: none;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.pagination-link:hover,
.pagination-link:focus-visible {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.pagination-link.is-active {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--gold-bright);
    font-weight: 700;
}

.pagination-link.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.pagination-gap {
    padding: 0 3px;
    color: var(--muted-2);
}

.empty-state {
    padding: 60px 24px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    text-align: center;
}

.empty-icon {
    margin-bottom: 8px;
    font-size: 2rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 1.4rem;
}

.empty-state p {
    color: var(--muted);
}

/* Book detail */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 26px;
    color: var(--muted-2);
    font-size: 0.76rem;
}

.breadcrumbs a {
    color: var(--muted);
}

.breadcrumbs a:hover {
    color: var(--gold-bright);
}

.book-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
    gap: 36px;
    align-items: start;
    scroll-margin-top: 96px;
}

.book-detail-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 8px;
}

.book-detail-title {
    margin-bottom: 2px;
    font-size: clamp(2rem, 4vw, 3rem);
    text-transform: uppercase;
}

.book-original-title {
    margin: 0;
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-style: italic;
    letter-spacing: 0.04em;
}

.book-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 18px 0 14px;
}

.meta-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.018);
    color: var(--text);
    font-size: 0.76rem;
}

.meta-chip-label {
    color: var(--muted-2);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.prose {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--line-soft);
}

.prose h2 {
    margin-bottom: 10px;
    color: var(--gold);
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.prose p {
    color: #c8bfae;
    font-size: 0.95rem;
    line-height: 1.75;
}

.prose > p:first-of-type::first-letter {
    float: left;
    margin: 0.04em 0.12em 0 0;
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 3.2em;
    font-weight: 700;
    line-height: 0.76;
}

.prose ul,
.prose ol {
    margin: 0 0 1em;
    padding-left: 1.4em;
    color: #c8bfae;
}

.prose li {
    margin-bottom: 0.35em;
    padding-left: 0.2em;
}

.prose li::marker {
    color: var(--gold);
}

blockquote {
    margin: 1.4em 0;
    padding: 14px 20px;
    border-left: 2px solid var(--gold);
    background: rgba(var(--accent-rgb), 0.05);
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.4;
}

.prose .why-block {
    margin-bottom: 14px;
    padding: 16px 18px;
    border-left: 2px solid var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.045);
    color: var(--text);
}

.match-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.badge-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 0;
}

.book-nav {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}

.book-nav-link {
    display: flex;
    flex-direction: column;
    max-width: 48%;
}

.book-nav-next {
    text-align: right;
}

.book-nav-label {
    color: var(--muted-2);
    font-size: 0.67rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.book-nav-title {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 0.94rem;
}

.book-nav-link:hover .book-nav-title {
    color: var(--gold-bright);
}

.book-detail-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rating-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.09), transparent 50%), var(--panel);
}

.rating-panel-label {
    margin: 0 0 6px;
    color: var(--muted-2);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.big-rating {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1;
}

.big-rating-value {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 3.4rem;
    font-weight: 600;
}

.big-rating-max {
    color: var(--muted-2);
    font-size: 1rem;
}

.rating-panel-caption {
    margin: 4px 0 14px;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.rating-bar {
    height: 5px;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
}

.rating-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
}

.personal-score {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.personal-score-label {
    color: var(--muted-2);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.personal-score-value {
    color: #c4d9ad;
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
}

.personal-score-value small {
    color: var(--muted-2);
    font-family: var(--font-body);
    font-size: 0.7rem;
}

.personal-score-empty {
    color: var(--muted-2);
    font-size: 0.75rem;
}

.side-status {
    padding: 16px 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.side-status-label {
    margin: 0 0 10px;
    color: var(--muted-2);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.side-status .status-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.side-status .status-option {
    min-height: 36px;
    justify-content: flex-start;
    padding-left: 10px;
    font-size: 0.7rem;
}

.mobile-status {
    display: none;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.progress-form {
    padding: 22px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.progress-form-title {
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.progress-form .field {
    margin-bottom: 13px;
}

.side-note {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.72rem;
    text-align: center;
}

/* Настройки профиля */

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.profile-form {
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.allegiance-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.allegiance-fieldset legend {
    margin-bottom: 4px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.allegiance-fieldset > .field-hint {
    display: block;
    margin-bottom: 14px;
}

.allegiance-group + .allegiance-group {
    margin-top: 20px;
}

.allegiance-group-title {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.allegiance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.allegiance-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.allegiance-option:hover {
    transform: translateY(-1px);
    border-color: var(--gold-dim);
}

.allegiance-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.allegiance-option-icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--legion-accent, var(--gold)) 45%, var(--line));
    border-radius: 50%;
    color: var(--legion-accent, var(--gold-bright));
    background: radial-gradient(circle at 50% 30%, rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.14), transparent 70%);
}

.allegiance-option-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.allegiance-option-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.15;
}

.allegiance-option-side {
    color: var(--gold);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.allegiance-option-description {
    margin-top: 4px;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.45;
}

.allegiance-option-check {
    position: absolute;
    top: 10px;
    right: 11px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: transparent;
    font-size: 0.62rem;
}

.allegiance-option:has(input:checked) {
    border-color: var(--legion-accent, var(--gold));
    background: linear-gradient(160deg, rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.14), transparent 65%), var(--bg-soft);
    box-shadow: inset 0 0 0 1px rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.2);
}

.allegiance-option:has(input:checked) .allegiance-option-check {
    border-color: var(--legion-accent, var(--gold));
    background: var(--legion-accent, var(--gold));
    color: #181006;
}

.allegiance-option:has(input:focus-visible) {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.profile-form-divider {
    margin: 24px 0;
    border-top: 1px solid var(--line-soft);
}

.profile-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.profile-interest-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.profile-interest-fieldset legend {
    margin-bottom: 4px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.profile-interest-fieldset > .field-hint {
    display: block;
    margin: 0 0 10px;
}

.profile-interest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 7px 12px;
}

.profile-interest-option {
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    line-height: 1.35;
}

.profile-interest-option:hover {
    border-color: var(--line-soft);
    color: var(--text);
}

.profile-interest-option input:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
}

.profile-interest-option:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.28);
    background: rgba(var(--accent-rgb), 0.06);
    color: var(--text);
}

.profile-side {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(var(--accent-rgb), 0.1), transparent 70%),
        var(--panel);
}

.profile-side-emblem {
    display: grid;
    width: 78px;
    height: 78px;
    margin-bottom: 14px;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.18), transparent 70%);
}

.profile-side-title {
    margin-bottom: 6px;
    font-size: 1.8rem;
    text-transform: uppercase;
}

.profile-side-side {
    margin: -2px 0 8px;
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.profile-side-description {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.profile-side-divider {
    margin: 18px 0;
    border-top: 1px solid var(--line-soft);
}

.profile-side-note {
    margin-bottom: 8px;
    color: var(--muted-2);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.check-list-compact {
    margin: 0;
}

.check-list-compact li {
    padding: 6px 0 6px 24px;
    font-size: 0.78rem;
}

.check-list-compact li::before {
    top: 6px;
}

/* Лор-раздел: персонажи, события, таймлайн */

.theme-imperial {
    --theme-color: #c9a45c;
    --theme-rgb: 201, 164, 92;
}

.theme-chaos {
    --theme-color: #c05c4c;
    --theme-rgb: 192, 92, 76;
}

.theme-marine {
    --theme-color: #7f9db5;
    --theme-rgb: 127, 157, 181;
}

.theme-xenos {
    --theme-color: #8fae70;
    --theme-rgb: 143, 174, 112;
}

.theme-inquisition {
    --theme-color: #8aa7a4;
    --theme-rgb: 138, 167, 164;
}

.theme-primarch {
    --theme-color: #b58ac9;
    --theme-rgb: 181, 138, 201;
}

.character-portrait {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(var(--theme-rgb), 0.45);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 28%, rgba(var(--theme-rgb), 0.28), transparent 62%),
        linear-gradient(160deg, #1b1711, #080706);
}

.portrait-art {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 23%;
}

.portrait-sm {
    width: 62px;
    height: 62px;
}

.portrait-md {
    width: 92px;
    height: 92px;
}

.portrait-lg {
    width: clamp(150px, 18vw, 210px);
    height: clamp(150px, 18vw, 210px);
}

.portrait-glow {
    position: absolute;
    z-index: 1;
    inset: 10%;
    border: 1px solid rgba(var(--theme-rgb), 0.18);
    border-radius: 50%;
    pointer-events: none;
}

.portrait-initial {
    position: absolute;
    top: 50%;
    left: 50%;
    color: rgba(var(--theme-rgb), 0.22);
    font-family: var(--font-display);
    font-size: 4.6rem;
    font-weight: 700;
    line-height: 1;
    transform: translate(-50%, -50%);
}

.portrait-sm .portrait-initial {
    font-size: 2.8rem;
}

.portrait-icon {
    position: absolute;
    z-index: 2;
    right: 10%;
    bottom: 9%;
    display: grid;
    width: 35%;
    height: 35%;
    place-items: center;
    border: 1px solid rgba(var(--theme-rgb), 0.45);
    border-radius: 50%;
    background: #0c0a08;
    color: var(--theme-color);
}

.portrait-frame {
    position: absolute;
    z-index: 3;
    inset: 6%;
    border: 1px solid rgba(var(--theme-rgb), 0.22);
    border-radius: 50%;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.character-card {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.character-card:hover {
    border-color: rgba(var(--theme-rgb), 0.55);
    color: var(--text);
    transform: translateY(-1px);
}

.character-card-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.character-card-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.character-card-title {
    color: var(--theme-color);
    font-size: 0.64rem;
    line-height: 1.35;
}

.character-card-bio {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.character-card-faction {
    margin-top: 3px;
    color: var(--muted-2);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.character-hero {
    display: flex;
    align-items: center;
    gap: clamp(20px, 4vw, 38px);
    margin-bottom: 26px;
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 55% 120% at 0% 0%, rgba(var(--theme-rgb), 0.16), transparent 70%),
        var(--panel);
}

.character-hero-body {
    flex: 1;
}

.character-hero h1 {
    margin: 0 0 4px;
    font-size: clamp(2rem, 4vw, 3rem);
    text-transform: uppercase;
}

.character-hero-title {
    margin: 0 0 10px;
    color: var(--theme-color);
    font-size: 0.85rem;
}

.character-hero-lead {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.character-hero-stats {
    display: flex;
    gap: 22px;
    padding-left: 22px;
    border-left: 1px solid var(--line-soft);
}

.character-hero-stats div {
    display: flex;
    flex-direction: column;
}

.character-hero-stats strong {
    color: var(--theme-color);
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
}

.character-hero-stats span {
    margin-top: 4px;
    color: var(--muted-2);
    font-size: 0.6rem;
    text-transform: uppercase;
}

.character-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

.character-bio {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.character-events {
    padding: 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.character-events h2 {
    margin-bottom: 14px;
    font-size: 1.2rem;
}

.mini-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--line);
    padding-left: 16px;
}

.mini-timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    color: var(--text);
}

.mini-timeline-item::before {
    position: absolute;
    top: 14px;
    left: -21px;
    width: 7px;
    height: 7px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    background: var(--bg);
    content: '';
}

.mini-timeline-item:hover {
    color: var(--gold-bright);
}

.mini-timeline-date {
    color: var(--muted-2);
    font-size: 0.6rem;
}

.mini-timeline-title {
    font-size: 0.78rem;
}

.event-art {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border: 1px solid rgba(var(--theme-rgb), 0.3);
    background:
        radial-gradient(ellipse 80% 100% at 80% 0%, rgba(var(--theme-rgb), 0.24), transparent 65%),
        linear-gradient(155deg, #1d1711, #080706);
    color: var(--theme-color);
}

.event-art-card {
    height: 128px;
    padding: 13px;
}

.event-art-hero {
    min-height: 270px;
    padding: 24px;
}

.event-art-dot {
    width: 42px;
    height: 42px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.event-art-dot .event-art-date {
    display: none;
}

.event-art-grid {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    background:
        repeating-linear-gradient(135deg, transparent 0, transparent 11px, rgba(var(--theme-rgb), 0.08) 11px, rgba(var(--theme-rgb), 0.08) 12px),
        repeating-linear-gradient(45deg, transparent 0, transparent 36px, rgba(var(--theme-rgb), 0.05) 36px, rgba(var(--theme-rgb), 0.05) 37px);
}

.event-art-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(var(--theme-rgb), 0.45);
    border-radius: 50%;
    background: rgba(6, 5, 4, 0.5);
}

.event-art-hero .event-art-icon {
    width: 84px;
    height: 84px;
}

.event-art-date {
    position: relative;
    z-index: 1;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.event-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.event-card:hover {
    border-color: rgba(var(--theme-rgb), 0.5);
    color: var(--text);
    transform: translateY(-1px);
}

.event-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
}

.event-card-era {
    color: var(--theme-color);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.event-card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.event-card-summary {
    flex: 1;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.45;
}

.event-card-meta {
    margin-top: 4px;
    color: var(--muted-2);
    font-size: 0.6rem;
}

.event-hero {
    display: grid;
    grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1fr);
    margin-bottom: 26px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.event-art-hero {
    min-height: 100%;
    border: 0;
    border-right: 1px solid var(--line-soft);
}

.event-hero-body {
    align-self: center;
    padding: clamp(22px, 4vw, 36px);
}

.event-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 3.6vw, 2.8rem);
    text-transform: uppercase;
}

.event-hero-lead {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.event-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.event-description {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.event-side {
    padding: 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.event-side-date {
    margin: 0 0 2px;
    color: var(--theme-color);
    font-family: var(--font-display);
    font-size: 1.6rem;
}

.event-side-era {
    margin: 0 0 14px;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.event-side-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 0.72rem;
}

.event-nav {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}

.era-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 28px;
}

.era-nav-link {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: var(--panel);
    color: var(--muted);
    font-size: 0.7rem;
}

.era-nav-link small {
    color: var(--gold-dim);
}

.era-nav-link:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.timeline-note {
    margin: -14px 0 24px;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.55;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.timeline-era {
    scroll-margin-top: 96px;
}

.timeline-era-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
}

.timeline-era-head h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}

.timeline-era-head span {
    color: var(--muted-2);
    font-size: 0.66rem;
    white-space: nowrap;
}

.timeline-list {
    margin-left: 20px;
    padding-left: 34px;
    border-left: 1px solid var(--line);
}

.timeline-item {
    position: relative;
    display: block;
    padding: 0 0 24px;
}

.timeline-marker {
    position: absolute;
    top: 0;
    left: -56px;
}

.timeline-content {
    padding-top: 1px;
}

.timeline-title {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.timeline-title:hover {
    color: var(--gold-bright);
}

.timeline-date {
    margin-left: 10px;
    color: var(--theme-color, var(--gold));
    font-size: 0.62rem;
    text-transform: uppercase;
}

.timeline-summary {
    margin: 4px 0 6px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    color: var(--muted-2);
    font-size: 0.65rem;
}

.timeline-link {
    margin-left: 8px;
    color: var(--gold);
    font-size: 0.68rem;
}

.book-story-art {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 18px 0 0;
    padding: 18px 22px;
    overflow: hidden;
    border: 1px solid rgba(var(--theme-rgb), 0.3);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 70% 130% at 0% 50%, rgba(var(--theme-rgb), 0.18), transparent 70%),
        linear-gradient(120deg, #1a1610, #080706);
}

.book-story-art.has-generated-artwork {
    min-height: 176px;
    padding-right: clamp(132px, 18vw, 210px);
}

.book-story-art-cover-link {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 20px;
    width: clamp(82px, 10vw, 118px);
    height: calc(100% - 24px);
    border: 1px solid rgba(var(--theme-rgb), 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.book-story-art-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 24%;
}

.book-story-art-icon {
    display: grid;
    width: 60px;
    height: 60px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(var(--theme-rgb), 0.4);
    border-radius: 50%;
    color: var(--theme-color);
}

.book-story-art-kicker {
    margin: 0 0 2px;
    color: var(--theme-color);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.book-story-art-quote {
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.35;
}

.book-story-art-frame {
    position: absolute;
    z-index: 3;
    inset: 7px;
    border: 1px solid rgba(var(--theme-rgb), 0.12);
    pointer-events: none;
}

.book-timeline {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--line);
    margin-left: 138px;
    padding-left: 24px;
}

.book-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text);
}

.book-timeline-date {
    position: absolute;
    right: calc(100% + 24px);
    width: 114px;
    color: var(--muted-2);
    font-size: 0.62rem;
    text-align: right;
}

.book-timeline-dot {
    position: absolute;
    left: -29px;
    width: 9px;
    height: 9px;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    background: var(--bg);
}

.book-timeline-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
}

.book-timeline-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.book-timeline-item:hover .book-timeline-title {
    color: var(--gold-bright);
}

.book-timeline-summary {
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.4;
}

.book-timeline-arrow {
    color: var(--muted-2);
    font-size: 0.8rem;
}

/* Баннеры разделов */

.page-banner {
    position: relative;
    display: flex;
    min-height: 320px;
    align-items: flex-end;
    margin-bottom: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #070605;
    box-shadow: var(--shadow);
}

.page-banner > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1.05) contrast(1.06);
}

.page-banner-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(6, 5, 4, 0.95) 0%, rgba(6, 5, 4, 0.68) 52%, rgba(6, 5, 4, 0.2) 100%),
        linear-gradient(0deg, rgba(6, 5, 4, 0.9), transparent 75%);
}

.page-banner-watermark {
    position: absolute;
    top: 50%;
    right: 5%;
    color: var(--theme-color);
    opacity: 0.1;
    transform: translateY(-50%) rotate(-8deg);
}

.page-banner-content {
    position: relative;
    z-index: 1;
    max-width: 780px;
    padding: clamp(24px, 4vw, 42px);
}

.page-banner h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    text-transform: uppercase;
}

.page-banner-lead {
    max-width: 700px;
    margin: 0;
    color: #d0c5b1;
    font-size: 0.9rem;
    line-height: 1.65;
}

.page-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.page-banner-actions:empty {
    display: none;
}

.page-banner-credit {
    position: absolute;
    right: 18px;
    bottom: 14px;
    z-index: 1;
    color: rgba(230, 220, 200, 0.45);
    font-size: 0.55rem;
}

/* Фоновые иллюстрации */

.book-story-art,
.event-art,
.event-hero,
.character-hero,
.lore-promo,
.timeline-hero {
    position: relative;
}

.book-story-art-bg,
.event-art-bg,
.event-hero-bg,
.character-hero-bg,
.lore-promo-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

.book-story-art-bg {
    opacity: 0.3;
    filter: grayscale(25%) brightness(0.65);
}

.book-story-art.has-generated-artwork .book-story-art-bg {
    opacity: 0.48;
    filter: grayscale(10%) brightness(0.72);
}

.book-story-art-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(8, 7, 5, 0.96) 0%, rgba(8, 7, 5, 0.72) 55%, rgba(8, 7, 5, 0.28) 100%),
        radial-gradient(ellipse 60% 100% at 0% 50%, rgba(var(--theme-rgb), 0.18), transparent 70%);
}

.book-story-art-icon,
.book-story-art-content,
.book-story-art-frame {
    position: relative;
    z-index: 1;
}

.event-art-bg {
    opacity: 0.3;
    filter: grayscale(30%) brightness(0.65);
}

.event-art-hero .event-art-bg {
    opacity: 0.5;
}

.event-art-hero::after {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(7, 6, 5, 0.2), rgba(7, 6, 5, 0.85)),
        linear-gradient(0deg, rgba(7, 6, 5, 0.82), transparent 65%);
    content: '';
}

.event-art-hero .event-art-icon,
.event-art-hero .event-art-date {
    z-index: 2;
}

.character-hero {
    overflow: hidden;
}

.character-hero-bg {
    opacity: 0.18;
    filter: grayscale(35%) brightness(0.6);
}

.character-hero::after {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(8, 7, 5, 0.88) 0%, rgba(8, 7, 5, 0.65) 55%, rgba(8, 7, 5, 0.35) 100%);
    content: '';
}

.character-hero > *:not(.character-hero-bg) {
    position: relative;
    z-index: 1;
}

.event-hero {
    position: relative;
    overflow: hidden;
}

.event-hero-bg {
    opacity: 0.18;
    filter: grayscale(30%) brightness(0.6);
}

.event-hero > *:not(.event-hero-bg) {
    position: relative;
    z-index: 1;
}

.lore-promo {
    overflow: hidden;
}

.lore-promo-bg {
    opacity: 0.2;
    filter: grayscale(35%) brightness(0.6);
}

.lore-promo::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(11, 9, 7, 0.85), rgba(11, 9, 7, 0.55) 55%, rgba(11, 9, 7, 0.2));
    content: '';
}

.lore-promo > *:not(.lore-promo-bg) {
    position: relative;
    z-index: 1;
}

.timeline-hero {
    display: flex;
    min-height: 430px;
    align-items: flex-end;
    margin-bottom: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #080706;
    box-shadow: var(--shadow);
}

.timeline-hero > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(1) contrast(1.05);
}

.timeline-hero-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(6, 5, 4, 0.94) 0%, rgba(6, 5, 4, 0.6) 55%, rgba(6, 5, 4, 0.1) 100%),
        linear-gradient(0deg, rgba(6, 5, 4, 0.9), transparent 70%);
}

.timeline-hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    padding: clamp(24px, 5vw, 46px);
}

.timeline-hero-content h1 {
    margin: 0 0 8px;
    font-size: clamp(2.2rem, 4.6vw, 3.5rem);
    text-transform: uppercase;
}

.timeline-hero-content .page-lead {
    margin-bottom: 18px;
    color: #cfc4b0;
}

.timeline-hero-credit {
    position: absolute;
    right: 18px;
    bottom: 14px;
    z-index: 1;
    color: rgba(230, 220, 200, 0.5);
    font-size: 0.55rem;
}

.credits-subtitle {
    margin: 34px 0 4px;
    color: var(--text);
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.credits-caption {
    margin: 0 0 14px;
    color: var(--muted-2);
    font-size: 0.75rem;
}

.credits-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.credit-card {
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.credit-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid var(--line-soft);
    background: #050504;
}

.credit-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.credit-body {
    padding: 16px 18px;
}

.credit-body h2 {
    margin: 0 0 3px;
    font-size: 1.15rem;
}

.credit-body p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.78rem;
}

.credit-license {
    color: var(--gold) !important;
    font-size: 0.62rem !important;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.credit-note {
    max-width: 900px;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.65;
}

/* Тест на сторону */

.quiz-callout {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius);
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.08), transparent 60%), var(--panel);
}

.quiz-callout-icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
}

.quiz-callout-body {
    flex: 1;
}

.quiz-callout-body h2 {
    margin: 0 0 2px;
    font-size: 1.25rem;
}

.quiz-callout-body p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.quiz-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--muted-2);
    font-size: 0.72rem;
}

.quiz-legend-item strong {
    margin-right: 2px;
    color: var(--gold);
}

.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.quiz-question {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 15px 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.quiz-question-title {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.55;
}

.quiz-question-number {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 0.9rem;
    line-height: 1.6;
}

.quiz-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
}

.quiz-option {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 3px;
    border: 1px solid var(--line-soft);
    border-radius: 2px;
    color: var(--muted-2);
    font-size: 0.6rem;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.quiz-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.quiz-option-value {
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 0.9rem;
    line-height: 1;
}

.quiz-option-label {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quiz-option:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.quiz-option:has(input:checked) {
    border-color: var(--gold);
    background: rgba(var(--accent-rgb), 0.13);
    color: var(--gold-bright);
}

.quiz-option:has(input:checked) .quiz-option-value {
    color: var(--gold-bright);
}

.quiz-option:has(input:focus-visible) {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.quiz-submit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.quiz-submit p {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.quiz-error {
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid rgba(180, 90, 79, 0.4);
    border-left: 3px solid var(--red);
    border-radius: 3px;
    background: var(--red-soft);
    color: #d9a39a;
    font-size: 0.82rem;
}

.quiz-result {
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 60% 60% at 0% 0%, rgba(var(--accent-rgb), 0.1), transparent 70%),
        var(--panel);
}

.quiz-result-head {
    display: flex;
    align-items: flex-start;
    gap: 22px;
}

.quiz-result-emblem {
    display: grid;
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.18), transparent 70%);
}

.quiz-result-head h2 {
    margin: 0 0 6px;
    font-size: clamp(2rem, 4vw, 3rem);
    text-transform: uppercase;
}

.quiz-result-description {
    max-width: 780px;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.quiz-result-bars {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 26px 0;
    padding: 20px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
}

.quiz-result-bar-head,
.quiz-axis-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.72rem;
}

.quiz-result-bar-head strong,
.quiz-axis-head strong {
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.quiz-result-bars .achievement-track,
.quiz-axes .achievement-track {
    height: 6px;
}

.quiz-fill-traitor {
    background: linear-gradient(90deg, #704274, #c26352);
}

.quiz-axes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
}

.quiz-match-line {
    margin: 12px 0 0;
    color: var(--muted-2);
    font-size: 0.76rem;
}

.quiz-match-line strong {
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 1.05rem;
}

.quiz-recommendation,
.quiz-alternatives {
    margin-top: 26px;
}

.quiz-recommended-legion {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
    padding: 18px 20px;
    border: 1px solid color-mix(in srgb, var(--legion-accent, var(--gold)) 55%, var(--line));
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 60% 100% at 0% 50%, rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.16), transparent 70%),
        var(--bg-soft);
}

.quiz-recommended-emblem {
    display: grid;
    width: 70px;
    height: 70px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--legion-accent, var(--gold)) 55%, var(--line));
    border-radius: 50%;
    color: var(--legion-accent, var(--gold-bright));
    background: radial-gradient(circle at 50% 30%, rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.24), transparent 70%);
}

.quiz-recommended-legion h3 {
    margin: 0 0 2px;
    font-size: 1.55rem;
}

.quiz-recommended-legion p {
    margin: 0;
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.quiz-recommended-motto {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.quiz-legion-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.quiz-legion-form {
    display: contents;
}

.quiz-legion-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.quiz-legion-option:hover {
    transform: translateY(-1px);
    border-color: var(--legion-accent, var(--gold));
    background: linear-gradient(160deg, rgba(var(--legion-accent-rgb, var(--accent-rgb)), 0.1), transparent 70%), var(--bg-soft);
}

.quiz-legion-option-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--legion-accent, var(--gold)) 45%, var(--line));
    border-radius: 50%;
    color: var(--legion-accent, var(--gold-bright));
}

.quiz-legion-option-body {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1px;
}

.quiz-legion-option-body strong {
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.2;
}

.quiz-legion-option-body span {
    color: var(--muted-2);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.quiz-legion-option-match {
    color: var(--legion-accent, var(--gold));
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.quiz-result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
}

.quiz-result-actions form {
    display: contents;
}

.quiz-disclaimer {
    max-width: 900px;
    margin-top: 18px;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.65;
}

/* Ранги читателя */

.lore-promo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 22px;
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius);
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.07), transparent 60%), var(--panel);
}

.lore-promo-art {
    position: relative;
    width: 140px;
    height: 88px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 3px;
    background: #050504;
}

.lore-promo-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8) saturate(0.9);
    opacity: 0.85;
}

.lore-promo-art::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(6, 5, 4, 0.65));
    content: '';
}

.lore-promo-art-icon {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 1;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.45);
    border-radius: 50%;
    background: rgba(6, 5, 4, 0.75);
    color: var(--gold-bright);
}

.lore-promo-body {
    flex: 1;
}

.lore-promo-body h2 {
    margin: 0 0 2px;
    font-size: 1.25rem;
}

.lore-promo-body p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.rank-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 22px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 55% 120% at 0% 0%, rgba(var(--accent-rgb), 0.09), transparent 70%),
        var(--panel);
}

.rank-emblem {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.2), transparent 72%);
    color: var(--gold-bright);
}

.rank-emblem-large {
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
}

.rank-title {
    margin: 0 0 4px;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.rank-description {
    max-width: 760px;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.rank-progress-row {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.rank-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.42);
}

.rank-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
    box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.3);
}

.rank-progress-text {
    color: var(--muted-2);
    font-size: 0.7rem;
}

.rank-link {
    color: var(--gold);
    font-size: 0.78rem;
    white-space: nowrap;
}

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

/* Страница достижений */

.achievement-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-rank {
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.rank-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    margin-bottom: 18px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 45% 100% at 0% 0%, rgba(var(--accent-rgb), 0.12), transparent 70%),
        linear-gradient(120deg, var(--panel), var(--bg-soft));
}

.rank-hero-body {
    flex: 1;
    min-width: 260px;
}

.rank-hero-title {
    margin: 0 0 4px;
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    text-transform: uppercase;
}

.rank-hero-side {
    display: flex;
    min-width: 120px;
    flex-direction: column;
    align-items: flex-end;
    padding-left: 22px;
    border-left: 1px solid var(--line-soft);
}

.rank-side-label {
    color: var(--muted-2);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.rank-side-value {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 2.4rem;
    line-height: 1;
}

.rank-side-caption {
    color: var(--muted-2);
    font-size: 0.66rem;
}

.rank-ladder {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.rank-step {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 3px;
    background: var(--panel);
    color: var(--muted-2);
}

.rank-step > .lore-icon {
    grid-row: span 3;
    color: var(--muted-2);
}

.rank-step-index {
    grid-column: 2;
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.7rem;
}

.rank-step-title {
    grid-column: 2;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.15;
}

.rank-step-threshold {
    grid-column: 2;
    font-size: 0.62rem;
}

.rank-step.is-completed {
    border-color: rgba(var(--accent-rgb), 0.25);
}

.rank-step.is-completed > .lore-icon,
.rank-step.is-completed .rank-step-index {
    color: var(--gold-dim);
}

.rank-step.is-current {
    border-color: var(--gold);
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

.rank-step.is-current > .lore-icon,
.rank-step.is-current .rank-step-title {
    color: var(--gold-bright);
}

.rank-step-current {
    grid-column: 2;
    color: var(--gold);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.next-goal {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 20px 22px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: var(--radius);
    background: linear-gradient(110deg, rgba(var(--accent-rgb), 0.08), transparent 65%), var(--panel);
}

.next-goal-icon {
    display: grid;
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
}

.next-goal-body {
    flex: 1;
}

.next-goal-body h2 {
    margin: 0 0 4px;
    font-size: 1.2rem;
}

.next-goal-body p:not(.eyebrow) {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.achievement-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.achievement-group-head h2 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.achievement-group-count {
    color: var(--muted-2);
    font-size: 0.72rem;
    white-space: nowrap;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.achievement-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.achievement-card.is-locked {
    background: #110f0b;
}

.achievement-card.is-locked .achievement-icon {
    color: var(--muted-2);
}

.achievement-card.is-unlocked {
    border-color: rgba(var(--accent-rgb), 0.24);
    background:
        linear-gradient(150deg, rgba(var(--accent-rgb), 0.055), transparent 55%),
        var(--panel);
}

.achievement-card.is-unlocked:hover {
    border-color: var(--gold-dim);
}

.achievement-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted-2);
}

.achievement-card.is-unlocked .achievement-icon {
    border-color: var(--gold-dim);
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.16), transparent 70%);
    color: var(--gold-bright);
}

.achievement-body {
    min-width: 0;
    flex: 1;
}

.achievement-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}

.achievement-category {
    color: var(--gold-dim);
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.achievement-date,
.achievement-state {
    color: var(--muted-2);
    font-size: 0.58rem;
}

.achievement-date::before {
    color: var(--green);
    content: '✓ ';
}

.achievement-title {
    margin: 0 0 3px;
    font-size: 1.06rem;
    line-height: 1.2;
}

.achievement-card.is-locked .achievement-title {
    color: #b9af9c;
}

.achievement-description {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.achievement-lore {
    margin: 0;
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-style: italic;
    line-height: 1.45;
}

.achievement-story {
    margin: 9px 0 0;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.5;
}

.achievement-story-label {
    display: inline-block;
    margin-right: 5px;
    color: var(--gold-dim);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.achievement-story-link {
    color: var(--gold);
    white-space: nowrap;
}

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

/* Редкость достижений */

.achievement-card.rarity-common .achievement-category {
    color: var(--muted-2);
}

.achievement-card.rarity-rare .achievement-category {
    color: var(--blue);
}

.achievement-card.rarity-legendary .achievement-category {
    color: var(--gold);
}

.achievement-card.rarity-epic .achievement-category {
    color: var(--purple);
}

.achievement-card.rarity-mythic .achievement-category {
    color: var(--mythic);
}

.achievement-card.rarity-rare .achievement-icon {
    border-color: rgba(127, 157, 181, 0.35);
    color: var(--blue);
}

.achievement-card.rarity-legendary .achievement-icon {
    border-color: rgba(var(--accent-rgb), 0.38);
    color: var(--gold);
}

.achievement-card.rarity-epic .achievement-icon {
    border-color: rgba(181, 138, 201, 0.35);
    color: var(--purple);
}

.achievement-card.rarity-mythic .achievement-icon {
    border-color: rgba(208, 123, 106, 0.4);
    color: var(--mythic);
}

.achievement-card.is-unlocked.rarity-rare .achievement-icon {
    border-color: rgba(127, 157, 181, 0.55);
    background: radial-gradient(circle at 50% 30%, rgba(127, 157, 181, 0.18), transparent 70%);
    color: #b9d0e2;
}

.achievement-card.is-unlocked.rarity-legendary .achievement-icon {
    border-color: var(--gold-dim);
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.18), transparent 70%);
    color: var(--gold-bright);
}

.achievement-card.is-unlocked.rarity-epic .achievement-icon {
    border-color: rgba(181, 138, 201, 0.55);
    background: radial-gradient(circle at 50% 30%, rgba(181, 138, 201, 0.2), transparent 70%);
    color: #d6b9e6;
}

.achievement-card.is-unlocked.rarity-mythic .achievement-icon {
    border-color: rgba(208, 123, 106, 0.6);
    background: radial-gradient(circle at 50% 30%, rgba(208, 123, 106, 0.2), transparent 70%);
    color: #e6a093;
}

.achievement-group-lore {
    margin: 2px 0 0;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.achievement-progress {
    margin-top: 10px;
}

.achievement-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    color: var(--muted-2);
    font-size: 0.6rem;
}

.achievement-progress-head strong {
    color: var(--muted);
    font-weight: 600;
}

.achievement-track {
    height: 4px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
}

.achievement-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
}

.achievement-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.achievement-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 3px;
    background: var(--panel);
    color: var(--text);
}

.achievement-mini:hover {
    border-color: var(--gold-dim);
    color: var(--text);
}

.achievement-mini-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
}

.achievement-mini.rarity-common .achievement-mini-icon {
    border-color: var(--line);
    color: var(--muted);
}

.achievement-mini.rarity-rare .achievement-mini-icon {
    border-color: rgba(127, 157, 181, 0.45);
    color: var(--blue);
}

.achievement-mini.rarity-legendary .achievement-mini-icon {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.achievement-mini.rarity-epic .achievement-mini-icon {
    border-color: rgba(181, 138, 201, 0.45);
    color: var(--purple);
}

.achievement-mini.rarity-mythic .achievement-mini-icon {
    border-color: rgba(208, 123, 106, 0.5);
    color: var(--mythic);
}

.achievement-mini-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.achievement-mini-title {
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.achievement-mini-desc {
    overflow: hidden;
    color: var(--muted-2);
    font-size: 0.65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.achievement-teaser {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted-2);
}

.achievement-teaser p {
    margin: 0;
    font-size: 0.82rem;
}

/* Достижения в уведомлениях */

.toast-achievement {
    border-color: rgba(var(--accent-rgb), 0.42);
    border-left-color: var(--gold);
    background: #1c170f;
    color: var(--text);
}

.toast-achievement-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 50%;
    color: var(--gold-bright);
}

.toast-kicker {
    display: block;
    margin-bottom: 1px;
    color: var(--gold);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.toast-achievement-title {
    display: block;
    font-family: var(--font-display);
    font-size: 0.98rem;
    line-height: 1.2;
}

.toast-achievement-desc {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.4;
}

/* Страница ошибки */

.error-page {
    display: flex;
    min-height: 62vh;
    flex-direction: column;
    justify-content: center;
    padding: clamp(60px, 10vw, 130px) 0;
    text-align: center;
}

.error-code {
    margin: 0 0 4px;
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: clamp(5rem, 14vw, 9rem);
    font-weight: 700;
    line-height: 1;
    opacity: 0.5;
}

.error-page .eyebrow {
    justify-content: center;
}

.error-page h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

.error-lead {
    max-width: 560px;
    margin: 0 auto 26px;
    color: var(--muted);
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Footer */

.site-footer {
    margin-top: 40px;
    padding: 26px 0;
    border-top: 1px solid var(--line-soft);
    background: var(--bg-soft);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted-2);
    font-size: 0.72rem;
}

.footer-inner p {
    margin: 0;
}

.footer-motto {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-style: italic;
    text-align: right;
}

/* Responsive */

@media (max-width: 1050px) {
    .hero {
        grid-template-columns: 1fr;
        padding-top: 48px;
    }

    .hero-visual {
        width: 100%;
        max-width: 560px;
        min-height: 480px;
    }

    .lore-banner {
        min-height: 380px;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .filter-actions {
        grid-column: span 2;
    }

    .filter-actions .button {
        flex: 1;
    }

    .book-detail {
        grid-template-columns: 1fr;
    }

    .book-detail-side {
        max-width: 520px;
    }

    .mobile-status {
        display: block;
    }

    .mobile-status .status-control {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-status .status-option {
        min-height: 36px;
        justify-content: flex-start;
        padding-left: 10px;
        font-size: 0.72rem;
    }

    .book-detail-top .status-badge {
        display: none;
    }

    .book-detail-side .side-status {
        display: none;
    }

    .plan-row {
        grid-template-columns: 38px minmax(0, 1fr) 220px;
    }

    .plan-ratings {
        display: none;
    }

    .stage-nav {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .stage-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .split-grid {
        grid-template-columns: 1fr;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .quiz-question {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .quiz-result-head {
        flex-direction: column;
    }

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

    .character-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline-hero,
    .page-banner {
        min-height: 340px;
    }

    .timeline-hero-credit {
        position: static;
        display: block;
        margin: 0 24px 16px;
    }

    .character-hero-stats {
        width: 100%;
        margin-left: 0;
        padding: 12px 0 0;
        border-top: 1px solid var(--line-soft);
        border-left: 0;
    }

    .book-timeline {
        margin-left: 0;
        padding-left: 20px;
    }

    .book-timeline-date {
        position: static;
        width: auto;
        margin-bottom: 2px;
        text-align: left;
    }

    .book-timeline-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .book-timeline-dot {
        left: -25px;
        top: 15px;
    }

    .book-timeline-arrow {
        display: none;
    }

    .profile-side {
        max-width: 560px;
    }

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

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

    .character-page-grid,
    .event-page-grid {
        grid-template-columns: 1fr;
    }

    .event-hero {
        grid-template-columns: 1fr;
    }

    .event-art-hero {
        min-height: 210px;
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .character-hero {
        flex-wrap: wrap;
    }

    .character-hero-stats {
        margin-left: auto;
    }

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

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

@media (max-width: 780px) {
    .container {
        width: min(100% - 28px, 1180px);
    }

    .header-inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        border-top: 1px solid var(--line-soft);
        padding-top: 8px;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav {
        gap: 2px;
    }

    .nav-link {
        padding: 7px 7px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .toast-stack {
        top: 76px;
        right: 14px;
        width: calc(100% - 28px);
    }

    .user-meta {
        display: none;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .feature-index {
        margin-bottom: 12px;
    }

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

    .auth-aside {
        order: 2;
        padding-top: 10px;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-head-actions {
        width: 100%;
    }

    .page-head-actions .button {
        flex: 1;
    }

    .cta-band {
        flex-direction: column;
        align-items: flex-start;
    }

    .cta-band .button {
        width: 100%;
    }

    .plan-summary {
        grid-template-columns: 1fr;
    }

    .plan-summary-profile {
        justify-self: start;
        text-align: left;
    }

    .plan-stage-head {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .stage-progress {
        grid-column: 2;
        flex-direction: row;
        align-items: baseline;
        gap: 6px;
        padding: 0;
        border: 0;
    }

    .stage-mini-track {
        width: 52px;
        margin-top: 0;
    }

    .plan-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 14px 16px;
    }

    .plan-number {
        display: none;
    }

    .plan-row .status-control {
        grid-column: 1;
    }

    .plan-ratings {
        display: flex;
        grid-column: 1;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-top: 2px;
    }

    .plan-rating-caption {
        display: none;
    }

    .stage-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        padding-bottom: 0;
    }

    .stage-nav-link {
        flex: none;
    }

    .book-detail-top {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .book-detail-side {
        max-width: none;
    }

    .book-nav {
        flex-direction: column;
    }

    .book-nav-link,
    .book-nav-next {
        max-width: 100%;
        text-align: left;
    }

    .entry-row {
        gap: 10px;
        padding: 12px 14px;
    }

    .entry-row .status-badge {
        display: none;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-motto {
        text-align: left;
    }

    .status-option {
        font-size: 0.7rem;
    }

    .status-option-icon {
        font-size: 0.78rem;
    }

    .lore-promo {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .lore-promo-art {
        width: 100%;
        height: 120px;
    }

    .lore-promo .button {
        width: 100%;
    }

    .rank-panel {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: 14px;
        padding: 18px;
    }

    .rank-link {
        grid-column: 2;
    }

    .rank-hero {
        gap: 18px;
        padding: 20px;
    }

    .rank-hero-side {
        width: 100%;
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
        padding: 12px 0 0;
        border-top: 1px solid var(--line-soft);
        border-left: 0;
    }

    .rank-progress-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .rank-side-value {
        font-size: 1.8rem;
    }

    .achievement-grid {
        grid-template-columns: 1fr;
    }

    .next-goal {
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .stage-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .allegiance-grid {
        grid-template-columns: 1fr;
    }

    .character-grid {
        grid-template-columns: 1fr;
    }

    .timeline-list {
        margin-left: 12px;
        padding-left: 26px;
    }

    .timeline-marker {
        left: -47px;
    }

    .event-art-dot {
        width: 34px;
        height: 34px;
    }

    .timeline-title {
        display: block;
    }

    .timeline-date {
        display: block;
        margin: 2px 0 0;
    }

    .book-story-art {
        align-items: flex-start;
        padding: 16px;
    }

    .book-story-art.has-generated-artwork {
        min-height: 152px;
        padding-right: 104px;
    }

    .book-story-art-cover-link {
        top: 14px;
        right: 14px;
        width: 74px;
        height: 112px;
    }

    .book-story-art-icon {
        width: 48px;
        height: 48px;
    }

    .quiz-callout {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .quiz-callout .button {
        width: 100%;
    }

    .quiz-result-bars,
    .quiz-axes,
    .quiz-legion-options {
        grid-template-columns: 1fr;
    }

    .credits-grid {
        grid-template-columns: 1fr;
    }

    .timeline-hero,
    .page-banner {
        min-height: 300px;
    }

    .timeline-hero-content,
    .page-banner-content {
        padding: 20px;
    }

    .page-banner-watermark {
        display: none;
    }

    .page-banner-credit {
        display: none;
    }

    .quiz-option {
        padding: 8px 2px;
    }

    .quiz-option-label {
        display: none;
    }

    .quiz-result-actions form,
    .quiz-result-actions .button {
        display: block;
        width: 100%;
    }

    .rank-ladder {
        grid-template-columns: 1fr;
    }

    .achievement-preview-grid {
        grid-template-columns: 1fr;
    }

    .rank-emblem {
        width: 52px;
        height: 52px;
    }

    .rank-emblem-large {
        width: 66px;
        height: 66px;
    }

    .achievement-card {
        padding: 14px;
    }

    .achievement-icon {
        width: 42px;
        height: 42px;
    }
    .book-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-search,
    .filter-actions {
        grid-column: 1 / -1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .stat-caption {
        font-size: 0.68rem;
    }

    .stage-tile {
        min-height: 132px;
    }

    .hero-title {
        letter-spacing: 0.015em;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .section-heading-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .hero-visual {
        min-height: 440px;
    }

    .hero-visual-content {
        right: 18px;
        bottom: 18px;
        left: 18px;
    }

    .lore-banner {
        min-height: 330px;
    }

    .lore-banner-scrim {
        background:
            linear-gradient(0deg, rgba(4, 4, 4, 0.92) 0%, rgba(4, 4, 4, 0.55) 70%, rgba(4, 4, 4, 0.12) 100%);
    }

    .progress-legend {
        gap: 10px;
    }
}

/* Личная библиотека и читалка */

.reader-stats {
    margin-bottom: 26px;
}

.reader-upload {
    margin-bottom: 34px;
    padding: clamp(20px, 3vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 60% 100% at 100% 0%, rgba(var(--accent-rgb), 0.08), transparent 65%),
        linear-gradient(180deg, var(--panel-2), var(--panel));
}

.reader-upload-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.reader-upload-head h2 {
    margin: 4px 0 8px;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.reader-upload-form {
    display: grid;
    gap: 14px;
}

.reader-dropzone {
    position: relative;
    display: grid;
    min-height: 168px;
    place-items: center;
    gap: 6px;
    padding: 28px 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.reader-dropzone:hover {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.05);
}

.reader-dropzone:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}

.reader-dropzone.is-dragover {
    border-color: var(--gold);
    background: rgba(var(--accent-rgb), 0.11);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.reader-dropzone.has-file {
    border-style: solid;
    border-color: var(--green);
    background: var(--green-soft);
}

.reader-dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    opacity: 0;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.reader-dropzone-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 50%;
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.07);
}

.reader-dropzone-title {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.reader-dropzone-hint {
    color: var(--muted-2);
    font-size: 0.82rem;
    word-break: break-word;
}

.reader-upload-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.reader-upload-note {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.8rem;
    line-height: 1.5;
}

.reader-library {
    margin-top: 8px;
}

.reader-library .section-heading-inline {
    margin-bottom: 18px;
}

.reader-library .section-heading-inline h2 {
    margin: 4px 0 0;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.reader-continue {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
    padding: 18px 20px;
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
    background:
        linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 65%),
        var(--panel);
}

.reader-continue h2 {
    margin: 4px 0;
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.reader-continue-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.reader-continue-actions {
    display: grid;
    width: min(100%, 280px);
    gap: 8px;
}

.reader-reading-stats {
    margin-top: 22px;
    padding: 18px 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), #110f0b);
}

.reader-reading-stats .section-heading-inline {
    margin-bottom: 14px;
}

.reader-streak {
    color: var(--gold);
    font-size: 0.78rem;
}

.reader-reading-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.reader-reading-chart {
    display: grid;
    height: 120px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
}

.reader-reading-day {
    display: grid;
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 4px;
    text-align: center;
}

.reader-reading-bar {
    display: block;
    width: 100%;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, var(--gold), var(--gold-dim));
    opacity: 0.75;
}

.reader-reading-label {
    color: var(--muted-2);
    font-size: 0.62rem;
    text-transform: uppercase;
}

.reader-reading-value {
    color: var(--muted);
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
}

.reader-library-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.reader-library-filters input,
.reader-library-filters select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
}

.reader-library-filters label {
    min-width: 150px;
}

.reader-filter-search {
    flex: 1 1 220px;
    min-width: 220px;
}

.reader-card-edit {
    margin-top: 10px;
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}

.reader-card-edit summary {
    cursor: pointer;
    color: var(--gold);
}

.reader-card-edit-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.reader-card-edit-form label {
    display: grid;
    gap: 4px;
}

.reader-card-edit-form input {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
}

.reader-card-reset {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--red);
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}

.reader-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
}

.reader-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), #110f0b);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reader-card:hover {
    border-color: var(--gold-dim);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

.reader-card-cover {
    display: block;
    width: 92px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg-soft);
}

.reader-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reader-card-cover-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--gold-dim);
    background:
        radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.12), transparent 70%),
        var(--panel-2);
}

.reader-card-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.reader-card-kicker {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reader-card-title {
    margin: 0;
    font-size: 1.14rem;
    line-height: 1.3;
}

.reader-card-title a {
    color: var(--text);
}

.reader-card-title a:hover {
    color: var(--gold-bright);
}

.reader-card-author {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.reader-card-edition {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.74rem;
    line-height: 1.45;
}

.reader-card-meta {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.45;
}

.reader-match {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.reader-match-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted-2);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.reader-match-badge.is-matched {
    border-color: rgba(125, 154, 99, 0.4);
    color: var(--green);
    background: var(--green-soft);
}

.reader-link-form {
    display: flex;
    flex-basis: 100%;
    align-items: center;
    gap: 8px;
}

.reader-link-form select {
    min-width: 0;
    flex: 1;
    padding: 7px 9px;
    font-size: 0.78rem;
}

.reader-card-progress {
    margin-top: 6px;
}

.reader-card-progress .progress-track {
    margin-bottom: 6px;
}

.reader-card-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted-2);
    font-size: 0.7rem;
}

.reader-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Погружённый режим чтения */

.reader-body {
    display: block;
    min-height: 100vh;
    background: var(--bg);
}

.reader-body .skip-link {
    z-index: 90;
}

.reader-theme-dark {
    --reader-chrome: rgba(12, 10, 7, 0.94);
    --reader-chrome-ink: #eee7d8;
    --reader-chrome-muted: #aea38c;
    --reader-chrome-line: #302819;
    --reader-paper-bg: #15120d;
    --reader-paper-2: #1b1711;
    --reader-ink: #eee7d8;
    --reader-ink-muted: #b9ad97;
    --reader-accent: #c9a45c;
    --reader-accent-bright: #e9ce8c;
    --reader-rule: #302819;
    --reader-panel-bg: #15120d;
    --reader-stage: #0a0907;
}

.reader-theme-auto {
    --reader-chrome: rgba(12, 10, 7, 0.94);
    --reader-chrome-ink: #eee7d8;
    --reader-chrome-muted: #aea38c;
    --reader-chrome-line: #302819;
    --reader-paper-bg: #15120d;
    --reader-paper-2: #1b1711;
    --reader-ink: #eee7d8;
    --reader-ink-muted: #b9ad97;
    --reader-accent: #c9a45c;
    --reader-accent-bright: #e9ce8c;
    --reader-rule: #302819;
    --reader-panel-bg: #15120d;
    --reader-stage: #0a0907;
}

@media (prefers-color-scheme: light) {
    .reader-theme-auto {
        --accent-rgb: 138, 90, 43;
        --reader-chrome: rgba(244, 241, 234, 0.97);
        --reader-chrome-ink: #241f18;
        --reader-chrome-muted: #6e6557;
        --reader-chrome-line: #d8d0c0;
        --reader-paper-bg: #fbf9f4;
        --reader-paper-2: #f2eee4;
        --reader-ink: #26221c;
        --reader-ink-muted: #665d4f;
        --reader-accent: #8a5a2b;
        --reader-accent-bright: #a36c34;
        --reader-rule: #ddd5c5;
        --reader-panel-bg: #fbf9f4;
        --reader-stage: #e3ddd1;
    }
}

.reader-theme-sepia {
    --accent-rgb: 138, 90, 43;
    --reader-chrome: rgba(48, 38, 24, 0.96);
    --reader-chrome-ink: #f2e8d2;
    --reader-chrome-muted: #cbbd9f;
    --reader-chrome-line: #5b4a31;
    --reader-paper-bg: #e9dcc0;
    --reader-paper-2: #ded0b0;
    --reader-ink: #33291b;
    --reader-ink-muted: #6b5a42;
    --reader-accent: #8a5a2b;
    --reader-accent-bright: #a36c34;
    --reader-rule: #c4b18d;
    --reader-panel-bg: #f0e6d0;
    --reader-stage: #2b2217;
}

.reader-theme-sepia .reader-paper {
    background-image:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(var(--accent-rgb), 0.05), transparent 70%),
        url('/images/texture-parchment.webp');
    background-size: cover, cover;
    background-position: center, center;
}

.reader-theme-light {
    --accent-rgb: 138, 90, 43;
    --reader-chrome: rgba(244, 241, 234, 0.97);
    --reader-chrome-ink: #241f18;
    --reader-chrome-muted: #6e6557;
    --reader-chrome-line: #d8d0c0;
    --reader-paper-bg: #fbf9f4;
    --reader-paper-2: #f2eee4;
    --reader-ink: #26221c;
    --reader-ink-muted: #665d4f;
    --reader-accent: #8a5a2b;
    --reader-accent-bright: #a36c34;
    --reader-rule: #ddd5c5;
    --reader-panel-bg: #fbf9f4;
    --reader-stage: #e3ddd1;
}

.reader-app {
    min-height: 100vh;
    background: var(--reader-stage, var(--bg));
    color: var(--text);
}

.reader-bar {
    position: fixed;
    z-index: 60;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 64px;
    padding: 0 clamp(12px, 2vw, 26px);
    border-bottom: 1px solid var(--reader-chrome-line);
    background: var(--reader-chrome);
    color: var(--reader-chrome-ink);
    backdrop-filter: blur(10px);
}

.reader-bar-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--reader-chrome-muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.reader-bar-back:hover {
    border-color: var(--reader-chrome-line);
    color: var(--reader-chrome-ink);
}

.reader-bar-title {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
}

.reader-bar-kicker {
    overflow: hidden;
    color: var(--reader-chrome-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.reader-bar-title strong {
    overflow: hidden;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-bar-chapter {
    overflow: hidden;
    color: var(--reader-chrome-muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reader-bar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.reader-bar-button:hover,
.reader-bar-button[aria-expanded="true"] {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
    background: rgba(var(--accent-rgb), 0.08);
}

.reader-bar-button:focus-visible {
    outline: 2px solid var(--reader-accent);
    outline-offset: 2px;
}

.reader-percent {
    min-width: 46px;
    color: var(--reader-chrome-muted);
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.reader-bar-progress {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--reader-chrome-line);
}

.reader-bar-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--reader-accent), var(--reader-accent-bright));
    transition: width 0.2s ease;
}

.reader-viewport {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    padding-top: 64px;
}

.reader-toc {
    position: sticky;
    top: 64px;
    display: flex;
    height: calc(100vh - 64px);
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 22px 14px 26px;
    border-right: 1px solid var(--reader-chrome-line);
    background: var(--reader-chrome);
    color: var(--reader-chrome-ink);
    scrollbar-width: thin;
}

.reader-toc-head h2 {
    margin: 4px 0 0;
    color: var(--reader-chrome-ink);
    font-size: 1.15rem;
}

.reader-toc-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.reader-toc-link {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.reader-toc-link:hover {
    border-color: var(--reader-chrome-line);
    color: var(--reader-chrome-ink);
    background: rgba(255, 255, 255, 0.03);
}

.reader-toc-link:focus-visible {
    outline: 2px solid var(--reader-accent);
    outline-offset: 1px;
}

.reader-toc-link.is-active {
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--reader-accent-bright);
    background: rgba(var(--accent-rgb), 0.09);
}

.reader-toc-link[data-level="1"] .reader-toc-title {
    font-weight: 700;
}

.reader-toc-link.is-subchapter {
    padding-left: 18px;
}

.reader-toc-link.is-subchapter .reader-toc-index {
    font-size: 0.78rem;
}

.reader-toc-node {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px;
    align-items: start;
    gap: 2px;
}

.reader-toc-node .reader-toc-link {
    grid-column: 1;
}

.reader-toc-toggle {
    grid-column: 2;
    width: 24px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-size: 0.7rem;
    cursor: pointer;
}

.reader-toc-toggle:hover {
    border-color: var(--reader-chrome-line);
    color: var(--reader-accent-bright);
}

.reader-toc-children {
    display: grid;
    gap: 1px;
    margin-left: 10px;
    border-left: 1px solid var(--reader-chrome-line);
    padding-left: 2px;
}

.reader-toc-children[hidden] {
    display: none;
}

.reader-toc-index {
    color: var(--reader-accent);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.reader-toc-title {
    overflow-wrap: anywhere;
}

.reader-toc-edition {
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--reader-chrome-line);
    color: var(--reader-chrome-muted);
    font-size: 0.7rem;
    line-height: 1.5;
}

.reader-main {
    min-width: 0;
    padding: clamp(18px, 3vw, 42px) clamp(12px, 2.5vw, 36px) 60px;
    background: var(--reader-stage, var(--bg));
}

.reader-paper {
    width: min(100%, var(--reader-width, 760px));
    margin: 0 auto;
    padding: clamp(22px, 3vw, 46px) clamp(18px, 3.5vw, 48px);
    border: 1px solid var(--reader-rule);
    border-radius: 4px;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(var(--accent-rgb), 0.04), transparent 70%),
        var(--reader-paper-bg);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.4);
    color: var(--reader-ink);
    font-family: 'PT Serif', Georgia, serif;
    font-size: var(--reader-font-size, 20px);
    line-height: var(--reader-line-height, 1.65);
    overflow-wrap: break-word;
}

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 30px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--reader-rule);
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.reader-paper .reader-chapter {
    margin-bottom: 2.4em;
    scroll-margin-top: 84px;
}

.reader-paper .reader-chapter:last-of-type {
    margin-bottom: 0;
}

.reader-paper p {
    margin: 0 0 1em;
    text-align: justify;
    hyphens: auto;
}

.reader-paper h1,
.reader-paper h2,
.reader-paper h3,
.reader-paper h4,
.reader-paper h5,
.reader-paper h6 {
    margin: 1.6em 0 0.7em;
    color: var(--reader-ink);
    font-family: var(--font-display);
    line-height: 1.2;
    text-align: left;
}

.reader-paper h1 {
    font-size: 2em;
}

.reader-paper h2 {
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--reader-rule);
    font-size: 1.6em;
}

.reader-paper h3 {
    font-size: 1.3em;
}

.reader-paper h4,
.reader-paper h5,
.reader-paper h6 {
    font-size: 1.1em;
}

.reader-paper blockquote {
    margin: 1.2em 0;
    padding: 0.2em 0 0.2em 1.1em;
    border-left: 2px solid var(--reader-accent);
    color: var(--reader-ink-muted);
    font-style: italic;
}

.reader-paper em,
.reader-paper i {
    font-style: italic;
}

.reader-paper strong,
.reader-paper b {
    color: var(--reader-ink);
    font-weight: 700;
}

.reader-paper a {
    color: var(--reader-accent-bright);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.reader-paper img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.4em auto;
    border-radius: 2px;
}

.reader-paper hr {
    margin: 1.8em 0;
    border: 0;
    border-top: 1px solid var(--reader-rule);
}

.reader-paper ul,
.reader-paper ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.reader-paper table {
    display: block;
    width: 100%;
    margin: 1.2em 0;
    overflow-x: auto;
    border-collapse: collapse;
}

.reader-paper th,
.reader-paper td {
    padding: 6px 10px;
    border: 1px solid var(--reader-rule);
    text-align: left;
}

.reader-paper pre {
    overflow-x: auto;
    padding: 12px;
    border: 1px solid var(--reader-rule);
    background: var(--reader-paper-2);
    font-size: 0.82em;
}

.reader-paper code {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.86em;
}

.reader-paper .reader-poem {
    margin: 0 0 1em;
    padding-left: 1.2em;
    font-style: italic;
}

.reader-end {
    width: min(100%, var(--reader-width, 760px));
    margin: 26px auto 0;
}

.reader-end-card {
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid var(--reader-rule);
    border-radius: 4px;
    background: var(--reader-paper-bg);
    color: var(--reader-ink);
    text-align: center;
}

.reader-end-card h2 {
    margin: 6px 0 10px;
    color: var(--reader-ink);
    font-size: 1.5rem;
}

.reader-end-lead {
    max-width: 560px;
    margin: 0 auto 18px;
    color: var(--reader-ink-muted);
    font-size: 0.88rem;
}

.reader-end-lead a {
    color: var(--reader-accent-bright);
    text-decoration: underline;
}

.reader-end-actions,
.reader-end-link {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.reader-end-link select {
    width: min(340px, 100%);
    background: var(--reader-paper-2);
    border-color: var(--reader-rule);
    color: var(--reader-ink);
}

.reader-end-note {
    margin: 16px 0 0;
    color: var(--reader-ink-muted);
    font-size: 0.72rem;
}

.reader-settings {
    position: fixed;
    z-index: 80;
    top: 76px;
    right: clamp(10px, 2vw, 24px);
    display: flex;
    width: min(340px, calc(100% - 20px));
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--reader-rule);
    border-radius: 4px;
    background: var(--reader-panel-bg);
    color: var(--reader-ink);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.reader-settings[hidden] {
    display: none;
}

.reader-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reader-settings-head .eyebrow {
    margin: 0;
    color: var(--reader-accent);
}

.reader-settings-close {
    width: 28px;
    height: 28px;
    border: 1px solid var(--reader-rule);
    border-radius: 50%;
    background: transparent;
    color: var(--reader-ink-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.reader-settings-close:hover {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
}

.reader-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reader-setting-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    color: var(--reader-ink-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.reader-setting-label output {
    color: var(--reader-ink);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.reader-setting input[type="range"] {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--reader-accent);
}

.reader-theme-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.reader-theme-option {
    padding: 8px 6px;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
}

.reader-theme-option:hover {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
}

.reader-theme-option.is-active {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
    background: rgba(201, 164, 92, 0.14);
}

.reader-settings-note {
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--reader-rule);
    color: var(--reader-ink-muted);
    font-size: 0.7rem;
    line-height: 1.5;
}

.reader-overlay {
    display: none;
}

.reader-overlay[hidden] {
    display: none;
}

@media (max-width: 960px) {
    .reader-bar {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px;
    }

    .reader-bar-button-label {
        display: none;
    }

    .reader-bar-button {
        padding: 7px 9px;
    }

    .reader-bar-chapter {
        display: none;
    }

    .reader-viewport {
        grid-template-columns: minmax(0, 1fr);
    }

    .reader-toc {
        position: fixed;
        z-index: 75;
        top: 64px;
        bottom: 0;
        left: 0;
        width: min(320px, calc(100% - 48px));
        height: auto;
        transform: translateX(-102%);
        transition: transform 0.22s ease;
        box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
    }

    .reader-toc-open .reader-toc {
        transform: translateX(0);
    }

    .reader-overlay {
        position: fixed;
        z-index: 70;
        inset: 64px 0 0;
        display: block;
        background: rgba(0, 0, 0, 0.55);
    }

    .reader-main {
        padding-top: 22px;
    }

    .reader-paper p {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .reader-upload-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .reader-card {
        grid-template-columns: 70px minmax(0, 1fr);
        gap: 14px;
    }

    .reader-card-cover {
        width: 70px;
    }

    .reader-bar {
        min-height: 58px;
    }

    .reader-bar-back span:last-child {
        display: none;
    }

    .reader-viewport {
        padding-top: 58px;
    }

    .reader-toc {
        top: 58px;
    }

    .reader-overlay {
        inset: 58px 0 0;
    }

    .reader-percent {
        min-width: 38px;
        font-size: 0.9rem;
    }

    .reader-paper {
        padding: 22px 16px;
    }

    .reader-paper p {
        text-align: left;
    }
}

@media (max-width: 780px) {
    /* Меню на телефоне переносится на новую строку вместо горизонтальной прокрутки. */
    .main-nav {
        flex-wrap: wrap;
        overflow: visible;
        row-gap: 2px;
    }
}

/* Reader 2.0: темы, постраничный режим, закладки и настройки */

.reader-body {
    --reader-bar-height: 64px;
    --reader-page-gap: 48px;
}

.reader-theme-night {
    --accent-rgb: 143, 163, 184;
    --reader-chrome: rgba(4, 5, 7, 0.97);
    --reader-chrome-ink: #d9d8d1;
    --reader-chrome-muted: #858783;
    --reader-chrome-line: #1f2328;
    --reader-paper-bg: #07090b;
    --reader-paper-2: #0d1114;
    --reader-ink: #d6d5ce;
    --reader-ink-muted: #91948f;
    --reader-accent: #8fa3b8;
    --reader-accent-bright: #c1d0df;
    --reader-rule: #20262c;
    --reader-panel-bg: #0a0d10;
    --reader-stage: #020304;
}

.reader-theme-imperial {
    --accent-rgb: 200, 120, 92;
    --reader-chrome: rgba(23, 10, 9, 0.97);
    --reader-chrome-ink: #f3dfcb;
    --reader-chrome-muted: #ba9a86;
    --reader-chrome-line: #4a2924;
    --reader-paper-bg: #1a100d;
    --reader-paper-2: #241512;
    --reader-ink: #f0dfcd;
    --reader-ink-muted: #bea290;
    --reader-accent: #c8785c;
    --reader-accent-bright: #e9a382;
    --reader-rule: #4a2924;
    --reader-panel-bg: #1a100d;
    --reader-stage: #0d0706;
}

.reader-paper {
    font-family: var(--reader-font-family, 'PT Serif', Georgia, serif);
}

body.reader-font-serif .reader-paper {
    --reader-font-family: 'PT Serif', Georgia, serif;
}

body.reader-font-sans .reader-paper {
    --reader-font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

body.reader-font-classic .reader-paper {
    --reader-font-family: 'Cormorant Garamond', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
}

body.reader-align-left .reader-paper p {
    text-align: left;
    hyphens: none;
}

body.reader-align-justify .reader-paper p {
    text-align: justify;
    hyphens: auto;
}

body.reader-indent .reader-paper p {
    margin-bottom: 0.55em;
    text-indent: 1.4em;
}

body.reader-indent .reader-paper h1 + p,
body.reader-indent .reader-paper h2 + p,
body.reader-indent .reader-paper h3 + p,
body.reader-indent .reader-paper h4 + p,
body.reader-indent .reader-paper h5 + p,
body.reader-indent .reader-paper h6 + p,
body.reader-indent .reader-paper blockquote p,
body.reader-indent .reader-paper li p {
    text-indent: 0;
}

.reader-settings-note-inline {
    margin: 8px 0 0;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    line-height: 1.45;
}

/* Необязательный издательский стиль: только безопасные классы из книги. */
body.reader-publisher-styles .reader-paper .center,
body.reader-publisher-styles .reader-paper .centered,
body.reader-publisher-styles .reader-paper .text-center,
body.reader-publisher-styles .reader-paper .align-center,
body.reader-publisher-styles .reader-paper .title,
body.reader-publisher-styles .reader-paper .subtitle {
    text-align: center;
    text-indent: 0;
}

body.reader-publisher-styles .reader-paper .epigraph,
body.reader-publisher-styles .reader-paper .epigraph p {
    margin: 1.2em 0;
    padding-left: 1.2em;
    border-left: 2px solid var(--reader-accent);
    color: var(--reader-ink-muted);
    font-style: italic;
    text-align: left;
    text-indent: 0;
}

body.reader-publisher-styles .reader-paper .poem,
body.reader-publisher-styles .reader-paper .stanza,
body.reader-publisher-styles .reader-paper .verse {
    margin: 1em 0;
    padding-left: 1.2em;
    font-style: italic;
}

body.reader-publisher-styles .reader-paper .no-indent,
body.reader-publisher-styles .reader-paper .first {
    text-indent: 0;
}

body.reader-publisher-styles .reader-paper .scene-break,
body.reader-publisher-styles .reader-paper .separator {
    margin: 1.6em 0;
    color: var(--reader-accent);
    letter-spacing: 0.5em;
    text-align: center;
    text-indent: 0;
}

body.reader-publisher-styles .reader-paper .small,
body.reader-publisher-styles .reader-paper .footnote,
body.reader-publisher-styles .reader-paper .note {
    font-size: 0.85em;
}

body.reader-publisher-styles .reader-paper .blockquote,
body.reader-publisher-styles .reader-paper .quote {
    margin: 1.2em 0;
    padding-left: 1.2em;
    border-left: 2px solid var(--reader-accent);
}

.reader-paper p {
    orphans: 2;
    widows: 2;
}

.reader-paper img,
.reader-paper h2,
.reader-paper h3,
.reader-paper blockquote {
    break-inside: avoid;
    page-break-inside: avoid;
}

.reader-bar {
    transition: transform 0.22s ease;
}

.reader-app.reader-bar-hidden .reader-bar {
    transform: translateY(-105%);
}

.reader-app.reader-chrome-hidden .reader-bar {
    transform: translateY(-105%);
}

.reader-app.reader-chrome-hidden .reader-page-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
}

.reader-save-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.reader-save-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(125, 154, 99, 0.45);
}

.reader-save-state[data-state="saving"] .reader-save-dot {
    background: var(--reader-accent);
    box-shadow: 0 0 8px rgba(201, 164, 92, 0.45);
    animation: reader-save-pulse 0.9s ease-in-out infinite alternate;
}

.reader-save-state[data-state="error"] {
    color: #d1897e;
}

.reader-save-state[data-state="error"] .reader-save-dot {
    background: var(--red);
    box-shadow: 0 0 8px rgba(180, 90, 79, 0.45);
}

@keyframes reader-save-pulse {
    from {
        opacity: 0.45;
    }

    to {
        opacity: 1;
    }
}

.reader-bar-button.is-active {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
    background: rgba(var(--accent-rgb), 0.1);
}

.reader-bar-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.reader-bar-progress {
    position: absolute;
    right: 0;
    bottom: -3px;
    left: 0;
    display: block;
    width: 100%;
    height: 6px;
    padding: 0;
    border: 0;
    background: var(--reader-chrome-line);
    cursor: pointer;
}

.reader-bar-progress::after {
    position: absolute;
    inset: -8px 0;
    content: "";
}

.reader-bar-progress:focus-visible {
    outline: 2px solid var(--reader-accent);
    outline-offset: 1px;
}

.reader-bar-progress .reader-progress-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
    background: linear-gradient(90deg, var(--reader-accent), var(--reader-accent-bright));
    transition: width 0.2s ease;
}

.reader-bar-progress .reader-progress-tick {
    position: absolute;
    top: 0;
    display: block;
    width: 1px;
    height: 4px;
    background: var(--reader-chrome-line);
    transform: translateX(-0.5px);
}

.reader-bar-progress .reader-progress-thumb {
    position: absolute;
    top: 50%;
    display: block;
    width: 11px;
    height: 11px;
    margin-left: -5.5px;
    border: 1px solid var(--reader-chrome);
    border-radius: 50%;
    background: var(--reader-accent-bright);
    box-shadow: 0 0 10px rgba(233, 206, 140, 0.5);
    transform: translateY(-50%);
    transition: left 0.2s ease;
}

.reader-bar-progress .reader-seek-tooltip {
    position: absolute;
    right: auto;
    bottom: 16px;
    left: 0;
    display: block;
    height: auto;
    padding: 4px 7px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: var(--reader-chrome);
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.reader-bar-progress .reader-seek-tooltip.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Оглавление и закладки */

.reader-toc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.reader-toc-head .eyebrow {
    margin-bottom: 4px;
    color: var(--reader-accent);
}

.reader-toc-close {
    display: none;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 50%;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-size: 0.75rem;
    cursor: pointer;
}

.reader-toc-close:hover {
    border-color: var(--reader-accent);
    color: var(--reader-chrome-ink);
}

.reader-toc-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
}

.reader-toc-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 6px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-family: var(--font-body);
    font-size: 0.66rem;
    font-weight: 700;
    cursor: pointer;
}

.reader-toc-tab:hover {
    color: var(--reader-chrome-ink);
}

.reader-toc-tab.is-active {
    border-color: var(--reader-chrome-line);
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--reader-accent-bright);
}

@media (max-width: 600px) {
    .reader-toc-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.reader-toc-count {
    display: inline-grid;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    place-items: center;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--reader-accent-bright);
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
}

.reader-toc-panel {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.reader-toc-panel[hidden] {
    display: none;
}

.reader-toc-search {
    position: relative;
    display: block;
}

.reader-toc-search input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--reader-chrome-ink);
    font-size: 0.76rem;
}

.reader-toc-search input::placeholder {
    color: var(--reader-chrome-muted);
}

.reader-toc-search input:focus {
    outline: none;
    border-color: var(--reader-accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.reader-search-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--reader-chrome-muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.reader-search-controls > div {
    display: flex;
    gap: 5px;
}

.reader-search-controls button {
    display: grid;
    width: 34px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-ink);
    cursor: pointer;
}

.reader-search-controls button:hover:not(:disabled) {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
}

.reader-search-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.reader-search-results {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reader-search-result {
    display: grid;
    gap: 3px;
    padding: 7px 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.13);
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}

.reader-search-result:hover,
.reader-search-result.is-current {
    border-color: var(--reader-accent);
    background: rgba(var(--accent-rgb), 0.08);
}

.reader-search-result-chapter {
    overflow: hidden;
    color: var(--reader-accent);
    font-size: 0.66rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-search-result-snippet {
    color: var(--reader-chrome-muted);
    font-size: 0.7rem;
    line-height: 1.4;
}

.reader-search-result-snippet mark {
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.28);
    color: var(--reader-chrome-ink);
}

::highlight(reader-search) {
    background-color: rgba(var(--accent-rgb), 0.22);
    color: inherit;
}

::highlight(reader-search-current) {
    background-color: rgba(var(--accent-rgb), 0.45);
    color: inherit;
    text-decoration: underline;
}

.reader-search-hint {
    margin: 0;
    color: var(--reader-chrome-muted);
    font-size: 0.66rem;
    line-height: 1.45;
}

.reader-search-hint.is-warning {
    color: var(--reader-accent-bright);
}

.reader-search-hit {
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.32);
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--reader-accent-bright);
    text-underline-offset: 2px;
}

.reader-search-hit.is-current {
    outline: 2px solid var(--reader-accent-bright);
    outline-offset: 1px;
}

.reader-toc-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}

.reader-toc-link[hidden] {
    display: none;
}

.reader-toc-empty,
.reader-bookmark-empty {
    margin: 14px 4px;
    color: var(--reader-chrome-muted);
    font-size: 0.74rem;
    line-height: 1.5;
    text-align: center;
}

.reader-toc-empty[hidden],
.reader-bookmark-empty[hidden] {
    display: none;
}

.reader-toc-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--reader-chrome-line);
    color: var(--reader-chrome-muted);
    font-size: 0.66rem;
}

.reader-toc-chapter-time {
    margin: 6px 0 0;
    color: var(--reader-accent);
    font-size: 0.66rem;
}

.reader-bookmark-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reader-bookmark {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: start;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.13);
}

.reader-bookmark:hover {
    border-color: var(--reader-accent);
}

.reader-bookmark-open {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}

.reader-bookmark-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.reader-bookmark-percent {
    flex-shrink: 0;
    color: var(--reader-accent);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.reader-bookmark-title {
    overflow: hidden;
    font-size: 0.76rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-bookmark-excerpt {
    display: -webkit-box;
    overflow: hidden;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.reader-bookmark-remove {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-size: 0.65rem;
    cursor: pointer;
}

.reader-bookmark-remove:hover {
    border-color: var(--red);
    color: #d1897e;
}

.reader-annotation-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reader-annotation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: start;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.13);
}

.reader-annotation:hover {
    border-color: var(--reader-accent);
}

.reader-annotation-open {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}

.reader-annotation-head {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--reader-chrome-muted);
    font-size: 0.66rem;
}

.reader-annotation-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
}

.reader-annotation-dot-gold {
    background: #d8b46a;
}

.reader-annotation-dot-red {
    background: #cf6b61;
}

.reader-annotation-dot-green {
    background: #79a878;
}

.reader-annotation-dot-blue {
    background: #6d93bd;
}

.reader-annotation-quote {
    display: -webkit-box;
    overflow: hidden;
    color: var(--reader-chrome-ink);
    font-size: 0.72rem;
    font-style: italic;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.reader-annotation-note {
    display: -webkit-box;
    overflow: hidden;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.reader-annotation-remove {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--reader-chrome-muted);
    font-size: 0.65rem;
    cursor: pointer;
}

.reader-annotation-remove:hover {
    border-color: var(--red);
    color: #d1897e;
}

.reader-lore-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reader-lore-item {
    display: grid;
    gap: 3px;
    padding: 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.13);
    color: var(--reader-chrome-ink);
    text-decoration: none;
}

.reader-lore-item:hover {
    border-color: var(--reader-accent);
}

.reader-lore-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.reader-lore-head strong {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
}

.reader-lore-count {
    flex-shrink: 0;
    color: var(--reader-accent);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.reader-lore-meta {
    color: var(--reader-chrome-muted);
    font-size: 0.66rem;
}

.reader-lore-description {
    display: -webkit-box;
    overflow: hidden;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

::highlight(reader-hl-gold) {
    background-color: rgba(216, 180, 106, 0.35);
    color: inherit;
}

::highlight(reader-hl-red) {
    background-color: rgba(207, 107, 97, 0.32);
    color: inherit;
}

::highlight(reader-hl-green) {
    background-color: rgba(121, 168, 120, 0.32);
    color: inherit;
}

::highlight(reader-hl-blue) {
    background-color: rgba(109, 147, 189, 0.32);
    color: inherit;
}

.reader-selection {
    position: fixed;
    z-index: 90;
    display: grid;
    width: min(320px, calc(100vw - 24px));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 6px;
    background: var(--reader-chrome);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
}

.reader-selection[hidden] {
    display: none;
}

.reader-selection-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reader-selection-label {
    margin-right: auto;
    color: var(--reader-chrome-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reader-selection-color {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
}

.reader-selection-color-gold {
    background: #d8b46a;
}

.reader-selection-color-red {
    background: #cf6b61;
}

.reader-selection-color-green {
    background: #79a878;
}

.reader-selection-color-blue {
    background: #6d93bd;
}

.reader-selection-actions button {
    padding: 5px 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    font-size: 0.68rem;
    cursor: pointer;
}

.reader-selection-actions button:hover {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
}

.reader-note-editor {
    display: grid;
    gap: 6px;
}

.reader-note-editor[hidden] {
    display: none;
}

.reader-note-editor textarea {
    width: 100%;
    resize: vertical;
    padding: 7px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    font-size: 0.75rem;
}

.reader-note-actions {
    display: flex;
    gap: 6px;
}

.reader-footnote {
    position: fixed;
    z-index: 92;
    width: min(360px, calc(100vw - 24px));
    padding: 10px 12px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 6px;
    background: var(--reader-chrome);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
}

.reader-footnote[hidden] {
    display: none;
}

.reader-footnote-text {
    margin: 0 0 8px;
    color: var(--reader-chrome-ink);
    font-size: 0.78rem;
    line-height: 1.5;
}

.reader-footnote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reader-footnote-actions button {
    padding: 5px 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-family: var(--font-body);
    font-size: 0.68rem;
    cursor: pointer;
}

.reader-footnote-actions button:hover {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
}

.reader-lightbox {
    position: fixed;
    z-index: 95;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.reader-lightbox[hidden] {
    display: none;
}

.reader-lightbox img {
    max-width: min(100%, 1400px);
    max-height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    object-fit: contain;
    cursor: default;
}

.reader-lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

/* Свёрнутое оглавление на широком экране */

@media (min-width: 961px) {
    .reader-toc-collapsed .reader-viewport {
        grid-template-columns: 0 minmax(0, 1fr);
    }

    .reader-toc-collapsed .reader-toc {
        width: 0;
        padding: 0;
        border: 0;
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
}

/* Постраничный режим */

body.reader-mode-paged {
    overflow: hidden;
}

body.reader-mode-paged .reader-viewport {
    height: calc(100dvh - var(--reader-bar-height, 64px));
    min-height: 0;
    overflow: hidden;
}

body.reader-mode-paged .reader-main {
    display: flex;
    height: 100%;
    justify-content: center;
    overflow: hidden;
    padding: 10px clamp(8px, 2vw, 24px) 64px;
}

body.reader-mode-paged .reader-paper {
    width: min(100%, var(--reader-width, 760px));
    height: 100%;
    margin: 0;
    overflow: hidden;
    padding: clamp(14px, 2.2vw, 32px) clamp(14px, 2.6vw, 34px);
}

body.reader-mode-paged .reader-flow {
    height: 100%;
    column-fill: auto;
    column-gap: var(--reader-page-gap, 48px);
    will-change: transform;
}

body.reader-mode-paged .reader-end {
    width: 100%;
    margin: 2.2em 0 0;
}

.reader-page-nav {
    position: fixed;
    z-index: 62;
    bottom: 18px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 999px;
    background: var(--reader-chrome);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
    color: var(--reader-chrome-ink);
    transform: translateX(-50%);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reader-page-nav[hidden] {
    display: none;
}

.reader-page-button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--reader-chrome-line);
    border-radius: 50%;
    background: transparent;
    color: var(--reader-chrome-ink);
    font-size: 0.95rem;
    cursor: pointer;
}

.reader-page-button:hover:not(:disabled) {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
}

.reader-page-button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

.reader-page-position {
    min-width: 58px;
    color: var(--reader-chrome-muted);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.reader-page-separator {
    margin: 0 2px;
    opacity: 0.5;
}

/* Настройки Reader 2.0 */

.reader-settings {
    width: min(380px, calc(100% - 20px));
    max-height: calc(100dvh - 92px);
    gap: 14px;
}

.reader-settings-head h2 {
    margin: 2px 0 0;
    color: var(--reader-ink);
    font-size: 1.18rem;
}

.reader-settings-head .eyebrow {
    margin: 0;
}

.reader-settings-scroll {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
}

.reader-settings-group {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.reader-settings-label {
    margin: 0;
    color: var(--reader-ink-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.reader-theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.reader-theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}

.reader-theme-option:hover {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
}

.reader-theme-option:focus-visible,
.reader-toc-tab:focus-visible,
.reader-toc-link:focus-visible,
.reader-search-controls button:focus-visible,
.reader-mode-option:focus-visible,
.reader-choice:focus-visible {
    outline: 2px solid var(--reader-accent-bright);
    outline-offset: 2px;
}

.reader-theme-option.is-active {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
    background: rgba(var(--accent-rgb), 0.09);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.16);
}

.reader-theme-chip {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
}

.reader-theme-option-dark .reader-theme-chip {
    background: radial-gradient(circle at 50% 40%, #c9a45c 0 18%, #15120d 20% 100%);
}

.reader-theme-option-night .reader-theme-chip {
    background: radial-gradient(circle at 50% 40%, #8fa3b8 0 18%, #07090b 20% 100%);
}

.reader-theme-option-imperial .reader-theme-chip {
    background: radial-gradient(circle at 50% 40%, #e9a382 0 18%, #1a100d 20% 100%);
}

.reader-theme-option-sepia .reader-theme-chip {
    background: radial-gradient(circle at 50% 40%, #8a5a2b 0 18%, #e9dcc0 20% 100%);
}

.reader-theme-option-light .reader-theme-chip {
    background: radial-gradient(circle at 50% 40%, #8a5a2b 0 18%, #fbf9f4 20% 100%);
}

.reader-theme-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
}

.reader-theme-text strong {
    font-size: 0.72rem;
    font-weight: 700;
}

.reader-theme-text small {
    color: var(--reader-ink-muted);
    font-size: 0.6rem;
}

.reader-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.reader-choice-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.reader-choice {
    padding: 8px 6px;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.reader-font-choice {
    display: flex;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.reader-font-sample {
    color: var(--reader-ink);
    font-size: 1.1rem;
    line-height: 1;
}

.reader-font-choice-serif .reader-font-sample {
    font-family: 'PT Serif', Georgia, serif;
}

.reader-font-choice-sans .reader-font-sample {
    font-family: 'Manrope', system-ui, sans-serif;
}

.reader-font-choice-classic .reader-font-sample {
    font-family: 'Cormorant Garamond', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
    font-size: 1.25rem;
}

.reader-choice:hover {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
}

.reader-choice.is-active {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
    background: rgba(var(--accent-rgb), 0.1);
}

.reader-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reader-range-row input[type="range"] {
    flex: 1;
}

.reader-font-step {
    display: grid;
    width: 38px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-display);
    font-size: 0.78rem;
    cursor: pointer;
}

.reader-font-step.is-large {
    color: var(--reader-ink);
    font-size: 1rem;
}

.reader-font-step:hover {
    border-color: var(--reader-accent);
    color: var(--reader-accent-bright);
}

.reader-font-step:focus-visible {
    outline: 2px solid var(--reader-accent-bright);
    outline-offset: 2px;
}

.reader-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.reader-mode-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}

.reader-mode-option strong {
    color: var(--reader-ink);
    font-size: 0.75rem;
}

.reader-mode-option small {
    font-size: 0.62rem;
}

.reader-mode-option:hover {
    border-color: var(--reader-accent);
}

.reader-mode-option.is-active {
    border-color: var(--reader-accent);
    background: rgba(var(--accent-rgb), 0.1);
}

.reader-settings-reset {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--reader-rule);
    border-radius: 3px;
    background: transparent;
    color: var(--reader-ink-muted);
    font-family: var(--font-body);
    font-size: 0.7rem;
    cursor: pointer;
}

.reader-settings-reset:hover {
    border-color: var(--reader-accent);
    color: var(--reader-ink);
}

.reader-shortcuts {
    display: block;
    margin-top: 6px;
    color: var(--reader-ink-muted);
    font-size: 0.64rem;
    letter-spacing: 0.02em;
}

.reader-toast {
    position: fixed;
    z-index: 85;
    bottom: 76px;
    left: 50%;
    max-width: min(420px, calc(100% - 28px));
    padding: 10px 16px;
    border: 1px solid var(--reader-accent);
    border-radius: 999px;
    background: var(--reader-chrome);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
    color: var(--reader-chrome-ink);
    font-size: 0.78rem;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.reader-toast[hidden] {
    display: none;
}

.reader-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.reader-end {
    width: 100%;
    margin: 2.4em 0 0;
}

@media (max-width: 960px) {
    .reader-save-text {
        display: none;
    }

    .reader-save-state {
        padding: 5px;
    }

    .reader-toc-close {
        display: grid;
        place-items: center;
    }

    .reader-settings {
        max-height: calc(100dvh - 84px);
    }
}

@media (max-width: 640px) {
    .reader-body {
        --reader-bar-height: 58px;
    }

    .reader-action-optional {
        display: none;
    }

    .reader-page-nav {
        bottom: 12px;
    }

    .reader-page-button {
        width: 32px;
        height: 32px;
    }

    .reader-toast {
        bottom: 64px;
    }

    .reader-settings {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 82dvh;
        border-radius: 12px 12px 0 0;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    }

    body.reader-mode-paged .reader-main {
        padding: 6px 5px 70px;
    }

    body.reader-mode-paged .reader-paper {
        padding: 14px 13px;
    }

    .reader-theme-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Связь плана, библиотеки и личной читалки */

.reader-coverage {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 55% 130% at 0% 0%, rgba(var(--accent-rgb), 0.09), transparent 68%),
        linear-gradient(180deg, var(--panel-2), var(--panel));
}

.reader-coverage.is-compact {
    margin-bottom: 20px;
    padding: 15px 18px;
}

.reader-coverage-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 50%;
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.07);
}

.reader-coverage-body {
    min-width: 0;
}

.reader-coverage-body .eyebrow {
    margin: 0 0 3px;
}

.reader-coverage-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
}

.reader-coverage-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.reader-coverage-count {
    margin: 0;
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.reader-coverage-count span {
    color: var(--muted-2);
    font-size: 0.95rem;
}

.reader-coverage-text {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.reader-coverage-text strong {
    color: var(--text);
}

.reader-coverage-body .progress-track {
    margin-top: 9px;
}

.reader-coverage-actions {
    display: flex;
    max-width: 280px;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.reader-coverage-actions .button {
    text-align: center;
    white-space: normal;
}

.reader-coverage.is-compact .reader-coverage-head h2 {
    font-size: 1.05rem;
}

.reader-coverage.is-compact .reader-coverage-icon {
    width: 40px;
    height: 40px;
}

/* Компактное состояние файла в карточках и строках плана */

.book-reader-state,
.plan-reader-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
}

.reader-state-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.reader-state-link:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
    background: rgba(var(--accent-rgb), 0.06);
}

.reader-state-link.is-uploaded {
    border-color: rgba(125, 154, 99, 0.36);
    color: var(--green);
    background: var(--green-soft);
}

.reader-state-link.is-uploaded:hover {
    border-color: var(--green);
    color: var(--text);
}

.reader-state-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.reader-state-missing {
    color: var(--muted-2);
    font-size: 0.66rem;
}

.side-reader {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.side-reader .button {
    text-align: center;
}

.side-reader-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted-2);
    font-size: 0.7rem;
}

.side-reader-progress strong {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.side-reader-link {
    color: var(--muted);
    font-size: 0.72rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.side-reader-link:hover {
    color: var(--gold-bright);
}

@media (max-width: 900px) {
    .reader-coverage {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .reader-coverage-actions {
        grid-column: 1 / -1;
        max-width: none;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .reader-coverage {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .reader-coverage-icon {
        display: none;
    }

    .reader-coverage-actions .button {
        flex: 1;
    }

    .reader-coverage-count {
        font-size: 1.25rem;
    }
}

/* Загрузка книги из конкретной позиции плана */

.reader-upload-metadata-note {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: var(--radius);
    background: rgba(var(--accent-rgb), 0.055);
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.55;
}

.reader-upload-quota {
    margin: -4px 0 0;
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.4;
}

.stage-reader-count {
    display: block;
    margin-top: 6px;
    color: var(--muted-2);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: right;
    text-transform: uppercase;
}

/* Легальные источники книги */

.legal-sources {
    padding: 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel);
}

.legal-sources h2 {
    margin: 3px 0 8px;
    font-size: 1.15rem;
}

.legal-sources-note {
    margin: 0 0 12px;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.5;
}

.legal-sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legal-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--text);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.legal-source:hover {
    border-color: var(--gold-dim);
    background: rgba(var(--accent-rgb), 0.05);
}

.legal-source-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.legal-source-body strong {
    color: var(--text);
    font-size: 0.78rem;
}

.legal-source-body span {
    color: var(--muted-2);
    font-size: 0.68rem;
    line-height: 1.4;
}

.legal-source-arrow {
    flex-shrink: 0;
    color: var(--gold);
    font-size: 0.8rem;
}

/* Парадная главная: готический парадный разворот */

body.page-home {
    background-image:
        radial-gradient(ellipse 70% 45% at 50% -10%, rgba(var(--accent-rgb), 0.1), transparent 70%),
        linear-gradient(180deg, rgba(6, 5, 4, 0.55), rgba(6, 5, 4, 0.92) 45%, rgba(6, 5, 4, 0.98)),
        var(--wallpaper);
}

.page-home .site-header {
    border-top: 2px solid var(--gold-dim);
    border-bottom-color: rgba(var(--accent-rgb), 0.28);
    background: linear-gradient(180deg, rgba(8, 7, 6, 0.97), rgba(10, 9, 7, 0.9));
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.page-home .site-header::after {
    position: absolute;
    right: 0;
    bottom: -4px;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim) 24%, transparent 48%, var(--gold-dim) 76%, transparent);
    content: '';
    opacity: 0.55;
    pointer-events: none;
}

.page-home .header-inner {
    min-height: 78px;
}

.page-home .brand-mark {
    width: 46px;
    height: 46px;
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.035), inset 0 0 18px rgba(var(--accent-rgb), 0.08);
}

.page-home .brand-title {
    font-size: 1.38rem;
    letter-spacing: 0.11em;
}

.page-home .nav-link {
    padding: 10px 12px;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.home-hero {
    position: relative;
    display: flex;
    min-height: clamp(560px, 64vh, 760px);
    align-items: center;
    overflow: hidden;
    isolation: isolate;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
    background: #050403;
}

.home-hero-bg,
.home-hero-veil {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.home-hero-bg {
    z-index: 0;
    background-position: center right;
    background-repeat: no-repeat;
    background-size: cover;
    filter: brightness(1.18) contrast(1.1) saturate(1.04);
}



.home-hero-veil {
    z-index: 2;
    background:
        radial-gradient(ellipse 55% 70% at 74% 38%, transparent 0%, rgba(4, 3, 2, 0.05) 48%, rgba(4, 3, 2, 0.78) 100%),
        linear-gradient(90deg, rgba(4, 3, 2, 0.95) 0%, rgba(4, 3, 2, 0.68) 30%, rgba(4, 3, 2, 0.02) 58%, rgba(4, 3, 2, 0.24) 100%),
        linear-gradient(0deg, rgba(4, 3, 2, 0.94) 0%, transparent 27%, rgba(4, 3, 2, 0.08) 100%);
}

.home-hero::before,
.home-hero::after {
    position: absolute;
    z-index: 4;
    right: 0;
    left: 0;
    height: 1px;
    content: '';
    pointer-events: none;
}

.home-hero::before {
    top: 0;
    background: linear-gradient(90deg, transparent, var(--gold-dim) 25%, var(--gold-bright) 50%, var(--gold-dim) 75%, transparent);
    opacity: 0.5;
}

.home-hero::after {
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6) 50%, transparent);
}

.home-hero-aquila {
    position: absolute;
    z-index: 1;
    top: 7%;
    right: 31%;
    width: clamp(220px, 24vw, 430px);
    height: auto;
    opacity: 0.075;
    pointer-events: none;
    filter: sepia(0.25) saturate(0.8);
    transform: rotate(-5deg);
}

.home-hero-inner {
    position: relative;
    z-index: 3;
    display: flex;
    min-height: inherit;
    align-items: center;
    padding: clamp(34px, 4.6vw, 68px) 0;
}

.home-hero-copy {
    width: min(920px, 64%);
}

.home-hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0 0 16px;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.home-hero-eyebrow::before,
.home-hero-eyebrow::after {
    width: 44px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim));
    content: '';
}

.home-hero-eyebrow::after {
    background: linear-gradient(90deg, var(--gold-dim), transparent);
}

.home-hero-eyebrow::before {
    margin-left: 2px;
}

.home-hero-title {
    margin: 0;
    color: #e3c582;
    font-family: var(--font-display);
    font-size: clamp(3rem, 4.8vw, 5.5rem);
    overflow-wrap: normal;
    font-weight: 700;
    letter-spacing: 0.025em;
    line-height: 0.91;
    text-transform: uppercase;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.75));
    background: linear-gradient(180deg, #fff3c9 0%, #e9c77c 26%, #bd8640 46%, #f1d58f 62%, #c5964d 82%, #8c642d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-hero-title span {
    display: block;
    margin-bottom: 0.03em;
    font-size: 0.52em;
    letter-spacing: 0.16em;
    line-height: 1;
}

.home-hero-subtitle {
    margin: 20px 0 0;
    color: #dfc184;
    font-family: var(--font-display);
    font-size: clamp(1.18rem, 1.65vw, 1.62rem);
    font-weight: 600;
    letter-spacing: 0.035em;
    line-height: 1.25;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.home-hero-lead {
    max-width: 610px;
    margin: 18px 0 0;
    color: #c3b69f;
    font-size: clamp(0.92rem, 1.08vw, 1.02rem);
    line-height: 1.72;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}

.button-imperial {
    position: relative;
    min-width: 218px;
    padding: 16px 28px;
    border: 1px solid #e2bf78;
    border-radius: 1px;
    background: url('/images/generated/controls/button-gold.webp') center / 100% 100% no-repeat;
    box-shadow:
        0 0 0 3px rgba(9, 7, 5, 0.85),
        0 0 0 4px rgba(201, 164, 92, 0.4),
        0 14px 35px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 250, 225, 0.8);
    color: #1d1408;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.button-imperial::before {
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(73, 45, 13, 0.42);
    content: '';
    pointer-events: none;
}

.button-imperial:hover {
    background: url('/images/generated/controls/button-gold.webp') center / 100% 100% no-repeat;
    filter: brightness(1.1) saturate(1.05);
    color: #130d05;
    box-shadow:
        0 0 0 3px rgba(9, 7, 5, 0.85),
        0 0 0 4px rgba(233, 206, 140, 0.65),
        0 18px 45px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 252, 235, 0.9);
}

.button-imperial-arrow {
    margin-left: 5px;
    font-size: 1.35em;
    line-height: 0.7;
}

.home-hero-actions .button-ghost {
    min-height: 58px;
    border-color: rgba(var(--accent-rgb), 0.34);
    background: url('/images/generated/controls/button-dark.webp') center / 100% 100% no-repeat;
    color: #d4c5a8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.home-hero-stats {
    display: flex;
    gap: clamp(18px, 3vw, 38px);
    margin-top: 34px;
    padding-top: 16px;
    border-top: 1px solid rgba(var(--accent-rgb), 0.24);
}

.home-hero-stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: clamp(18px, 3vw, 38px);
    border-right: 1px solid rgba(var(--accent-rgb), 0.18);
}

.home-hero-stats div:last-child {
    padding-right: 0;
    border-right: 0;
}

.home-hero-stats strong {
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1;
}

.home-hero-stats span {
    color: var(--muted-2);
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-hero-credit {
    position: absolute;
    z-index: 4;
    right: clamp(16px, 2vw, 34px);
    top: 16px;
    color: rgba(201, 164, 92, 0.56);
    font-size: 0.6rem;
    letter-spacing: 0.05em;
}

/* Карточки-порталы под hero */

.home-features {
    position: relative;
    z-index: 5;
    margin-top: -54px;
    padding-bottom: 20px;
}

.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.home-feature {
    position: relative;
    display: grid;
    min-height: 190px;
    grid-template-columns: 38% minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    border-radius: 2px;
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 53%),
        linear-gradient(180deg, #17130d, #0e0c08);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
    color: var(--text);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.home-feature::before {
    position: absolute;
    inset: 4px;
    z-index: 3;
    background: url('/images/generated/frames/frame-card.png') center / 100% 100% no-repeat;
    content: '';
    opacity: 0.58;
    pointer-events: none;
    mix-blend-mode: screen;
}

.home-feature::after {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 3;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    content: '';
    opacity: 0.65;
    pointer-events: none;
}

.home-feature:hover {
    border-color: var(--gold);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(var(--accent-rgb), 0.18);
    color: var(--text);
    transform: translateY(-4px);
}

.home-feature-art {
    position: relative;
    display: block;
    overflow: hidden;
    background: #080705;
}

.home-feature-art::after {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 20%, rgba(20, 16, 11, 0.76) 100%),
        linear-gradient(0deg, rgba(8, 6, 4, 0.86), transparent 65%);
    content: '';
}

.home-feature-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) saturate(0.92) contrast(1.1) brightness(1.08);
    transition: transform 0.35s ease, filter 0.35s ease;
}

.home-feature:hover .home-feature-art img {
    filter: sepia(0.18) saturate(1) contrast(1.16) brightness(1);
    transform: scale(1.06);
}

.home-feature-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: 20px 15px 18px 10px;
}

.home-feature-body .eyebrow {
    margin-bottom: 7px;
    font-size: 0.57rem;
    letter-spacing: 0.13em;
}

.home-feature-title {
    color: #e8d3a4;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.06;
    text-transform: uppercase;
}

.home-feature-text {
    display: block;
    margin-top: 7px;
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.45;
}

.home-feature-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
    padding-top: 16px;
    color: var(--gold);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.home-feature-link span {
    font-size: 1.1rem;
    line-height: 0.6;
}

.home-feature:hover .home-feature-link {
    color: var(--gold-bright);
}

/* Три шага */

.home-steps {
    position: relative;
    background-image: linear-gradient(180deg, rgba(7, 6, 4, 0.82), rgba(7, 6, 4, 0.92)), url('/images/generated/textures/texture-stone.webp');
    background-size: cover, cover;
    margin-top: 30px;
    padding: clamp(24px, 3vw, 34px) clamp(16px, 3vw, 34px) 18px;
    border-top: 1px solid rgba(var(--accent-rgb), 0.3);
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
    background:
        linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.06) 50%, transparent),
        rgba(9, 8, 6, 0.55);
}

.home-steps-head {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

.home-steps-head h2 {
    margin: 0;
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.home-steps-wing {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim));
}

.home-steps-wing.is-right {
    background: linear-gradient(90deg, var(--gold-dim), transparent);
}

.home-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(16px, 4vw, 48px);
}

.home-step {
    display: flex;
    align-items: center;
    gap: 15px;
}

.home-step-number {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 1px solid var(--gold-dim);
    border-radius: 3px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12), transparent 70%);
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.05rem;
}

.home-step-icon {
    display: grid;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.48);
    border-radius: 50%;
    color: var(--gold-bright);
    background:
        radial-gradient(circle at 50% 35%, rgba(var(--accent-rgb), 0.18), transparent 68%),
        linear-gradient(150deg, var(--panel-2), var(--bg));
    box-shadow: inset 0 0 18px rgba(var(--accent-rgb), 0.08), 0 6px 18px rgba(0, 0, 0, 0.28);
}

.home-step-icon .lore-icon {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.36));
}

.home-step h3 {
    margin: 0 0 3px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.03em;
}

.home-step p {
    margin: 0;
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.45;
}

.home-steps-motto {
    margin: 23px 0 0;
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 0.82rem;
    letter-spacing: 0.24em;
    text-align: center;
    text-transform: uppercase;
}

/* Усиление внутренних страниц */

.page-banner {
    border-color: rgba(var(--accent-rgb), 0.34);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(var(--accent-rgb), 0.1);
}

.page-banner::after {
    position: absolute;
    inset: 6px;
    z-index: 3;
    background: url('/images/generated/frames/frame-grand.png') center / 100% 100% no-repeat;
    content: '';
    opacity: 0.3;
    pointer-events: none;
    mix-blend-mode: screen;
}

.page-banner h1 {
    text-shadow: 0 4px 22px rgba(0, 0, 0, 0.7);
}

.book-card {
    border-color: rgba(var(--accent-rgb), 0.2);
    box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), 0.05);
}

.book-card:hover {
    border-color: var(--gold);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.cta-band-imperial {
    border-color: rgba(var(--accent-rgb), 0.4);
    border-left: 3px solid var(--gold);
    background:
        radial-gradient(ellipse 50% 130% at 100% 50%, rgba(var(--accent-rgb), 0.14), transparent 70%),
        linear-gradient(100deg, rgba(var(--accent-rgb), 0.1), transparent 60%),
        var(--panel);
}

@media (max-width: 1120px) {
    .home-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-feature {
        min-height: 178px;
    }

    .home-hero-copy {
        width: min(680px, 66%);
    }
}

@media (max-width: 900px) {
    .home-hero {
        min-height: 650px;
    }

    .home-hero-copy {
        width: min(640px, 86%);
    }

    .home-features {
        margin-top: -30px;
    }

    .home-steps-grid {
        gap: 18px;
        grid-template-columns: 1fr;
    }

    .home-step {
        align-items: flex-start;
    }

    .home-step-icon {
        margin-top: 1px;
    }
}

@media (max-width: 760px) {
    .home-hero {
        min-height: 670px;
    }

    .home-hero-inner {
        padding: 42px 0 92px;
    }

    .home-hero-copy {
        width: 100%;
    }

    .home-hero-title {
        font-size: clamp(2.8rem, 12vw, 4.4rem);
    }

    .home-hero-title .home-hero-franchise {
        font-size: clamp(2.8rem, 12vw, 4.4rem);
        font-size: clamp(2rem, min(12vw, 10.5cqi), 4.4rem);
    }

    .home-hero-eyebrow {
        font-size: 0.62rem;
        letter-spacing: 0.17em;
    }

    .home-hero-eyebrow::before,
    .home-hero-eyebrow::after {
        width: 25px;
    }

    .home-hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .home-hero-actions .button {
        width: 100%;
    }

    .home-hero-stats {
        gap: 12px;
    }

    .home-hero-stats div {
        padding-right: 12px;
    }

    .home-hero-stats strong {
        font-size: 1.35rem;
    }

    .home-hero-stats span {
        font-size: 0.54rem;
    }

    .home-feature-grid,
    .home-steps-grid {
        grid-template-columns: 1fr;
    }

    .home-features {
        margin-top: 16px;
    }

    .home-feature {
        min-height: 150px;
        grid-template-columns: 33% minmax(0, 1fr);
    }

    .home-steps {
        margin-top: 10px;
    }

    .home-steps-head {
        gap: 8px;
    }

    .home-steps-head h2 {
        font-size: 0.78rem;
        letter-spacing: 0.08em;
        white-space: normal;
    }

    .home-step p {
        font-size: 0.74rem;
    }

    .home-steps-motto {
        font-size: 0.65rem;
        letter-spacing: 0.15em;
    }

    .page-home .nav-link {
        font-size: 0.62rem;
        letter-spacing: 0.06em;
    }
}


.header-crest {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    min-width: 176px;
    flex-direction: column;
    align-items: center;
    padding: 6px 20px 7px;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.11), transparent 48%),
        rgba(7, 6, 5, 0.72);
    box-shadow: inset 0 0 0 3px rgba(8, 7, 6, 0.86), 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--gold-bright);
    font-family: var(--font-display);
    line-height: 0.9;
    pointer-events: none;
    text-align: center;
    transform: translate(-50%, -50%);
}

.header-crest::before,
.header-crest::after {
    position: absolute;
    top: 50%;
    width: 32px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim));
    content: '';
}

.header-crest::before {
    right: 100%;
}

.header-crest::after {
    left: 100%;
    background: linear-gradient(90deg, var(--gold-dim), transparent);
}

.header-crest img {
    width: 34px;
    height: 34px;
    margin-bottom: 2px;
    object-fit: contain;
    opacity: 0.8;
}

.header-crest span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.header-crest strong {
    margin-top: 4px;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

@media (max-width: 1100px) {
    .header-crest {
        display: none;
    }
}


.home-guest-nav {
    margin-right: auto;
}

@media (max-width: 1280px) {
    .home-guest-nav {
        display: none;
    }
}

/* Редизайн с авторскими ассетами проекта */

:root {
    --radius: 6px;
    --font-display: 'Forum', 'Cormorant Garamond', 'PT Serif', Georgia, serif;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
}

body {
    background-image:
        linear-gradient(180deg, rgba(6, 5, 4, 0.82), rgba(6, 5, 4, 0.94) 58%, rgba(6, 5, 4, 0.97)),
        var(--wallpaper);
    background-position: center top, center top;
    background-repeat: no-repeat, repeat;
    background-size: cover, 760px 760px;
    background-attachment: fixed;
}

.site-header {
    border-bottom-color: rgba(var(--accent-rgb), 0.28);
    background: linear-gradient(180deg, rgba(12, 10, 7, 0.97), rgba(8, 7, 5, 0.91));
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.24);
}

.header-inner {
    min-height: 82px;
}

.brand {
    gap: 14px;
}

.brand-mark {
    width: 50px;
    height: 50px;
    overflow: hidden;
    border-color: rgba(var(--accent-rgb), 0.65);
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.15), rgba(4, 3, 2, 0.8) 68%);
    box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.11), inset 0 0 10px rgba(var(--accent-rgb), 0.12);
}

.brand-mark img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 7px rgba(var(--accent-rgb), 0.32));
}

.brand-title {
    font-size: 1.12rem;
    letter-spacing: 0.08em;
}

.brand-sub {
    margin-top: 4px;
    color: var(--gold-dim);
    letter-spacing: 0.16em;
}

.main-nav {
    gap: 4px;
}

.nav-link {
    position: relative;
    padding: 11px 12px;
    border-radius: 3px 3px 0 0;
    font-size: 0.77rem;
}

.nav-link.is-active::after {
    position: absolute;
    right: 12px;
    bottom: -1px;
    left: 12px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
    content: '';
}

.header-crest {
    min-width: 190px;
    padding: 5px 18px 6px;
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.13), transparent 60%),
        rgba(7, 6, 5, 0.86);
}

.header-crest img {
    width: 110px;
    height: 34px;
    object-fit: contain;
    opacity: 0.88;
}

.user-area {
    gap: 10px;
}

.user-name {
    color: var(--gold-bright);
    font-family: var(--font-display);
}

.home-hero {
    min-height: clamp(610px, 76vh, 900px);
    border-bottom-color: rgba(var(--accent-rgb), 0.42);
}

.home-hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 64% center;
    filter: brightness(0.86) contrast(1.08) saturate(0.92);
}

.home-hero-veil {
    background:
        radial-gradient(ellipse 44% 85% at 78% 45%, transparent 0%, rgba(4, 3, 2, 0.12) 55%, rgba(4, 3, 2, 0.55) 100%),
        linear-gradient(90deg, rgba(4, 3, 2, 0.98) 0%, rgba(4, 3, 2, 0.78) 34%, rgba(4, 3, 2, 0.15) 70%, rgba(4, 3, 2, 0.2) 100%),
        linear-gradient(0deg, rgba(4, 3, 2, 0.96), transparent 32%);
}

.home-hero-copy {
    width: min(820px, 62%);
    container-type: inline-size;
}

.home-hero-title {
    font-size: clamp(3.1rem, 5.2vw, 6rem);
    letter-spacing: 0.055em;
    line-height: 0.98;
}

.home-hero-title span {
    font-size: 0.35em;
    letter-spacing: 0.28em;
}

.home-hero-title .home-hero-franchise {
    max-width: 100%;
    font-size: clamp(3.1rem, 5.2vw, 6rem);
    font-size: clamp(3.1rem, min(5.2vw, 10.5cqi), 6rem);
    letter-spacing: inherit;
    line-height: 1.04;
}

.home-hero-subtitle {
    max-width: 690px;
    color: #ead39a;
    font-size: clamp(1.2rem, 1.7vw, 1.7rem);
}

.home-hero-lead {
    max-width: 580px;
    color: #d1c4ae;
}

.home-hero-aquila {
    right: 34%;
    width: clamp(180px, 20vw, 360px);
    opacity: 0.11;
}

.home-feature-grid {
    gap: 14px;
}

.home-feature {
    min-height: 210px;
    grid-template-columns: 42% minmax(0, 1fr);
    border-color: rgba(var(--accent-rgb), 0.3);
    background:
        linear-gradient(145deg, rgba(var(--accent-rgb), 0.08), transparent 58%),
        var(--panel);
}

.home-feature::before {
    inset: 3px;
    opacity: 0.28;
}

.home-feature-art img {
    filter: saturate(0.88) contrast(1.08) brightness(0.87);
}

.home-feature-body {
    padding: 21px 17px;
}

.home-feature-title {
    font-size: clamp(0.96rem, 1.2vw, 1.22rem);
    line-height: 1.2;
}

.home-feature-text {
    color: #b7ab95;
    font-size: 0.72rem;
}

.home-steps {
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    background:
        linear-gradient(180deg, rgba(9, 8, 6, 0.9), rgba(9, 8, 6, 0.96)),
        url('/images/generated/textures/texture-stone.webp') center / 520px repeat;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
}

.home-steps-head h2 {
    font-size: 1.16rem;
    letter-spacing: 0.1em;
}

.home-step-number {
    width: 38px;
    height: 38px;
    border-radius: 3px;
    transform: rotate(45deg);
}

.home-step-number::first-letter {
    transform: rotate(-45deg);
}

.home-step-icon {
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.07);
}

.lore-banner {
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    box-shadow: var(--shadow);
}

.lore-banner img {
    object-fit: cover;
}

.cta-band-imperial {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 210px;
    background: #0c0906;
}

.cta-band-art {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.68;
}

.cta-band-imperial::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgba(8, 6, 4, 0.96), rgba(8, 6, 4, 0.65) 55%, rgba(8, 6, 4, 0.28));
    content: '';
}

.page-section {
    padding-top: clamp(24px, 3.5vw, 46px);
}

.page-banner {
    min-height: clamp(300px, 31vw, 430px);
    border-color: rgba(var(--accent-rgb), 0.4);
    border-radius: 3px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(var(--accent-rgb), 0.14);
}

.page-banner > img {
    object-position: center 42%;
    filter: brightness(0.88) contrast(1.06) saturate(0.88);
}

.page-banner-scrim {
    background:
        linear-gradient(90deg, rgba(5, 4, 3, 0.96), rgba(5, 4, 3, 0.78) 42%, rgba(5, 4, 3, 0.22)),
        linear-gradient(0deg, rgba(5, 4, 3, 0.84), transparent 68%);
}

.page-banner::after {
    inset: 5px;
    opacity: 0.22;
}

.page-banner-content {
    max-width: min(820px, 76%);
    padding: clamp(28px, 4.5vw, 56px);
}

.page-banner h1 {
    font-size: clamp(2.15rem, 4.7vw, 3.65rem);
    letter-spacing: 0.055em;
}

.page-banner-lead {
    max-width: 660px;
    color: #d1c6b1;
    font-size: 0.96rem;
}

.page-banner-watermark {
    right: 8%;
    opacity: 0.16;
    filter: drop-shadow(0 0 24px rgba(var(--accent-rgb), 0.25));
}

.stat-card,
.progress-panel,
.rank-panel,
.rank-hero,
.next-book,
.profile-panel,
.achievement-card,
.reader-upload {
    border-color: rgba(var(--accent-rgb), 0.22);
    background-image:
        linear-gradient(145deg, rgba(20, 16, 11, 0.95), rgba(10, 9, 7, 0.96)),
        url('/images/generated/textures/texture-black-steel.webp');
    background-position: center, center;
    background-size: cover, 480px 480px;
}

.stat-card {
    min-height: 142px;
    padding: 22px 58px 20px 22px;
    box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), 0.08), 0 12px 32px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-color: rgba(var(--accent-rgb), 0.34);
    background: rgba(var(--accent-rgb), 0.06);
}

.stat-value {
    font-size: clamp(1.8rem, 2.6vw, 2.45rem);
}

.progress-panel,
.rank-panel,
.rank-hero,
.next-book,
.profile-panel,
.reader-upload {
    box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), 0.07), 0 16px 44px rgba(0, 0, 0, 0.22);
}

.rank-emblem img,
.rank-step-emblem {
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 4px 9px rgba(0, 0, 0, 0.5));
}

.rank-emblem img {
    width: 100%;
    height: 100%;
}

.rank-step-emblem {
    grid-row: span 4;
    width: 52px;
    height: 52px;
}

.rank-step {
    border-radius: 4px;
    background-image:
        linear-gradient(150deg, rgba(19, 15, 10, 0.94), rgba(10, 9, 7, 0.98)),
        url('/images/generated/textures/texture-black-steel.webp');
    background-size: cover, 240px 240px;
}

.achievement-icon {
    position: relative;
    width: 78px;
    height: 78px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.achievement-icon-frame,
.achievement-icon-art {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.achievement-icon-frame {
    opacity: 0.75;
}

.achievement-icon-art {
    inset: 17%;
    width: 66%;
    height: 66%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.achievement-card.is-locked .achievement-icon-art {
    filter: grayscale(0.85) brightness(0.62);
}

.achievement-card.is-unlocked .achievement-icon {
    filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.2));
}

.achievement-card {
    align-items: flex-start;
    padding: 18px;
    border-radius: 4px;
}

.achievement-card.is-unlocked {
    border-color: rgba(var(--accent-rgb), 0.35);
}

.status-option-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}

.status-dot {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.plan-stage {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-color: rgba(var(--accent-rgb), 0.28);
    background: var(--bg-soft);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.plan-stage-art {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.21;
    filter: saturate(0.78) contrast(1.08);
}

.plan-stage::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgba(8, 7, 5, 0.76), rgba(8, 7, 5, 0.9) 62%, rgba(8, 7, 5, 0.76));
    content: '';
}

.plan-stage-head {
    background: linear-gradient(100deg, rgba(var(--accent-rgb), 0.1), rgba(7, 6, 4, 0.68) 72%);
}

.stage-index {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 700;
}

.stage-emblem {
    display: block;
    width: 66px;
    height: 66px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55));
}

.stage-nav-link {
    border-radius: 4px;
    background-image:
        linear-gradient(145deg, rgba(20, 16, 11, 0.92), rgba(10, 9, 7, 0.96)),
        url('/images/generated/textures/texture-black-steel.webp');
    background-size: cover, 220px 220px;
}

.lore-promo-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 42%;
}

.reader-upload {
    background-image:
        linear-gradient(90deg, rgba(12, 10, 7, 0.97), rgba(12, 10, 7, 0.83) 62%, rgba(12, 10, 7, 0.52)),
        url('/images/generated/reader/upload.webp');
    background-position: center, right center;
    background-size: cover;
}

.reader-card-cover-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reader-card-cover-placeholder {
    overflow: hidden;
}

.reader-bar-button img {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(var(--accent-rgb), 0.24));
}

.reader-mode-option img {
    display: block;
    width: 44px;
    height: 44px;
    margin: 0 auto 8px;
    object-fit: contain;
}

.reader-theme-option-dark .reader-theme-chip { background-image: url('/images/generated/reader/theme-dark.webp'); }
.reader-theme-option-night .reader-theme-chip { background-image: url('/images/generated/reader/theme-night.webp'); }
.reader-theme-option-imperial .reader-theme-chip { background-image: url('/images/generated/reader/theme-imperial.webp'); }
.reader-theme-option-sepia .reader-theme-chip { background-image: url('/images/generated/reader/theme-sepia.webp'); }
.reader-theme-option-light .reader-theme-chip { background-image: url('/images/generated/reader/theme-light.webp'); }

.reader-theme-chip {
    position: relative;
    overflow: hidden;
    background-position: center;
    background-size: cover;
}

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

.reader-theme-auto-chip {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0907 0 49%, #fbf9f4 51% 100%);
}

.reader-theme-dark .reader-app {
    background-image: linear-gradient(rgba(7, 6, 5, 0.58), rgba(7, 6, 5, 0.68)), url('/images/generated/reader/theme-dark.webp');
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.reader-theme-night .reader-app {
    background-image: linear-gradient(rgba(3, 5, 8, 0.62), rgba(3, 5, 8, 0.72)), url('/images/generated/reader/theme-night.webp');
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.reader-theme-imperial .reader-app {
    background-image: linear-gradient(rgba(12, 6, 7, 0.62), rgba(12, 6, 7, 0.72)), url('/images/generated/reader/theme-imperial.webp');
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.reader-theme-sepia .reader-app {
    background-image: linear-gradient(rgba(35, 25, 14, 0.35), rgba(35, 25, 14, 0.45)), url('/images/generated/reader/theme-sepia.webp');
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.reader-theme-light .reader-app {
    background-image: linear-gradient(rgba(224, 216, 198, 0.35), rgba(224, 216, 198, 0.48)), url('/images/generated/reader/theme-light.webp');
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.reader-theme-dark .reader-paper { background-image: url('/images/generated/reader/paper-dark.webp'); }
.reader-theme-night .reader-paper { background-image: url('/images/generated/reader/paper-night.webp'); }
.reader-theme-imperial .reader-paper { background-image: url('/images/generated/reader/paper-imperial.webp'); }

/* Редизайн фракционных тем: различаются не только акценты, но и ритм, фактура и геометрия. */
body.allegiance-loyalist {
    --gold: #c7a65e;
    --gold-bright: #f0d99c;
    --gold-dim: #806b3f;
    --accent-rgb: 199, 166, 94;
    --line: #393322;
    --line-soft: #292519;
}

body.allegiance-loyalist .site-header {
    border-bottom-color: rgba(199, 166, 94, 0.34);
    background-image: linear-gradient(90deg, rgba(199, 166, 94, 0.045), transparent 36%, rgba(199, 166, 94, 0.025));
}

body.allegiance-loyalist .page-banner,
body.allegiance-loyalist .stat-card,
body.allegiance-loyalist .progress-panel,
body.allegiance-loyalist .rank-panel,
body.allegiance-loyalist .book-card {
    border-top-color: rgba(199, 166, 94, 0.62);
}

body.allegiance-traitor {
    --gold: #d15b50;
    --gold-bright: #ffad91;
    --gold-dim: #813932;
    --accent-rgb: 209, 91, 80;
    --line: #432628;
    --line-soft: #2b1a1c;
    --font-display: 'Forum', 'Cormorant Garamond', Georgia, serif;
}

body.allegiance-traitor .site-header {
    border-bottom-color: rgba(209, 91, 80, 0.5);
    background-image: linear-gradient(90deg, rgba(160, 37, 43, 0.12), transparent 40%, rgba(94, 37, 98, 0.09));
}

body.allegiance-traitor .page-banner,
body.allegiance-traitor .stat-card,
body.allegiance-traitor .progress-panel,
body.allegiance-traitor .rank-panel,
body.allegiance-traitor .book-card {
    border-radius: 0 12px 0 12px;
    border-top-color: rgba(209, 91, 80, 0.76);
    box-shadow: 0 18px 50px rgba(73, 10, 24, 0.19), inset 0 1px rgba(255, 153, 120, 0.06);
}

body.allegiance-traitor .button {
    border-radius: 0 8px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.075em;
}

body.allegiance-traitor .nav-link.is-active {
    box-shadow: inset 0 -2px var(--gold);
}

body.allegiance-traitor h1,
body.allegiance-traitor h2,
body.allegiance-traitor h3 {
    text-shadow: 0 0 24px rgba(192, 57, 62, 0.14);
}

body.reader-body.allegiance-loyalist {
    --reader-faction-accent: #c7a65e;
}

body.reader-body.allegiance-traitor {
    --reader-faction-accent: #d15b50;
}

body.reader-body .reader-bar {
    border-bottom-color: color-mix(in srgb, var(--reader-faction-accent) 45%, transparent);
}

body.reader-body .reader-bar-button:hover,
body.reader-body .reader-bar-back:hover,
body.reader-body .reader-percent {
    color: var(--reader-faction-accent);
}

.page-banner-placeholder,
.timeline-hero-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--gold);
    background:
        radial-gradient(ellipse at 75% 35%, rgba(var(--accent-rgb), 0.24), transparent 35%),
        repeating-linear-gradient(135deg, transparent 0 17px, rgba(var(--accent-rgb), 0.035) 18px 19px),
        linear-gradient(115deg, var(--panel-2), var(--bg) 72%);
}

.page-banner-placeholder::before,
.timeline-hero-placeholder::before {
    position: absolute;
    width: min(54vw, 500px);
    aspect-ratio: 1;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    content: '';
    transform: rotate(45deg);
}

.page-banner-placeholder svg,
.timeline-hero-placeholder svg {
    position: relative;
    z-index: 1;
    width: min(38vw, 260px);
    height: auto;
    opacity: 0.24;
}

.page-banner:has(.page-banner-placeholder) .page-banner-scrim,
.timeline-hero:has(.timeline-hero-placeholder) .timeline-hero-scrim {
    background: linear-gradient(90deg, rgba(6, 5, 4, 0.94), rgba(6, 5, 4, 0.28)), linear-gradient(0deg, rgba(6, 5, 4, 0.85), transparent 78%);
}
.reader-theme-sepia .reader-paper { background-image: url('/images/generated/reader/paper-sepia.webp'); }
.reader-theme-light .reader-paper { background-image: url('/images/generated/reader/paper-light.webp'); }

.reader-paper {
    background-position: center;
    background-repeat: repeat;
    background-size: 400px 500px;
}

.auth-aside {
    position: relative;
    min-height: 390px;
    padding: clamp(24px, 4vw, 44px);
    overflow: hidden;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: var(--radius);
    background-image:
        linear-gradient(90deg, rgba(10, 8, 6, 0.9), rgba(10, 8, 6, 0.6)),
        url('/images/generated/sections/auth-gate.webp');
    background-position: center;
    background-size: cover;
    box-shadow: var(--shadow);
}

.error-page {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 72vh;
}

.error-art {
    position: absolute;
    inset: 5% 0;
    z-index: -2;
    width: 100%;
    height: 90%;
    object-fit: cover;
    opacity: 0.42;
    mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent), linear-gradient(0deg, transparent, #000 15%, #000 85%, transparent);
}

.error-page::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse, transparent, var(--bg) 76%);
    content: '';
}

.empty-state {
    position: relative;
    overflow: hidden;
    border-color: rgba(var(--accent-rgb), 0.24);
    background:
        linear-gradient(160deg, rgba(12, 10, 7, 0.84), rgba(12, 10, 7, 0.96)),
        url('/images/generated/textures/texture-black-steel.webp') center / 480px repeat;
}

.empty-state-art {
    display: block;
    width: min(280px, 72%);
    max-height: 160px;
    margin: 0 auto 16px;
    object-fit: cover;
    opacity: 0.88;
    mask-image: linear-gradient(180deg, #000 70%, transparent);
}

@media (max-width: 1050px) {
    .header-inner {
        min-height: 76px;
    }

    .home-feature-grid {
        gap: 12px;
    }
}

@media (max-width: 760px) {
    body {
        background-size: cover, 520px 520px;
        background-attachment: scroll;
    }

    .home-hero {
        min-height: 690px;
    }

    .home-hero-bg {
        object-position: 61% center;
    }

    .home-hero-veil {
        background:
            linear-gradient(90deg, rgba(4, 3, 2, 0.9), rgba(4, 3, 2, 0.48)),
            linear-gradient(0deg, rgba(4, 3, 2, 0.96), transparent 62%);
    }

    .home-hero-copy {
        width: 100%;
    }

    .home-feature-grid {
        grid-template-columns: 1fr;
    }

    .home-feature {
        min-height: 170px;
    }

    .page-banner {
        min-height: 360px;
    }

    .page-banner-content {
        max-width: 100%;
        padding: 26px 22px 32px;
    }

    .page-banner-watermark {
        right: -2%;
        opacity: 0.1;
    }

    .stage-index {
        gap: 0;
    }

    .stage-emblem {
        width: 48px;
        height: 48px;
    }

    .rank-step-emblem {
        width: 42px;
        height: 42px;
    }

    .achievement-icon {
        width: 62px;
        height: 62px;
    }

    .achievement-card {
        gap: 10px;
        padding: 13px;
    }

    .reader-paper {
        background-size: auto 100%;
    }
}

@media (max-width: 560px) {
    .header-inner {
        min-height: 68px;
        gap: 8px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .brand-mark img {
        width: 34px;
        height: 34px;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-sub {
        font-size: 0.58rem;
    }

    .user-meta {
        display: none;
    }

    .home-hero {
        min-height: 620px;
    }

    .home-hero-title {
        font-size: clamp(2.5rem, 12vw, 3.9rem);
    }

    .home-hero-stats {
        justify-content: space-between;
    }

    .home-hero-stats div {
        padding-right: 9px;
    }

    .home-hero-stats span {
        font-size: 0.48rem;
        letter-spacing: 0.04em;
    }

    .cta-band-art {
        object-position: 62% center;
        opacity: 0.45;
    }

    .page-banner {
        min-height: 330px;
    }

    .page-banner-credit {
        right: 10px;
        bottom: 8px;
    }

    .page-banner-actions {
        gap: 8px;
    }

    .rank-hero {
        gap: 14px;
        padding: 18px;
    }

    .rank-emblem-large {
        width: 70px;
        height: 70px;
    }

    .rank-ladder {
        grid-template-columns: 1fr;
    }

    .rank-step-emblem {
        width: 48px;
        height: 48px;
    }
}

.home-step-number {
    transform: none;
}

.plan-stage-head {
    grid-template-columns: 82px minmax(0, 1fr) auto;
}

.plan-stage-head > *,
.plan-rows {
    position: relative;
    z-index: 1;
}

.level-legend-item img {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    object-fit: contain;
}

.achievement-mini-icon img {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.reader-end-card {
    background-image:
        linear-gradient(110deg, rgba(10, 8, 6, 0.96), rgba(10, 8, 6, 0.78)),
        url('/images/generated/reader/complete.webp');
    background-position: center, right center;
    background-size: cover;
}

.stage-preview {
    position: relative;
    isolation: isolate;
    padding: clamp(20px, 3vw, 34px);
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    background: linear-gradient(180deg, rgba(8, 7, 5, 0.86), rgba(8, 7, 5, 0.96));
}

.stage-preview::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgba(8, 7, 5, 0.92), rgba(8, 7, 5, 0.64)), url('/images/generated/home/route-banner.webp') center / cover;
    content: '';
    opacity: 0.5;
}

.site-footer {
    background-image:
        linear-gradient(rgba(8, 7, 5, 0.94), rgba(8, 7, 5, 0.96)),
        url('/images/generated/textures/texture-black-steel.webp');
    background-size: cover, 420px 420px;
}

@media (max-width: 780px) {
    .plan-stage-head {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .plan-stage-head .stage-progress {
        grid-column: 2;
    }
}

/* UI-аудит: единая ширина чтения, опорные размеры текста и предсказуемая шапка. */
:root {
    --layout-max: 1480px;
    --layout-gutter: clamp(32px, 6vw, 96px);
}

html {
    scroll-padding-top: 110px;
    text-size-adjust: 100%;
}

body {
    line-height: 1.6;
}

.container {
    width: min(calc(100% - var(--layout-gutter)), var(--layout-max));
}

.section {
    padding-block: clamp(40px, 5vw, 72px);
}

.page-section {
    padding-block: clamp(28px, 4vw, 56px) 72px;
}

.section-heading-inline > div,
.section-heading-inline > .section-heading-copy {
    min-width: 0;
}

.section-heading-inline h2,
.page-banner h1,
.home-hero-title {
    text-wrap: balance;
}

.section-lead,
.page-lead,
.page-banner-lead {
    max-width: min(68ch, 100%);
    line-height: 1.65;
}

.eyebrow {
    font-size: clamp(0.7rem, 0.67rem + 0.12vw, 0.78rem);
    letter-spacing: 0.13em;
}

.brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.series-kicker,
.stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.065em;
}

.stage-tile-count,
.stage-tile-level {
    font-size: 0.7rem;
    letter-spacing: 0.035em;
}

.home-hero-stats span,
.home-hero-credit,
.page-banner-credit,
.timeline-hero-credit {
    font-size: 0.7rem;
    letter-spacing: 0.035em;
}

.home-hero-title {
    letter-spacing: 0.025em;
    line-height: 1.04;
}

.home-hero-title span {
    letter-spacing: 0.17em;
}

.page-banner h1 {
    letter-spacing: 0.025em;
    line-height: 1.12;
}

.book-grid {
    gap: clamp(12px, 1.6vw, 22px);
}

.book-card {
    height: 100%;
    padding: clamp(16px, 1.6vw, 24px);
}

.button {
    min-height: 44px;
}

.button-small {
    min-height: 40px;
}

.nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.logout-label-compact {
    display: none;
}

.status-option {
    min-height: 40px;
}

.header-inner-auth {
    min-height: auto;
    flex-wrap: wrap;
    row-gap: 0;
    padding-top: 12px;
}

.header-inner-auth > .brand,
.header-inner-auth > .user-area {
    flex: 0 0 auto;
}

.header-inner-auth > .user-area {
    margin-left: auto;
}

.header-inner-auth > .main-nav {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    justify-content: center;
    gap: clamp(6px, 1.2vw, 18px);
    margin-top: 10px;
    padding: 8px 0 0;
    border-top: 1px solid var(--line-soft);
}

.header-inner-auth .nav-link {
    flex: 0 0 auto;
    padding: 9px clamp(8px, 1vw, 14px);
    border-radius: 2px 2px 0 0;
    font-size: 0.74rem;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.header-inner-auth .nav-link.is-active {
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.12), transparent);
}

@media (max-width: 1180px) {
    .header-inner-auth {
        padding-top: 10px;
    }

    .header-inner-auth > .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--gold-dim) transparent;
    }

    .header-inner-auth > .main-nav::-webkit-scrollbar {
        height: 4px;
    }

    .header-inner-auth > .main-nav::-webkit-scrollbar-thumb {
        border-radius: 4px;
        background: var(--gold-dim);
    }

    .header-inner-auth .nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 780px) {
    .header-inner-auth {
        column-gap: 12px;
        row-gap: 0;
    }

    .header-inner-auth > .main-nav {
        flex: 0 0 100%;
        padding-top: 6px;
    }

    .header-inner-auth > .user-area {
        gap: 8px;
    }
}

@media (max-width: 560px) {
    .header-inner-auth {
        column-gap: 8px;
    }

    .header-inner-auth > .brand {
        flex: 1 1 auto;
        gap: 8px;
    }

    .header-inner-auth .brand-mark {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }

    .header-inner-auth .brand-mark img {
        width: 30px;
        height: 30px;
    }

    .header-inner-auth .brand-title {
        overflow: hidden;
        font-size: 0.86rem;
        letter-spacing: 0.035em;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-inner-auth .brand-sub {
        display: none;
    }

    .header-inner-auth .logout-label-wide {
        display: none;
    }

    .header-inner-auth .logout-label-compact {
        display: inline;
    }

    .header-inner-auth .user-area .button-small {
        min-height: 36px;
        padding-inline: 10px;
    }

    .header-inner-auth .settings-link {
        width: 32px;
        height: 32px;
    }

    .header-inner-auth .nav-link {
        padding-inline: 10px;
        font-size: 0.72rem;
    }
}

/* Гостевая шапка не участвует в auth-навигации и сохраняет свой макет. */
@media (max-width: 1180px) {
    .header-inner:not(.header-inner-auth) {
        flex-wrap: wrap;
        column-gap: 16px;
        row-gap: 8px;
        padding-block: 10px;
    }

    .header-inner:not(.header-inner-auth) > .brand {
        min-width: 0;
    }

    .header-inner:not(.header-inner-auth) > .main-nav {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
        overflow-x: auto;
        border-top: 1px solid var(--line-soft);
        padding-top: 6px;
        scrollbar-width: none;
    }

    .header-inner:not(.header-inner-auth) > .main-nav::-webkit-scrollbar {
        display: none;
    }

    .header-inner:not(.header-inner-auth) .nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 780px) {
    :root {
        --layout-gutter: 28px;
    }

    .page-section {
        padding-bottom: 52px;
    }

    .page-banner-actions {
        align-items: stretch;
    }

    .page-banner-actions .button {
        flex: 1 1 10rem;
    }

    .home-hero-stats {
        gap: 12px;
    }

    .home-hero-stats div {
        min-width: 0;
        padding-right: 12px;
    }
}

@media (max-width: 560px) {
    .brand-sub {
        font-size: 0.68rem;
        letter-spacing: 0.07em;
    }

    .home-hero-title {
        font-size: clamp(2rem, 9.5vw, 3.3rem);
        letter-spacing: 0.01em;
    }

    .home-hero-title .home-hero-franchise {
        font-size: clamp(1.8rem, 9.5vw, 3.3rem);
        font-size: clamp(1.8rem, min(9.5vw, 10.5cqi), 3.3rem);
    }

    .home-hero-title span {
        letter-spacing: 0.12em;
    }

    .home-hero-stats span {
        font-size: 0.7rem;
        line-height: 1.35;
        letter-spacing: 0.015em;
        text-transform: none;
    }

    .page-banner-actions {
        flex-direction: column;
    }

    .page-banner-actions .button {
        width: 100%;
    }
}

.reader-match-badge.is-failed {
    border-color: rgba(180, 90, 79, 0.45);
    background: var(--red-soft);
    color: var(--red);
}

@media (max-width: 560px) {
    .achievement-stats {
        gap: 10px;
    }

    .stat-rank {
        font-size: 1rem;
    }

    .achievement-stats .stat-card {
        padding-right: 16px;
    }
}

/* Админ-панель */

.admin-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-heading h1 {
    margin: 2px 0 4px;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    text-transform: uppercase;
}

.admin-lead,
.admin-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.admin-badge,
.admin-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--gold);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.admin-nav-link {
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    text-decoration: none;
}

.admin-nav-link:hover,
.admin-nav-link:focus-visible,
.admin-nav-link.is-active {
    border-color: var(--line);
    background: var(--panel);
    color: var(--gold-bright);
}

.admin-flash {
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid rgba(125, 154, 99, 0.4);
    border-radius: var(--radius);
    background: var(--green-soft);
    color: var(--green);
}

.admin-flash.is-error {
    border-color: rgba(180, 90, 79, 0.4);
    background: var(--red-soft);
    color: var(--red);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.admin-stat {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-stat span {
    display: block;
    color: var(--muted-2);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-stat strong {
    display: block;
    margin-top: 6px;
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.4rem;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.admin-panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-panel-block {
    margin-bottom: 18px;
}

.admin-code {
    margin: 10px 0 0;
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--gold-bright);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.76rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--muted-2);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table small {
    color: var(--muted-2);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.admin-actions form {
    margin: 0;
}

.admin-danger {
    padding: 0;
    border: 0;
    background: none;
    color: var(--red);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.admin-filters input,
.admin-filters select {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text);
}

.admin-form {
    display: grid;
    gap: 14px;
    max-width: 980px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.admin-form > label,
.admin-form-grid > label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.75rem;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
}

.admin-form textarea {
    resize: vertical;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-fieldset {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
}

.admin-fieldset legend {
    padding: 0 6px;
    color: var(--gold);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.admin-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.admin-check {
    display: flex !important;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-check input {
    width: auto;
}

.admin-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 18px;
    margin: 0 0 12px;
    font-size: 0.8rem;
}

.admin-dl dt {
    color: var(--muted-2);
}

.admin-dl dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 780px) {
    .admin-grid-2,
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-heading {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Оформление основного сайта: имперская антиква + индустриальный гротеск.
   Читалка сохраняет свои шрифты через body.reader-body. */
body.reader-body {
    --font-display: 'PT Serif', 'Times New Roman', Georgia, serif;
    --font-ui: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

body:not(.reader-body) .button,
body:not(.reader-body) .nav-link,
body:not(.reader-body) .eyebrow,
body:not(.reader-body) .field-label,
body:not(.reader-body) .stat-label,
body:not(.reader-body) .tag,
body:not(.reader-body) .filter-chip,
body:not(.reader-body) .status-badge,
body:not(.reader-body) .series-kicker,
body:not(.reader-body) .reader-match-badge,
body:not(.reader-body) .match-score,
body:not(.reader-body) .rating-caption,
body:not(.reader-body) .pagination-link,
body:not(.reader-body) .admin-nav-link,
body:not(.reader-body) .admin-tag,
body:not(.reader-body) .admin-stat span {
    font-family: var(--font-ui);
}

/* Режим Когитатора: фосфорный терминал, не зависит от стороны. */

.cogitator-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 18px;
    padding: 5px 18px;
    border-bottom: 1px solid var(--line);
    background: #020604;
    color: var(--gold-dim);
    font-family: var(--font-ui);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.cogitator-strip span::before {
    color: var(--gold);
    content: '// ';
}

.cogitator-blink {
    animation: cogitator-blink 1s steps(1) infinite;
}

@keyframes cogitator-blink {
    50% {
        opacity: 0;
    }
}

body.cogitator-mode {
    --bg: #020604;
    --bg-soft: #040b06;
    --panel: #061109;
    --panel-2: #08180d;
    --panel-3: #0b2012;
    --line: #1e4d2d;
    --line-soft: #12311d;
    --gold: #7df29a;
    --gold-bright: #c9ffd3;
    --gold-dim: #3f9b58;
    --accent-rgb: 125, 242, 154;
    --text: #c8f7d0;
    --muted: #79b98a;
    --muted-2: #4f8a60;
    --green: #7df29a;
    --red: #ff7b6b;
    --red-soft: rgba(255, 123, 107, 0.12);
    --blue: #7fd7ff;
    --purple: #c8a4ff;
    --radius: 0;
    --shadow: 0 0 24px rgba(125, 242, 154, 0.08);
    --font-display: 'PT Mono', 'Cascadia Code', Consolas, monospace;
    --font-ui: 'PT Mono', 'Cascadia Code', Consolas, monospace;
    --font-body: 'PT Mono', 'Cascadia Code', Consolas, monospace;
    background-image:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0, rgba(0, 0, 0, 0.22) 1px, transparent 1px, transparent 3px),
        linear-gradient(180deg, rgba(1, 8, 4, 0.9), rgba(1, 5, 3, 0.97) 60%, #010503),
        var(--wallpaper);
    background-position: center top, center top, center top;
    background-size: auto, auto, cover;
}

body.cogitator-mode::after {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0, rgba(0, 0, 0, 0.12) 1px, transparent 1px, transparent 4px);
    content: '';
}

body.cogitator-mode .page-glow {
    background:
        radial-gradient(ellipse 55% 40% at 50% 0%, rgba(125, 242, 154, 0.09), transparent 70%),
        radial-gradient(ellipse 45% 40% at 90% 100%, rgba(125, 242, 154, 0.04), transparent 70%);
}

body.cogitator-mode .site-header {
    border-bottom-color: var(--line);
    background: linear-gradient(180deg, rgba(2, 8, 4, 0.98), rgba(1, 5, 3, 0.94));
    box-shadow: 0 0 30px rgba(125, 242, 154, 0.06);
}

body.cogitator-mode .brand-mark {
    border-color: var(--line);
    border-radius: 0;
    background: #041008;
    box-shadow: inset 0 0 18px rgba(125, 242, 154, 0.08);
}

body.cogitator-mode .brand-mark img,
body.cogitator-mode .main-nav img {
    filter: grayscale(1) sepia(1) hue-rotate(55deg) saturate(1.5) brightness(0.9);
}

body.cogitator-mode .brand-title {
    color: var(--gold-bright);
    letter-spacing: 0.12em;
}

body.cogitator-mode .brand-sub {
    color: var(--muted-2);
    letter-spacing: 0.12em;
}

body.cogitator-mode .brand-sub::after {
    color: var(--gold-dim);
    content: ' // КОГИТАТОР';
}

body.cogitator-mode .main-nav {
    counter-reset: cogitator-nav;
}

body.cogitator-mode .main-nav .nav-link {
    border: 1px solid transparent;
    border-radius: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.cogitator-mode .main-nav .nav-link::before {
    margin-right: 6px;
    color: var(--muted-2);
    counter-increment: cogitator-nav;
    content: '0' counter(cogitator-nav);
    font-size: 0.66em;
}

body.cogitator-mode .main-nav .nav-link:hover,
body.cogitator-mode .main-nav .nav-link.is-active {
    border-color: var(--line);
    background: rgba(125, 242, 154, 0.07);
    color: var(--gold-bright);
}

body.cogitator-mode .main-nav .nav-link.is-active::after {
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--gold);
}

body.cogitator-mode .user-name {
    color: var(--gold-bright);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

body.cogitator-mode .user-role,
body.cogitator-mode .footer-motto {
    color: var(--muted-2);
}

body.cogitator-mode h1,
body.cogitator-mode h2,
body.cogitator-mode h3,
body.cogitator-mode h4,
body.cogitator-mode .brand-title {
    text-transform: uppercase;
    letter-spacing: 0.035em;
    text-shadow: 0 0 14px rgba(125, 242, 154, 0.14);
}

body.cogitator-mode .eyebrow {
    color: var(--gold);
    letter-spacing: 0.16em;
}

body.cogitator-mode .eyebrow::before {
    width: auto;
    height: auto;
    background: none;
    color: var(--gold);
    content: '▸';
}

body.cogitator-mode .tag::before {
    color: var(--gold-dim);
    content: '#';
}

body.cogitator-mode .button {
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(125, 242, 154, 0.035);
    color: var(--gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.cogitator-mode .button:hover,
body.cogitator-mode .button:focus-visible {
    border-color: var(--gold);
    background: rgba(125, 242, 154, 0.12);
    color: var(--gold-bright);
}

body.cogitator-mode .button-gold {
    border-color: var(--gold);
    background: rgba(125, 242, 154, 0.13);
    color: var(--gold-bright);
    box-shadow: inset 0 0 16px rgba(125, 242, 154, 0.08);
}

body.cogitator-mode .stat-card,
body.cogitator-mode .book-card,
body.cogitator-mode .page-banner,
body.cogitator-mode .profile-panel,
body.cogitator-mode .rank-panel,
body.cogitator-mode .admin-panel,
body.cogitator-mode .admin-table-wrap,
body.cogitator-mode .reader-continue,
body.cogitator-mode .reader-reading-stats,
body.cogitator-mode .reader-upload,
body.cogitator-mode .next-goal,
body.cogitator-mode .rank-hero {
    border-color: var(--line);
    border-radius: 0;
    background-color: var(--panel);
    box-shadow: inset 0 0 0 1px rgba(125, 242, 154, 0.03), 0 0 26px rgba(125, 242, 154, 0.04);
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

body.cogitator-mode .stat-card::before {
    color: var(--gold-dim);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    content: ':: ДАННЫЕ';
}

body.cogitator-mode .stat-value {
    color: var(--gold-bright);
    font-family: var(--font-display);
    text-shadow: 0 0 12px rgba(125, 242, 154, 0.2);
}

body.cogitator-mode .stat-label::before {
    content: '// ';
}

body.cogitator-mode .book-card-art img,
body.cogitator-mode .page-banner img,
body.cogitator-mode .character-portrait img,
body.cogitator-mode .event-art img,
body.cogitator-mode .home-hero-art img,
body.cogitator-mode .achievement-icon img {
    filter: grayscale(0.9) sepia(0.35) hue-rotate(55deg) saturate(1.25) brightness(0.82);
}

body.cogitator-mode .book-card-art-scrim {
    background: linear-gradient(180deg, transparent 30%, rgba(2, 8, 4, 0.88));
}

body.cogitator-mode .series-kicker {
    color: var(--gold);
    text-transform: uppercase;
}

body.cogitator-mode .progress-track,
body.cogitator-mode .rank-track,
body.cogitator-mode .achievement-track {
    border-radius: 0;
    background: #020604;
}

body.cogitator-mode .progress-fill,
body.cogitator-mode .rank-fill,
body.cogitator-mode .achievement-fill {
    border-radius: 0;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
    box-shadow: 0 0 12px rgba(125, 242, 154, 0.28);
}

body.cogitator-mode .site-footer {
    border-top-color: var(--line);
    background: rgba(1, 5, 3, 0.92);
}

body.cogitator-mode .toast {
    border-radius: 0;
    border-color: var(--line);
    background: #041008;
    color: var(--text);
    box-shadow: 0 0 22px rgba(125, 242, 154, 0.1);
}

body.cogitator-mode input,
body.cogitator-mode select,
body.cogitator-mode textarea {
    border-radius: 0;
    border-color: var(--line);
    background: #020704;
    color: var(--text);
}

body.cogitator-mode input:focus,
body.cogitator-mode select:focus,
body.cogitator-mode textarea:focus {
    border-color: var(--gold);
    outline: 1px solid var(--gold);
    outline-offset: 1px;
}

body.cogitator-mode .allegiance-option,
body.cogitator-mode .profile-interest-option {
    border-radius: 0;
}

body.cogitator-mode .cogitator-setting {
    border: 1px dashed var(--line);
    padding: 14px;
}

@media (max-width: 780px) {
    .cogitator-strip {
        justify-content: flex-start;
        font-size: 0.56rem;
    }
}

.voice-annotation {
    margin: 0 0 16px;
    color: var(--muted-2);
    font-family: var(--font-ui);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body.allegiance-traitor .voice-annotation {
    color: #b8746d;
}

body.cogitator-mode .voice-annotation {
    color: var(--gold);
    text-shadow: 0 0 8px rgba(125, 242, 154, 0.18);
}

.voice-prefix {
    display: inline-block;
    margin: 0 0 8px;
    padding: 3px 9px;
    border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent);
    border-radius: 999px;
    color: var(--gold);
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.2;
}

.voice-closer {
    display: block;
    margin: 8px 0 18px;
    color: var(--muted-2);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-style: italic;
    letter-spacing: 0.03em;
}

/* API для разработчиков */

.api-page {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.api-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.api-card-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted-2);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.api-card code {
    display: block;
    overflow-wrap: anywhere;
}

.api-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.api-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-section-head h2 {
    margin: 0 0 4px;
}

.api-section-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.api-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.api-panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.api-panel h3 {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.api-muted {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.api-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.api-table th,
.api-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

.api-table th {
    color: var(--muted-2);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.api-table tbody tr:last-child td {
    border-bottom: 0;
}

.api-method,
.api-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--gold);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.api-code {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--gold-bright);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.api-note {
    margin: 0;
    padding: 14px 16px;
    border-left: 3px solid var(--gold);
    background: rgba(var(--accent-rgb), 0.06);
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

@media (max-width: 860px) {
    .api-two-col {
        grid-template-columns: 1fr;
    }
}
