/* RRtranslate — public frontend design system */

@font-face {
    font-family: "Literata";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/literata-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Literata";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/literata-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Literata";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/literata-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

.rr-app {
    --rr-color-primary: #2364aa;
    --rr-color-primary-hover: #174f88;
    --rr-color-primary-muted: rgba(35, 100, 170, 0.14);
    --rr-color-on-primary: #ffffff;
    --rr-color-accent: #0f8b8d;
    --rr-color-accent-muted: rgba(15, 139, 141, 0.12);
    --rr-color-accent-strong: #0b6f70;
    --rr-color-warm: #f2b84b;
    --rr-color-text: #18202a;
    --rr-color-muted: #667085;
    --rr-color-soft: #f5f7fb;
    --rr-color-border: #d9e2ec;
    --rr-color-border-strong: rgba(217, 226, 236, 0.95);
    --rr-color-surface: #ffffff;
    --rr-color-surface-raised: #ffffff;
    --rr-color-bg: #f6f8fb;
    --rr-color-success: #1a7f37;
    --rr-color-success-muted: rgba(26, 127, 55, 0.12);
    --rr-color-danger: #c62828;
    --rr-color-danger-muted: rgba(198, 40, 40, 0.1);
    --rr-color-warning: #b26a00;
    --rr-color-warning-muted: rgba(178, 106, 0, 0.12);
    --rr-radius: 8px;
    --rr-radius-md: 12px;
    --rr-radius-lg: 16px;
    --rr-shadow: 0 1px 2px rgba(24, 32, 42, 0.08), 0 8px 24px rgba(24, 32, 42, 0.06);
    --rr-shadow-sm: 0 1px 2px rgba(24, 32, 42, 0.06), 0 4px 12px rgba(24, 32, 42, 0.05);
    --rr-shadow-md: 0 16px 40px rgba(24, 32, 42, 0.12);
    --rr-app-gradient: linear-gradient(180deg, #eef4fb 0, #f8fafc 260px, #ffffff 620px);
    --rr-cover-gradient: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(238, 244, 251, 0.94));
    --rr-table-bg: #f8fafc;
    --rr-table-cell-bg: #ffffff;
    --rr-table-head-bg: #eef4fb;
    --rr-font-reading: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --rr-font-display: "Literata", Georgia, "Times New Roman", serif;
    --rr-measure: 42rem;
    --rr-header-offset: 56px;
    --rr-space-1: 4px;
    --rr-space-2: 8px;
    --rr-space-3: 12px;
    --rr-space-4: 16px;
    --rr-space-5: 24px;
    --rr-space-6: 32px;
    --rr-space-7: 40px;
    font-family: var(--rr-font-reading);
    color: var(--rr-color-text);
    line-height: 1.5;
    background: var(--rr-app-gradient);
    min-height: 100vh;
}

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

@media (prefers-reduced-motion: reduce) {
    .rr-app *,
    .rr-app *::before,
    .rr-app *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* --- Base / layout --- */

.rr-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--rr-space-6) var(--rr-space-4) var(--rr-space-7);
}

.rr-main {
    min-height: 40vh;
}

.rr-public-footer {
    max-width: 760px;
    margin: var(--rr-space-7) auto 0;
    padding: var(--rr-space-5) 0 0;
    color: var(--rr-color-muted);
    border-top: 1px solid var(--rr-color-border);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
}

.rr-public-footer p {
    margin: 0;
}

.rr-public-footer a {
    color: var(--rr-color-primary);
    font-weight: 600;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.rr-public-footer a:hover {
    color: var(--rr-color-primary-hover);
    text-decoration: underline;
}

.rr-main,
.rr-card,
.rr-novel-hero,
.chapter-content {
    overflow-wrap: anywhere;
}

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

.rr-auth-page .wa-signup-form-wrapper {
    visibility: visible !important;
}

/* --- Auth pages --- */

.rr-auth-page {
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 220px);
}

.rr-auth-shell {
    width: min(100%, 460px);
    margin: 0 auto;
    padding: var(--rr-space-3) 0 var(--rr-space-5);
}

.rr-auth-back {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-bottom: var(--rr-space-4);
    color: var(--rr-color-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.rr-auth-back:hover,
.rr-auth-back:focus-visible {
    color: var(--rr-color-primary);
    text-decoration: underline;
}

.rr-auth-intro {
    margin-bottom: var(--rr-space-5);
    text-align: center;
}

.rr-auth-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    margin-bottom: var(--rr-space-3);
    padding: 0 var(--rr-space-3);
    color: var(--rr-color-primary);
    background: var(--rr-color-primary-muted);
    border: 1px solid rgba(35, 100, 170, 0.18);
    border-radius: var(--rr-radius);
    font-size: 0.8125rem;
    font-weight: 750;
}

.rr-auth-intro h1 {
    margin: 0 0 var(--rr-space-2);
    color: var(--rr-color-text);
    font-size: 1.75rem;
    line-height: 1.22;
    font-weight: 750;
}

.rr-auth-intro p {
    max-width: 34rem;
    margin: 0 auto;
    color: var(--rr-color-muted);
    font-size: 0.975rem;
}

.rr-auth-card {
    width: 100%;
    padding: var(--rr-space-6);
    background: var(--rr-color-surface);
    border: 1px solid var(--rr-color-border-strong);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow-md);
}

.rr-auth-page .wa-login-form-wrapper,
.rr-auth-page .wa-signup-form-wrapper,
.rr-auth-page .wa-forgotpassword-form-wrapper,
.rr-auth-page .wa-set-password-form-wrapper {
    width: 100%;
    max-width: none;
    margin: 0;
    color: var(--rr-color-text);
    font-family: inherit;
}

.rr-auth-page form,
.rr-auth-page .js-wa-form-item {
    margin: 0;
}

.rr-auth-page .wa-login-form-title,
.rr-auth-page .wa-signup-form-title {
    margin: 0 0 var(--rr-space-5);
    color: var(--rr-color-text);
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 700;
}

.rr-auth-page .wa-login-form-fields,
.rr-auth-page .wa-signup-form-fields,
.rr-auth-page .wa-forgotpassword-form-fields,
.rr-auth-page .wa-login-form-actions,
.rr-auth-page .wa-signup-form-actions,
.rr-auth-page .wa-forgotpassword-form-actions {
    display: grid;
    gap: var(--rr-space-4);
}

.rr-auth-page .wa-field {
    margin: 0;
}

.rr-auth-page .wa-field .wa-name {
    margin: 0 0 var(--rr-space-2);
    color: var(--rr-color-text);
    font-size: 0.875rem;
    line-height: 1.35;
    font-weight: 650;
}

.rr-auth-page .wa-field .wa-value {
    display: grid;
    gap: var(--rr-space-2);
    margin: 0;
}

.rr-auth-page .wa-field p {
    margin: 0;
}

.rr-auth-page input[type="text"],
.rr-auth-page input[type="email"],
.rr-auth-page input[type="password"],
.rr-auth-page input[type="tel"] {
    width: 100%;
    min-height: 44px;
    padding: var(--rr-space-2) var(--rr-space-3);
    color: var(--rr-color-text);
    background: var(--rr-color-surface-raised);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    font: inherit;
    outline: none;
    box-shadow: none;
}

.rr-auth-page input[type="text"]:focus,
.rr-auth-page input[type="email"]:focus,
.rr-auth-page input[type="password"]:focus,
.rr-auth-page input[type="tel"]:focus {
    border-color: var(--rr-color-primary);
    box-shadow: 0 0 0 3px var(--rr-color-primary-muted);
}

.rr-auth-page input[type="submit"],
.rr-auth-page button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: var(--rr-space-2) var(--rr-space-4);
    color: var(--rr-color-on-primary);
    background: var(--rr-color-primary);
    border: 1px solid var(--rr-color-primary);
    border-radius: var(--rr-radius);
    font: inherit;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.rr-auth-page input[type="submit"]:hover,
.rr-auth-page button:hover {
    background: var(--rr-color-primary-hover);
    border-color: var(--rr-color-primary-hover);
    transform: translateY(-1px);
}

