:root {
    color-scheme: light;
    --bg: #f7efe6;
    --bg-soft: #f1e3d0;
    --surface: rgba(255, 249, 241, 0.92);
    --surface-strong: #fff8ef;
    --text: #3a2d29;
    --muted: #7c655c;
    --accent: #b86e49;
    --accent-strong: #8f4d2f;
    --accent-soft: #f2d6c4;
    --green: #6c8771;
    --gold: #c49349;
    --border: rgba(112, 82, 67, 0.14);
    --shadow: 0 20px 70px rgba(121, 81, 53, 0.12);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --container: 1180px;
    --reader-font-size: 19px;
    --font-heading: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --font-body: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
    --page-background:
        radial-gradient(circle at top left, rgba(255, 214, 182, 0.55), transparent 32%),
        radial-gradient(circle at top right, rgba(161, 192, 182, 0.34), transparent 26%),
        linear-gradient(180deg, #f9f1e8 0%, #f7efe6 45%, #f3e4d6 100%);
    --reader-background:
        radial-gradient(circle at top center, rgba(208, 224, 216, 0.38), transparent 34%),
        linear-gradient(180deg, #f9f4ee 0%, #f3ede6 100%);
    --page-backdrop-background:
        radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.34), transparent 16%),
        radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.22), transparent 12%),
        radial-gradient(circle at 84% 72%, rgba(255, 255, 255, 0.22), transparent 16%);
    --header-background: rgba(247, 239, 230, 0.74);
    --header-border: rgba(118, 87, 67, 0.08);
    --footer-background: rgba(255, 250, 244, 0.72);
    --nav-link-hover-background: rgba(255, 255, 255, 0.6);
    --button-secondary-background: rgba(255, 255, 255, 0.7);
    --button-secondary-border: rgba(149, 110, 88, 0.16);
    --button-ghost-background: transparent;
    --button-ghost-border: rgba(149, 110, 88, 0.16);
    --section-soft-background: linear-gradient(180deg, rgba(255, 249, 242, 0.48), rgba(255, 255, 255, 0));
    --hero-card-background: linear-gradient(150deg, rgba(255, 246, 236, 0.92), rgba(243, 226, 206, 0.85));
    --hero-card-soft-background: linear-gradient(150deg, rgba(239, 247, 242, 0.95), rgba(247, 239, 230, 0.88));
    --chip-background: rgba(255, 255, 255, 0.76);
    --chip-border: rgba(150, 118, 95, 0.12);
    --info-chip-background: rgba(255, 255, 255, 0.78);
    --info-chip-border: rgba(150, 118, 95, 0.12);
    --collection-card-surface: rgba(255, 250, 244, 0.92);
    --collection-card-blend-base: white;
    --collection-card-background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--collection-accent) 18%, var(--collection-card-blend-base)), transparent 26%),
        var(--collection-card-surface);
    --collection-card-border: var(--border);
    --collection-card-shadow: var(--shadow);
    --collection-card-accent-opacity: 0.28;
    --input-background: rgba(255, 255, 255, 0.9);
    --input-background-strong: rgba(255, 255, 255, 0.98);
    --input-border: rgba(145, 108, 83, 0.14);
    --input-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    --input-focus-border: rgba(184, 110, 73, 0.28);
    --input-focus-ring:
        0 0 0 4px rgba(184, 110, 73, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    --file-button-background: rgba(255, 255, 255, 0.82);
    --file-button-background-hover: rgba(255, 255, 255, 0.96);
    --action-button-background: rgba(255, 255, 255, 0.7);
    --action-button-background-hover: rgba(255, 255, 255, 0.92);
    --action-button-border: rgba(149, 110, 88, 0.16);
    --action-button-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    --tooltip-background: rgba(58, 45, 41, 0.88);
    --tooltip-text: #fff7f1;
    --reader-toolbar-background: rgba(255, 249, 241, 0.85);
    --reader-surface: rgba(255, 252, 247, 0.92);
    --reader-surface-focus: rgba(255, 255, 255, 0.98);
    --reader-divider: rgba(149, 110, 88, 0.14);
    --similar-card-background: rgba(255, 255, 255, 0.74);
    --similar-card-border: rgba(140, 108, 84, 0.12);
    --feature-panel-background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.36), transparent 24%),
        linear-gradient(145deg, rgba(229, 209, 190, 0.72), rgba(245, 239, 229, 0.96));
    --note-background: rgba(255, 255, 255, 0.66);
    --note-border: rgba(149, 110, 88, 0.16);
    --subtle-panel-background: rgba(255, 255, 255, 0.58);
    --subtle-panel-border: rgba(149, 110, 88, 0.16);
    --theme-toggle-background: rgba(255, 255, 255, 0.56);
    --theme-toggle-border: rgba(149, 110, 88, 0.14);
    --theme-toggle-hover-background: rgba(255, 255, 255, 0.78);
    --notification-menu-background: rgba(255, 250, 244, 0.96);
    --notification-item-background: rgba(255, 255, 255, 0.78);
    --notification-item-border: rgba(149, 110, 88, 0.16);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1418;
    --bg-soft: #121d23;
    --surface: rgba(18, 25, 31, 0.9);
    --surface-strong: #182129;
    --text: #f2e7d8;
    --muted: #bca995;
    --accent: #d9875f;
    --accent-strong: #f1b28a;
    --accent-soft: rgba(217, 135, 95, 0.18);
    --green: #84a18b;
    --gold: #d8b36a;
    --border: rgba(241, 178, 138, 0.14);
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
    --page-background:
        radial-gradient(circle at top left, rgba(217, 135, 95, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(132, 161, 139, 0.14), transparent 24%),
        linear-gradient(180deg, #10171c 0%, #0d1418 48%, #0a1014 100%);
    --reader-background:
        radial-gradient(circle at top center, rgba(132, 161, 139, 0.14), transparent 32%),
        linear-gradient(180deg, #11181d 0%, #0b1115 100%);
    --page-backdrop-background:
        radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.05), transparent 14%),
        radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.04), transparent 10%),
        radial-gradient(circle at 84% 72%, rgba(255, 255, 255, 0.04), transparent 14%);
    --header-background: rgba(10, 16, 20, 0.8);
    --header-border: rgba(241, 178, 138, 0.1);
    --footer-background: rgba(14, 21, 26, 0.84);
    --nav-link-hover-background: rgba(255, 255, 255, 0.06);
    --button-secondary-background: rgba(255, 255, 255, 0.06);
    --button-secondary-border: rgba(241, 178, 138, 0.12);
    --button-ghost-background: rgba(255, 255, 255, 0.02);
    --button-ghost-border: rgba(241, 178, 138, 0.1);
    --section-soft-background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
    --hero-card-background: linear-gradient(150deg, rgba(35, 49, 58, 0.94), rgba(22, 31, 37, 0.9));
    --hero-card-soft-background: linear-gradient(150deg, rgba(29, 46, 42, 0.94), rgba(17, 24, 29, 0.92));
    --chip-background: rgba(255, 255, 255, 0.06);
    --chip-border: rgba(241, 178, 138, 0.08);
    --info-chip-background: var(--similar-card-background);
    --info-chip-border: var(--similar-card-border);
    --collection-card-surface: rgba(18, 26, 32, 0.92);
    --collection-card-blend-base: #d9e6ff;
    --collection-card-background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 26%),
        linear-gradient(145deg, color-mix(in srgb, var(--collection-accent) 12%, transparent) 0%, transparent 42%),
        rgba(18, 25, 31, 0.94);
    --collection-card-border: rgba(255, 255, 255, 0.08);
    --collection-card-shadow:
        0 18px 44px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --collection-card-accent-opacity: 0.42;
    --input-background: rgba(255, 255, 255, 0.05);
    --input-background-strong: rgba(255, 255, 255, 0.08);
    --input-border: rgba(241, 178, 138, 0.1);
    --input-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --input-focus-border: rgba(241, 178, 138, 0.28);
    --input-focus-ring:
        0 0 0 4px rgba(241, 178, 138, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --file-button-background: rgba(255, 255, 255, 0.08);
    --file-button-background-hover: rgba(255, 255, 255, 0.12);
    --action-button-background: rgba(255, 255, 255, 0.06);
    --action-button-background-hover: rgba(255, 255, 255, 0.1);
    --action-button-border: rgba(241, 178, 138, 0.1);
    --action-button-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --tooltip-background: rgba(7, 11, 14, 0.94);
    --tooltip-text: #f7efe6;
    --reader-toolbar-background: rgba(18, 25, 31, 0.82);
    --reader-surface: rgba(20, 28, 34, 0.92);
    --reader-surface-focus: rgba(24, 33, 40, 0.96);
    --reader-divider: rgba(241, 178, 138, 0.1);
    --similar-card-background: rgba(255, 255, 255, 0.06);
    --similar-card-border: rgba(241, 178, 138, 0.08);
    --feature-panel-background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 24%),
        linear-gradient(145deg, rgba(64, 46, 34, 0.78), rgba(18, 25, 31, 0.96));
    --note-background: rgba(255, 255, 255, 0.05);
    --note-border: rgba(241, 178, 138, 0.1);
    --subtle-panel-background: rgba(255, 255, 255, 0.05);
    --subtle-panel-border: rgba(241, 178, 138, 0.1);
    --theme-toggle-background: rgba(255, 255, 255, 0.06);
    --theme-toggle-border: rgba(241, 178, 138, 0.12);
    --theme-toggle-hover-background: rgba(255, 255, 255, 0.1);
    --notification-menu-background: rgba(12, 18, 23, 0.96);
    --notification-item-background: rgba(255, 255, 255, 0.05);
    --notification-item-border: rgba(241, 178, 138, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

html.is-navigating [data-page-main],
html.is-navigating [data-shell-header],
html.is-navigating [data-shell-footer] {
    opacity: 0.72;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    background: var(--page-background);
    min-height: 100vh;
}

[hidden] {
    display: none !important;
}

body,
[data-page-main],
[data-shell-header],
[data-shell-footer] {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

body.reader-focus {
    background: var(--reader-background);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: var(--page-backdrop-background);
    z-index: -1;
}

.container {
    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 0;
    backdrop-filter: blur(16px);
    background: var(--header-background);
    border-bottom: 1px solid var(--header-border);
}

.site-header__inner {
    display: grid;
    width: calc(100% - 40px);
    max-width: none;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
}

.brand {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    justify-self: start;
}

.brand__mark {
    font-family: var(--font-heading);
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.brand__sub {
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.1;
}

.main-nav {
    display: flex;
    justify-content: center;
    justify-self: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    line-height: 1.05;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--text);
    background: var(--nav-link-hover-background);
    transform: translateY(-1px);
}

.mobile-bottom-nav {
    display: none;
}

.mobile-bottom-nav__inner {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.mobile-bottom-nav__link {
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 10px 8px 8px;
    border-radius: 20px;
    color: var(--muted);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mobile-bottom-nav__link.is-active {
    color: var(--text);
    background: var(--nav-link-hover-background);
    transform: translateY(-1px);
}

@media (hover: hover) and (pointer: fine) {
    .mobile-bottom-nav__link:hover {
        color: var(--text);
        background: var(--nav-link-hover-background);
    }
}

.mobile-bottom-nav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.mobile-bottom-nav__icon svg {
    width: 22px;
    height: 22px;
}

.mobile-bottom-nav__label {
    font-size: 0.72rem;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    justify-self: end;
}

.nav-user__account {
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--theme-toggle-border);
    background: var(--theme-toggle-background);
    color: var(--text);
    box-shadow: none;
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: var(--theme-toggle-hover-background);
}

.theme-toggle:focus-visible {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: var(--input-focus-ring);
}

.theme-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.theme-toggle__icon--sun {
    display: none;
}

.notification-menu {
    position: relative;
    display: inline-flex;
}

.notification-menu > summary {
    list-style: none;
    cursor: pointer;
}

.notification-menu > summary::-webkit-details-marker {
    display: none;
}

.notification-toggle {
    position: relative;
}

.notification-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.notification-toggle__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent-strong);
    color: #fff8ef;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.notification-menu[open] > .notification-toggle {
    background: var(--theme-toggle-hover-background);
    border-color: var(--input-focus-border);
    box-shadow: var(--input-focus-ring);
}

.notification-menu__panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(380px, calc(100vw - 24px));
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--notification-menu-background);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    z-index: 35;
}

