/* Цвета и основные параметры */

:root {
    color-scheme: light;

    --cover: #242320;
    --cover-deep: #181816;
    --paper: #f4eddf;
    --paper-light: #fbf7ef;
    --ink: #292720;
    --muted: #6a6255;
    --brass: #ad8d52;
    --line: #cabda5;
    --link: #665022;

    --success-bg: #e9eddf;
    --success-border: #778359;
    --error-bg: #f2e4d9;
    --error-border: #9a6345;

    --font-body: "Segoe UI", Arial, sans-serif;
    --font-heading: Georgia, "Times New Roman", serif;
}

/* Общая основа */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    padding: 36px 24px;
    background: var(--cover-deep);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
}

a {
    color: var(--link);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 3px solid var(--brass);
    outline-offset: 4px;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Переплёт */

.journal {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 12px 12px 24px;
    border: 1px solid #655537;
    background: var(--cover);
    box-shadow: 0 18px 60px rgb(0 0 0 / 35%);
    position: relative;
}

.journal::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 9px;
    border-left: 1px dashed #786440;
    pointer-events: none;
}

/* Шапка и навигация */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px 28px;
    padding: 22px 20px;
    color: var(--paper);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--paper);
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: bold;
    line-height: 1.2;
    text-decoration: none;
}

.site-brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 40px;
    border: 1px solid var(--brass);
    color: #d8be87;
    font-size: 23px;
}

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 22px;
    font-size: 14px;
}

.site-nav a {
    color: var(--paper);
    text-decoration: none;
}

.site-nav a:hover {
    color: #e0c58d;
    text-decoration: underline;
}

.site-nav .account-link {
    color: #e0c58d;
    overflow-wrap: anywhere;
}

.logout-form {
    margin: 0;
}

.site-nav .nav-button {
    min-height: 36px;
    padding: 5px 12px;
    border: 1px solid #857049;
    background: transparent;
    color: var(--paper);
    box-shadow: none;
}

.site-nav .nav-button:hover {
    border-color: #d8be87;
    background: #353129;
}

/* Светлая страница */

.journal-page {
    min-height: 65vh;
    padding: clamp(24px, 4vw, 52px);
    border: 1px solid var(--brass);
    outline: 1px solid var(--line);
    outline-offset: -7px;
    background: var(--paper);
    overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4,
legend {
    color: var(--ink);
    font-family: var(--font-heading);
    line-height: 1.25;
}

h1 {
    margin: 0 0 24px;
    font-size: clamp(30px, 4vw, 44px);
    letter-spacing: -0.025em;
}

h2 {
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--brass);
    font-size: 27px;
}

h3 {
    margin: 0 0 12px;
    font-size: 22px;
}

p {
    margin: 0 0 16px;
}

section {
    margin-top: 36px;
}