.rr-auth-page input[type="submit"]:focus-visible,
.rr-auth-page button:focus-visible {
    outline: 2px solid var(--rr-color-primary);
    outline-offset: 2px;
}

.rr-auth-page .wa-login-forgotpassword-url,
.rr-auth-page .wa-signup-url,
.rr-auth-page .wa-login-url,
.rr-auth-page .wa-edit-login-link,
.rr-auth-page .wa-send-again-confirmation-code-link,
.rr-auth-message a {
    color: var(--rr-color-primary);
    font-weight: 650;
    text-decoration: none;
}

.rr-auth-page .wa-login-forgotpassword-url:hover,
.rr-auth-page .wa-signup-url a:hover,
.rr-auth-page .wa-login-url a:hover,
.rr-auth-page .wa-edit-login-link:hover,
.rr-auth-page .wa-send-again-confirmation-code-link:hover,
.rr-auth-message a:hover {
    color: var(--rr-color-primary-hover);
    text-decoration: underline;
}

.rr-auth-page .wa-login-forgotpassword-url {
    justify-self: start;
    font-size: 0.875rem;
}

.rr-auth-page .wa-buttons-wrapper,
.rr-auth-page .wa-forgotpassword-button {
    margin: var(--rr-space-1) 0 0;
}

.rr-auth-page .wa-signup-url,
.rr-auth-page .wa-login-url {
    margin-top: var(--rr-space-4);
    color: var(--rr-color-muted);
    font-size: 0.9375rem;
    text-align: center;
}

.rr-auth-page .wa-info-messages,
.rr-auth-page .wa-uncaught-errors,
.rr-auth-page .wa-error-msg,
.rr-auth-page .wa-error {
    color: var(--rr-color-danger);
    background: var(--rr-color-danger-muted);
    border: 1px solid color-mix(in srgb, var(--rr-color-danger) 35%, transparent);
    border-radius: var(--rr-radius);
    padding: var(--rr-space-3);
    font-size: 0.875rem;
}

.rr-auth-page .wa-info-messages:empty,
.rr-auth-page .wa-uncaught-errors:empty {
    display: none !important;
}

.rr-auth-page .wa-loading {
    margin-left: var(--rr-space-2);
    vertical-align: middle;
}

.rr-auth-message {
    text-align: center;
}

.rr-auth-message h2 {
    margin: 0 0 var(--rr-space-3);
    color: var(--rr-color-text);
    font-size: 1.375rem;
    line-height: 1.3;
}

.rr-auth-message p {
    margin: 0 0 var(--rr-space-3);
    color: var(--rr-color-muted);
}

.rr-auth-message p:last-child {
    margin-bottom: 0;
}

/* --- Typography --- */

.rr-hero {
    margin-bottom: var(--rr-space-6);
}

.rr-hero--catalog {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
    align-items: stretch;
    gap: var(--rr-space-5);
    padding: var(--rr-space-7);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--rr-color-primary) 10%, transparent), color-mix(in srgb, var(--rr-color-accent) 10%, transparent)),
        var(--rr-color-surface);
    border: 1px solid color-mix(in srgb, var(--rr-color-primary) 16%, transparent);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow);
}

.rr-hero__content {
    min-width: 0;
}

.rr-hero__panel,
.rr-novel-hero__aside {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--rr-space-2);
    min-height: 148px;
    padding: var(--rr-space-5);
    color: var(--rr-color-text);
    background: color-mix(in srgb, var(--rr-color-surface-raised) 82%, transparent);
    border: 1px solid color-mix(in srgb, var(--rr-color-surface-raised) 90%, transparent);
    border-radius: var(--rr-radius-lg);
}

.rr-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: var(--rr-space-3);
    color: var(--rr-color-accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.rr-stat__value {
    display: block;
    font-size: 2.25rem;
    line-height: 1;
    font-weight: 750;
    color: var(--rr-color-primary);
}

.rr-stat__label {
    color: var(--rr-color-muted);
    font-size: 0.9375rem;
}

.rr-hero__title {
    margin: 0 0 var(--rr-space-2);
    font-family: var(--rr-font-display);
    font-size: clamp(1.65rem, 1.2rem + 2vw, 2.4rem);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
    color: var(--rr-color-text);
}

.rr-hero__subtitle {
    margin: 0;
    font-size: 1rem;
    color: var(--rr-color-muted);
    max-width: 42rem;
}

/* --- Components: breadcrumbs --- */

.rr-breadcrumbs {
    margin-bottom: var(--rr-space-5);
    font-size: 0.875rem;
    color: var(--rr-color-muted);
}

.rr-breadcrumbs a {
    color: var(--rr-color-primary);
    text-decoration: none;
}

.rr-breadcrumbs a:hover,
.rr-breadcrumbs a:focus-visible {
    text-decoration: underline;
}

.rr-breadcrumbs__sep {
    margin: 0 var(--rr-space-2);
    color: var(--rr-color-border);
}

.rr-breadcrumbs__current {
    color: var(--rr-color-text);
}

/* --- Components: buttons --- */

.rr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--rr-space-2);
    padding: var(--rr-space-2) var(--rr-space-4);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    border-radius: var(--rr-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.rr-btn:focus-visible {
    outline: 2px solid var(--rr-color-primary);
    outline-offset: 2px;
}

.rr-btn--primary {
    background: var(--rr-color-primary);
    color: var(--rr-color-on-primary);
    border-color: var(--rr-color-primary);
}

.rr-btn--primary:hover {
    background: var(--rr-color-primary-hover);
    border-color: var(--rr-color-primary-hover);
    transform: translateY(-1px);
}

.rr-btn--secondary {
    background: var(--rr-color-bg);
    color: var(--rr-color-text);
    border-color: var(--rr-color-border);
}

.rr-btn--secondary:hover {
    background: var(--rr-color-border);
}

.rr-btn--ghost {
    background: transparent;
    color: var(--rr-color-muted);
    border-color: var(--rr-color-border);
}

.rr-btn--ghost:hover {
    background: var(--rr-color-bg);
    color: var(--rr-color-text);
}

.rr-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rr-space-2);
    justify-content: flex-end;
    margin-top: var(--rr-space-5);
}

/* --- Components: empty state --- */

.rr-empty {
    text-align: center;
    padding: var(--rr-space-7) var(--rr-space-4);
    background: var(--rr-color-surface);
    border: 1px dashed color-mix(in srgb, var(--rr-color-primary) 28%, transparent);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow);
}

.rr-empty__title {
    margin: 0 0 var(--rr-space-2);
    font-size: 1.125rem;
    font-weight: 600;
}

.rr-empty__text {
    margin: 0;
    color: var(--rr-color-muted);
}

/* --- Components: badge --- */

.rr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 2px var(--rr-space-3);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rr-color-primary);
    background: var(--rr-color-primary-muted);
    border-radius: 999px;
    flex-shrink: 0;
}

/* --- Catalog toolbar --- */

.rr-catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rr-space-4);
    flex-wrap: wrap;
    margin: 0 0 var(--rr-space-5);
}

.rr-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rr-space-2);
}

.rr-status-filter__link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: var(--rr-space-2) var(--rr-space-4);
    color: var(--rr-color-muted);
    background: var(--rr-color-surface-raised);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

.rr-status-filter__link:hover,
.rr-status-filter__link:focus-visible,
.rr-status-filter__link.is-active {
    color: var(--rr-color-primary);
    background: var(--rr-color-primary-muted);
    border-color: color-mix(in srgb, var(--rr-color-primary) 45%, transparent);
}

.rr-search {
    position: relative;
    display: block;
    width: min(100%, 420px);
}

.rr-search__icon {
    position: absolute;
    left: var(--rr-space-3);
    top: 50%;
    display: flex;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: var(--rr-color-muted);
    pointer-events: none;
}

.rr-search__icon svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.rr-search__input {
    width: 100%;
    min-height: 44px;
    padding: var(--rr-space-2) var(--rr-space-4) var(--rr-space-2) 42px;
    color: var(--rr-color-text);
    font: inherit;
    background: var(--rr-color-surface-raised);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    box-shadow: var(--rr-shadow);
    outline: none;
}

.rr-search__input:focus {
    border-color: var(--rr-color-primary);
    box-shadow: 0 0 0 3px var(--rr-color-primary-muted);
}