.notification-menu__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.notification-menu__eyebrow {
    margin: 0 0 6px;
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.76rem;
}

.notification-menu__head h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.notification-menu__caption {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.notification-menu__list {
    display: grid;
    gap: 10px;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding-right: 2px;
}

.notification-menu__empty,
.notification-item {
    border-radius: var(--radius-md);
    border: 1px solid var(--notification-item-border);
    background: var(--notification-item-background);
}

.notification-menu__empty {
    display: grid;
    gap: 8px;
    padding: 16px;
}

.notification-menu__empty strong,
.notification-item__body strong {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    line-height: 1.2;
}

.notification-menu__empty p,
.notification-item__body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.notification-item {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 14px 16px 14px 18px;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.notification-item.is-unread::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    border-radius: 999px;
    background: var(--accent-strong);
}

a.notification-item:hover {
    transform: translateY(-1px);
    border-color: var(--input-focus-border);
    background: var(--input-background-strong);
}

.notification-item__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.8rem;
}

.notification-item__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
}

.notification-item__body {
    display: grid;
    gap: 6px;
}

:root[data-theme="dark"] .theme-toggle__icon--moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__icon--sun {
    display: inline-flex;
}

.site-header .button {
    min-height: 40px;
    padding: 0 16px;
}

.site-header .button-ghost,
.site-header .button-primary,
.site-header .button-secondary,
.theme-toggle,
.notification-toggle {
    box-shadow: none;
}