hr {
    margin: 28px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

small,
.text-muted {
    color: var(--muted);
}

/* Кнопки */

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid var(--cover);
    border-radius: 2px;
    background: var(--cover);
    color: var(--paper-light);
    font: 600 15px/1.4 var(--font-body);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: #403b31;
    color: var(--paper-light);
    text-decoration: none;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-secondary {
    border-color: #8b7959;
    background: transparent;
    color: var(--ink);
}

.button-secondary:hover {
    background: #e7dcc7;
    color: var(--ink);
}

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

/* Формы */

form {
    margin: 20px 0;
}

.form-field {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input,
select,
textarea {
    font: inherit;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #a99b83;
    border-radius: 2px;
    background: var(--paper-light);
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--link);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: var(--link);
    vertical-align: middle;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

fieldset {
    min-width: 0;
    margin: 24px 0;
    padding: 20px;
    border: 1px solid var(--line);
}

legend {
    padding: 0 10px;
    font-size: 22px;
    font-weight: bold;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

/* Сообщения */

[role="status"],
[role="alert"] {
    margin: 20px 0;
    padding: 14px 18px;
    border: 1px solid;
    border-left-width: 4px;
}

[role="status"] {
    border-color: var(--success-border);
    background: var(--success-bg);
}

[role="alert"] {
    border-color: var(--error-border);
    background: var(--error-bg);
}

/* Таблицы и списки свойств */

table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    border-bottom-color: var(--brass);
    background: #e9dfcd;
    font-weight: 600;
}

tbody tr:hover {
    background: rgb(173 141 82 / 7%);
}

.table-scroll {
    overflow-x: auto;
}

dl {
    margin: 20px 0;
}

dt {
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

dd {
    margin: 4px 0 0;
}

/* Общие блоки для следующих страниц */

.card {
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--paper-light);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}

.prose {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Подвал */

.site-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 20px 20px 8px;
    color: #d1c6b0;
    font-size: 13px;
}

.site-footer p {
    margin: 0;
}

.footer-motto {
    color: #bda67a;
    font-family: var(--font-heading);
    font-style: italic;
}

/* Переход к содержимому с клавиатуры */

.skip-link {
    position: absolute;
    top: -120px;
    left: 16px;
    z-index: 10;
    padding: 10px 16px;
    background: var(--paper-light);
    color: var(--ink);
}

.skip-link:focus {
    top: 12px;
}

/* Узкие экраны */

@media (max-width: 700px) {
    body {
        padding: 12px 8px;
    }

    .journal {
        padding: 0 6px 6px 12px;
    }

    .journal::before {
        left: 4px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 12px;
    }

    .site-nav {
        gap: 12px 18px;
    }

    .journal-page {
        padding: 26px 20px;
    }

    h2 {
        font-size: 24px;
    }

    th,
    td {
        padding: 10px 8px;
    }

    .site-footer {
        padding: 16px 12px 8px;
    }
}

/* Страница кампании */

.breadcrumbs {
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 14px;
}

.breadcrumbs span {
    margin-left: 6px;
}

.campaign-heading {
    padding: 8px 0 24px;
}

.eyebrow {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.campaign-heading h1 {
    margin-bottom: 16px;
}

.campaign-role {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.campaign-description {
    max-width: 75ch;
    margin-top: 20px;
}

.campaign-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 14px 0;
    border-top: 1px solid var(--brass);
    border-bottom: 1px solid var(--brass);
}

.campaign-sections a {
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.campaign-sections a:hover {
    text-decoration: underline;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--brass);
}

.section-heading h2 {
    margin: 0;
    padding: 0;
    border: 0;
}

.section-heading > a:not(.button) {
    font-size: 14px;
}

section[id] {
    scroll-margin-top: 24px;
}

/* Метки статусов */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid #b8a47d;
    border-radius: 3px;
    background: #eee3cb;
    color: #554523;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-available {
    border-color: #a0ab87;
    background: #e8ecdc;
    color: #3e4b2c;
}

.badge-completed {
    border-color: #b0a58e;
    background: #e9e4d8;
    color: #57503e;
}

.badge-muted {
    border-color: #bcb5aa;
    background: #e9e5de;
    color: #625d54;
}

/* Карточки встреч */

.meeting-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-top: 3px solid var(--brass);
}

.meeting-card h3 a {
    color: var(--ink);
    text-decoration: none;
}

.meeting-card h3 a:hover {
    text-decoration: underline;
}

.meeting-status {
    color: var(--muted);
    font-size: 14px;
}

.meeting-objective {
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.meeting-objective p {
    margin: 0;
}

.meeting-objective a {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: bold;
}

.field-caption {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.meeting-facts {
    margin: 0 0 24px;
}

.meeting-button {
    align-self: flex-start;
    margin-top: auto;
}

/* Задания */

.quest-list {
    display: grid;
    gap: 12px;
}

.quest-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brass);
    background: var(--paper-light);
}

.quest-card h3 {
    min-width: 0;
    margin: 0;
    font-size: 21px;
}

.quest-card h3 a {
    color: var(--ink);
    text-decoration: none;
}

.quest-card h3 a:hover {
    text-decoration: underline;
}

.quest-card .badge {
    flex-shrink: 0;
}

/* Таблица персонажей */

.character-table {
    min-width: 600px;
    margin-top: 0;
}

.character-table tbody th {
    border-bottom-color: var(--line);
    background: transparent;
}

.character-table tbody th a {
    font-family: var(--font-heading);
    font-size: 18px;
}

/* Пустые разделы */

.empty-state {
    padding: 28px;
    border: 1px dashed #b8a887;
    background: rgb(251 247 239 / 55%);
}

.empty-state h3 {
    font-size: 22px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

/* Приглашение */

.invitation-panel {
    padding: 26px;
    border: 1px solid var(--brass);
    background: #eae0cc;
}

.invitation-panel h2 {
    border-bottom-color: #b5a078;
}

.invite-code {
    display: inline-block;
    max-width: 100%;
    padding: 12px 16px;
    border: 1px dashed #a18b62;
    background: var(--paper-light);
    color: var(--ink);
    font-family: Consolas, "Courier New", monospace;
    font-size: 18px;
    overflow-wrap: anywhere;
    user-select: all;
}

@media (max-width: 700px) {
    .section-heading {
        align-items: flex-start;
    }

    .quest-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 16px;
    }

    .invitation-panel,
    .empty-state {
        padding: 20px;
    }
}

/* Страница игровой встречи */

.session-heading {
    margin-bottom: 24px;
}

.session-heading h1 {
    margin-bottom: 16px;
}

.session-state {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 12px;
    border-left: 3px solid var(--brass);
    background: #e9dfcb;
    font-weight: 600;
}

.session-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    border: 1px solid var(--line);
    background: var(--paper-light);
}