.rr-catalog-empty {
    margin-top: var(--rr-space-5);
}

/* --- Catalog: novel cards --- */

.rr-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--rr-space-5);
    margin: 0;
    padding: 0;
    list-style: none;
}

.rr-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--rr-color-surface);
    border: 1px solid var(--rr-color-border-strong);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.rr-card:hover,
.rr-card:focus-within {
    border-color: color-mix(in srgb, var(--rr-color-primary) 55%, transparent);
    box-shadow: var(--rr-shadow-md);
    transform: translateY(-2px);
}

.rr-card__cover {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 132px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--rr-color-primary) 14%, transparent), color-mix(in srgb, var(--rr-color-accent) 14%, transparent)),
        var(--rr-cover-gradient);
    color: var(--rr-color-primary);
    border-bottom: 1px solid var(--rr-color-border-strong);
}

.rr-card__cover svg {
    width: 48px;
    height: 48px;
    opacity: 0.7;
}

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

.rr-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--rr-space-5);
}

.rr-work-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px var(--rr-space-2);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
    width: fit-content;
    margin-bottom: var(--rr-space-3);
}

.rr-work-status--ongoing {
    background: color-mix(in srgb, var(--rr-color-accent) 14%, transparent);
    color: var(--rr-color-accent-strong);
}

.rr-work-status--abandoned {
    background: var(--rr-color-soft);
    color: var(--rr-color-muted);
}

.rr-work-status--completed {
    background: var(--rr-color-primary-muted);
    color: var(--rr-color-primary);
}

.rr-novel-meta .rr-work-status {
    margin-bottom: 0;
}

.rr-card__title {
    margin: 0 0 var(--rr-space-2);
    font-family: var(--rr-font-display);
    font-size: 1.1875rem;
    font-weight: 600;
    line-height: 1.3;
    text-wrap: balance;
}

.rr-card__title a {
    color: var(--rr-color-text);
    text-decoration: none;
}

.rr-card__title a:hover,
.rr-card__title a:focus-visible {
    color: var(--rr-color-primary);
}

.rr-card__original {
    margin: 0 0 var(--rr-space-2);
    font-size: 0.875rem;
    font-style: italic;
    color: var(--rr-color-muted);
}

.rr-card__author {
    margin: 0 0 var(--rr-space-3);
    font-size: 0.875rem;
    color: var(--rr-color-muted);
}

.rr-card__desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--rr-color-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rr-card__action {
    display: inline-flex;
    align-items: center;
    gap: var(--rr-space-2);
    width: fit-content;
    min-height: 34px;
    margin-top: auto;
    padding: 4px var(--rr-space-4);
    color: var(--rr-color-primary);
    border: 1px solid color-mix(in srgb, var(--rr-color-primary) 32%, transparent);
    border-radius: var(--rr-radius);
    font-size: 0.9rem;
    font-weight: 680;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.rr-card__action:hover,
.rr-card__action:focus-visible {
    color: var(--rr-color-primary-hover);
    background: var(--rr-color-primary-muted);
    border-color: color-mix(in srgb, var(--rr-color-primary) 55%, transparent);
    outline: none;
}

/* Legacy aliases (catalog) */
.novels-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--rr-space-5);
    margin-top: var(--rr-space-4);
}

.novel-item {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rr-color-border);
    padding: 0;
    border-radius: var(--rr-radius-lg);
    background: var(--rr-color-surface);
    box-shadow: var(--rr-shadow);
    overflow: hidden;
}

.novel-item h2 {
    margin-top: 0;
}

.novel-item h2 a {
    text-decoration: none;
    color: var(--rr-color-text);
}

.novel-item h2 a:hover {
    color: var(--rr-color-primary);
}

.original-name,
.author {
    color: var(--rr-color-muted);
    margin: var(--rr-space-1) 0;
}

.original-name {
    font-style: italic;
}

.description {
    margin-top: var(--rr-space-2);
    color: var(--rr-color-muted);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.rr-rich-text > :first-child {
    margin-top: 0;
}

.rr-rich-text > :last-child {
    margin-bottom: 0;
}

.rr-rich-text p,
.rr-rich-text ul,
.rr-rich-text ol,
.rr-rich-text blockquote {
    margin: 0 0 var(--rr-space-3);
}

.rr-rich-text ul,
.rr-rich-text ol {
    padding-left: var(--rr-space-5);
}

.rr-rich-text blockquote {
    padding-left: var(--rr-space-4);
    color: var(--rr-color-muted);
    border-left: 3px solid var(--rr-color-accent);
}

/* --- Novel page --- */

.rr-novel-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--rr-space-5);
    margin-bottom: var(--rr-space-6);
    padding: var(--rr-space-7);
    background: var(--rr-color-surface);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow);
}

.rr-novel-hero--with-cover {
    grid-template-columns: minmax(132px, 180px) minmax(0, 1fr);
}

.rr-novel-hero--with-aside {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
}

.rr-novel-hero--with-cover.rr-novel-hero--with-aside {
    grid-template-columns: minmax(132px, 180px) minmax(0, 1fr) minmax(180px, 240px);
}

.rr-novel-cover {
    align-self: start;
    width: 100%;
    max-width: 180px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--rr-color-soft);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    box-shadow: var(--rr-shadow);
}

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

.rr-novel-hero__content {
    min-width: 0;
}

.rr-novel-hero h1 {
    margin: 0 0 var(--rr-space-2);
    font-family: var(--rr-font-display);
    font-size: clamp(1.55rem, 1.15rem + 1.8vw, 2.2rem);
    font-weight: 650;
    line-height: 1.22;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.rr-novel-hero .original-name {
    font-size: 1.0625rem;
}

.rr-novel-hero .description {
    margin-top: var(--rr-space-4);
    font-size: 1rem;
    line-height: 1.7;
    color: #263241;
}

.rr-novel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rr-space-2);
    margin-top: var(--rr-space-3);
}

.rr-meta-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px var(--rr-space-3);
    color: var(--rr-color-muted);
    background: var(--rr-color-soft);
    border: 1px solid var(--rr-color-border);
    border-radius: 999px;
    font-size: 0.875rem;
}

.rr-meta-pill--link {
    color: var(--rr-color-primary);
    font-weight: 600;
    text-decoration: none;
}

.rr-meta-pill--link:hover {
    color: var(--rr-color-primary-hover);
    border-color: var(--rr-color-primary);
}

.rr-source-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.rr-source-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--rr-color-text) 14%, transparent);
    border-radius: 999px;
    color: color-mix(in srgb, var(--rr-color-text) 70%, var(--rr-color-muted));
    background: color-mix(in srgb, var(--rr-color-surface-raised) 72%, transparent);
    text-decoration: none;
    font-size: 13px;
}

.rr-source-chip.is-primary {
    border-color: color-mix(in srgb, var(--rr-color-success) 28%, transparent);
    background: var(--rr-color-success-muted);
    color: var(--rr-color-success);
}

.rr-source-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 var(--rr-space-4);
}

.rr-source-switcher__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 12px;
    color: var(--rr-color-text);
    background: var(--rr-color-surface);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    text-decoration: none;
}

.rr-source-switcher__link small {
    color: var(--rr-color-muted);
    font-size: 0.78rem;
}

.rr-source-switcher__link:hover,
.rr-source-switcher__link:focus-visible {
    color: var(--rr-color-primary);
    border-color: color-mix(in srgb, var(--rr-color-primary) 45%, transparent);
    outline: none;
}

.rr-source-switcher__link.is-active {
    color: var(--rr-color-primary);
    background: var(--rr-color-primary-muted);
    border-color: color-mix(in srgb, var(--rr-color-primary) 45%, transparent);
    font-weight: 700;
}

.rr-novel-hero__aside {
    align-items: flex-start;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--rr-color-accent) 10%, transparent), color-mix(in srgb, var(--rr-color-primary) 10%, transparent)),
        var(--rr-color-surface-raised);
    border-color: color-mix(in srgb, var(--rr-color-accent) 18%, transparent);
}

.rr-chapters-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rr-space-4);
    margin-bottom: var(--rr-space-4);
    padding: 0 var(--rr-space-1);
}