.site-footer {
    padding: 32px 0 48px;
}

.site-footer__inner {
    padding: 28px 32px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-radius: var(--radius-xl);
    background: var(--footer-background);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.site-footer__brand {
    display: grid;
    gap: 10px;
    max-width: 760px;
}

.site-footer__title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: 0 0 8px;
}

.site-footer p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.site-footer__meta {
    font-size: 0.92rem;
}

.site-footer__meta a {
    color: var(--accent-strong);
}

.site-footer__links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--muted);
}

.site-footer__columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 24px;
}

.site-footer__group {
    display: grid;
    gap: 12px;
}

.site-footer__heading {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-strong);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
}

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

.button-primary {
    color: #fff7f1;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 12px 30px rgba(145, 83, 53, 0.2);
}

.button-secondary {
    color: var(--text);
    background: var(--button-secondary-background);
    border-color: var(--button-secondary-border);
}

.button-ghost {
    color: var(--muted);
    background: var(--button-ghost-background);
    border-color: var(--button-ghost-border);
}

.button--large {
    min-height: 52px;
    padding: 0 22px;
}

.button--wide {
    min-width: 180px;
}

.button.is-disabled {
    pointer-events: none;
    opacity: 0.42;
    box-shadow: none;
    transform: none;
}

.inline-form {
    display: inline-flex;
}

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

.section {
    padding: 40px 0 56px;
}

.section--soft {
    background: var(--section-soft-background);
}

.section--tight {
    padding-top: 28px;
    padding-bottom: 36px;
}

.eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: var(--accent-strong);
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    margin: 0;
    line-height: 1.1;
}

h1 {
    font-size: clamp(2.6rem, 5vw, 4.9rem);
}

h2 {
    font-size: clamp(2rem, 3.2vw, 3rem);
}

h3 {
    font-size: clamp(1.3rem, 2vw, 1.7rem);
}

p {
    line-height: 1.7;
}

.hero__grid,
.story-hero,
.reader-layout,
.auth-layout,
.account-hero {
    display: grid;
    gap: 28px;
}

.hero {
    padding: 44px 0 56px;
}

.hero__grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    align-items: stretch;
}

.hero__copy,
.hero__panel,
.catalog-head,
.story-hero,
.auth-panel,
.reader-main,
.reader-sidebar,
.sidebar-card,
.collection-card,
.story-card,
.saved-card,
.history-item,
.empty-state,
.catalog-filters {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}

.hero__copy {
    padding: 40px;
}

.hero__copy h1 {
    line-height: 0.94;
}

.hero__text {
    max-width: 62ch;
    color: var(--muted);
    font-size: 1.02rem;
}

.hero__actions,
.story-card__actions,
.story-hero__actions,
.saved-card__actions,
.catalog-filters__actions,
.reader-toolbar__controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero__stats,
.catalog-summary,
.story-hero__meta,
.account-hero__stats,
.sidebar-card__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 12px;
}

.hero__stats {
    margin-top: 22px;
}

.hero__panel {
    display: grid;
    grid-template-rows: minmax(0, 1.28fr) minmax(0, 0.72fr);
    gap: 18px;
    height: 100%;
}

.hero-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 28px;
    border-radius: var(--radius-xl);
    background: var(--hero-card-background);
    border: 1px solid rgba(165, 120, 92, 0.16);
    box-shadow: var(--shadow);
}

.hero-card--soft {
    background: var(--hero-card-soft-background);
}