.session-summary > div {
    min-width: 0;
    padding: 20px;
}

.session-summary > div + div {
    border-left: 1px solid var(--line);
}

.session-summary dt {
    margin: 0 0 8px;
    font-size: 12px;
}

.session-summary dd {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 23px;
    font-weight: bold;
    line-height: 1.35;
}

.summary-separator {
    color: var(--muted);
    font-size: 16px;
    font-weight: normal;
}

/* Выбранное задание */

.selected-quest-panel {
    padding: 26px;
    border: 1px solid var(--brass);
    border-left-width: 4px;
    background: #eae0cc;
}

.selected-quest-panel h2 {
    margin-bottom: 14px;
    padding: 0;
    border: 0;
    font-size: 24px;
}

.selected-quest-panel p:last-child {
    margin-bottom: 0;
}

.selected-quest-link {
    font-family: var(--font-heading);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: bold;
    line-height: 1.3;
}

/* Запись и участники */

.session-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 24px;
    margin-top: 36px;
}

.session-panel {
    min-width: 0;
    margin-top: 0;
}

.session-panel > p:last-child {
    margin-bottom: 0;
}

.session-panel h2 {
    font-size: 24px;
}

.session-form {
    margin: 20px 0 0;
}

.session-form .form-hint {
    margin-bottom: 16px;
}

.participation-note {
    padding: 12px 16px;
    border-left: 3px solid var(--success-border);
    background: var(--success-bg);
}

.participant-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.participant-list li {
    padding: 14px 0;
}

.participant-list li + li {
    border-top: 1px solid var(--line);
}

.participant-list li:first-child {
    padding-top: 0;
}

.participant-list li:last-child {
    padding-bottom: 0;
}

.participant-player {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
}

.participant-character {
    font-family: var(--font-heading);
    font-size: 21px;
    font-weight: bold;
}

/* Варианты голосования */

.vote-options {
    margin-top: 24px;
    padding: 16px;
}

.vote-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    background: var(--paper-light);
}

.vote-option + .vote-option {
    margin-top: 10px;
}

.vote-option input[type="radio"] {
    margin: 0;
}

.vote-option label {
    margin: 0;
    cursor: pointer;
}

.vote-option:has(input:checked) {
    border-color: #8d7547;
    background: #eae0cb;
    box-shadow: inset 3px 0 0 var(--brass);
}