.rr-chapters-section__title {
    margin: 0;
    font-family: var(--rr-font-display);
    font-size: 1.3rem;
    font-weight: 600;
}

.rr-chapters-section__count {
    font-size: 0.875rem;
    color: var(--rr-color-muted);
}

.rr-chapter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: var(--rr-radius-lg);
    background: var(--rr-color-surface);
    overflow: hidden;
    box-shadow: var(--rr-shadow);
}

.rr-chapter-list__item {
    border-bottom: 1px solid var(--rr-color-border);
}

.rr-chapter-list__item:last-child {
    border-bottom: none;
}

.rr-chapter-list__link {
    display: flex;
    align-items: center;
    gap: var(--rr-space-4);
    min-height: 56px;
    padding: var(--rr-space-3) var(--rr-space-5);
    text-decoration: none;
    color: var(--rr-color-text);
    transition: background 0.15s;
}

.rr-chapter-list__link:hover,
.rr-chapter-list__link:focus-visible {
    background: linear-gradient(90deg, var(--rr-color-primary-muted), transparent);
    color: var(--rr-color-primary);
}

.rr-chapter-list__link:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--rr-color-primary);
}

.rr-chapter-list__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rr-chapter-list__source {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.08);
    color: #52606d;
    font-size: 12px;
    white-space: nowrap;
}

/* Legacy novel/chapter */
.novel-header {
    margin-bottom: var(--rr-space-6);
}

.chapters-list ul {
    list-style: none;
    padding: 0;
}

.chapters-list li {
    padding: 0;
    border-bottom: none;
}

.breadcrumbs {
    margin-bottom: var(--rr-space-5);
    color: var(--rr-color-muted);
    font-size: 0.875rem;
}

.breadcrumbs a {
    color: var(--rr-color-primary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* --- Reader --- */

.rr-reader {
    --rr-reader-header-height: 64px;
    --rr-reader-header-bg: color-mix(in srgb, var(--rr-color-surface-raised) 90%, transparent);
    --rr-reader-header-text: var(--rr-color-text);
    --rr-reader-width: var(--rr-measure);
    width: 100%;
    max-width: min(var(--rr-reader-width), calc(100vw - 24px));
    margin: 0 auto;
}

.rr-reader-header {
    position: sticky;
    top: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rr-space-3);
    min-height: var(--rr-reader-header-height);
    width: min(var(--rr-reader-width), 100%);
    margin: 0 auto;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    color: var(--rr-reader-header-text);
    background: var(--rr-reader-header-bg);
    border-bottom: 1px solid var(--rr-color-border-strong);
    box-shadow: var(--rr-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateY(0);
    transition: transform 0.22s ease;
}

.rr-reader-header.is-hidden {
    transform: translateY(-110%);
}

.reader-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: inherit;
    text-decoration: none;
    background: color-mix(in srgb, currentColor 5%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: var(--rr-radius);
    cursor: pointer;
}

.reader-header-btn:hover,
.reader-header-btn:focus-visible {
    background: color-mix(in srgb, currentColor 12%, transparent);
    outline: none;
}

.reader-header-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.reader-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: 0;
}

.reader-header-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--rr-color-on-primary);
    background: var(--rr-color-primary);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
}

.reader-header-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-chapter-switch {
    display: grid;
    grid-template-columns: minmax(88px, 1fr) minmax(116px, auto) minmax(88px, 1fr);
    align-items: center;
    gap: var(--rr-space-3);
    width: 100%;
    max-width: min(var(--rr-reader-width), calc(100vw - 24px));
    margin: 0 auto;
    padding: var(--rr-space-3) 0;
}

.reader-chapter-switch--top {
    padding-top: var(--rr-space-4);
}

.reader-chapter-switch--bottom {
    margin-top: var(--rr-space-5);
    padding-bottom: var(--rr-space-5);
}

.reader-chapter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 var(--rr-space-4);
    color: var(--rr-color-muted);
    background: transparent;
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.reader-chapter-btn:hover:not(:disabled),
.reader-chapter-btn:focus-visible:not(:disabled) {
    border-color: color-mix(in srgb, var(--rr-color-primary) 45%, transparent);
    background: var(--rr-color-primary-muted);
    color: var(--rr-color-primary);
    outline: none;
}

.reader-chapter-btn:disabled {
    color: #a7b0bd;
    background: #f8fafc;
    cursor: not-allowed;
}

.reader-chapter-btn:last-child {
    justify-self: end;
}

.reader-chapter-arrow {
    font-size: 1.8rem;
    line-height: 1;
}

.reader-chapter-label {
    font-size: 0.95rem;
}

.reader-chapter-status {
    min-width: 0;
    color: var(--rr-color-text);
    text-align: center;
    line-height: 1.25;
}

.reader-chapter-count {
    font-size: 1.1rem;
    font-weight: 600;
}

.reader-progress-value {
    margin-top: 2px;
    color: var(--rr-color-muted);
    font-size: 0.9rem;
}

.reader-current-title {
    max-width: 15rem;
    margin-top: 4px;
    color: var(--rr-color-muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-content-wrapper {
    width: 100%;
    max-width: min(var(--rr-reader-width), calc(100vw - 24px));
    margin: 0 auto;
    padding: var(--rr-space-3) 0;
}

.chapter-content {
    line-height: 1.8;
    font-size: 16px;
    color: var(--rr-color-text);
    background: var(--rr-color-surface);
    padding: var(--rr-space-7) var(--rr-space-4);
    border-radius: var(--rr-radius-lg);
    box-shadow: var(--rr-shadow);
    border: 1px solid var(--rr-color-border-strong);
}

.chapter-content .translated-text,
.chapter-content .original-text {
    word-wrap: break-word;
}

.chapter-content table {
    width: 100% !important;
    max-width: 100%;
    margin: var(--rr-space-4) 0;
    color: var(--rr-color-text);
    background: var(--rr-table-bg) !important;
    border: 1px solid var(--rr-color-border) !important;
    border-collapse: collapse;
}

.chapter-content table th,
.chapter-content table td {
    background: var(--rr-table-cell-bg) !important;
    border: 1px solid var(--rr-color-border) !important;
    padding: var(--rr-space-2) var(--rr-space-3);
    vertical-align: top;
}

.chapter-content table th {
    background: var(--rr-table-head-bg) !important;
    font-weight: 700;
}

.chapter-content table tr:nth-child(even) td {
    background: var(--rr-table-bg) !important;
}

.chapter-model-meta {
    display: inline-flex;
    margin-bottom: var(--rr-space-5);
    padding: 4px var(--rr-space-3);
    color: var(--rr-color-muted);
    background: var(--rr-color-soft);
    border: 1px solid var(--rr-color-border);
    border-radius: 999px;
    font-size: 0.8125rem;
}

.ct-term {
    cursor: pointer;
    padding: 0;
    color: #7c2d12;
    font-weight: 650;
    background: transparent;
    border: none;
    text-decoration: none;
    transition: color 0.15s ease;
}

.ct-term:hover {
    color: #9a3412;
}

.ct-term.is-customized {
    color: #2563eb;
    font-weight: 500;
}

.ct-term.is-customized:hover {
    color: #1d4ed8;
}

/* Modals */
.variants-modal {
    --rr-color-primary: #2364aa;
    --rr-color-primary-hover: #174f88;
    --rr-color-primary-muted: rgba(35, 100, 170, 0.14);
    --rr-color-accent: #0f8b8d;
    --rr-color-muted: #667085;
    --rr-color-border: #d9e2ec;
    --rr-color-surface: #ffffff;
    --rr-color-bg: #f6f8fb;
    --rr-color-text: #18202a;
    --rr-radius: 8px;
    --rr-radius-lg: 8px;
    --rr-shadow-md: 0 16px 40px rgba(24, 32, 42, 0.18);
    --rr-space-1: 4px;
    --rr-space-2: 8px;
    --rr-space-3: 12px;
    --rr-space-4: 16px;
    --rr-space-5: 24px;
    --rr-space-6: 32px;
    font-family: var(--rr-font-reading, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    color: var(--rr-color-text);
}

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

.settings-modal,
.variants-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--rr-space-4);
}

.settings-modal.active,
.variants-modal.active {
    display: flex;
}

.settings-panel,
.variants-modal-content {
    background: var(--rr-color-surface);
    border-radius: var(--rr-radius-lg);
    padding: var(--rr-space-5);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--rr-shadow-md);
    position: relative;
    border: 1px solid rgba(217, 226, 236, 0.95);
}