.hero-card__label,
.collection-card__badge,
.auth-note__title,
.auth-panel__title {
    margin: 0 0 8px;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.hero-card__story {
    display: grid;
    gap: 8px;
    align-content: start;
}

.hero-card__story .button {
    justify-self: start;
}

.hero-card__story-link {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.hero-card__story-meta,
.hero-card__placeholder {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

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

.story-grid,
.collection-grid,
.saved-grid,
.hub-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.story-card,
.collection-card,
.saved-card {
    overflow: hidden;
}

.story-card {
    grid-column: span 6;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.story-grid--catalog {
    column-gap: 20px;
    row-gap: 30px;
}

.story-grid--catalog .story-card {
    grid-column: span 4;
}

.story-grid--catalog > .empty-state {
    grid-column: 1 / -1;
}

.collection-card {
    grid-column: span 4;
    padding: 32px 32px 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    isolation: isolate;
    border-color: var(--collection-card-border);
    box-shadow: var(--collection-card-shadow);
}

.hub-card {
    grid-column: span 4;
    padding: 26px 28px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    gap: 10px;
    min-height: 100%;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.hub-card:hover {
    transform: translateY(-2px);
    border-color: var(--input-focus-border);
}

.hub-card__eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.hub-card__title {
    font-family: var(--font-heading);
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    line-height: 1.02;
}

.hub-card__description,
.hub-card__meta {
    margin: 0;
    color: var(--muted);
}

.hub-card__meta {
    font-size: 0.92rem;
}

.saved-card {
    grid-column: span 6;
    display: grid;
    grid-template-columns: 200px 1fr;
    height: 100%;
}

.story-card__body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.story-grid--catalog .story-card__body {
    padding: 22px 22px 18px;
}

.story-card__text {
    display: grid;
    gap: 12px;
    align-content: start;
}

.story-grid--catalog .story-card__text {
    gap: 10px;
    min-height: 7.2rem;
}

.saved-card__body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

.story-card__meta,
.story-card__author {
    color: var(--muted);
    font-size: 0.92rem;
}

.story-card__meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.story-card__tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.story-card__author {
    flex: 0 1 44%;
    min-width: 0;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-grid--catalog .story-card__meta {
    min-height: 42px;
}

.story-grid--catalog .story-card__author {
    max-width: none;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.84rem;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.pill:hover,
.story-card__author-link:hover {
    transform: translateY(-1px);
}

.story-card__author-link:hover,
.story-hero__eyebrow-link:hover,
.story-hero__author-link:hover {
    color: var(--accent-strong);
}

.story-card__title,
.saved-card h3 {
    font-size: 1.65rem;
}

.story-grid--catalog .story-card__title {
    font-size: 1.45rem;
    line-height: 1.08;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card__description,
.saved-card p,
.collection-card p,
.catalog-head p,
.story-hero__description,
.auth-panel p,
.account-hero__profile p {
    margin: 0;
    color: var(--muted);
}

.saved-card__meta {
    font-size: 0.9rem;
    color: var(--accent-strong);
}

.story-grid--catalog .story-card__description {
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-grid--catalog .story-card__actions {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.42fr);
    gap: 8px;
    margin-top: -12px;
    align-items: stretch;
}

.story-grid--catalog .story-card__actions > * {
    min-width: 0;
}

.story-grid--catalog .story-card__actions .inline-form {
    display: flex;
}

.story-grid--catalog .story-card__actions .button {
    min-height: 40px;
    padding: 0 28px;
    font-size: 0.9rem;
}

.saved-card__actions {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.42fr);
    gap: 8px;
    margin-top: auto;
    align-items: stretch;
}

.saved-card__actions > * {
    min-width: 0;
}

.saved-card__actions .inline-form {
    display: flex;
}

.saved-card__actions .button {
    min-height: 40px;
    padding: 0 28px;
    font-size: 0.9rem;
}

.saved-card__actions .inline-form .button {
    width: 100%;
}

.saved-card__actions > :last-child .button {
    padding: 0 30px;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    background: var(--info-chip-background);
    border-color: var(--info-chip-border);
    box-shadow: none;
}

.story-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    flex-wrap: nowrap;
}

.story-card__actions > * {
    min-width: 0;
    flex: 0 0 auto;
}

.story-card__actions .inline-form {
    display: flex;
    margin-left: auto;
}

.story-card__actions .button {
    min-height: 40px;
    padding: 0 28px;
    font-size: 0.9rem;
    width: auto;
}

.story-card__actions .story-action-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
}

.story-card__actions .story-action-button svg {
    width: 18px;
    height: 18px;
}

.story-card__actions > :last-child {
    margin-left: auto;
}

.story-grid:not(.story-grid--catalog) .story-card__actions {
    gap: 12px;
}

.story-grid:not(.story-grid--catalog) .story-card__actions .inline-form {
    display: flex;
}

.story-grid:not(.story-grid--catalog) .story-card__actions .button {
    min-width: 148px;
    padding: 0 34px;
}

.story-grid:not(.story-grid--catalog) .story-card__actions .story-action-button {
    min-width: 40px;
}

.story-grid--catalog .story-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin-top: -12px;
}

.story-grid--catalog .story-card__actions > * {
    flex: 0 0 auto;
}

.story-grid--catalog .story-card__actions .inline-form {
    margin-left: auto;
}

.story-cover {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 360px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fffaf4;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.3), transparent 24%),
        radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.16), transparent 28%),
        linear-gradient(145deg, var(--cover-color) 0%, var(--accent-color) 100%);
}

.story-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(18, 17, 20, 0.16) 0%, rgba(18, 17, 20, 0.05) 34%, rgba(18, 17, 20, 0.22) 100%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 0;
}

.story-cover--compact {
    min-height: 250px;
}

.story-grid--catalog .story-cover--compact {
    min-height: 210px;
}

.saved-card .story-cover--compact {
    min-height: 100%;
    padding: 20px 16px 18px;
}

.story-cover__theme {
    position: relative;
    z-index: 1;
    align-self: flex-start;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
}

.story-cover__title {
    position: relative;
    z-index: 1;
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    line-height: 0.9;
    max-width: 11ch;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    text-shadow: 0 8px 18px rgba(33, 23, 19, 0.28);
}

.story-grid--catalog .story-cover__title {
    font-size: clamp(1.55rem, 2vw, 2.1rem);
    line-height: 0.88;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
}

.story-grid:not(.story-grid--catalog) .story-cover__title {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
}

.saved-card .story-cover__title {
    font-size: clamp(1.1rem, 1.45vw, 1.55rem);
    line-height: 0.98;
    max-width: 8ch;
}

.saved-card .story-cover__theme {
    padding: 7px 10px;
    font-size: 0.76rem;
}

.story-cover__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -1;
}

.story-cover--compact .story-cover__image {
    transform: scale(1.02);
}

.metric-chip {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--info-chip-background);
    border: 1px solid var(--info-chip-border);
    display: grid;
    gap: 6px;
}

.metric-chip__value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text);
}

.metric-chip__label {
    color: var(--muted);
    font-size: 0.82rem;
}

.story-card__stats {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    align-self: start;
    margin-top: auto;
}

.story-grid--catalog .story-card__stats {
    margin-top: auto;
    transform: translateY(-10px);
}

.compact-metric {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 8px;
    min-height: 30px;
    border-radius: 12px;
    background: var(--chip-background);
    border: 1px solid var(--chip-border);
    color: var(--muted);
    white-space: nowrap;
}

.compact-metric__icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-strong);
    flex: 0 0 auto;
    align-self: center;
    line-height: 1;
    overflow: hidden;
}

.compact-metric__icon svg {
    width: 14px;
    height: 14px;
    display: block;
    flex: 0 0 auto;
}

.compact-metric__value {
    display: inline-flex;
    align-items: center;
    align-self: center;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    min-height: 0;
    font-variant-numeric: tabular-nums;
}

.story-grid--catalog .compact-metric {
    min-height: 32px;
    padding: 0 12px;
    align-items: center;
}

.story-grid--catalog .compact-metric__icon {
    width: 14px;
    height: 14px;
    min-height: 14px;
    transform: translateY(0);
}

.story-grid--catalog .compact-metric__value {
    min-height: 14px;
    height: 14px;
    align-items: center;
    transform: translateY(1.5px);
}

.collection-card {
    background: var(--collection-card-background);
}

.collection-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 32px;
    width: 88px;
    height: 2px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--collection-accent) 72%, rgba(255, 255, 255, 0.2));
    opacity: var(--collection-card-accent-opacity);
    pointer-events: none;
}

.collection-card h3 {
    line-height: 1.04;
}

.collection-card p {
    line-height: 1.82;
}

.collection-card__meta {
    margin: -4px 0 6px;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.45;
}

.collection-card__list {
    padding-left: 18px;
    margin: 4px 0 22px;
    display: grid;
    gap: 14px;
    color: var(--text);
}

.collection-card__list li {
    line-height: 1.55;
}

.collection-card__list a {
    color: var(--text);
}

.collection-card .button {
    margin-top: auto;
    align-self: flex-start;
}

.catalog-head {
    padding: 28px 32px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 18px;
}

.catalog-head h1 {
    line-height: 0.96;
    margin-bottom: 14px;
}

.catalog-head > div > p:last-child {
    margin-top: 8px;
}