.vote-option:focus-within {
    border-color: var(--link);
}

.vote-description {
    font-size: 13px;
}

/* Результаты голосования */

.vote-results {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.vote-results li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 4px;
    border-bottom: 1px solid var(--line);
}

.vote-results li > a {
    min-width: 0;
    font-family: var(--font-heading);
    font-size: 21px;
    font-weight: bold;
}

.vote-count {
    flex-shrink: 0;
    min-width: 64px;
    text-align: center;
}

.vote-count .field-caption {
    margin-bottom: 0;
}

.vote-count strong {
    font-family: var(--font-heading);
    font-size: 27px;
    line-height: 1.2;
}

/* Действия ведущего */

.organizer-panel {
    padding: 26px;
    border: 1px solid #b9a681;
    background: #eee5d3;
}

.management-action + .management-action {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.management-action .session-form {
    max-width: 560px;
}

@media (max-width: 800px) {
    .session-columns {
        grid-template-columns: 1fr;
    }

    .session-summary {
        grid-template-columns: 1fr;
    }

    .session-summary > div + div {
        border-top: 1px solid var(--line);
        border-left: 0;
    }
}

@media (max-width: 700px) {
    .selected-quest-panel,
    .organizer-panel {
        padding: 20px;
    }
}

/* Карточки выбора задания */

.quest-voting {
    min-width: 0;
    margin: 24px 0 16px;
    padding: 0;
    border: 0;
}

.quest-voting legend {
    margin-bottom: 16px;
    padding: 0;
    font-size: 20px;
}

.quest-voting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
}

.quest-voting-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.quest-voting-card {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 180px;
    margin: 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--line);
    background: var(--paper-light);
    font-weight: normal;
    cursor: pointer;
}

.quest-voting-card:hover {
    border-color: var(--brass);
    background: #f1e7d4;
}

.quest-voting-card .eyebrow {
    display: block;
    margin-bottom: 16px;
}