.variants-modal-content {
    max-width: 600px;
    padding: var(--rr-space-6);
}

.settings-panel h3 {
    margin: 0 0 var(--rr-space-5);
    font-size: 1.25rem;
    color: var(--rr-color-text);
    padding-right: var(--rr-space-6);
}

.settings-group {
    margin-bottom: var(--rr-space-5);
}

.settings-group label {
    display: block;
    margin-bottom: var(--rr-space-2);
    font-weight: 500;
    color: var(--rr-color-text);
}

.settings-group input[type="range"] {
    width: 100%;
    margin-bottom: var(--rr-space-2);
}

.settings-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    cursor: pointer;
}

.settings-value {
    display: inline-block;
    margin-left: var(--rr-space-2);
    color: var(--rr-color-muted);
    font-size: 0.875rem;
}

.settings-close,
.variants-modal-close {
    position: absolute;
    top: var(--rr-space-3);
    right: var(--rr-space-3);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--rr-color-muted);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--rr-radius);
    line-height: 1;
}

.settings-close:hover,
.settings-close:focus-visible,
.variants-modal-close:hover,
.variants-modal-close:focus-visible {
    color: var(--rr-color-text);
    background: var(--rr-color-bg);
    outline: none;
}

.rr-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rr-space-2);
    margin: 0 0 var(--rr-space-5);
    padding: var(--rr-space-2);
    background: var(--rr-color-soft);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius-lg);
}

.rr-settings-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 var(--rr-space-4);
    color: var(--rr-color-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--rr-radius);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.rr-settings-tab:hover,
.rr-settings-tab:focus-visible {
    color: var(--rr-color-text);
    background: #fff;
    border-color: rgba(217, 226, 236, 0.95);
    outline: none;
}

.rr-settings-tab.is-active {
    color: var(--rr-color-primary);
    background: #fff;
    border-color: rgba(35, 100, 170, 0.18);
    box-shadow: var(--rr-shadow);
}

.rr-settings-panels {
    min-width: 0;
}

.rr-settings-panel {
    display: none;
}

.rr-settings-panel.is-active {
    display: block;
}

.rr-settings-panel .field-group {
    margin-bottom: 0;
}

.rr-provider-profiles {
    display: grid;
    gap: var(--rr-space-4);
}

.rr-provider-profile {
    padding: var(--rr-space-4);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    background: #fff;
}

.rr-provider-profile.is-active {
    border-color: rgba(36, 139, 75, 0.55);
    background: #f7fff8;
}

.rr-provider-profile--new {
    border-style: dashed;
}

.rr-provider-profile__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--rr-space-4);
    margin-bottom: var(--rr-space-4);
    flex-wrap: wrap;
}

.rr-provider-profile__actions {
    display: flex;
    gap: var(--rr-space-2);
    flex-wrap: wrap;
}

.rr-image-api-code,
.rr-image-api-curl {
    display: block;
    max-width: 820px;
    padding: 8px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    background: #f5f5f5;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
}

.rr-image-api-token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-image-api-token-row input {
    width: min(100%, 520px);
    font-family: monospace;
}

.rr-theme-presets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rr-space-2);
    margin-bottom: var(--rr-space-2);
}

.rr-theme-presets .rr-btn {
    flex: 1;
    min-width: 5rem;
}

.rr-theme-presets .rr-btn.is-active {
    border-color: var(--rr-color-primary);
    background: var(--rr-color-primary-muted);
    color: var(--rr-color-primary);
}

.variants-modal-header {
    margin-bottom: var(--rr-space-5);
    padding-bottom: var(--rr-space-4);
    border-bottom: 1px solid var(--rr-color-border);
    padding-right: var(--rr-space-6);
}

.variants-modal-header h3 {
    margin: 0 0 var(--rr-space-2);
    font-size: 1.25rem;
    color: var(--rr-color-text);
    line-height: 1.25;
}

.variants-modal-original {
    font-size: 1rem;
    color: var(--rr-color-muted);
    font-style: italic;
    overflow-wrap: anywhere;
}

.variants-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.variants-list-item {
    display: flex;
    align-items: center;
    gap: var(--rr-space-3);
    padding: var(--rr-space-4);
    margin-bottom: var(--rr-space-2);
    background: #ffffff;
    border-radius: var(--rr-radius);
    border: 1px solid var(--rr-color-border);
    border-left: 3px solid var(--rr-color-primary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.variants-list-item:hover,
.variants-list-item:focus-visible {
    background: var(--rr-color-bg);
    border-color: rgba(35, 100, 170, 0.55);
    box-shadow: 0 0 0 3px var(--rr-color-primary-muted);
    outline: none;
    transform: translateY(-1px);
}

.variants-list-item-main {
    flex: 1;
    min-width: 0;
}

.variants-list-item-text {
    font-size: 1rem;
    color: var(--rr-color-text);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.variants-list-item-type {
    font-size: 0.75rem;
    color: var(--rr-color-muted);
    margin-top: var(--rr-space-1);
}

.variants-list-item-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--rr-color-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--rr-radius);
    cursor: pointer;
}

.variants-list-item-delete:hover,
.variants-list-item-delete:focus-visible {
    color: #b42318;
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.22);
    outline: none;
}

.variants-loading,
.variants-empty {
    text-align: center;
    padding: var(--rr-space-5);
    color: var(--rr-color-muted);
    background: var(--rr-color-bg);
    border: 1px dashed var(--rr-color-border);
    border-radius: var(--rr-radius);
}

.variants-custom {
    margin-top: var(--rr-space-5);
    padding-top: var(--rr-space-5);
    border-top: 1px solid var(--rr-color-border);
}

.variants-custom-input {
    width: 100%;
    min-height: 44px;
    padding: var(--rr-space-3);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    font-size: 1rem;
    margin-bottom: var(--rr-space-2);
    box-sizing: border-box;
    font-family: inherit;
    color: var(--rr-color-text);
    background: var(--rr-color-surface);
    outline: none;
}

.variants-custom-input:focus {
    border-color: var(--rr-color-primary);
    box-shadow: 0 0 0 3px var(--rr-color-primary-muted);
}

.variants-custom-button {
    width: 100%;
    min-height: 44px;
    padding: var(--rr-space-3);
    background: var(--rr-color-primary);
    color: #fff;
    border: none;
    border-radius: var(--rr-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.variants-custom-button:hover {
    background: var(--rr-color-primary-hover);
}

.variants-custom-button:focus-visible {
    outline: 2px solid var(--rr-color-primary);
    outline-offset: 2px;
}

.variants-custom-label {
    display: block;
    margin-bottom: var(--rr-space-2);
    font-size: 0.875rem;
    color: var(--rr-color-muted);
    font-weight: 500;
}

.chapter-header {
    margin-bottom: var(--rr-space-5);
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin: var(--rr-space-5) 0;
    padding: var(--rr-space-4) 0;
    border-top: 1px solid var(--rr-color-border);
    border-bottom: 1px solid var(--rr-color-border);
}

.chapter-navigation a {
    text-decoration: none;
    color: var(--rr-color-primary);
}

/* Backend */
.rr-admin-page {
    --rr-color-primary: #2364aa;
    --rr-color-primary-hover: #174f88;
    --rr-color-primary-muted: rgba(35, 100, 170, 0.14);
    --rr-color-text: #18202a;
    --rr-color-muted: #667085;
    --rr-color-border: #d9e2ec;
    --rr-color-surface: #ffffff;
    --rr-admin-border: #d9e2ec;
    --rr-admin-muted: #667085;
    --rr-admin-soft: #f7f9fb;
    --rr-admin-text: #18202a;
    --rr-admin-surface: #ffffff;
    --rr-admin-bg: #ffffff;
    --rr-admin-danger: #d32f2f;
    color: var(--rr-admin-text);
    background: var(--rr-admin-bg);
}

html[data-theme="dark"] .rr-admin-page {
    --rr-color-primary: #8ab4f8;
    --rr-color-primary-hover: #aecbfa;
    --rr-color-primary-muted: rgba(138, 180, 248, 0.18);
    --rr-color-text: #e8eaed;
    --rr-color-muted: #aab3c2;
    --rr-color-border: #3c4656;
    --rr-color-surface: #202733;
    --rr-admin-border: #3c4656;
    --rr-admin-muted: #aab3c2;
    --rr-admin-soft: #252d3a;
    --rr-admin-text: #e8eaed;
    --rr-admin-surface: #202733;
    --rr-admin-bg: #161b22;
    --rr-admin-danger: #ff8a80;
}

.rr-admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rr-admin-border);
}

