:root {
    color-scheme: light;
    --background: #f4f5f8;
    --surface: #ffffff;
    --surface-muted: #eef0f5;
    --text: #1f2530;
    --muted: #626b79;
    --border: #d9dee8;
    --accent: #3659a7;
    --accent-dark: #294681;
    --accent-soft: #e8eefc;
    --success: #236447;
    --success-soft: #e3f3eb;
    --warning-bg: #fff5d9;
    --warning-border: #e4c56c;
    --shadow: 0 12px 35px rgb(31 37 48 / 8%);
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 100%;
    background: var(--background);
    color: var(--text);
}

body {
    display: flex;
    min-width: 20rem;
    min-height: 100vh;
    flex-direction: column;
    margin: 0;
}

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

a:hover {
    color: var(--accent-dark);
}

.site-header {
    background: #17223b;
    color: #ffffff;
}

.header-inner,
.page-shell {
    width: min(72rem, calc(100% - 2rem));
    margin-inline: auto;
}

.header-inner {
    display: flex;
    min-height: 4.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    color: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.brand:hover {
    color: #ffffff;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a {
    color: #d8e2fa;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 0.3rem;
}

.reader-account-link {
    display: inline-flex;
    max-width: 11rem;
    align-items: center;
    gap: 0.45rem;
}

.reader-account-link img {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    object-fit: cover;
}

.reader-account-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-logout {
    margin: 0;
}

.header-logout button {
    border: 0;
    background: transparent;
    color: #d8e2fa;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0;
}

.header-logout button:hover,
.header-logout button:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 0.3rem;
}

.page-shell {
    flex: 1;
    padding-block: clamp(2rem, 6vw, 4.5rem);
}

.flash-message {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: var(--surface);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
    font-weight: 700;
}

.flash-message--success {
    border-color: #9dcbb5;
    background: var(--success-soft);
    color: var(--success);
}

.flash-message--error {
    border-color: #e0aaa5;
    background: #fff0ee;
    color: #8b2f29;
}

.page-heading {
    max-width: 46rem;
    margin-bottom: 2rem;
}

.page-heading h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 600;
    line-height: 1.08;
}