.quest-voting-title {
    display: block;
    margin-bottom: 24px;
    color: var(--ink);
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: bold;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.quest-voting-indicator {
    display: block;
    margin-top: auto;
    color: var(--muted);
    font-size: 13px;
}

.quest-voting-selected {
    display: none;
}

.quest-voting-card:has(input:checked) {
    border-color: #8d7547;
    background: #eae0cb;
    box-shadow: inset 0 0 0 1px #8d7547;
}

.quest-voting-card:has(input:checked) .quest-voting-unselected {
    display: none;
}

.quest-voting-card:has(input:checked) .quest-voting-selected {
    display: inline;
    color: #59431c;
    font-weight: 700;
}

.quest-voting-card:has(input:focus-visible) {
    outline: 3px solid var(--brass);
    outline-offset: 4px;
}

/* Радиокнопка скрыта визуально, но доступна с клавиатуры */

.quest-voting-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.quest-voting-details {
    align-self: flex-start;
    margin: 12px 0 4px;
    font-size: 14px;
}

/* Журнал кампании с закладками */

.campaign-book {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 24px;
    min-width: 0;
}

.book-bookmarks {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 12px;
}

.book-bookmark {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 14px 16px;
    border: 1px solid #76613e;
    border-left: 4px solid var(--brass);
    border-radius: 2px 5px 5px 2px;
    background: var(--cover);
    color: var(--paper);
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: bold;
    line-height: 1.3;
    text-decoration: none;
    box-shadow: 2px 3px 0 rgb(0 0 0 / 10%);
}

.book-bookmark:hover {
    background: #3b352a;
    color: #ead4a4;
    text-decoration: none;
}

.book-bookmark[aria-current="page"] {
    border-color: #947746;
    background: #d9c59e;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%);
}

.bookmark-number {
    flex-shrink: 0;
    min-width: 22px;
    color: #c2a46a;
    font-size: 14px;
}

.book-bookmark[aria-current="page"] .bookmark-number {
    color: #6a522a;
}

.book-pages {
    min-width: 0;
}

.book-panel {
    margin: 0;
    min-width: 0;
}

.book-panel[hidden] {
    display: none;
}

.book-panel + .book-panel:not([hidden]) {
    margin-top: 36px;
}

.campaign-book.is-enhanced .book-panel {
    margin-top: 0;
}

.book-panel .campaign-heading {
    padding-top: 0;
    padding-bottom: 0;
}

.book-panel .campaign-heading + section {
    margin-top: 24px;
}

.book-panel .book-panel-title {
    font-size: clamp(28px, 3vw, 36px);
}

.campaign-notices:empty {
    display: none;
}

.campaign-notices [role="status"] {
    margin: 0 0 16px;
}

/* На ПК высота журнала ограничена окном.
   Эти правила действуют только после запуска JS на странице кампании. */

@media (min-width: 1000px) and (min-height: 650px) {
    body:has(.campaign-book.is-enhanced) {
        height: 100dvh;
        min-height: 0;
        padding: 20px 24px;
        overflow: hidden;
    }

    body:has(.campaign-book.is-enhanced) .journal {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 1440px;
        height: 100%;
        min-height: 0;
    }

    body:has(.campaign-book.is-enhanced) .site-header,
    body:has(.campaign-book.is-enhanced) .site-footer {
        flex-shrink: 0;
    }

    body:has(.campaign-book.is-enhanced) .journal-page {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
        padding: 24px;
        overflow: hidden;
    }

    body:has(.campaign-book.is-enhanced) .breadcrumbs {
        flex-shrink: 0;
        margin-bottom: 20px;
    }

    body:has(.campaign-book.is-enhanced) .campaign-notices {
        flex-shrink: 0;
        max-height: 25%;
        overflow-y: auto;
    }

    .campaign-book.is-enhanced {
        flex: 1;
        min-height: 0;
    }

    .campaign-book.is-enhanced .book-bookmarks {
        min-height: 0;
        padding-right: 6px;
        padding-bottom: 12px;
        overflow-y: auto;
    }

    .campaign-book.is-enhanced .book-pages {
        min-height: 0;
        padding: 8px 20px 20px 8px;
        overflow-y: auto;
        scrollbar-gutter: stable;
        scrollbar-width: thin;
        scrollbar-color: #a68c60 var(--paper);
    }
}

/* На небольших экранах закладки располагаются сверху. */

@media (max-width: 999px) {
    .campaign-book {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .book-bookmarks {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 0;
    }

    .book-bookmark {
        flex: 1 1 130px;
        justify-content: center;
        min-height: 48px;
        padding: 12px;
        border-left-width: 1px;
        border-bottom: 3px solid var(--brass);
        font-size: 17px;
    }

    .book-pages {
        overflow: visible;
    }
}

/* Обзор: сведения слева, встречи справа */

.overview-info {
    min-width: 0;
}

.overview-description {
    margin-top: 24px;
}

.overview-meta {
    margin-top: 32px;
}

.overview-invitation {
    margin-top: 20px;
}

.overview-invitation .invite-code {
    padding: 8px 12px;
    font-size: 16px;
}

.overview-meetings {
    min-width: 0;
}

/* Компоновка журнала на ПК */

@media (min-width: 1000px) and (min-height: 650px) {
    body:has(.campaign-book.is-enhanced) .journal-page {
        padding: 0;
    }

    body:has(.campaign-book.is-enhanced) .breadcrumbs {
        margin: 0;
        padding: 10px 24px;
        border-bottom: 1px solid var(--line);
    }

    body:has(.campaign-book.is-enhanced) .campaign-notices:not(:empty) {
        padding: 12px 24px 0;
    }

    .campaign-book.is-enhanced {
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 0;
    }

    .campaign-book.is-enhanced .book-bookmarks {
        gap: 12px;
        padding: 20px 0 20px 8px;
        border-right: 1px solid var(--brass);
        background: #e7dcc5;
    }

    .campaign-book.is-enhanced .book-bookmark {
        justify-content: center;
        min-height: 48px;
        padding: 12px 6px;
        border-radius: 2px 0 0 2px;
        font-size: 14px;
    }

    .campaign-book.is-enhanced .bookmark-number {
        display: none;
    }

    .campaign-book.is-enhanced .book-pages {
        padding: 28px;
    }

    .campaign-book.is-enhanced .campaign-overview:not([hidden]) {
        display: grid;
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
        gap: 32px;
        height: 100%;
        min-height: 0;
    }

    .campaign-book.is-enhanced:has(#overview:not([hidden])) .book-pages {
        overflow: hidden;
    }

    .campaign-overview .overview-info {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding-right: 20px;
        border-right: 1px solid var(--line);
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .campaign-overview .campaign-heading h1 {
        font-size: clamp(28px, 2.5vw, 40px);
    }

    .campaign-overview .overview-description {
        margin-bottom: 32px;
    }

    .campaign-overview .overview-meta {
        margin-top: auto;
        padding-top: 24px;
    }

    .campaign-overview .overview-meetings {
        min-height: 0;
        margin: 0;
        padding: 0 12px 12px 4px;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .overview-meetings .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .overview-meetings .meeting-card {
        padding: 18px;
    }

    .overview-meetings .meeting-card h3 {
        font-size: 21px;
    }

    .overview-meetings .meeting-button {
        width: 100%;
        padding-right: 10px;
        padding-left: 10px;
    }
}
/* Действия в заголовке встреч */

.meetings-heading-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
}

.meetings-heading-actions > a:not(.button) {
    font-size: 14px;
}

/* На ПК кампания занимает всё окно */

@media (min-width: 1000px) and (min-height: 650px) {
    body:has(.campaign-book.is-enhanced) {
        padding: 0;
    }

    body:has(.campaign-book.is-enhanced) .journal {
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    body:has(.campaign-book.is-enhanced) .journal::before {
        display: none;
    }

    body:has(.campaign-book.is-enhanced) .journal-page {
        border: 0;
        outline: none;
    }

    .campaign-book.is-enhanced {
        --bookmark-max-width: 180px;

        grid-template-columns:
            fit-content(var(--bookmark-max-width))
            minmax(0, 1fr);
    }

    .campaign-book.is-enhanced .book-bookmarks {
        min-width: 0;
        padding: 20px 0;
        overflow-x: hidden;
    }

    .campaign-book.is-enhanced .book-bookmark {
        justify-content: flex-start;
        min-width: 0;
        max-width: 100%;
        padding: 14px 18px;
    }

    .campaign-book.is-enhanced .book-bookmark > span:last-child {
        display: block;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
}
/* Более компактная общая шапка */

.site-header {
    padding-top: 16px;
    padding-bottom: 16px;
}

/* Подвал скрыт только на странице кампании */

body:has(.campaign-book) .site-footer {
    display: none;
}

/* Всплывающие уведомления кампании */

body:has(.campaign-book) .campaign-notices,
body:has(.campaign-book) .campaign-notices:not(:empty) {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;

    display: flex;
    flex-direction: column;
    gap: 12px;

    width: min(380px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    margin: 0;
    padding: 0;
    overflow-y: auto;

    pointer-events: none;
}

body:has(.campaign-book) .campaign-notices:empty {
    display: none;
}

.campaign-notices [role="status"],
.campaign-notices [role="alert"] {
    position: relative;
    flex-shrink: 0;
    margin: 0;
    padding: 18px 48px 18px 20px;
    box-shadow: 0 6px 24px rgb(0 0 0 / 20%);
    font-size: 14px;
    pointer-events: auto;
}

.campaign-notices .notice-close {
    position: absolute;
    top: 6px;
    right: 6px;

    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 0;

    background: transparent;
    color: var(--ink);
    font-size: 22px;
    font-weight: normal;
    line-height: 1;
}

.campaign-notices .notice-close:hover {
    background: rgb(0 0 0 / 8%);
    color: var(--ink);
}

@media (max-width: 700px) {
    body:has(.campaign-book) .campaign-notices {
        right: 16px;
        bottom: 16px;
        max-height: calc(100dvh - 32px);
    }
}

/* Лист персонажа */

body:has(.character-sheet) .journal {
    max-width: 1440px;
}

.character-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.character-heading > div {
    min-width: 0;
}

.character-heading h1 {
    margin-bottom: 12px;
}

.character-heading > .button {
    flex-shrink: 0;
}

.character-identity {
    margin-bottom: 0;
    color: var(--muted);
    font-family: var(--font-heading);
    font-size: 21px;
}

.character-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--brass);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.character-background-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 20px 0 28px;
}

.character-background-facts dt {
    margin-top: 0;
}

.character-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: start;
    gap: 28px;
}

.character-column {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.character-sheet .sheet-section {
    min-width: 0;
    margin-top: 24px;
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--paper-light);
}

.character-column > .sheet-section {
    margin-top: 0;
}

.sheet-section h2 {
    margin-bottom: 20px;
    font-size: 25px;
}

/* Характеристики и бой */

.ability-grid,
.combat-grid {
    display: grid;
    gap: 12px;
    margin: 0;
}

.ability-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.combat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ability-grid > div,
.combat-grid > div {
    min-width: 0;
    padding: 14px 8px;
    border: 1px solid var(--line);
    background: var(--paper);
    text-align: center;
}

.ability-grid dt,
.combat-grid dt {
    margin: 0 0 8px;
    font-size: 12px;
}

.ability-grid dd,
.combat-grid dd {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: bold;
    line-height: 1.2;
}

.combat-grid .hit-points {
    grid-column: 1 / -1;
    border-top: 3px solid var(--brass);
}

.hp-divider {
    margin: 0 6px;
    color: var(--muted);
    font-weight: normal;
}

/* Спасброски и передвижение */

.sheet-stat-list {
    margin: 0;
}

.sheet-stat-list > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
}

.sheet-stat-list > div + div {
    border-top: 1px solid var(--line);
}

.sheet-stat-list dt {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: normal;
}

.sheet-stat-list dd {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: bold;
    line-height: 1.3;
}

/* Текстовые поля существующего тега sheetField */

.sheet-text-fields {
    margin: 0;
}

.sheet-text-fields dt {
    margin-top: 20px;
    margin-bottom: 6px;
}

.sheet-text-fields dt:first-child {
    margin-top: 0;
}

.sheet-text-fields dd {
    margin-left: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Монеты */

.coin-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.coin-grid > div {
    min-width: 0;
    padding: 12px 6px;
    border: 1px solid var(--line);
    background: var(--paper);
    text-align: center;
}

.coin-grid dt {
    margin: 0 0 8px;
    font-size: 11px;
}

.coin-grid dd {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 21px;
    font-weight: bold;
    overflow-wrap: anywhere;
}

.character-bottom-actions {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

@media (max-width: 1000px) {
    .character-columns {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }
}

@media (max-width: 700px) {
    .character-sheet .sheet-section {
        padding: 18px;
    }

    .character-background-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .coin-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }

    .ability-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Верхняя строка листа */

.character-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 20px;
}

.character-topline .eyebrow {
    margin: 0;
}

.character-topline > a {
    font-size: 14px;
}

.character-heading {
    align-items: center;
}

.character-heading h1 {
    min-width: 0;
    margin: 0;
}

/* Класс и уровень слева, мировоззрение и титул справа */

.character-identity-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 28px;
    margin: 16px 0 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--brass);
}

.character-identity-row .character-background-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px 24px;
    margin: 0 0 0 auto;
    text-align: right;
}