.rr-admin-title {
    min-width: 0;
}

.rr-admin-title h1 {
    margin: 4px 0 0;
    font-size: 24px;
    line-height: 1.25;
    color: var(--rr-admin-text);
}

.rr-admin-meta {
    margin-top: 6px;
    color: var(--rr-admin-muted);
    font-size: 13px;
}

.rr-admin-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--rr-admin-muted);
    font-size: 13px;
    text-decoration: none;
}

.rr-admin-back:hover {
    color: var(--rr-color-primary);
    text-decoration: underline;
}

.rr-admin-actions,
.rr-admin-source-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-admin-source-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px 16px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--rr-admin-soft);
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
}

.rr-admin-source-meta {
    min-width: 0;
}

.rr-admin-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--rr-admin-muted);
    font-size: 12px;
    font-weight: 650;
}

.rr-admin-source-url {
    display: block;
    color: var(--rr-admin-text);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rr-admin-source-url.is-primary,
.rr-novel-source-row.is-primary {
    border-left: 3px solid #2f8f46;
}

.rr-novel-source-list {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.rr-novel-source-row,
.rr-novel-source-add {
    border: 1px solid var(--rr-admin-border);
    border-radius: 6px;
    padding: 12px;
    background: var(--rr-admin-surface);
}

.rr-novel-source-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(120px, auto) minmax(80px, auto);
    gap: 10px;
    align-items: end;
}

.rr-novel-source-grid label {
    display: grid;
    gap: 4px;
}

.rr-novel-source-row input[type="url"],
.rr-novel-source-row input[type="text"],
.rr-novel-source-row input[type="number"],
.rr-novel-source-row select,
.rr-novel-source-row textarea {
    width: 100%;
    box-sizing: border-box;
}

.rr-novel-source-row textarea {
    margin-top: 8px;
}

.rr-novel-source-merge-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--rr-admin-border);
}

.rr-novel-source-merge-panel form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.rr-admin-json-preview {
    flex-basis: 100%;
    max-height: 260px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 10px;
    color: var(--rr-admin-text);
    background: var(--rr-admin-soft);
    border: 1px solid var(--rr-admin-border);
    border-radius: 6px;
    white-space: pre-wrap;
}

.rr-chapter-source-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--rr-color-primary-muted);
    color: var(--rr-color-primary);
    font-size: 12px;
}

.rr-admin-status-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--rr-admin-muted);
    font-size: 13px;
}

.rr-admin-status-row--spaced {
    margin-top: 8px;
}

.rr-admin-status-row--compact {
    margin-top: 4px;
}

.rr-inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.rr-inline-form--wrap {
    flex-wrap: wrap;
}

.rr-input-s {
    width: 120px;
}

.rr-input-m {
    width: 100%;
    max-width: 500px;
}

.rr-input-l,
.rr-textarea-l {
    width: 100%;
    max-width: 700px;
}

.rr-mb-xs {
    margin-bottom: 8px;
}

.rr-mt-xs {
    margin-top: 5px;
}

.rr-mt-s {
    margin-top: 10px;
}

.rr-mt-m {
    margin-top: 20px;
}

.rr-admin-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--rr-admin-border);
}

.rr-button-primary {
    color: #fff;
    background: var(--rr-color-primary);
}

.rr-code-textarea {
    width: 100%;
    font-family: Consolas, Monaco, monospace;
}

.rr-muted-dash {
    color: var(--rr-admin-muted);
}

.rr-action-separator {
    margin: 0 5px;
    color: var(--rr-admin-muted);
}

.rr-source-setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.rr-source-setting-row__label {
    min-width: 120px;
}

.rr-code-block {
    display: block;
    max-width: 700px;
    padding: 8px;
    color: var(--rr-admin-text);
    overflow-wrap: anywhere;
    background: var(--rr-admin-soft);
    border-radius: 6px;
}

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

.rr-safe-full-compare textarea {
    width: 100%;
    min-height: 240px;
}

.rr-chapter-editor {
    box-sizing: border-box;
    width: calc(100vw - 32px);
    max-width: 100%;
    margin: 18px 0;
    overflow-x: auto;
    border: 1px solid var(--rr-admin-border);
    border-radius: 6px;
    background: var(--rr-admin-surface);
}

.rr-chapter-editor__toolbar {
    min-width: 960px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--rr-admin-border);
    background: var(--rr-admin-soft);
}

.rr-chapter-editor__tabs { display: inline-flex; gap: 2px; }
.rr-chapter-editor__tab { min-width: 72px; }
.rr-chapter-editor__tab.is-active { color: #fff; background: var(--rr-color-primary); }

.rr-chapter-editor__grid {
    min-width: 960px;
    display: grid;
    grid-template-columns: repeat(3, minmax(300px, 1fr));
}

.rr-chapter-editor__pane {
    min-width: 0;
    padding: 10px;
    border-right: 1px solid var(--rr-admin-border);
}

.rr-chapter-editor__pane:last-child { border-right: 0; }

.rr-chapter-editor__pane h3 {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0;
}

.rr-chapter-editor__surface {
    position: relative;
    height: 520px;
    border: 1px solid var(--rr-admin-border);
    background: var(--rr-admin-surface);
}

.rr-chapter-editor__surface:focus-within {
    border-color: var(--rr-color-primary);
    box-shadow: 0 0 0 1px var(--rr-color-primary);
}

.rr-chapter-editor__surface textarea,
.field .value .rr-chapter-editor__surface textarea {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 10px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    font: 13px/1.5 Consolas, "Courier New", monospace;
    letter-spacing: 0;
    white-space: pre-wrap;
    overflow: auto;
}

.rr-chapter-editor__mirror {
    position: absolute;
    z-index: 1;
    inset: 0;
    box-sizing: border-box;
    padding: 10px;
    overflow: hidden;
    color: transparent;
    font: 13px/1.5 Consolas, "Courier New", monospace;
    letter-spacing: 0;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    pointer-events: none;
}

.rr-chapter-editor__mirror mark {
    color: transparent;
    background: #ffe48a;
    box-shadow: 0 0 0 1px #e5b92f;
}

.rr-chapter-editor__mirror mark.is-uncertain {
    background: #ffd3a8;
    box-shadow: 0 0 0 1px #d9802f;
}

.rr-chapter-editor__pane .rr-admin-actions { margin-top: 8px; }
.rr-chapter-editor [hidden] { display: none !important; }

.box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--rr-space-5);
}

.field-group {
    margin-bottom: var(--rr-space-5);
}

.field {
    margin-bottom: var(--rr-space-4);
}

.field .name {
    font-weight: bold;
    margin-bottom: var(--rr-space-1);
}

.field .name .required {
    color: #dc2626;
}

.field .value input[type="text"],
.field .value input[type="url"],
.field .value input[type="password"],
.field .value input[type="number"],
.field .value textarea,
.field .value select {
    width: 100%;
    max-width: 500px;
    padding: var(--rr-space-2);
    border: 1px solid var(--rr-color-border);
    border-radius: var(--rr-radius);
    color: var(--rr-color-text);
    background: var(--rr-color-surface);
}

.field .value textarea {
    resize: vertical;
}

.status {
    padding: 3px 8px;
    border-radius: var(--rr-radius);
    font-size: 12px;
}

.status.green {
    background: #d4edda;
    color: #155724;
}

.status.yellow {
    background: #fff3cd;
    color: #856404;
}

.status.gray {
    background: #e9ecef;
    color: #495057;
}

.rr-backend-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px;
    background: #f7f9fb;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
}