.page-heading p {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.page-heading--compact {
    margin-bottom: 1.5rem;
}

.page-heading--compact h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

.notice,
.empty-state {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.notice {
    border-color: var(--warning-border);
    background: var(--warning-bg);
}

.notice h2,
.empty-state h1,
.empty-state h2,
.empty-state h3 {
    margin: 0;
    font-size: 1.1rem;
}

.notice p,
.empty-state p {
    margin: 0.5rem 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.notice details {
    margin-top: 0.75rem;
    color: var(--muted);
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    gap: 1.25rem;
}

.story-card {
    display: grid;
    min-height: 18rem;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.story-card__cover {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(155deg, #253965, #17223b 70%);
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.25rem;
    text-decoration: none;
}

.story-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card__body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 1.35rem;
}

.story-card h2 {
    margin: 0.45rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    line-height: 1.2;
}

.story-card h2 a {
    color: var(--text);
    text-decoration: none;
}

.story-card h2 a:hover,
.story-card h2 a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.story-card p {
    color: var(--muted);
    line-height: 1.6;
}

.story-card .story-card__subtitle {
    margin: 0.35rem 0 0;
    color: var(--text);
    font-size: 0.9rem;
    font-style: italic;
}

.story-card__category {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.story-card__category:hover {
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.story-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
}

.page-action {
    margin: 2rem 0 0;
    text-align: center;
}

.button {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    border-radius: 0.45rem;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0.6rem 1rem;
    text-decoration: none;
}

.button:hover,
.button:focus-visible {
    border-color: var(--accent-dark);
    background: var(--accent-dark);
    color: #ffffff;
}

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

.button--secondary:hover,
.button--secondary:focus-visible {
    color: #ffffff;
}

.catalog-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.catalog-back {
    display: inline-flex;
    margin-bottom: 0.75rem;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.catalog-back::before {
    content: "←";
    margin-right: 0.35rem;
}

.catalog-back:hover,
.catalog-back:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.catalog-filters label {
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.catalog-filters select,
.catalog-filters input {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.55rem 2.25rem 0.55rem 0.7rem;
}

.catalog-filters input {
    padding-right: 0.7rem;
}

.catalog-filters select:focus,
.catalog-filters input:focus {
    border-color: var(--accent);
    outline: 2px solid #b9c8ec;
    outline-offset: 1px;
}

.catalog-filter--search {
    grid-column: span 2;
}

.catalog-filters__actions {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.catalog-count {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination a {
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--surface);
    padding: 0.55rem 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.pagination span {
    color: var(--muted);
    font-size: 0.92rem;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.story-detail {
    display: grid;
    grid-template-columns: minmax(11rem, 16rem) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
}

.story-detail__cover {
    display: flex;
    aspect-ratio: 2 / 3;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: linear-gradient(155deg, #3659a7, #17223b 72%);
    color: #ffffff;
    overflow: hidden;
    box-shadow: 0 18px 40px rgb(23 34 59 / 18%);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(4rem, 12vw, 7rem);
}

.story-detail__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-detail__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.story-detail__eyebrow a {
    text-decoration: none;
}

.status-badge {
    display: inline-flex;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.status-badge--complete {
    background: var(--success-soft);
    color: var(--success);
}

.status-badge--hiatus,
.status-badge--archived {
    background: var(--surface-muted);
    color: var(--muted);
}

.story-detail h1 {
    margin: 0.65rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.3rem, 6vw, 4.5rem);
    font-weight: 600;
    line-height: 1.02;
}

.story-detail__subtitle {
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-style: italic;
}

.story-detail__description {
    max-width: 48rem;
    margin-top: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.75;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.tag-list a {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    padding: 0.35rem 0.7rem;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
}

.tag-list a:hover,
.tag-list a:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

.story-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 1.75rem 0 0;
    border-block: 1px solid var(--border);
}

.story-stats div {
    padding: 1rem;
}

.story-stats div:first-child {
    padding-left: 0;
}

.story-stats div + div {
    border-left: 1px solid var(--border);
}

.story-stats dt {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.story-stats dd {
    margin: 0.25rem 0 0;
    font-weight: 700;
}

.story-rating-summary {
    display: grid;
    gap: 0.15rem;
}

.story-rating-summary small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.chapter-section {
    margin-top: clamp(3rem, 8vw, 5rem);
}

.story-reading-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    border: 1px solid #bdcbed;
    border-radius: 0.75rem;
    background: var(--accent-soft);
    padding: 1rem 1.15rem;
}

.story-reading-action > div {
    display: grid;
    gap: 0.25rem;
}

.story-reading-action strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
}

.story-reading-action span {
    color: var(--muted);
    font-size: 0.88rem;
}

.story-library-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow);
}

.story-library-actions > div:first-child {
    display: grid;
    gap: 0.25rem;
}

.story-library-actions strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
}

.story-library-actions span {
    color: var(--muted);
    font-size: 0.86rem;
}

.story-library-actions__buttons,
.account-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.story-library-actions form,
.library-story-row__actions form {
    margin: 0;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

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

.chapter-list {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow);
    list-style: none;
}

.chapter-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
}

.chapter-list li + li {
    border-top: 1px solid var(--border);
}

.chapter-list__label {
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chapter-list h3 {
    margin: 0.2rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
}

.chapter-list h3 a {
    color: var(--text);
    text-decoration: none;
}

.chapter-list h3 a:hover,
.chapter-list h3 a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.18rem;
}

.chapter-list__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: right;
}

.chapter-progress {
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    font-size: 0.74rem;
    font-weight: 800;
}

.chapter-progress--unread {
    background: var(--surface-muted);
    color: var(--muted);
}

.chapter-progress--started {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.chapter-progress--completed {
    background: var(--success-soft);
    color: var(--success);
}

.discussion-section {
    margin-top: clamp(3rem, 8vw, 5rem);
    scroll-margin-top: 1rem;
}

.discussion-heading > div {
    display: grid;
    gap: 0.25rem;
}

.discussion-scope {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.discussion-scope label,
.comment-form > label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.discussion-scope > div {
    display: flex;
    gap: 0.75rem;
}

.discussion-scope select {
    min-width: 0;
    min-height: 2.75rem;
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.55rem 0.7rem;
}

.discussion-empty,
.discussion-signin {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.discussion-empty h3,
.discussion-signin p {
    margin: 0;
}

.discussion-empty p {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.discussion-signin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
}

.comment-list,
.comment-replies {
    margin: 0;
    padding: 0;
    list-style: none;
}

.comment-thread + .comment-thread {
    margin-top: 1rem;
}

.comment-card {
    display: grid;
    grid-template-columns: 2.8rem minmax(0, 1fr);
    gap: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.1rem;
    box-shadow: var(--shadow);
}

.comment-card--pending {
    border-color: var(--warning-border);
    background: #fffaf0;
}

.comment-replies {
    margin: 0.75rem 0 0 clamp(1rem, 6vw, 3.5rem);
}

.comment-replies li + li {
    margin-top: 0.75rem;
}

.comment-card--reply {
    box-shadow: none;
}

.comment-avatar {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent), #17223b);
    color: #ffffff;
    overflow: hidden;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-content {
    min-width: 0;
}

.comment-content header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.75rem;
}

.comment-content time {
    color: var(--muted);
    font-size: 0.78rem;
}

.comment-pending {
    border-radius: 999px;
    background: var(--warning-bg);
    color: #75550d;
    padding: 0.16rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.comment-body {
    margin-top: 0.65rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.comment-reply-button {
    margin-top: 0.7rem;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0;
}

.comment-form {
    display: grid;
    gap: 0.55rem;
    margin-top: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.comment-form textarea {
    width: 100%;
    min-height: 8rem;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    line-height: 1.55;
    padding: 0.75rem;
}

.comment-form textarea:focus,
.discussion-scope select:focus {
    border-color: var(--accent);
    outline: 2px solid #b9c8ec;
    outline-offset: 1px;
}

.comment-form__footer,
.comment-replying {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.comment-form__footer > span {
    color: var(--muted);
    font-size: 0.82rem;
}

.comment-replying {
    border-radius: 0.4rem;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.comment-replying[hidden] {
    display: none;
}

.comment-replying button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.site-footer {
    padding: 1.5rem 1rem;
    color: var(--muted);
    text-align: center;
}

.account-auth-shell {
    display: grid;
    min-height: min(42rem, calc(100vh - 13rem));
    place-items: center;
}

.account-auth-card {
    width: min(31rem, 100%);
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    box-shadow: var(--shadow);
}

.account-eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.account-auth-card h1,
.account-page-heading h1 {
    margin: 0.45rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    line-height: 1.08;
}

.account-auth-card h1 {
    font-size: clamp(2rem, 7vw, 3rem);
}

.account-intro {
    margin: 1rem 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.account-notice {
    margin-top: 1.25rem;
    border: 1px solid var(--warning-border);
    border-radius: 0.5rem;
    background: var(--warning-bg);
    padding: 0.85rem;
    color: var(--text);
    line-height: 1.5;
}

.social-login-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.social-login {
    display: grid;
    min-height: 3.2rem;
    grid-template-columns: 2rem 1fr 2rem;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    padding: 0.55rem 0.75rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.social-login::after {
    content: "";
}

.social-login:hover,
.social-login:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.social-login__mark {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--accent-dark);
    font-size: 0.85rem;
}

.social-login--discord .social-login__mark {
    background: #5865f2;
    color: #ffffff;
}

.account-privacy-note {
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.55;
}

.account-back-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.account-page-heading {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.account-page-heading h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.account-page-heading > div:last-child > p:last-child {
    margin: 0.55rem 0 0;
    color: var(--muted);
}

.account-avatar {
    display: grid;
    width: clamp(4.5rem, 12vw, 6.5rem);
    aspect-ratio: 1;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent), #17223b);
    color: #ffffff;
    overflow: hidden;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.account-stat-grid div {
    display: grid;
    gap: 0.25rem;
    padding: 1.2rem;
    text-align: center;
}

.account-stat-grid div + div {
    border-left: 1px solid var(--border);
}

.account-stat-grid strong {
    color: var(--accent-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
}

.account-stat-grid span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.account-panel {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    padding: 1.35rem;
    box-shadow: var(--shadow);
}

.account-panel h2 {
    margin: 0 0 1.1rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
}

.account-field {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

.account-field input {
    width: 100%;
    min-height: 2.8rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    padding: 0.55rem 0.7rem;
}

.account-field input:focus {
    border-color: var(--accent);
    outline: 2px solid #b9c8ec;
    outline-offset: 1px;
}

.account-email {
    margin: 0.75rem 0 1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.identity-list {
    margin-bottom: 1rem;
    border-block: 1px solid var(--border);
}

.identity-row {
    display: flex;
    min-height: 4rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.75rem;
}

.identity-row + .identity-row {
    border-top: 1px solid var(--border);
}

.identity-row > div {
    display: grid;
    gap: 0.2rem;
}

.identity-row span {
    color: var(--muted);
    font-size: 0.78rem;
}

.identity-row button {
    border: 0;
    background: transparent;
    color: #9b3731;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
}

.identity-row button:disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.55;
}

.identity-add {
    display: inline-flex;
    min-height: 2.6rem;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.account-panel--progress {
    margin-top: 1.5rem;
}

.account-panel--progress p {
    max-width: 48rem;
    color: var(--muted);
    line-height: 1.65;
}

.library-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.library-heading h1 {
    margin: 0.4rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.3rem, 6vw, 4rem);
    font-weight: 600;
    line-height: 1.05;
}

.library-heading p:last-child {
    max-width: 42rem;
    margin: 0.75rem 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.library-section + .library-section {
    margin-top: clamp(3rem, 8vw, 5rem);
}

.continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
    gap: 1rem;
}

.continue-card {
    display: grid;
    min-width: 0;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.library-cover {
    display: flex;
    min-height: 7.5rem;
    align-items: center;
    justify-content: center;
    background: linear-gradient(155deg, #253965, #17223b 70%);
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    text-decoration: none;
    overflow: hidden;
}

.library-cover:hover,
.library-cover:focus-visible {
    color: #ffffff;
}

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

.continue-card__body {
    min-width: 0;
    padding: 1.15rem;
}

.library-kicker {
    color: var(--accent);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.continue-card h3,
.library-story-row h3 {
    margin: 0.25rem 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
}

.continue-card h3 a,
.library-story-row h3 a {
    color: var(--text);
    text-decoration: none;
}

.continue-card h3 a:hover,
.continue-card h3 a:focus-visible,
.library-story-row h3 a:hover,
.library-story-row h3 a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.continue-card__body > p,
.library-story-row__body > p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.library-progress {
    height: 0.4rem;
    margin-top: 1rem;
    border-radius: 99rem;
    background: var(--surface-muted);
    overflow: hidden;
}

.library-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.continue-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
}

.continue-card__footer > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.continue-card__footer .button,
.library-story-row__actions .button {
    min-height: 2.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
}

.library-story-list {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.library-story-row {
    display: grid;
    grid-template-columns: 4.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.library-story-row + .library-story-row {
    border-top: 1px solid var(--border);
}

.library-story-row .library-cover {
    min-height: 5.5rem;
    border-radius: 0.4rem;
    font-size: 1.5rem;
}

.library-story-row__body {
    min-width: 0;
}

.library-story-row__title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.library-story-row__title h3 {
    margin-top: 0;
}

.library-update-badge {
    display: inline-flex;
    border-radius: 99rem;
    background: var(--success-soft);
    color: var(--success);
    padding: 0.25rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.library-story-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.library-story-row__actions {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
}

.library-text-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.2rem;
    text-decoration: underline;
    text-underline-offset: 0.18rem;
}

.library-text-button:hover,
.library-text-button:focus-visible {
    color: var(--accent-dark);
}

@media (max-width: 60rem) {
    .catalog-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .story-stats div:nth-child(3) {
        padding-left: 0;
    }

    .story-stats div:nth-child(3) {
        border-left: 0;
    }

    .story-stats div:nth-child(n + 3) {
        border-top: 1px solid var(--border);
    }

    .account-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 44rem) {
    .story-detail {
        grid-template-columns: 7rem minmax(0, 1fr);
        gap: 1.25rem;
    }

    .story-detail__cover {
        font-size: 3.5rem;
    }

    .story-detail h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .story-detail__description,
    .tag-list,
    .story-stats {
        grid-column: 1 / -1;
    }

    .chapter-list li {
        align-items: flex-start;
        flex-direction: column;
    }

    .chapter-list__meta {
        justify-content: flex-start;
        text-align: left;
    }

    .story-reading-action {
        align-items: stretch;
        flex-direction: column;
    }

    .story-reading-action .button {
        width: 100%;
    }

    .story-library-actions,
    .library-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .story-library-actions__buttons .button,
    .story-library-actions > .button,
    .library-heading > .button {
        width: 100%;
    }

    .story-library-actions__buttons,
    .story-library-actions__buttons form {
        width: 100%;
    }

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

    .library-story-row__actions {
        grid-column: 2;
        justify-items: start;
    }
}

@media (max-width: 36rem) {
    .header-inner,
    .page-shell {
        width: min(100% - 1.25rem, 72rem);
    }

    .page-shell {
        padding-block: 2rem;
    }

    .header-inner {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
        padding-block: 1rem;
    }

    .site-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.75rem 1.1rem;
    }

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

    .catalog-filter--search {
        grid-column: auto;
    }

    .catalog-filters__actions {
        justify-content: space-between;
    }

    .story-card {
        grid-template-columns: 4.5rem minmax(0, 1fr);
    }

    .story-card__body {
        padding: 1.1rem;
    }

    .story-detail {
        grid-template-columns: 1fr;
    }

    .story-detail__cover {
        width: min(10rem, 44vw);
    }

    .story-detail__description,
    .tag-list,
    .story-stats {
        grid-column: auto;
    }

    .story-stats {
        grid-template-columns: 1fr 1fr;
    }

    .pagination {
        justify-content: space-between;
    }

    .account-stat-grid {
        grid-template-columns: 1fr;
    }

    .account-stat-grid div + div {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .account-page-heading {
        align-items: flex-start;
    }

    .discussion-scope > div,
    .discussion-signin,
    .comment-form__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .discussion-scope .button,
    .discussion-signin .button,
    .comment-form__footer .button {
        width: 100%;
    }

    .comment-card {
        grid-template-columns: 2.25rem minmax(0, 1fr);
        padding: 0.9rem;
    }

    .comment-avatar {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.95rem;
    }

    .comment-replies {
        margin-left: 0.75rem;
    }
}