.character-background-facts > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.character-background-facts dt {
    margin: 0;
    font-size: 13px;
}

.character-background-facts dd {
    margin: 0;
    font-size: 14px;
}

/* Сведения об игроке теперь находятся внизу листа */

.character-sheet > .character-context {
    margin-top: 32px;
}

@media (max-width: 700px) {
    .character-identity-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .character-identity-row .character-background-facts {
        justify-content: flex-start;
        margin-left: 0;
        text-align: left;
    }
}

/* Подразделы текстовых блоков листа персонажа */

.character-sheet .sheet-text-fields dt {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--link);
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: bold;
}

.character-sheet .sheet-text-fields dt:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.character-sheet .sheet-text-fields dd {
    margin-top: 8px;
}

/* Приветственная страница */

.welcome-hero {
    padding: 24px 0 40px;
    border-bottom: 1px solid var(--brass);
}

.welcome-hero h1 {
    max-width: 16ch;
    margin-bottom: 24px;
    font-size: clamp(40px, 6vw, 68px);
    line-height: 1.08;
}

.welcome-lead {
    max-width: 65ch;
    color: var(--muted);
    font-size: 19px;
    line-height: 1.75;
}

.welcome-hero .actions {
    margin-top: 28px;
}

.welcome-about-link {
    font-size: 15px;
}