.rr-chapter-toolbar {
    align-items: flex-start;
    margin-bottom: 12px;
}

.rr-server-clock {
    position: fixed;
    top: 58px;
    right: 16px;
    z-index: 1100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: #18202a;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(24, 32, 42, 0.12);
    font-size: 12px;
    line-height: 1;
}

.rr-server-clock__label {
    color: #667085;
    font-weight: 600;
    text-transform: uppercase;
}

.rr-server-clock__time {
    min-width: 56px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.rr-backend-filters,
.rr-bulk-panel {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-novels-toolbar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.rr-backend-filters label,
.rr-inline-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--rr-admin-muted);
}

.rr-backend-filters select,
.rr-backend-filters input[type="search"],
.rr-bulk-panel select {
    min-height: 34px;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
    color: var(--rr-admin-text);
    background: var(--rr-admin-surface);
}

.rr-backend-filters input[type="search"] {
    min-width: 220px;
    padding: 0 10px;
}

.rr-inline-label select {
    min-width: 64px;
}

.rr-bulk-counter,
.rr-inline-status {
    color: var(--rr-admin-muted);
    font-size: 13px;
}

.rr-bulk-counter {
    align-self: center;
    min-width: 92px;
}

.rr-table-scroll {
    overflow-x: auto;
}

.rr-chapter-nsfw-toggle {
    min-width: 42px;
    font-weight: 700;
}

.rr-chapter-nsfw-toggle.is-active {
    color: #fff;
    background: #8e24aa;
    border-color: #8e24aa;
}

.rr-backend-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
    color: var(--rr-admin-muted);
    font-size: 13px;
}

.rr-backend-pagination__summary {
    font-variant-numeric: tabular-nums;
}

.rr-backend-pagination__nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rr-backend-pagination__link {
    min-width: 34px;
    text-align: center;
}

.rr-backend-pagination__link.is-disabled {
    pointer-events: none;
    opacity: 0.58;
}

.rr-backend-pagination__link.is-active {
    color: #fff;
    background: #2364aa;
    border-color: #2364aa;
}

.rr-backend-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--rr-admin-muted);
}

.rr-admin-table {
    min-width: 1080px;
}

.rr-admin-table th {
    white-space: nowrap;
}

.rr-admin-table td {
    vertical-align: top;
}

.rr-checkbox-cell {
    width: 32px;
    text-align: center;
}

.rr-admin-title-cell {
    min-width: 220px;
    font-weight: 600;
}

.rr-admin-count-cell {
    width: 130px;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rr-admin-action-links {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    min-width: 360px;
    font-size: 13px;
}

.rr-admin-action-links a,
.rr-admin-action-links .button {
    white-space: nowrap;
}

.rr-admin-action-links .button {
    margin: 0;
}

.rr-danger-link {
    color: var(--rr-admin-danger, #d32f2f);
}

.rr-admin-empty {
    padding: 36px 20px;
    text-align: center;
    border: 1px dashed var(--rr-admin-border);
    border-radius: 8px;
    background: var(--rr-admin-surface);
}

.rr-admin-empty h2 {
    margin: 0 0 8px;
    color: var(--rr-admin-text);
    font-size: 18px;
    line-height: 1.3;
}

.rr-admin-empty p {
    margin: 0 0 18px;
    color: var(--rr-admin-muted);
}

.rr-admin-home-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.rr-admin-home-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 12px;
    color: var(--rr-admin-text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
}

.rr-admin-home-link:hover {
    border-color: #9bbce0;
    color: #2364aa;
    text-decoration: none;
}

.rr-admin-home-link i {
    color: #2364aa;
}

.rr-image-chat {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 16px;
    min-height: 620px;
}

.rr-image-chat__sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding-right: 16px;
    border-right: 1px solid var(--rr-admin-border);
}

.rr-image-chat__new {
    justify-content: center;
    text-align: center;
}

.rr-image-chat__session-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 230px);
    overflow-y: auto;
    padding-right: 2px;
}

.rr-image-chat__session {
    display: block;
    padding: 10px 12px;
    color: var(--rr-admin-text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
}

.rr-image-chat__session:hover,
.rr-image-chat__session.is-current {
    color: #184f8b;
    text-decoration: none;
    border-color: #8db5df;
    background: #f0f6fc;
}

.rr-image-chat__session-title,
.rr-image-chat__session-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rr-image-chat__session-title {
    font-weight: 650;
}

.rr-image-chat__session-meta,
.rr-image-chat__sidebar-empty {
    margin-top: 4px;
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__sidebar-empty {
    padding: 12px;
    border: 1px dashed var(--rr-admin-border);
    border-radius: 8px;
    background: #fff;
}

.rr-image-chat__workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rr-image-chat__workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.rr-image-chat__workspace-head h2 {
    margin: 0;
    color: var(--rr-admin-text);
    font-size: 20px;
    line-height: 1.3;
}

.rr-image-chat__messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 330px;
    max-height: calc(100vh - 390px);
    overflow-y: auto;
    padding: 2px 4px 12px;
}

.rr-image-chat__message {
    width: min(720px, 100%);
    padding: 12px;
    background: #fff;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
}

.rr-image-chat__message--user {
    align-self: flex-end;
    background: #f7f9fb;
}

.rr-image-chat__message--assistant {
    align-self: flex-start;
}

.rr-image-chat__message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__message-head strong {
    color: var(--rr-admin-text);
    font-size: 13px;
}

.rr-image-chat__prompt-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.rr-image-chat__thumb {
    margin: 10px 0 0;
    max-width: 520px;
}

.rr-image-chat__message--user .rr-image-chat__thumb {
    max-width: 260px;
}

.rr-image-chat__thumb img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    background: #f7f9fb;
    border: 1px solid #e5eaf0;
    border-radius: 8px;
}

.rr-image-chat__thumb figcaption {
    margin-top: 6px;
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 13px;
}

.rr-image-chat__message-details,
.rr-image-chat__revised {
    margin-top: 8px;
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__revised span {
    display: block;
    margin-bottom: 4px;
    font-weight: 650;
}

.rr-image-chat__revised p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.rr-image-chat__error {
    padding: 10px 12px;
    color: #b42318;
    background: #fff1f0;
    border: 1px solid #f4b8b2;
    border-radius: 8px;
}

.rr-image-chat__empty {
    padding: 28px 18px;
    text-align: center;
    background: #fff;
    border: 1px dashed var(--rr-admin-border);
    border-radius: 8px;
}

.rr-image-chat__empty h3 {
    margin: 0 0 8px;
    color: var(--rr-admin-text);
    font-size: 18px;
}

.rr-image-chat__empty p {
    margin: 0 0 14px;
    color: var(--rr-admin-muted);
}

.rr-image-chat__composer {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--rr-admin-border);
}

.rr-image-chat__mode-switch,
.rr-image-chat__controls {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-image-chat__mode-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--rr-admin-text);
    background: #fff;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
}

.rr-image-chat__mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rr-image-chat__mode-option.is-active {
    color: #fff;
    background: #2364aa;
    border-color: #2364aa;
}

.rr-image-chat__prompt,
.rr-image-chat__file label,
.rr-image-chat__controls label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__prompt textarea {
    width: 100%;
    min-height: 108px;
    padding: 10px;
    color: var(--rr-admin-text);
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
    resize: vertical;
}

.rr-image-chat__file.is-hidden {
    display: none;
}

.rr-image-chat__file input[type="file"] {
    min-height: 34px;
}

.rr-image-chat__size {
    display: grid;
    gap: 6px;
    min-width: min(100%, 390px);
}

.rr-image-chat__control-label {
    color: var(--rr-admin-muted);
    font-size: 12px;
}