.catalog-filters {
    padding: 22px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.catalog-filters > * {
    min-width: 0;
}

.catalog-filters__search {
    grid-column: 1 / -1;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field span {
    font-size: 0.9rem;
    color: var(--muted);
}

.field__hint {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

.form-legal-note {
    margin: 2px 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--muted);
}

.form-legal-note a {
    color: var(--accent-strong);
}

.catalog-filters > .form-legal-note {
    grid-column: 1 / -1;
    margin-top: -2px;
}

.file-field {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid var(--input-border);
    padding: 8px 12px;
    background: var(--input-background);
    color: var(--text);
    box-shadow: var(--input-shadow);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.file-field:focus-within {
    border-color: var(--input-focus-border);
    box-shadow: var(--input-focus-ring);
    background: var(--input-background-strong);
}

.file-field__input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.file-field__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--input-border);
    background: var(--file-button-background);
    color: var(--text);
    box-shadow: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.file-field__button:hover {
    background: var(--file-button-background-hover);
    border-color: var(--input-focus-border);
    transform: translateY(-1px);
}

.file-field__name {
    flex: 1 1 180px;
    min-width: 0;
    color: var(--muted);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid var(--input-border);
    padding: 0 16px;
    background-color: var(--input-background);
    color: var(--text);
    box-shadow: var(--input-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field textarea {
    min-height: 220px;
    padding: 14px 16px;
    resize: vertical;
}

.field input::placeholder {
    color: rgba(122, 101, 92, 0.55);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: var(--input-focus-ring);
    background-color: var(--input-background-strong);
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 48px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4.5 6.75 9 11.25l4.5-4.5' stroke='%23855c4a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px 18px;
}

.field select::-ms-expand {
    display: none;
}

:root[data-theme="dark"] .field input::placeholder,
:root[data-theme="dark"] .field textarea::placeholder {
    color: rgba(188, 169, 149, 0.66);
}

:root[data-theme="dark"] .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4.5 6.75 9 11.25l4.5-4.5' stroke='%23f1b28a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.catalog-filters__actions {
    align-items: end;
}

.catalog-filters__actions .button-secondary {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid var(--input-border);
    padding: 0 24px;
    background: var(--input-background);
    color: var(--text);
    box-shadow: var(--input-shadow);
}

.catalog-filters__actions .button-secondary:hover {
    background: var(--input-background-strong);
    border-color: var(--input-focus-border);
    box-shadow: var(--input-focus-ring);
}

.story-hero {
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
    padding: 30px;
}

.story-hero__cover {
    display: flex;
}

.story-hero__cover .story-cover {
    flex: 1;
    min-height: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
}

.story-hero__content {
    display: grid;
    align-content: center;
    gap: 14px;
}

.story-hero__content .eyebrow {
    margin-bottom: 0;
}

.hub-inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.story-hero__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.story-action-form {
    display: flex;
}

.story-action-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    min-width: 60px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--action-button-border);
    background: var(--action-button-background);
    color: var(--muted);
    box-shadow: var(--action-button-shadow);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease;
    overflow: visible;
}

.story-action-button:hover {
    transform: translateY(-1px);
    border-color: var(--input-focus-border);
    background: var(--action-button-background-hover);
    color: var(--text);
}

.story-action-button:disabled {
    cursor: default;
    opacity: 0.74;
    transform: none;
}

.story-action-button.is-active {
    color: #fff7f1;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    border-color: rgba(145, 83, 53, 0.18);
    box-shadow: 0 12px 30px rgba(145, 83, 53, 0.18);
}

.story-action-button svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.story-action-button::after {
    content: attr(data-copy-feedback);
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--tooltip-background);
    color: var(--tooltip-text);
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.story-action-button[data-copy-state="done"]::after,
.story-action-button[data-copy-state="error"]::after {
    opacity: 1;
}

.story-hero__author {
    color: var(--muted);
    font-size: 0.95rem;
}

.story-hero__author-link,
.story-hero__eyebrow-link {
    color: inherit;
}

.reader-layout {
    grid-template-columns: minmax(0, 1.3fr) 320px;
    align-items: start;
}

.reader-main,
.reader-sidebar {
    display: grid;
    gap: 20px;
}

.reader-toolbar,
.story-reader,
.story-resume-card,
.sidebar-card {
    padding: 24px;
}

.reader-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--reader-toolbar-background);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}

.reader-toolbar__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.story-resume-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--subtle-panel-border);
    background: var(--subtle-panel-background);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}

.story-resume-card h3,
.story-resume-card p {
    margin: 0;
}

.story-resume-card h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 2vw, 1.9rem);
    line-height: 1.08;
}

.story-resume-card p:last-of-type {
    color: var(--muted);
}

.story-resume-card .button {
    justify-self: start;
}

.story-reader {
    border: 1px solid var(--border);
    background: var(--reader-surface);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    font-family: var(--font-heading);
    font-size: var(--reader-font-size);
    line-height: 1.95;
    overflow-wrap: anywhere;
    word-break: break-word;
    scroll-margin-top: 110px;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.story-reader p {
    margin: 0 0 1.35em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.story-reader__chapter-intro {
    display: grid;
    gap: 8px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--reader-divider);
}

.story-reader__chapter-intro h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2.3vw, 2.2rem);
    line-height: 1.08;
}

.story-reader__chapter-caption,
.story-reader__chapter-position {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.story-reader__chapter-caption {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-strong);
    font-size: 0.82rem;
}

.story-reader__chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 22px;
    border-top: 1px solid var(--reader-divider);
}

.story-reader__chapter-nav .button {
    min-width: 0;
}

.reader-focus .site-header,
.reader-focus .site-footer {
    opacity: 0.92;
}

.reader-focus .story-reader {
    background: var(--reader-surface-focus);
}

.sidebar-card {
    display: grid;
    gap: 16px;
}

.sidebar-card--overview {
    gap: 10px;
}

.sidebar-card--overview > .eyebrow {
    margin-bottom: 0;
}

.sidebar-card__stats--overview {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 2px;
}

.sidebar-card__stats--overview .metric-chip {
    padding: 16px 18px;
    min-height: 0;
}

.sidebar-card__stats--overview .metric-chip__value {
    font-size: 1.4rem;
    line-height: 1.08;
}

.sidebar-card__stats--overview .metric-chip__label {
    font-size: 0.9rem;
}

.story-comments-section {
    display: grid;
    gap: 20px;
    grid-column: 1;
}

.story-comments__summary {
    min-width: 160px;
}

.story-comments__form,
.story-comments__guest,
.story-comment {
    padding: 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}

.story-comments__form {
    display: grid;
    gap: 16px;
}