.welcome-feature {
    border-top: 3px solid var(--brass);
}

.welcome-feature p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.welcome-how {
    padding: 28px;
    border: 1px solid var(--line);
    background: #eae0cc;
}

.welcome-steps {
    margin: 0;
    padding-left: 24px;
}

.welcome-steps li {
    padding-left: 8px;
}

.welcome-steps li + li {
    margin-top: 16px;
}

.welcome-steps li::marker {
    color: var(--link);
    font-family: var(--font-heading);
    font-weight: bold;
}

/* Страница о формате */

.about-page {
    max-width: 850px;
    margin: 0 auto;
}

.resource-list {
    display: grid;
    gap: 16px;
}

.resource-list .card {
    border-left: 3px solid var(--brass);
}

.resource-list .card p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

@media (max-width: 700px) {
    .welcome-hero {
        padding-top: 12px;
    }

    .welcome-lead {
        font-size: 17px;
    }

    .welcome-how {
        padding: 20px;
    }
}

/* Фоновый арт приветственной страницы */

body:has(.welcome-page) {
    background-color: var(--cover-deep);

    background-image:
        linear-gradient(rgb(0 0 0 / 30%), rgb(0 0 0 / 30%)),
        url("../images/welcome-background.jpg");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Список кампаний */

.campaign-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--brass);
}