.rr-image-chat__size-presets,
.rr-image-chat__size-fields {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-image-chat__size-preset {
    min-height: 34px;
    margin: 0;
}

.rr-image-chat__size-preset.is-active {
    color: #fff;
    background: #2364aa;
    border-color: #2364aa;
}

.rr-image-chat__size-fields label {
    flex: 1 1 110px;
}

.rr-image-chat__size-fields input {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
    background: #fff;
}

.rr-image-chat__size-hint {
    min-height: 16px;
}

.rr-image-chat__size-hint.is-error {
    color: #b42318;
}

.rr-image-chat__controls select {
    min-width: 140px;
    min-height: 34px;
    border: 1px solid var(--rr-admin-border);
    border-radius: 8px;
    background: #fff;
}

.rr-image-chat__controls button {
    min-height: 34px;
}

.rr-inline-status.is-error {
    color: #b42318;
}

@media (max-width: 760px) {
    .rr-admin-header {
        flex-direction: column;
        align-items: stretch;
    }

    .rr-admin-title h1 {
        font-size: 20px;
    }

    .rr-admin-source-panel {
        grid-template-columns: 1fr;
    }

    .rr-admin-source-actions,
    .rr-backend-filters,
    .rr-bulk-panel {
        width: 100%;
    }

    .rr-novels-toolbar-actions {
        width: 100%;
        align-items: stretch;
    }

    .rr-server-clock {
        top: auto;
        right: 10px;
        bottom: 10px;
    }

    .rr-image-chat {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .rr-image-chat__sidebar {
        padding-right: 0;
        padding-bottom: 12px;
        border-right: none;
        border-bottom: 1px solid var(--rr-admin-border);
    }

    .rr-image-chat__session-list {
        max-height: 220px;
    }

    .rr-image-chat__workspace-head {
        flex-direction: column;
    }

    .rr-image-chat__messages {
        max-height: none;
    }

    .rr-image-chat__message {
        width: 100%;
    }

    .rr-image-chat__message--user,
    .rr-image-chat__message--assistant {
        align-self: stretch;
    }

    .rr-image-chat__controls,
    .rr-image-chat__mode-switch {
        align-items: stretch;
    }

    .rr-image-chat__controls label,
    .rr-image-chat__controls button,
    .rr-image-chat__mode-option {
        flex: 1 1 160px;
    }

    .rr-image-chat__size {
        width: 100%;
    }
}

.rr-form-subfield {
    margin-top: 10px;
}

.rr-form-subfield label {
    display: block;
    margin-bottom: 4px;
    color: #667085;
    font-size: 12px;
}

.rr-dictionary-manual-forms {
    width: 100%;
}

.rr-dictionary-manual-forms__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.rr-dictionary-manual-forms__grid input {
    width: 100%;
}

@media (max-width: 720px) {
    .rr-dictionary-manual-forms__grid {
        grid-template-columns: 1fr;
    }
}

.rr-supported-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.rr-supported-source {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid #d6dee8;
    border-radius: 4px;
    background: #f8fafc;
    color: #1f2937;
}

.rr-supported-source small {
    color: #6b7280;
}

.rr-novel-cover-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.rr-novel-cover-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #d6dee8;
    border-radius: 6px;
    color: #667085;
    font-size: 11px;
    text-align: center;
}

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

.rr-telegram-chat {
    max-width: 720px;
    padding: 12px;
    background: #f7f9fb;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
}

.rr-telegram-chat__toolbar,
.rr-telegram-chat__composer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.rr-telegram-chat__log {
    min-height: 160px;
    max-height: 320px;
    margin: 12px 0;
    padding: 10px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
}

.rr-telegram-chat__empty,
.rr-telegram-chat__message-meta {
    color: #667085;
    font-size: 12px;
}

.rr-telegram-chat__message {
    padding: 8px 0;
    border-bottom: 1px solid #eef2f7;
}

.rr-telegram-chat__message:last-child {
    border-bottom: none;
}

.rr-telegram-chat__message-text {
    margin-top: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.rr-telegram-chat__composer textarea {
    flex: 1;
    min-width: 260px;
    max-width: 560px;
    width: 100%;
    padding: 8px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
}

.rr-disclaimer-preview {
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #f8fafc;
}

.rr-disclaimer-preview__body {
    margin-top: 10px;
}

.rr-disclaimer-list {
    display: grid;
    gap: 16px;
}

.rr-disclaimer-card {
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.rr-disclaimer-card__head,
.rr-disclaimer-card__body,
.rr-disclaimer-toggle {
    display: flex;
    gap: 12px;
}

.rr-disclaimer-card__head {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.rr-disclaimer-card__body {
    align-items: stretch;
    flex-wrap: wrap;
}

.rr-disclaimer-block {
    flex: 1 1 240px;
    min-width: 0;
}

.rr-disclaimer-block__title {
    margin-bottom: 8px;
    color: #667085;
    font-size: 12px;
}

.rr-disclaimer-context {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    overflow-wrap: anywhere;
}

.rr-disclaimer-context--candidate {
    background: #fff7ed;
    border-color: #fdba74;
}

.rr-disclaimer-context--empty {
    color: #98a2b3;
}

.rr-disclaimer-save-status {
    min-height: 18px;
    margin-top: 10px;
    color: #16803c;
    font-size: 12px;
}

.rr-disclaimer-save-status.is-error {
    color: #b42318;
}

/* --- Responsive --- */

@media (max-width: 640px) {
    .rr-container {
        padding: var(--rr-space-4) var(--rr-space-3) var(--rr-space-6);
    }

    .rr-public-footer {
        margin-top: var(--rr-space-6);
        padding-top: var(--rr-space-4);
        text-align: left;
    }

    .rr-auth-page {
        min-height: auto;
    }

    .rr-auth-shell {
        padding-top: 0;
    }

    .rr-auth-card {
        padding: var(--rr-space-5);
    }

    .rr-auth-intro h1 {
        font-size: 1.5rem;
    }

    .rr-hero--catalog,
    .rr-novel-hero {
        grid-template-columns: 1fr;
        padding: var(--rr-space-5);
    }

    .rr-hero__panel,
    .rr-novel-hero__aside {
        min-height: 0;
        padding: var(--rr-space-4);
    }

    .rr-hero__title {
        font-size: 1.5rem;
    }

    .rr-catalog-grid,
    .novels-list {
        grid-template-columns: 1fr;
    }

    body[data-page="frontend-chapter"] .rr-app {
        background: #fff;
    }

    body[data-page="frontend-chapter"] .rr-container {
        max-width: none;
        padding: 0;
    }

    body[data-page="frontend-chapter"] .rr-main {
        min-height: 100vh;
    }

    .rr-reader {
        max-width: none;
        width: 100%;
    }

    .rr-reader-header {
        position: fixed;
        top: 0;
        left: 50%;
        right: auto;
        width: min(var(--rr-reader-width), 100%);
        max-width: 100%;
        transform: translateX(-50%);
    }

    .rr-reader-header.is-hidden {
        transform: translateX(-50%) translateY(-110%);
    }

    .reader-header-brand {
        font-size: 1.15rem;
    }

    .reader-header-mark {
        width: 32px;
        height: 32px;
    }

    .reader-chapter-switch {
        grid-template-columns: minmax(76px, 1fr) minmax(106px, auto) minmax(76px, 1fr);
        gap: 8px;
        padding-left: 12px;
        padding-right: 12px;
        border-top: 1px solid var(--rr-color-border-strong);
        border-bottom: 1px solid var(--rr-color-border-strong);
        background: #fff;
    }

    .reader-chapter-switch--top {
        padding-top: calc(var(--rr-reader-header-height) + 14px);
        border-top: none;
    }

    .reader-chapter-switch--bottom {
        margin-top: 0;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .reader-chapter-btn {
        min-height: 44px;
        padding: 0 12px;
        box-shadow: none;
    }

    .reader-chapter-label {
        font-size: 0.95rem;
    }

    .reader-chapter-count {
        font-size: 1rem;
    }

    .reader-current-title {
        display: -webkit-box;
        max-width: min(48vw, 15rem);
        margin-right: auto;
        margin-left: auto;
        overflow: hidden;
        line-height: 1.25;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .chapter-content-wrapper {
        max-width: none;
        padding: 0;
    }

    .chapter-content {
        padding: 26px 6px 72px;
        border: none;
        border-radius: 0;
        box-shadow: none;
        font-size: 18px;
        line-height: 1.78;
    }

    .rr-chapters-section__head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 1024px) {
    .rr-hero__title {
        font-size: 2.25rem;
    }

    .rr-container {
        padding: var(--rr-space-6) var(--rr-space-5);
    }
}