.story-comments__form textarea {
    min-height: 132px;
    resize: vertical;
}

.story-comments__form-actions,
.story-comments__guest,
.story-comment__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.story-comment__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.story-comments__hint,
.story-comments__guest p,
.story-comment__meta,
.story-comment__likes {
    margin: 0;
    color: var(--muted);
}

.story-comments__list {
    display: grid;
    gap: 16px;
}

.story-comment {
    display: grid;
    gap: 16px;
}

.story-comment__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.story-comment__moderation {
    flex: 0 0 auto;
}

.story-comment__author {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    line-height: 1.08;
}

.story-comment__content {
    display: grid;
    gap: 12px;
}

.story-comment__content p {
    margin: 0;
    color: var(--text);
}

.story-comment__actions .story-action-form,
.story-comment__actions .story-action-button {
    flex: 0 0 auto;
}

.story-comments__empty {
    box-shadow: none;
    background: var(--subtle-panel-background);
    border-style: dashed;
}

.similar-story-list {
    display: grid;
    gap: 12px;
}

.similar-story {
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--similar-card-background);
    border: 1px solid var(--similar-card-border);
    display: grid;
    gap: 6px;
}

.similar-story__title {
    font-weight: 600;
}

.similar-story__meta {
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
}

.auth-panel {
    padding: 32px;
}

.page-admin {
    overflow-x: hidden;
}

.auth-panel--feature h1 {
    line-height: 0.92;
    margin-bottom: 16px;
}

.auth-panel--feature {
    background: var(--feature-panel-background);
}

.auth-benefits {
    margin: 18px 0 0;
    padding-left: 20px;
    display: grid;
    gap: 10px;
}

.auth-note {
    margin-top: 24px;
    padding: 18px;
    border-radius: 22px;
    background: var(--note-background);
    border: 1px solid var(--note-border);
}

.auth-note p {
    margin: 0 0 8px;
}

.admin-layout,
.admin-insights,
.submission-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.page-admin .catalog-head,
.page-admin .admin-layout,
.page-admin .admin-insights,
.page-admin .admin-panel,
.page-admin .sidebar-card,
.page-admin .admin-form,
.page-admin .admin-filter,
.page-admin .admin-story-picker,
.page-admin .admin-story-list,
.page-admin .admin-story-row {
    min-width: 0;
}

.admin-insights {
    align-items: start;
}

.admin-insights > .sidebar-card {
    align-self: start;
}

.submission-layout {
    align-items: start;
}

.admin-panel {
    padding: 32px;
}

.admin-panel__lead {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.72;
}

.admin-health-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
}

.admin-health__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-health__head h3 {
    margin: 0;
}

.admin-health__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.admin-health__badge.is-ready {
    color: #4f6c55;
    background: rgba(109, 142, 113, 0.14);
    border-color: rgba(109, 142, 113, 0.18);
}

.admin-health__badge.is-warning {
    color: var(--accent-strong);
    background: rgba(184, 110, 73, 0.1);
    border-color: rgba(184, 110, 73, 0.16);
}

.admin-health__badge.is-error {
    color: #8f4d2f;
    background: rgba(184, 110, 73, 0.08);
    border-color: rgba(184, 110, 73, 0.18);
}

.admin-health__meta,
.admin-health__list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.admin-health__meta strong,
.admin-health__list-title {
    color: var(--text);
}

.admin-health__meta li,
.admin-health__list li {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.admin-health__value,
.admin-health__code {
    color: var(--text);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.admin-health__code {
    font-family: var(--font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
    font-size: 0.95em;
}

.admin-health__alerts {
    display: grid;
    gap: 8px;
}

.admin-health__list-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.admin-form {
    gap: 16px;
}

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

.admin-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-toggle__row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--input-border);
    background: var(--chip-background);
}

.admin-toggle__row input {
    appearance: none;
    inline-size: 22px;
    block-size: 22px;
    min-height: 0;
    padding: 0;
    flex: 0 0 22px;
    margin-top: 4px;
    border-radius: 7px;
    border: 1.5px solid color-mix(in srgb, var(--muted) 72%, transparent);
    background: var(--input-background-strong);
    box-shadow: var(--input-shadow);
    cursor: pointer;
    position: relative;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.admin-toggle__row input:hover {
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
    background: var(--input-background-strong);
}

.admin-toggle__row input:checked {
    border-color: color-mix(in srgb, var(--accent-strong) 72%, transparent);
    background: rgba(184, 110, 73, 0.08);
    box-shadow:
        0 0 0 3px rgba(184, 110, 73, 0.06),
        var(--input-shadow);
}

.admin-toggle__row input:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 2px;
    width: 5px;
    height: 11px;
    border-right: 2px solid var(--accent-strong);
    border-bottom: 2px solid var(--accent-strong);
    transform: rotate(45deg);
}

.admin-toggle__row input:focus-visible {
    outline: none;
    box-shadow: var(--input-focus-ring);
}

.admin-toggle__body {
    display: grid;
    gap: 5px;
}

.admin-toggle__body strong {
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.28;
    color: var(--text);
}

.admin-toggle__body small {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.field--full {
    grid-column: 1 / -1;
}

.admin-chapters {
    display: grid;
    gap: 16px;
}

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

.admin-chapters__head > span {
    font-size: 0.9rem;
    color: var(--muted);
}

.admin-chapters__list {
    display: grid;
    gap: 16px;
}

.admin-chapter-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid var(--input-border);
    background: var(--input-background);
}

.admin-chapter-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-chapter-card__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.admin-chapter-card__remove {
    min-height: 40px;
}

.admin-chapter-card textarea {
    min-height: 180px;
}

.admin-story-picker {
    padding: 12px;
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 22px;
    border: 1px solid var(--input-border);
    background: var(--action-button-background);
}

.admin-filter {
    display: grid;
    gap: 12px;
}

.admin-filter--panel {
    margin-top: 18px;
}

.admin-filter__meta {
    display: grid;
    gap: 10px;
}

.admin-filter__field {
    margin: 0;
}

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

.admin-filter__summary {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.admin-filter__toggle {
    min-height: 38px;
    box-shadow: none;
}

.admin-filter__empty {
    margin: 0;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px dashed var(--input-border);
    background: var(--chip-background);
    color: var(--muted);
}

.admin-story-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--chip-background);
    border: 1px solid var(--input-border);
}