.campaign-list-heading h1 {
    min-width: 0;
    margin: 0;
}

.campaign-list-heading .button {
    flex-shrink: 0;
}

.campaign-list {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.campaign-list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 26px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brass);
    background: var(--paper-light);
    color: var(--ink);
    text-decoration: none;
}

.campaign-list-card:hover {
    border-color: var(--brass);
    background: #eee4d1;
    text-decoration: none;
}

.campaign-list-name {
    min-width: 0;
    font-family: var(--font-heading);
    font-size: 27px;
    font-weight: bold;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.campaign-list-role {
    flex-shrink: 0;
    text-align: right;
}

.campaign-list-role .field-caption {
    margin-bottom: 5px;
}

.campaign-list-bottom {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
    .campaign-list-card {
        gap: 16px;
        padding: 18px;
    }

    .campaign-list-name {
        font-size: 22px;
    }
}

.campaign-join-form {
    max-width: 560px;
}

.invite-link-tools {
    margin-top: 20px;
}

.invite-link-tools > a {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14px;
}

.invite-link-tools input {
    font-size: 13px;
}

.invite-link-tools .form-hint {
    margin-top: 10px;
}

.invite-link-tools.invite-compact {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.invite-compact .invite-code {
    min-width: 0;
    max-width: 100%;
}

.invite-compact [data-copy-invite] {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
}

.invite-compact [data-copy-feedback] {
    flex-basis: 100%;
    margin: 0;
}

.invite-compact [data-copy-feedback]:empty {
    display: none;
}

.invite-compact [hidden] {
    display: none;
}

.book-panel:focus {
    outline: none;
}