.admin-story-option input {
    appearance: none;
    inline-size: 22px;
    block-size: 22px;
    min-width: 22px;
    min-height: 22px;
    padding: 0;
    margin-top: 3px;
    border-radius: 7px;
    border: 1.5px solid color-mix(in srgb, var(--muted) 72%, transparent);
    background: var(--input-background-strong);
    box-shadow: var(--input-shadow);
    cursor: pointer;
    position: relative;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.admin-story-option input:hover {
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
    background: var(--input-background-strong);
}

.admin-story-option input:checked {
    border-color: color-mix(in srgb, var(--accent-strong) 72%, transparent);
    background: rgba(184, 110, 73, 0.08);
    box-shadow:
        0 0 0 3px rgba(184, 110, 73, 0.06),
        var(--input-shadow);
}

.admin-story-option input:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 2px;
    width: 5px;
    height: 11px;
    border-right: 2px solid var(--accent-strong);
    border-bottom: 2px solid var(--accent-strong);
    transform: rotate(45deg);
}

.admin-story-option input:focus-visible {
    outline: none;
    box-shadow: var(--input-focus-ring);
}

.admin-story-option__body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.admin-story-option__body strong {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.admin-story-option__body small {
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.admin-cover-upload {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.admin-cover-upload__note {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.admin-cover-upload__preview {
    width: min(100%, 240px);
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--input-border);
    background: var(--chip-background);
}

.admin-story-list {
    display: grid;
    gap: 12px;
}

.admin-story-row {
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--similar-card-background);
    border: 1px solid var(--similar-card-border);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    overflow: hidden;
}

.admin-story-row__body {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.admin-story-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
}

.admin-story-row__actions .button {
    min-height: 38px;
    min-width: 0;
    padding: 0 16px;
    font-size: 0.88rem;
    box-shadow: none;
    white-space: normal;
    text-align: center;
}

.admin-story-row--submission {
    align-items: start;
}

.admin-story-row--submission .admin-story-row__actions {
    flex-wrap: wrap;
    align-self: start;
}

.admin-story-row--comment {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.admin-story-row--comment .admin-story-row__actions {
    justify-content: flex-start;
    align-self: stretch;
}

.submission-preview {
    margin-top: 2px;
}

.submission-preview summary {
    cursor: pointer;
    color: var(--accent-strong);
    font-weight: 600;
}

.submission-preview__body {
    margin-top: 12px;
    padding: 16px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 14px;
    border-radius: 18px;
    border: 1px solid var(--input-border);
    background: var(--input-background);
}

.page-admin .similar-story__meta,
.page-admin .similar-story__title {
    overflow-wrap: anywhere;
}

.submission-preview__body p {
    margin: 0;
    line-height: 1.7;
}

.submission-preview__chapter {
    display: grid;
    gap: 10px;
}

.submission-preview__chapter + .submission-preview__chapter {
    padding-top: 12px;
    border-top: 1px solid var(--input-border);
}

.submission-preview__chapter-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.button--danger {
    color: #8f4d2f;
    border-color: rgba(184, 110, 73, 0.22);
    background: rgba(184, 110, 73, 0.08);
}

.button--danger:hover {
    background: rgba(184, 110, 73, 0.14);
    border-color: rgba(184, 110, 73, 0.28);
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-panel > .auth-form {
    margin-top: 22px;
}

.auth-link {
    margin-top: 16px;
    display: inline-flex;
    color: var(--accent-strong);
}

.auth-help-link {
    display: inline-flex;
    justify-self: start;
    color: var(--accent-strong);
    font-size: 0.94rem;
}

.info-page {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.info-page__head {
    margin-bottom: 0;
    min-width: 0;
}

.info-page__head > div {
    min-width: 0;
}

.info-page__grid {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.info-card {
    padding: 28px 32px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
    min-width: 0;
}

.info-card h2 {
    line-height: 1.02;
    margin: 0;
    overflow-wrap: anywhere;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.info-card__list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 10px;
    color: var(--text);
}

.info-card__list li {
    overflow-wrap: anywhere;
}

.form-alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(184, 110, 73, 0.1);
    color: var(--accent-strong);
    border: 1px solid rgba(184, 110, 73, 0.16);
}

.form-alert--success {
    background: rgba(109, 142, 113, 0.14);
    color: #4f6c55;
    border-color: rgba(109, 142, 113, 0.18);
}

.account-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 32px 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}

.account-hero__profile,
.account-hero__stats {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.account-hero__profile {
    max-width: 52rem;
}

.account-hero__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0 16px;
}

.account-settings {
    margin-top: 22px;
    padding: 20px 22px;
    max-width: 520px;
    border-radius: 24px;
    background: var(--subtle-panel-background);
    border: 1px solid var(--subtle-panel-border);
}

.account-settings__title {
    margin: 0 0 14px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
}

.submission-list {
    display: grid;
    gap: 12px;
}

.submission-card {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 24px;
    border: 1px solid var(--similar-card-border);
    background: var(--similar-card-background);
}

.submission-card__main {
    display: grid;
    gap: 8px;
}

.submission-card__head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    flex-wrap: wrap;
}

.submission-card__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.3rem;
}

.submission-card__meta,
.submission-card__description {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.submission-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.submission-status.is-pending {
    color: var(--accent-strong);
    background: rgba(184, 110, 73, 0.1);
    border-color: rgba(184, 110, 73, 0.16);
}

.submission-status.is-approved {
    color: #4f6c55;
    background: rgba(109, 142, 113, 0.14);
    border-color: rgba(109, 142, 113, 0.18);
}

.submission-status.is-rejected {
    color: #8f4d2f;
    background: rgba(184, 110, 73, 0.08);
    border-color: rgba(184, 110, 73, 0.18);
}

.account-settings__form {
    gap: 12px;
}

.account-settings__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.account-hero__stats {
    grid-template-columns: 1fr;
    justify-items: end;
    align-content: start;
    width: min(100%, 220px);
    margin-left: auto;
}

.account-hero__stats .metric-chip {
    width: 100%;
}

.account-hero__since {
    margin-top: 10px;
    font-size: 0.92rem;
}

.history-list {
    display: grid;
    gap: 14px;
}

.history-list > .empty-state {
    grid-column: 1 / -1;
}

.history-item {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    height: 100%;
}

.history-item__main {
    display: grid;
    gap: 4px;
}

.history-item__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.history-item__meta {
    margin: 0;
    color: var(--muted);
}

.empty-state {
    padding: 36px;
    text-align: center;
}

.empty-state--compact {
    width: 100%;
}

@media (max-width: 1120px) {
    .story-card,
    .saved-card {
        grid-column: span 12;
    }

    .collection-card {
        grid-column: span 6;
    }

    .story-grid:not(.story-grid--catalog) .story-card {
        grid-column: span 6;
    }

    .story-grid--catalog .story-card {
        grid-column: span 6;
    }

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

    .catalog-filters__actions {
        grid-column: auto;
    }

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

    .account-hero__stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        justify-items: stretch;
        width: 100%;
        margin-left: 0;
    }

    .reader-layout,
    .auth-layout,
    .admin-layout,
    .admin-insights,
    .submission-layout,
    .account-hero,
    .hero__grid,
    .story-hero {
        grid-template-columns: 1fr;
    }

    .hero__panel {
        grid-template-rows: repeat(2, auto);
        height: auto;
    }

    .hero-card {
        min-height: 0;
    }
}

.story-comments-layout {
    align-items: start;
}

@media (max-width: 820px) {
    body {
        padding-bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    }

    .site-header__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 12px 16px;
        justify-items: stretch;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
    }

    .nav-user {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        justify-content: flex-end;
        align-self: start;
        flex-wrap: nowrap;
    }

    .main-nav {
        display: none;
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        justify-self: center;
        justify-content: center;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 50%;
        width: min(640px, calc(100% - 20px));
        bottom: 10px;
        transform: translateX(-50%);
        z-index: 26;
        display: block;
        padding: 8px;
        border-radius: 28px;
        border: 1px solid var(--header-border);
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        box-shadow: none;
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }

    .site-header .button,
    .site-header .button-ghost,
    .site-header .button-primary,
    .site-header .button-secondary,
    .theme-toggle,
    .notification-toggle {
        width: auto;
        white-space: nowrap;
    }

    .notification-menu__head {
        flex-direction: column;
        align-items: stretch;
    }

    .notification-menu__head .inline-form {
        width: 100%;
    }

    .notification-menu__head .button {
        width: 100%;
    }

    .hero__copy,
    .hero-card,
    .catalog-head,
    .catalog-filters,
    .auth-panel,
    .story-hero,
    .story-reader,
    .reader-toolbar,
    .sidebar-card,
    .hub-card,
    .collection-card,
    .saved-card__body,
    .story-card__body {
        padding: 24px;
    }

    .account-hero {
        padding: 24px;
    }

    .info-page__head,
    .info-card {
        padding: 24px;
    }

    .account-settings__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .saved-card {
        grid-template-columns: 1fr;
    }

    .story-cover,
    .story-cover--compact {
        min-height: 220px;
    }

    .story-hero__cover .story-cover {
        min-height: 300px;
    }

    .story-card .story-cover--compact {
        min-height: 268px;
    }

    .story-grid:not(.story-grid--catalog) .story-card {
        grid-column: span 12;
    }

    .story-grid--catalog .story-card {
        grid-column: span 6;
    }

    .collection-card,
    .hub-card {
        grid-column: span 6;
    }

    .section-heading,
    .catalog-head,
    .reader-toolbar,
    .history-item,
    .site-footer__inner,
    .story-comments__form-actions,
    .story-comments__guest {
        flex-direction: column;
        align-items: stretch;
    }

    .site-footer__columns {
        grid-template-columns: 1fr;
    }

    .catalog-filters {
        grid-template-columns: 1fr;
    }

    .admin-form__grid {
        grid-template-columns: 1fr;
    }

    .catalog-filters__actions {
        grid-column: auto;
    }

    .story-card__meta {
        align-items: center;
    }

    .admin-story-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-story-row__actions {
        justify-content: flex-start;
    }

    .admin-filter__status {
        flex-direction: column;
        align-items: stretch;
    }

    .story-reader__chapter-nav {
        flex-direction: column;
    }

    .story-reader__chapter-nav .button {
        width: 100%;
    }

    .admin-chapters__head {
        align-items: stretch;
    }

    .info-page__head h1 {
        font-size: clamp(2.5rem, 11vw, 4.4rem);
    }
}

@media (max-width: 560px) {
    .container {
        width: min(var(--container), calc(100% - 20px));
    }

    .main-nav .nav-link--account {
        display: none;
    }

    .history-list {
        grid-template-columns: 1fr;
    }

    .account-hero__controls,
    .account-settings__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .button,
    .button--wide,
    .hero__actions .button,
    .story-card__actions .button,
    .saved-card__actions .button,
    .story-hero__actions .button {
        width: 100%;
    }

    .story-card__actions {
        flex-wrap: nowrap;
    }

    .info-page__head,
    .info-card {
        padding: 22px 20px;
    }

    .story-grid--catalog .story-card {
        grid-column: span 12;
    }

    .collection-card,
    .hub-card {
        grid-column: span 12;
    }

    .story-card__actions .button {
        width: auto;
    }

    .hero__stats,
    .story-hero__meta,
    .catalog-summary,
    .account-hero__stats,
    .sidebar-card__stats,
    .story-comments__summary {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.45rem;
    }

    .story-hero__cover .story-cover {
        min-height: 324px;
        padding: 26px 20px 24px;
    }

    .story-card .story-cover--compact {
        min-height: 314px;
        padding: 24px 20px 22px;
    }

    .story-card .story-cover--compact .story-cover__title {
        font-size: clamp(1.6rem, 8vw, 2.2rem);
        max-width: min(100%, 11.5ch);
        line-height: 0.92;
    }

    .site-header {
        padding: 8px 0;
    }

    .site-header__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 10px 12px;
        justify-items: stretch;
    }

    .main-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 4px;
        width: 100%;
        justify-self: center;
        justify-content: center;
    }

    .nav-link {
        padding: 7px 12px;
        font-size: 0.98rem;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
    }

    .nav-user {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        width: auto;
        max-width: 100%;
        justify-self: end;
        justify-content: flex-end;
        align-self: start;
    }

    .site-header .button,
    .site-header .button-ghost,
    .site-header .button-primary,
    .site-header .button-secondary,
    .theme-toggle,
    .notification-toggle {
        width: auto;
        min-height: 36px;
        padding: 0 14px;
        font-size: 0.96rem;
        white-space: nowrap;
    }

    .theme-toggle,
    .notification-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        padding: 0;
        flex: 0 0 36px;
        aspect-ratio: 1 / 1;
    }

    .nav-user__account {
        max-width: 116px;
    }

    .notification-menu__panel {
        width: min(340px, calc(100vw - 20px));
    }
}

@media (max-width: 430px) {
    .brand {
        display: none;
    }

    .story-hero__cover .story-cover {
        min-height: 304px;
        padding: 24px 18px 22px;
    }

    .story-card .story-cover--compact {
        min-height: 296px;
        padding: 22px 18px 20px;
    }

    .story-card .story-cover--compact .story-cover__title {
        font-size: clamp(1.42rem, 8.1vw, 1.95rem);
        max-width: min(100%, 12ch);
    }

    .site-header__inner {
        grid-template-columns: 1fr;
    }

    .nav-user {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
    }

    .nav-user__account {
        max-width: 92px;
    }

    .main-nav {
        grid-row: 2;
    }
}
