:root {
    --bg: #050505;
    --bg-soft: #12090a;
    --panel: rgba(21, 10, 12, 0.78);
    --panel-strong: rgba(12, 12, 16, 0.88);
    --blood: #cf2f2f;
    --blood-soft: rgba(207, 47, 47, 0.14);
    --ember: #ff8c5a;
    --void: #84d0c7;
    --bone: #f6eee8;
    --mist: #afa095;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --content: 1180px;
    --reader-size: 18px;
    --reader-line-height: 1.95;
    --reader-width: 820px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--bone);
    font-family: "Bricolage Grotesque", sans-serif;
    -webkit-text-size-adjust: 100%;
    background:
        radial-gradient(
            circle at top,
            rgba(207, 47, 47, 0.22),
            transparent 28%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(132, 208, 199, 0.14),
            transparent 22%
        ),
        linear-gradient(180deg, #090607 0%, #050505 45%, #0b0708 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 95%);
}

a {
    color: inherit;
}

header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    background: rgba(8, 10, 16, 0.9);
    border-bottom: 1px solid var(--line);
}

.header-shell {
    max-width: var(--content);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    min-width: 0;
}

.brand-mark {
    width: clamp(90px, 9vw, 140px);
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.brand-mark::after {
    display: none;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.38));
}

.brand-copy {
    display: none;
}

.nav-row,
.mobile-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-row {
    white-space: nowrap;
    padding: 2px;
    scrollbar-width: none;
    flex: 1 1 auto;
    min-width: 0;
    /* Removed overflow:hidden to allow dropdowns */
}

/* Dropdown styling */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(8, 10, 16, 0.95);
    backdrop-filter: blur(20px);
    min-width: 160px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 8px;
    z-index: 100;
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 4px;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: flex;
}

.nav-dropdown-content .nav-btn {
    text-align: left;
    width: 100%;
    justify-content: flex-start;
}

.nav-row::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--mist);
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.25s ease;
    flex: 0 0 auto;
    white-space: nowrap;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--bone);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.status-pill {
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(207, 47, 47, 0.14),
        rgba(132, 208, 199, 0.1)
    );
    border: 1px solid var(--line);
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bone);
}

.lang-toggle {
    background: linear-gradient(
        135deg,
        rgba(132, 208, 199, 0.15),
        rgba(132, 208, 199, 0.08)
    ) !important;
    border-color: rgba(132, 208, 199, 0.3) !important;
    color: #a8ddd6 !important;
}

.lang-toggle:hover {
    background: linear-gradient(
        135deg,
        rgba(132, 208, 199, 0.25),
        rgba(132, 208, 199, 0.15)
    ) !important;
    border-color: rgba(132, 208, 199, 0.5) !important;
    color: #c0e4de !important;
    box-shadow: 0 0 20px rgba(132, 208, 199, 0.2) !important;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 6px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bone);
    font-size: 12px;
    max-width: 160px;
    flex: 0 0 auto;
}

.user-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.08);
}

.user-chip .user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main {
    max-width: var(--content);
    margin: 0 auto;
    padding: 32px 20px 100px;
}

.view {
    display: none;
    animation: fadeIn 0.35s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 28px;
}

.hero-card,
.card,
.quote-card {
    position: relative;
    overflow: hidden;
    background: rgba(18, 20, 28, 0.96);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.hero-card {
    padding: 34px;
    min-height: 480px;
}

.hero-logo-wrap {
    margin: 0 0 18px;
    max-width: 760px;
}

.hero-logo {
    display: block;
    width: min(100%, 720px);
    height: auto;
    filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.45));
}

/* When the logo IS the visual title (square format), hide the text H1 visually
   but keep it in the DOM for screen readers and search engines */
.hero-copy-block .series-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-card::after,
.card::after,
.quote-card::after {
    content: none;
    position: absolute;
    inset: auto -15% -45% auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(207, 47, 47, 0.18),
        transparent 68%
    );
    pointer-events: none;
}

.chapter-card:hover,
.power-card:hover,
.character-card:hover,
.lore-card:hover,
.step-card:hover,
.mini-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
}

@media (min-width: 1100px) {
    .header-shell {
        padding: 14px 28px;
        gap: 16px;
    }

    .nav-row {
        gap: 4px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 12.5px;
    }

    main {
        padding: 40px 28px 120px;
    }

    .section-head {
        margin-bottom: 24px;
    }

    .hero-shell {
        grid-template-columns: minmax(0, 1fr) min(480px, 40vw);
        gap: 52px;
    }

    .reader-toolbar .toolbar-pill {
        flex-basis: 260px;
    }
}

@media (max-width: 1200px) {
    .user-chip .user-name {
        display: none;
    }
}

@media (max-width: 1100px) {
    .header-shell {
        gap: 8px;
        padding: 10px 14px;
    }

    .brand-mark {
        width: clamp(72px, 8vw, 110px);
        height: 32px;
    }
}

@media (max-width: 820px) {
    .user-chip {
        display: none;
    }
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--void);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
}

.series-title {
    margin: 0;
    color: var(--bone);
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(3.4rem, 7vw, 6.8rem);
    line-height: 0.82;
    letter-spacing: 0;
    text-transform: uppercase;
    text-shadow: 0 20px 54px rgba(207, 47, 47, 0.2);
}

.series-subtitle {
    margin: 14px 0 18px;
    color: #ff4b5f;
    font-family: "Space Mono", monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.hero-title {
    margin: 0;
    max-width: 26ch;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    line-height: 1.02;
    letter-spacing: 0;
    font-weight: 700;
}

.hero-title .blood {
    color: #ffd7d0;
    text-shadow: 0 0 40px rgba(207, 47, 47, 0.18);
}

.hero-copy {
    max-width: 62ch;
    margin: 18px 0 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--mist);
}

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

.apk-note {
    margin: 16px 0 0;
    color: rgba(246, 238, 232, 0.72);
    line-height: 1.7;
    max-width: 58ch;
}

.hero-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(460px, 42vw);
    gap: 48px;
    align-items: center;
}

.hero-copy-block {
    max-width: 640px;
}

.hero-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-wrap {
    margin: 0 auto;
    width: 100%;
    max-width: 460px;
}

.hero-logo {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 20px;
    filter: drop-shadow(0 0 60px rgba(207, 47, 47, 0.22))
        drop-shadow(0 0 30px rgba(138, 43, 226, 0.12))
        drop-shadow(0 24px 50px rgba(0, 0, 0, 0.65));
    transition:
        filter 0.35s ease,
        transform 0.35s ease;
}

.hero-logo:hover {
    filter: drop-shadow(0 0 80px rgba(207, 47, 47, 0.38))
        drop-shadow(0 0 40px rgba(138, 43, 226, 0.22))
        drop-shadow(0 28px 56px rgba(0, 0, 0, 0.7));
    transform: translateY(-6px) scale(1.015);
}

.series-title {
    max-width: 10ch;
}

.hero-title {
    max-width: 24ch;
}

.hero-copy {
    max-width: 56ch;
}

.hero-copy strong {
    color: var(--bone);
    font-weight: 700;
}

.story-points {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.story-point {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(246, 238, 232, 0.76);
    line-height: 1.7;
}

.story-point strong {
    color: var(--bone);
}

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

.app-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: 26px;
    font-family: "Cormorant Garamond", serif;
}

.app-card p {
    margin: 0;
    color: var(--mist);
    line-height: 1.75;
}

.app-start {
    margin-top: 24px;
    padding: 28px;
}

.app-start-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.app-start-head h3 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 3vw, 2.7rem);
    font-family: "Cormorant Garamond", serif;
}

.app-start-head p {
    margin: 0;
    color: var(--mist);
    line-height: 1.75;
    max-width: 56ch;
}

.start-badge {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bone);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: "Space Mono", monospace;
    white-space: nowrap;
}

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

.step-card {
    min-height: 280px;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 72%),
        rgba(8, 8, 10, 0.7);
}

.step-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--bone);
    color: #160607;
    font-size: 20px;
    font-weight: 800;
}

.step-card h4 {
    margin: 0 0 12px;
    font-size: 28px;
    line-height: 1;
    font-family: "Cormorant Garamond", serif;
}

.step-card p {
    margin: 0;
    color: var(--mist);
    line-height: 1.75;
}

.step-card .link-cluster {
    margin-top: 18px;
}

.app-dashboard {
    display: none;
    gap: 20px;
}

.native-app .app-dashboard {
    display: grid;
}

.native-app .web-app-promo {
    display: none !important;
}

.native-app main {
    max-width: min(100%, 1320px);
    padding-top: max(18px, env(safe-area-inset-top));
}

.app-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 20px;
    padding: 26px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background:
        linear-gradient(
            135deg,
            rgba(207, 47, 47, 0.12),
            rgba(132, 208, 199, 0.08)
        ),
        rgba(12, 12, 16, 0.78);
    box-shadow: var(--shadow);
}

.app-dashboard-hero h2 {
    margin: 0 0 10px;
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    line-height: 0.95;
    font-family: "Cormorant Garamond", serif;
}

.app-dashboard-hero p {
    margin: 0;
    max-width: 68ch;
    color: rgba(246, 238, 232, 0.76);
    line-height: 1.65;
}

.app-dashboard-actions,
.app-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    min-width: 0;
}

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

.app-panel {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 68%),
        rgba(14, 14, 18, 0.78);
    overflow: hidden;
}

.app-panel-library {
    grid-column: span 2;
}

.app-library-list {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.app-list-item {
    width: 100%;
    min-height: 58px;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--bone);
    text-align: left;
    cursor: pointer;
}

.app-list-item:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.07);
}

.app-list-item span {
    color: var(--void);
    font-size: 10px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    font-family: "Space Mono", monospace;
}

.app-list-item strong {
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.app-status-copy {
    margin: 0;
    color: rgba(246, 238, 232, 0.7);
    line-height: 1.55;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(
            circle at top,
            rgba(207, 47, 47, 0.16),
            transparent 24%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(132, 208, 199, 0.12),
            transparent 18%
        ),
        linear-gradient(180deg, rgba(5, 5, 5, 0.98), rgba(11, 7, 8, 1));
    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-shell {
    width: min(100%, 420px);
    padding: 34px 28px 28px;
    border-radius: 28px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 70%),
        rgba(18, 10, 12, 0.88);
    box-shadow: var(--shadow);
    text-align: center;
}

.loading-logo {
    width: min(100%, 260px);
    margin: 0 auto 18px;
    display: block;
    filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.42));
}

.loading-shell h2 {
    margin: 0 0 10px;
    font-size: 34px;
    font-family: "Cormorant Garamond", serif;
}

.loading-shell p {
    margin: 0;
    color: var(--mist);
    line-height: 1.7;
}

.loading-bar {
    height: 8px;
    margin-top: 22px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.loading-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #84d0c7, #ff8c5a 72%, #cf2f2f);
    transform-origin: left center;
    animation: loadingPulse 1.25s ease-in-out infinite;
}

@keyframes loadingPulse {
    0% {
        transform: scaleX(0.22);
        opacity: 0.75;
    }
    50% {
        transform: scaleX(0.82);
        opacity: 1;
    }
    100% {
        transform: scaleX(0.3);
        opacity: 0.8;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 800;
    transition: 0.25s ease;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    color: #160607;
    background: linear-gradient(135deg, #ffe5dd, #ff8c5a);
    box-shadow: 0 18px 30px rgba(255, 140, 90, 0.18);
}

.btn-secondary {
    color: var(--bone);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line-strong);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.tag {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: var(--bone);
    font-size: 12px;
    font-weight: 700;
}

.hero-side {
    display: grid;
    gap: 18px;
}

.mini-card {
    padding: 24px;
    min-height: 150px;
}

.mini-card h3,
.card h3 {
    margin: 0 0 10px;
    font-size: 22px;
    font-family: "Cormorant Garamond", serif;
}

.mini-card p,
.card p,
.quote-card p,
.section-copy {
    margin: 0;
    color: var(--mist);
    line-height: 1.75;
}

.quote-card {
    margin-bottom: 38px;
    padding: 28px 30px;
    display: grid;
    gap: 14px;
}

.quote-card strong {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--void);
    font-family: "Space Mono", monospace;
}

.quote-card blockquote {
    margin: 0;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
}

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

.section-head h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-family: "Cormorant Garamond", serif;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

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

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

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

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

.card {
    padding: 24px;
}

.chapter-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 240px;
}

.chapter-label,
.chip-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.comments-shell {
    margin-top: 20px;
}

.discuss-chat-shell {
    display: grid;
    grid-template-rows: auto minmax(320px, 1fr) auto;
    min-height: min(72vh, 760px);
    padding: 0;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(32, 36, 58, 0.94), rgba(13, 15, 26, 0.96)),
        rgba(255, 255, 255, 0.03);
}

.discuss-server-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
}

.discuss-server-bar span {
    display: block;
    margin-top: 2px;
    color: var(--mist);
    font-size: 12px;
}

.discuss-server-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(145deg, #7c3aed, #b91c1c);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.discuss-channel-row {
    display: grid;
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    gap: 10px;
}

.community-shell {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 16px;
}

.community-compose {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.community-feed {
    display: grid;
    gap: 12px;
}

.community-post {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.community-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.community-head img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
}

.community-meta {
    color: var(--mist);
    font-size: 12px;
}

.name-badges {
    display: inline-flex;
    gap: 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.blue-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1d9bf0;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.owner-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(29, 155, 240, 0.55);
    background: rgba(29, 155, 240, 0.16);
    color: #8cc7ff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.community-post h4 {
    margin: 6px 0 8px;
    font-size: 22px;
}

.community-post .post-image {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin-top: 10px;
}

.volume-cover-art {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line);
    margin: 6px 0 12px;
    object-fit: cover;
    max-height: 420px;
}

.spoiler-body {
    filter: blur(10px);
    user-select: none;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.spoiler-body.revealed {
    filter: blur(0);
    user-select: text;
}

.post-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-comments {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.post-comment {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 14px;
}

.comment-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.comment-form textarea,
.comment-form select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--bone);
    padding: 10px 12px;
    font-family: "Bricolage Grotesque", sans-serif;
}

.comment-form textarea {
    min-height: 84px;
    resize: vertical;
}

.comment-list {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.discord-message-list {
    align-content: start;
    max-height: 52vh;
    min-height: 320px;
    overflow-y: auto;
    padding: 4px 8px 4px 2px;
}

.comment-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--mist);
    margin-bottom: 6px;
}

.chapter-label span,
.chip {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mist);
    font-family: "Space Mono", monospace;
}

.chat-message-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
}

.chat-message-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
}

.chat-message-content {
    min-width: 0;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-username {
    color: var(--bone);
    font-weight: 800;
}

.chat-timestamp,
.chat-ping {
    color: var(--mist);
    font-size: 12px;
}

.chat-type-chip {
    border: 1px solid rgba(179, 136, 255, 0.35);
    border-radius: 999px;
    padding: 2px 7px;
    color: #cbb7ff;
    font-size: 11px;
}

.chat-body {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.discord-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.discord-message-actions .btn {
    padding: 5px 9px;
    font-size: 12px;
}

.discord-replies {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid rgba(179, 136, 255, 0.22);
}

.discord-reply {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
    font-size: 14px;
}

.discord-reply-box {
    display: none;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
}

.discord-reply-box.active {
    display: grid;
}

.discord-delete-btn {
    border: 0;
    background: none;
    color: #ff7979;
    cursor: pointer;
    font-size: 12px;
}

.buy-panel {
    position: relative;
    overflow: hidden;
    max-width: 1120px;
    margin-inline: auto;
    padding: clamp(18px, 3vw, 34px);
    border: 1px solid rgba(192, 57, 43, 0.32);
    border-radius: 10px;
    background:
        radial-gradient(circle at 78% 10%, rgba(122, 26, 26, 0.28), transparent 34%),
        linear-gradient(155deg, rgba(122, 26, 26, 0.18), rgba(8, 5, 8, 0.86) 66%);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.buy-panel::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(237, 224, 212, 0.08);
    pointer-events: none;
}

.buy-mark {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(44px, 10vw, 94px);
    line-height: 0.9;
    color: rgba(237, 224, 212, 0.08);
    position: absolute;
    right: 22px;
    bottom: 18px;
    pointer-events: none;
}

.buy-panel-premium {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 0.9fr);
    gap: clamp(22px, 4vw, 46px);
    align-items: center;
}

.buy-cover-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.42fr);
    gap: clamp(10px, 2vw, 18px);
    align-items: end;
    min-width: 0;
}

.buy-cover-card {
    position: relative;
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(237, 224, 212, 0.16);
    border-radius: 8px;
    background: rgba(5, 5, 8, 0.72);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.36);
}

.buy-cover-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.buy-cover-card figcaption {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 7px 9px;
    border: 1px solid rgba(237, 224, 212, 0.14);
    border-radius: 6px;
    background: rgba(5, 5, 8, 0.72);
    color: var(--mist);
    font-size: 12px;
    line-height: 1.2;
    backdrop-filter: blur(10px);
}

.buy-cover-card:not(.is-featured) {
    transform: translateY(-8px);
}

.buy-copy {
    position: relative;
    z-index: 1;
}

.buy-panel h3 {
    margin: 10px 0 14px;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(34px, 7vw, 66px);
    line-height: 0.95;
}

.buy-panel p:not(.eyebrow) {
    max-width: 560px;
    color: var(--mist);
    font-size: 18px;
    line-height: 1.75;
}

.buy-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0;
}

.buy-meta-row span {
    border: 1px solid rgba(237, 224, 212, 0.14);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--mist);
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.buy-cta {
    width: fit-content;
}

@media (max-width: 820px) {
    .buy-panel-premium {
        grid-template-columns: 1fr;
    }

    .buy-cover-grid {
        grid-template-columns: 1fr 0.72fr;
    }
}

@media (max-width: 560px) {
    .buy-cover-grid {
        grid-template-columns: 1fr;
    }

    .buy-cover-card:not(.is-featured) {
        display: none;
    }

    .buy-cta {
        width: 100%;
        justify-content: center;
    }
}

.chapter-card strong {
    font-size: 25px;
    font-family: "Cormorant Garamond", serif;
    line-height: 1;
}

.chapter-card .meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: var(--mist);
    font-size: 12px;
    font-family: "Space Mono", monospace;
}

.chapter-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subtab-btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--mist);
    border-radius: 999px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: 0.25s ease;
}

.subtab-btn:hover,
.subtab-btn.active {
    color: var(--bone);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong);
}

.leaks-panel {
    display: none;
    margin-top: 18px;
}

.leaks-panel.active {
    display: block;
}

.spoiler-note {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        135deg,
        rgba(207, 47, 47, 0.14),
        rgba(132, 208, 199, 0.08)
    );
    border: 1px solid var(--line);
    color: var(--mist);
    line-height: 1.8;
}

.ghost-btn {
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bone);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.25s ease;
}

.ghost-btn.download-btn {
    min-width: 120px;
    padding-left: 16px;
    padding-right: 16px;
}

.ghost-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
}

.ghost-btn.pdf-btn {
    background: linear-gradient(
        135deg,
        rgba(207, 47, 47, 0.18),
        rgba(255, 140, 90, 0.08)
    );
    border-color: rgba(255, 140, 90, 0.24);
}

.ghost-btn.epub-btn {
    background: linear-gradient(
        135deg,
        rgba(132, 208, 199, 0.16),
        rgba(255, 255, 255, 0.04)
    );
    border-color: rgba(132, 208, 199, 0.2);
}

.character-card {
    min-height: 250px;
}

.character-card .role {
    color: var(--void);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
    margin-bottom: 10px;
    display: block;
}

.character-card strong {
    display: block;
    font-size: 28px;
    font-family: "Cormorant Garamond", serif;
    margin-bottom: 10px;
}

.power-card strong,
.lore-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: 24px;
    font-family: "Cormorant Garamond", serif;
}

.power-note {
    margin-top: 24px;
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        135deg,
        rgba(132, 208, 199, 0.08),
        rgba(207, 47, 47, 0.12)
    );
    border: 1px solid var(--line);
    color: var(--mist);
    line-height: 1.8;
}

.link-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.credits-hero {
    display: grid;
    gap: 18px;
    margin-bottom: 22px;
    padding: 30px;
    background:
        radial-gradient(
            circle at top right,
            rgba(132, 208, 199, 0.18),
            transparent 30%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(255, 140, 90, 0.18),
            transparent 26%
        ),
        linear-gradient(135deg, rgba(24, 10, 12, 0.92), rgba(12, 12, 16, 0.96));
}

.credits-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--void);
    font-family: "Space Mono", monospace;
}

.credits-hero h3 {
    margin: 0;
    max-width: 14ch;
    font-size: clamp(2.3rem, 5vw, 3.6rem);
    line-height: 0.92;
    font-family: "Cormorant Garamond", serif;
}

.credits-hero p {
    margin: 0;
    max-width: 64ch;
    color: rgba(246, 238, 232, 0.78);
    line-height: 1.8;
}

.credits-list {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bone);
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.credit-note {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--mist);
    line-height: 1.7;
}

.coming-soon-card {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: space-between;
}

.coming-soon-box {
    min-height: 140px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--mist);
    line-height: 1.7;
}

.reader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    background:
        radial-gradient(circle at top, rgba(207, 47, 47, 0.1), transparent 28%),
        linear-gradient(180deg, rgba(4, 4, 5, 0.98), rgba(8, 7, 10, 1));
    transform: translateY(100%);
    transition: transform 0.35s ease;
}

.reader.open {
    transform: translateY(0);
}

body.reader-theme-night .reader {
    background:
        radial-gradient(circle at top, rgba(207, 47, 47, 0.1), transparent 28%),
        linear-gradient(180deg, rgba(4, 4, 5, 0.98), rgba(8, 7, 10, 1));
}

body.reader-theme-paper .reader {
    background:
        radial-gradient(circle at top, rgba(138, 35, 51, 0.1), transparent 28%),
        linear-gradient(180deg, #f5ede4, #f0e6dc 55%, #efe4d9 100%);
}

body.reader-theme-paper .reader-top,
body.reader-theme-paper .reader-toolbar,
body.reader-theme-paper .reader-footer {
    background: rgba(248, 241, 234, 0.9);
    border-color: rgba(35, 24, 23, 0.1);
    color: #231817;
}

body.reader-theme-paper .reader-title-wrap strong,
body.reader-theme-paper .reader-content,
body.reader-theme-paper .page-indicator,
body.reader-theme-paper .toolbar-pill,
body.reader-theme-paper .toolbar-pill select,
body.reader-theme-paper .toolbar-pill input,
body.reader-theme-paper .toolbar-note {
    color: #231817;
}

body.reader-theme-paper .reader-content h2,
body.reader-theme-paper .reader-content .chapter-title,
body.reader-theme-paper .toolbar-value,
body.reader-theme-paper #tts-status {
    color: #1d1112;
}

body.reader-theme-paper .reader-content {
    color: #342320;
}

body.reader-theme-paper .reader-content .story-callout,
body.reader-theme-paper .reader-content .system-box,
body.reader-theme-paper .reader-content .ep-intro-bar {
    background: rgba(138, 35, 51, 0.06);
    border-color: rgba(35, 24, 23, 0.12);
    color: #4a302d;
}

body.reader-theme-paper .icon-btn,
body.reader-theme-paper .ghost-btn,
body.reader-theme-paper .btn-secondary,
body.reader-theme-paper .toolbar-pill {
    background: rgba(35, 24, 23, 0.04);
    border-color: rgba(35, 24, 23, 0.14);
    color: #231817;
}

body.reader-theme-paper .toolbar-pill.status,
body.reader-theme-paper .progress-rail {
    background: rgba(35, 24, 23, 0.05);
    border-color: rgba(35, 24, 23, 0.14);
}

body.reader-theme-ember .reader {
    background:
        radial-gradient(
            circle at top right,
            rgba(255, 140, 90, 0.2),
            transparent 26%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(132, 208, 199, 0.12),
            transparent 18%
        ),
        linear-gradient(180deg, #120708, #090607 50%, #140a0d 100%);
}

body.reader-theme-forest .reader {
    background:
        radial-gradient(
            circle at top left,
            rgba(34, 197, 94, 0.15),
            transparent 30%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(16, 185, 129, 0.1),
            transparent 25%
        ),
        linear-gradient(180deg, #0a1f0a, #0d2d0d 55%, #0f3d0f 100%);
}

body.reader-theme-ocean .reader {
    background:
        radial-gradient(
            circle at top center,
            rgba(59, 130, 246, 0.2),
            transparent 35%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(14, 165, 233, 0.15),
            transparent 28%
        ),
        linear-gradient(180deg, #0c1929, #0f2444 55%, #122f5f 100%);
}

body.reader-theme-sunset .reader {
    background:
        radial-gradient(
            circle at top right,
            rgba(251, 146, 60, 0.25),
            transparent 32%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(239, 68, 68, 0.15),
            transparent 28%
        ),
        linear-gradient(180deg, #1a0f08, #2d1810 55%, #402118 100%);
}

body.reader-theme-midnight .reader {
    background:
        radial-gradient(
            circle at center,
            rgba(99, 102, 241, 0.1),
            transparent 40%
        ),
        radial-gradient(
            circle at top left,
            rgba(139, 92, 246, 0.08),
            transparent 30%
        ),
        linear-gradient(180deg, #000000, #0a0a0f 55%, #141420 100%);
}

.reader-top,
.reader-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 5, 5, 0.84);
    backdrop-filter: blur(18px);
}

.reader-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    position: relative;
    z-index: 6;
}

.reader-footer {
    border-top: 1px solid var(--line);
    border-bottom: none;
    position: relative;
    z-index: 6;
}

.reader-top-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    min-width: 0;
}

.reader-title-wrap {
    flex: 1 1 260px;
    min-width: 0;
    overflow: hidden;
}

.reader-title-wrap span {
    display: block;
    color: var(--void);
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.reader-title-wrap strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
    font-family: "Cormorant Garamond", serif;
    line-height: 1;
    overflow-wrap: anywhere;
}

.reader-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 10px;
}

.reader-summary span {
    color: rgba(246, 238, 232, 0.7);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: "Space Mono", monospace;
}

.reader-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    position: relative;
    z-index: 7;
}

.reader-progress-bar {
    padding: 0 22px;
    background: rgba(5, 5, 5, 0.84);
    border-bottom: 1px solid var(--line);
}

.progress-rail {
    position: relative;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #84d0c7, #ff8c5a 70%, #cf2f2f);
    transition: width 0.25s ease;
}

.reader-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(18px);
    align-content: start;
    align-items: start;
    justify-content: stretch;
}

.reader:not(.tools-open) .reader-toolbar {
    display: none;
}

.toolbar-pill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    flex: 1 1 280px;
    min-height: 0;
    min-width: 0;
    height: auto;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 68%),
        rgba(255, 255, 255, 0.04);
    color: var(--mist);
    font-size: 13px;
    touch-action: auto;
}

.toolbar-pill.export-card,
.toolbar-pill.bookmark-card {
    flex-basis: 340px;
}

.toolbar-pill.chapter-card,
.toolbar-pill.status {
    flex-basis: 300px;
}

.reader-toolbar .toolbar-pill:not(.status) .toolbar-note {
    display: none;
}

.toolbar-pill span {
    white-space: normal;
}

.pill-label {
    color: var(--mist);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: "Space Mono", monospace;
}

.toolbar-value {
    color: var(--bone);
    font-size: 18px;
    line-height: 1.1;
    font-family: "Cormorant Garamond", serif;
    margin: -4px 0 0;
    overflow-wrap: anywhere;
}

.toolbar-pill select,
.toolbar-pill input[type="range"] {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--bone);
    font-family: "Bricolage Grotesque", sans-serif;
    touch-action: auto;
    pointer-events: auto;
}

.toolbar-pill select:focus,
.toolbar-pill input:focus {
    outline: 2px solid rgba(132, 208, 199, 0.35);
    outline-offset: 1px;
}

.toolbar-pill.status {
    color: var(--bone);
    justify-content: space-between;
}

.toolbar-note {
    margin: 0;
    color: rgba(246, 238, 232, 0.68);
    line-height: 1.6;
    font-size: 13px;
}

.toolbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 7px;
    align-items: stretch;
}

.toolbar-actions .ghost-btn {
    min-height: 40px;
    width: 100%;
    white-space: normal;
    padding: 8px 10px;
    line-height: 1.15;
}

.bookmark-card .bookmark-status {
    display: block;
    min-height: 18px;
    color: rgba(132, 208, 199, 0.88);
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--bone);
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    position: relative;
    z-index: 8;
    touch-action: manipulation;
}

.reader-tools-btn {
    display: inline-flex;
    min-height: 42px;
    padding-left: 16px;
    padding-right: 16px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    position: relative;
    z-index: 8;
    touch-action: manipulation;
}

.reader-tools-overlay {
    display: none;
}

.reader.tools-open .reader-tools-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20;
    border: none;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.reader.tools-open .reader-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 24px;
    position: fixed;
    left: max(40px, env(safe-area-inset-left));
    right: max(40px, env(safe-area-inset-right));
    top: max(84px, env(safe-area-inset-top));
    bottom: max(84px, env(safe-area-inset-bottom));
    z-index: 21;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
    align-items: start;
}

.mobile-only {
    display: none;
}

.reader-body {
    overflow-y: auto;
    padding: 28px 20px 40px;
}

.reader-inner {
    max-width: var(--reader-width);
    margin: 0 auto;
    transition:
        max-width 0.22s ease,
        opacity 0.18s ease,
        transform 0.18s ease;
}

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.reader-content {
    font-size: var(--reader-size);
    line-height: var(--reader-line-height);
    color: #ece4dd;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

.reader-content h2 {
    margin: 0 0 16px;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    line-height: 0.95;
    font-family: "Cormorant Garamond", serif;
    color: #ffe8df;
}

.reader-content p {
    margin: 0 0 18px;
}

.reader-page-transitioning .reader-inner {
    opacity: 0;
    transform: translateY(8px);
}

body.reader-focus-mode header,
body.reader-focus-mode .reader-top,
body.reader-focus-mode .reader-progress-bar,
body.reader-focus-mode .reader-footer {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

body.reader-focus-mode .reader-body {
    padding-top: max(32px, env(safe-area-inset-top));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
}

body.reader-theme-amoled,
body.reader-theme-amoled .reader,
body.reader-theme-amoled .reader-body,
body.reader-theme-amoled .reader-top,
body.reader-theme-amoled .reader-toolbar,
body.reader-theme-amoled .reader-progress-bar {
    background: #000 !important;
}

body.reader-theme-amoled .reader-content {
    color: #f5f5f5;
}

.tts-highlight {
    background: linear-gradient(
        135deg,
        rgba(255, 214, 120, 0.6),
        rgba(255, 193, 7, 0.4)
    );
    color: #fff8e8;
    border-radius: 4px;
    box-shadow:
        0 2px 8px rgba(255, 214, 120, 0.4),
        0 0 0 1px rgba(255, 214, 120, 0.3);
    transition: all 0.2s ease-in-out;
    animation: ttsPulse 1.5s ease-in-out infinite alternate;
}

@keyframes ttsPulse {
    0% {
        background: linear-gradient(
            135deg,
            rgba(255, 214, 120, 0.6),
            rgba(255, 193, 7, 0.4)
        );
        box-shadow:
            0 2px 8px rgba(255, 214, 120, 0.4),
            0 0 0 1px rgba(255, 214, 120, 0.3);
    }
    100% {
        background: linear-gradient(
            135deg,
            rgba(255, 214, 120, 0.8),
            rgba(255, 193, 7, 0.6)
        );
        box-shadow:
            0 4px 12px rgba(255, 214, 120, 0.6),
            0 0 0 2px rgba(255, 214, 120, 0.5);
    }
}

.reader-content .story-callout {
    padding: 18px 20px;
    margin: 24px 0;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: #f4d9d0;
}

.reader-content .chapter-head {
    text-align: center;
    margin: 0 0 34px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.reader-content .chapter-num {
    display: block;
    margin-bottom: 10px;
    color: var(--void);
    text-transform: uppercase;
    letter-spacing: 0.26em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
}

.reader-content .chapter-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4.4vw, 3rem);
    line-height: 1;
    font-family: "Cormorant Garamond", serif;
    color: #ffe8df;
}

.reader-content .chapter-subtitle {
    margin: 0;
    color: var(--mist);
    font-style: italic;
    text-indent: 0;
}

.reader-content .scene-break {
    margin: 30px 0;
    text-align: center;
    letter-spacing: 0.45em;
    color: rgba(246, 238, 232, 0.38);
    font-family: "Space Mono", monospace;
    font-size: 13px;
}

/* Bilingual Layout Styles */
.bilingual-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.bilingual-block {
    margin: 20px 0;
    border-left: 3px solid rgba(255, 214, 120, 0.3);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

.bilingual-en,
.bilingual-ja {
    padding: 16px 20px;
    line-height: 1.6;
}

.bilingual-en {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.01);
}

.bilingual-ja {
    font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 0.95em;
    color: #ffe8df;
}

.bilingual-en p,
.bilingual-ja p {
    margin: 0 0 12px 0;
}

.bilingual-en p:last-child,
.bilingual-ja p:last-child {
    margin-bottom: 0;
}

.bilingual-en .chapter-title {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.bilingual-ja .chapter-title {
    font-size: 1.6em;
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .bilingual-block {
        margin: 16px 0;
    }

    .bilingual-en,
    .bilingual-ja {
        padding: 12px 16px;
    }

    .bilingual-ja {
        font-size: 0.9em;
    }
}

.reader-content .scene-title {
    margin: 34px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffd7d0;
    font-family: "Cormorant Garamond", serif;
    font-size: 1.25rem;
    text-indent: 0;
}

.reader-content .novel-p {
    margin-bottom: 18px;
    text-indent: 1.8em;
}

.reader-content .novel-p:first-of-type,
.reader-content .no-indent {
    text-indent: 0;
}

.reader-content .dialogue {
    color: #ffe8df;
}

.reader-content .thought {
    color: var(--void);
    font-style: italic;
}

.reader-content .shout {
    color: #ffb3a1;
    font-weight: 700;
}

.reader-content .emphasis {
    color: #ffd7d0;
    font-weight: 700;
}

.reader-content .system-box {
    margin: 22px 0;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: #f4d9d0;
    font-family: "Space Mono", monospace;
    font-size: 0.88rem;
    line-height: 1.8;
}

.reader-content .system-box h5 {
    margin: 0 0 10px;
    color: var(--void);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 11px;
}

.reader-content .big-sfx {
    display: block;
    margin: 22px 0;
    text-align: center;
    color: #ffd7d0;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.reader-content .fanservice-note {
    margin: 28px 0;
    text-align: center;
    color: rgba(246, 238, 232, 0.48);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
}

.reader-content .tbc {
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: rgba(246, 238, 232, 0.58);
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
}

.reader-content .ep-intro-bar {
    margin-bottom: 22px;
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    text-align: center;
}

.reader-content .ep-intro-bar p {
    margin: 0;
    text-indent: 0;
    color: var(--void);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-family: "Space Mono", monospace;
}

.page-indicator {
    color: var(--mist);
    font-family: "Space Mono", monospace;
    font-size: 12px;
}

.mobile-nav {
    display: none;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 40;
    padding: 10px;
    border-radius: 999px;
    background: rgba(8, 8, 9, 0.92);
    border: 1px solid var(--line);
    backdrop-filter: blur(18px);
    justify-content: flex-start;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.mobile-nav .nav-btn,
.reader-footer .btn,
.toolbar-actions .ghost-btn,
.ghost-btn,
.btn {
    position: relative;
    z-index: 8;
    touch-action: manipulation;
}

body.reader-open .mobile-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
}

footer {
    max-width: var(--content);
    margin: 0 auto;
    padding: 0 20px 120px;
    color: var(--mist);
    font-size: 13px;
}

.footer-shell {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
        rgba(12, 12, 16, 0.82);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.footer-shell strong {
    display: block;
    margin-bottom: 6px;
    color: var(--bone);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: "Space Mono", monospace;
}

.footer-shell p {
    margin: 0;
    line-height: 1.7;
}

@media (max-width: 980px) {
    .feature-strip,
    .steps-grid,
    .chapter-grid,
    .volumes-grid,
    .character-grid,
    .power-grid,
    .lore-grid,
    .credits-grid,
    .drawings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .nav-row,
    .status-pill {
        display: none;
    }

    .mobile-nav {
        display: flex;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        padding: 10px;
        gap: 8px;
        scroll-snap-type: x proximity;
        border-radius: 18px;
        background: rgba(8, 10, 16, 0.92);
        border: 1px solid var(--line);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
    }

    main {
        padding: 18px 14px calc(140px + env(safe-area-inset-bottom));
    }

    .header-shell,
    .reader-top,
    .reader-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hero-card {
        padding: 20px;
        min-height: auto;
    }

    .hero-shell {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .hero-copy-block,
    .hero-copy {
        max-width: none;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 14px;
    }

    .chapter-card {
        min-height: auto;
        gap: 10px;
    }

    .chapter-card .meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .chapter-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .subtabs {
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .subtab-btn,
    .mobile-nav .nav-btn,
    .hero-actions .btn,
    .chapter-actions .ghost-btn {
        min-height: 48px;
    }

    .subtab-btn,
    .mobile-nav .nav-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        text-align: center;
        scroll-snap-align: start;
    }

    .hero-actions .btn {
        flex: 1 1 calc(50% - 6px);
    }

    .card {
        padding: 16px;
        border-radius: 18px;
    }

    .footer-shell {
        flex-direction: column;
    }

    .app-start-head {
        flex-direction: column;
    }

    .app-dashboard-hero,
    .app-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .app-dashboard-hero {
        padding: 18px;
    }

    .app-dashboard-actions {
        justify-content: stretch;
        width: 100%;
    }

    .app-dashboard-actions .btn,
    .app-tool-actions .ghost-btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .app-panel,
    .app-panel-library {
        grid-column: auto;
        min-height: auto;
    }

    .reader-top {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .reader-top-main {
        min-width: 0;
        align-items: center;
        flex-wrap: nowrap;
    }

    .reader-title-wrap {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .reader-title-wrap strong {
        display: block;
        line-height: 1.08;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .reader-controls {
        justify-content: space-between;
        width: 100%;
        gap: 6px;
    }

    .reader-toolbar {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        padding: 12px;
        max-height: min(66vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(12, 14, 20, 0.98);
    }

    .reader-toolbar::-webkit-scrollbar,
    .subtabs::-webkit-scrollbar,
    .mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .reader:not(.tools-open) .reader-toolbar {
        display: none;
    }

    .reader.tools-open .reader-toolbar {
        left: 12px;
        right: 12px;
        top: max(66px, env(safe-area-inset-top));
        bottom: max(92px, env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .toolbar-pill {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        min-height: auto;
        max-width: none;
        border-radius: 16px;
        padding: 12px;
        gap: 8px;
        font-size: 12px;
        margin-bottom: 10px;
    }

    .toolbar-pill.export-card,
    .toolbar-pill.bookmark-card,
    .toolbar-pill.chapter-card,
    .toolbar-pill.status {
        flex-basis: auto;
    }

    .toolbar-pill:last-child {
        margin-bottom: 0;
    }

    .toolbar-pill span,
    .toolbar-actions .ghost-btn {
        width: 100%;
    }

    .pill-label {
        font-size: 10px;
        letter-spacing: 0.12em;
    }

    .toolbar-value {
        font-size: 16px;
        line-height: 1.2;
        margin: 0;
    }

    .toolbar-note {
        font-size: 12px;
        line-height: 1.45;
    }

    .toolbar-note {
        display: none;
    }

    .toolbar-pill select,
    .toolbar-pill input[type="range"] {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 12px;
    }

    .toolbar-pill.status,
    .toolbar-pill.chapter-card,
    .toolbar-pill.export-card {
        grid-column: 1 / -1;
    }

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

    .toolbar-actions .ghost-btn {
        min-height: 40px;
        width: 100%;
    }

    .reader-progress-bar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .reader-body {
        padding: 22px 16px calc(154px + env(safe-area-inset-bottom));
    }

    .reader-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(74px, auto) minmax(0, 1fr);
        gap: 10px;
        position: sticky;
        bottom: 0;
        z-index: 4;
        padding-top: 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
        backdrop-filter: blur(16px);
    }

    .reader-footer .btn {
        width: 100%;
    }

    .hero-title {
        max-width: none;
    }

    .quote-card blockquote {
        font-size: 2.2rem;
    }

    .reader-controls .icon-btn:nth-child(1),
    .reader-controls .icon-btn:nth-child(2),
    .reader-controls .icon-btn:nth-child(3) {
        width: 38px;
        height: 38px;
    }

    .reader-tools-btn {
        min-height: 44px;
        padding-left: 12px;
        padding-right: 12px;
        font-size: 13px;
    }

    .mobile-nav .nav-btn {
        width: auto;
        min-width: 102px;
        padding: 12px 14px;
    }
}

@media (max-width: 560px) {
    .header-shell {
        padding-top: calc(12px + env(safe-area-inset-top));
        padding-bottom: 10px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .brand-copy strong {
        font-size: 11px;
        letter-spacing: 0.14em;
    }

    .brand-mark {
        width: 142px;
        height: 50px;
    }

    .hero-card,
    .card,
    .quote-card {
        border-radius: 16px;
    }

    .hero-card {
        padding: 16px;
    }

    .hero-title {
        font-size: clamp(1.6rem, 7vw, 2.2rem);
    }

    .series-title {
        font-size: clamp(2.7rem, 15vw, 4.4rem);
    }

    .series-subtitle {
        font-size: 10px;
        line-height: 1.5;
    }

    .hero-actions .btn,
    .link-cluster .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .chapter-card strong,
    .power-card strong,
    .lore-card strong,
    .character-card strong {
        font-size: 20px;
    }

    .reader-title-wrap strong {
        font-size: 20px;
    }

    .reader-toolbar {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .reader-top-main {
        gap: 10px;
    }

    .community-shell {
        grid-template-columns: 1fr;
    }

    .discuss-channel-row,
    .discord-reply-box {
        grid-template-columns: 1fr;
    }

    .community-compose {
        position: static;
    }

    .reader-controls {
        justify-content: flex-start;
    }

    .reader-tools-btn {
        flex: 1 1 auto;
    }

    .reader-toolbar {
        padding: 10px;
    }

    .app-dashboard-hero h2 {
        font-size: clamp(2rem, 13vw, 3rem);
    }

    .app-panel {
        padding: 16px;
        border-radius: 16px;
    }

    .page-indicator {
        font-size: 12px;
        text-align: center;
        line-height: 1.2;
    }

    .reader-footer .btn {
        min-width: 0;
        padding-left: 10px;
        padding-right: 10px;
    }

    .toolbar-pill {
        padding: 10px;
    }

    .toolbar-value {
        font-size: 15px;
    }

    .mobile-nav .nav-btn,
    .subtab-btn {
        min-width: 92px;
    }

    .toolbar-pill.status,
    .toolbar-pill.chapter-card,
    .toolbar-pill.export-card {
        grid-column: auto;
    }

    .reader-summary {
        gap: 6px;
    }

    .hero-shell {
        gap: 18px;
    }

    .loading-shell {
        padding: 22px 16px 20px;
    }
}
/* --- Added Authentication & Profile Styles --- */

.shell {
    max-width: 920px;
    margin: 0 auto;
    display: grid;
    gap: 20px;
    padding: 32px 20px 100px;
}

.auth-shell {
    max-width: 480px;
    margin: 100px auto;
    padding: 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    text-align: center;
}

.row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.input-field {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.4);
    color: var(--bone);
    padding: 14px 16px;
    margin-top: 6px;
    margin-bottom: 18px;
    font-family: inherit;
    font-size: 15px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--ember);
    box-shadow: 0 0 0 2px rgba(255, 140, 90, 0.2);
}

label {
    display: block;
    font-size: 13px;
    color: var(--mist);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: "Space Mono", monospace;
    margin-bottom: 8px;
    text-align: left;
}

.btn-form {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 15px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ember), var(--blood));
    color: #160607;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.btn-form:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(207, 47, 47, 0.25);
}

.btn-google {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #151515;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.btn-google:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.24);
}

.btn-google:disabled,
.btn-form:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.google-mark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(
        from -45deg,
        #4285f4 0deg 90deg,
        #34a853 90deg 180deg,
        #fbbc05 180deg 270deg,
        #ea4335 270deg 360deg
    );
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 900;
    flex: 0 0 auto;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--mist);
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.muted {
    color: var(--mist);
    font-size: 0.95rem;
}
.badge {
    display: inline-block;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
}
.ok {
    color: var(--void);
}
.error {
    color: var(--blood);
}

.back-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--mist);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--bone);
}

/* Threadborn reader tools and reaction polish */
.reader.tools-open .reader-toolbar {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: auto;
    gap: 16px;
    padding: 18px;
    align-items: start;
    align-content: start;
}

.reader.tools-open .toolbar-pill {
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    overflow: visible;
}

.reader.tools-open .toolbar-value {
    margin: 0;
    line-height: 1.15;
}

.reader.tools-open .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reader.tools-open .toolbar-actions .ghost-btn,
.reader.tools-open .toolbar-pill select,
.reader.tools-open .toolbar-pill input[type="range"] {
    min-width: 0;
    max-width: 100%;
}

.reaction-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.reaction-summary {
    color: var(--mist);
    font-size: 13px;
    line-height: 1.5;
}

.reaction-rating {
    color: #ffd678;
    letter-spacing: 0.03em;
}

.discuss-chat-shell {
    max-width: 980px;
    margin-inline: auto;
    display: grid;
    grid-template-rows: auto minmax(320px, 1fr) auto;
    min-height: min(72vh, 760px);
    background:
        linear-gradient(180deg, rgba(32, 36, 58, 0.94), rgba(13, 15, 26, 0.96)),
        rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    overflow: hidden;
}

.discuss-chat-form {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px;
    background: rgba(30, 31, 34, 0.6);
    margin-bottom: 20px;
}

.chat-message-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 8px;
    margin-top: 0;
    border-radius: 8px;
    transition: background-color 0.1s ease;
}

.chat-message-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
}

.chat-message-content {
    min-width: 0;
}

.chat-message-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-username {
    color: #fff;
    font-weight: 500;
    font-size: 16px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.chat-username:hover {
    text-decoration: underline;
}

.chat-timestamp {
    font-size: 0.75rem;
    color: #949ba4;
}

.chat-body {
    color: #dbdee1;
    font-size: 16px;
    line-height: 1.375rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-ping {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    margin: 2px 0 8px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #00a8fc;
    background: rgba(0, 168, 252, 0.1);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.chat-type-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    padding: 2px 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.chat-spoiler {
    background: #111214;
    color: transparent;
    cursor: pointer;
    border-radius: 4px;
    padding: 0 4px;
}

.chat-spoiler:hover {
    background: #1e1f22;
}

.chat-spoiler.revealed {
    background: rgba(255, 107, 107, 0.1);
    color: #dbdee1;
}

.reader-reactions-inline {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.reader-reaction-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.reader-reaction-head strong {
    color: var(--bone);
    font-family: "Cormorant Garamond", serif;
    font-size: 22px;
}

.reader-reaction-head span {
    color: var(--mist);
    font-size: 13px;
}

.reader-reaction-list {
    display: grid;
    gap: 10px;
}

@media (max-width: 820px) {
    .reader.tools-open .reader-toolbar {
        grid-template-columns: 1fr;
        gap: 10px;
        left: 10px;
        right: 10px;
        top: max(66px, env(safe-area-inset-top));
        bottom: max(92px, env(safe-area-inset-bottom));
        padding: 10px;
    }

    .reader.tools-open .toolbar-actions,
    .reaction-form-row {
        grid-template-columns: 1fr;
    }
}

/* Final reader tools no-overlap layout */
.reader.tools-open .reader-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-content: flex-start;
    align-items: flex-start;
    justify-content: flex-start;
}

.reader.tools-open .toolbar-pill {
    flex: 1 1 300px;
    width: auto;
    min-width: min(100%, 300px);
    max-width: none;
    align-self: flex-start;
}

.reader.tools-open .toolbar-pill.export-card,
.reader.tools-open .toolbar-pill.bookmark-card {
    flex-basis: 340px;
}

.reader.tools-open .toolbar-pill.chapter-card,
.reader.tools-open .toolbar-pill.status {
    flex-basis: 300px;
}

@media (max-width: 820px) {
    .reader.tools-open .reader-toolbar {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
    }

    .reader.tools-open .toolbar-pill,
    .reader.tools-open .toolbar-pill.export-card,
    .reader.tools-open .toolbar-pill.bookmark-card,
    .reader.tools-open .toolbar-pill.chapter-card,
    .reader.tools-open .toolbar-pill.status {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
}

/* Dashboard & Global Banners */
.global-banner {
    background: linear-gradient(
        135deg,
        rgba(20, 20, 30, 0.9) 0%,
        rgba(30, 20, 40, 0.9) 100%
    );
    border: 1px solid rgba(138, 43, 226, 0.4);
    color: #fff;
    padding: 12px 16px;
    text-align: center;
    font-weight: 500;
    margin-bottom: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-in 0.3s ease-out;
}

.poll-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.poll-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-family: "Cormorant Garamond", serif;
    font-size: 1.25rem;
    color: #fff;
}

.poll-option {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.poll-bg {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(138, 43, 226, 0.2);
    transition: width 0.4s ease;
    z-index: 0;
}

.poll-option:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.5);
}

.poll-option.voted {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.8);
}

.poll-option span.votes {
    font-family: "Space Mono", monospace;
    font-size: 0.85rem;
    color: #aaa;
}

.poll-admin-controls {
    margin-top: 12px;
    text-align: right;
}

.btn-clear {
    background: transparent;
    border: 1px solid rgba(255, 50, 50, 0.6);
    color: #ff6b6b;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-clear:hover {
    background: rgba(255, 50, 50, 0.1);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.input-row input {
    flex: 1;
    margin-bottom: 0 !important;
}

/* Improved Input Styles for Dashboard */
input[type="text"],
input[type="datetime-local"],
select,
textarea {
    background: rgba(20, 20, 30, 0.6) !important;
    border: 1px solid rgba(138, 43, 226, 0.4) !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-family: "Space Mono", monospace !important;
    padding: 10px !important;
    transition: all 0.2s ease !important;
    color-scheme: dark;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: rgba(138, 43, 226, 0.9) !important;
    background: rgba(30, 30, 45, 0.8) !important;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.4) !important;
}

input::placeholder,
textarea::placeholder {
    color: #888 !important;
}

/* ═══════════════════════════════════════════════════════════
   NEW FEATURES — Search, Timeline, Codex, Stats, Badges,
   Inline Reactions, Spoilers, Feedback, Follows, Unlocks
═══════════════════════════════════════════════════════════ */

/* ── Search ─────────────────────────────────────────────── */
.search-bar-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto 28px;
}
.search-bar-wrap input {
    width: 100%;
    padding: 14px 52px 14px 18px;
    border-radius: 999px;
    border: 1px solid rgba(138, 43, 226, 0.4);
    background: rgba(20, 20, 30, 0.8);
    color: #fff;
    font-size: 16px;
    font-family: "Bricolage Grotesque", sans-serif;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.search-bar-wrap input:focus {
    border-color: rgba(138, 43, 226, 0.9);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.15);
}
.search-bar-wrap .search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.5;
    pointer-events: none;
}
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}
.filter-chip {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--mist);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: "Space Mono", monospace;
}
.filter-chip:hover,
.filter-chip.active {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.6);
    color: #c4a0ff;
}
.search-result-group {
    margin-bottom: 28px;
}
.search-result-group h3 {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--void);
    margin: 0 0 12px;
}
.search-result-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 8px;
    cursor: pointer;
    transition: 0.2s ease;
}
.search-result-item:hover {
    border-color: rgba(138, 43, 226, 0.4);
    background: rgba(138, 43, 226, 0.06);
}
.search-result-icon {
    font-size: 22px;
    flex: 0 0 auto;
}
.search-result-title {
    font-weight: 700;
    color: var(--bone);
    font-size: 15px;
}
.search-result-meta {
    font-size: 12px;
    color: var(--mist);
    margin-top: 2px;
}
.search-empty {
    text-align: center;
    color: var(--mist);
    padding: 40px 0;
}

/* ── Tag Filters (chapters) ──────────────────────────────── */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 32px;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(
        180deg,
        rgba(207, 47, 47, 0.6),
        rgba(138, 43, 226, 0.4),
        rgba(132, 208, 199, 0.3)
    );
}
.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.9);
    transition: 0.2s ease;
}
.timeline-item:hover {
    border-color: rgba(138, 43, 226, 0.4);
    transform: translateX(4px);
}
.timeline-item::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(207, 47, 47, 0.8);
    background: var(--bg);
}
.timeline-item.volume-marker::before {
    border-color: rgba(138, 43, 226, 0.9);
    background: rgba(138, 43, 226, 0.3);
}
.timeline-vol-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--void);
    font-family: "Space Mono", monospace;
    margin-bottom: 4px;
}
.timeline-item h4 {
    margin: 0 0 4px;
    font-family: "Cormorant Garamond", serif;
    font-size: 18px;
    color: var(--bone);
}
.timeline-item p {
    margin: 0;
    color: var(--mist);
    font-size: 13px;
    line-height: 1.6;
}
.timeline-vol-header {
    font-family: "Cormorant Garamond", serif;
    font-size: 24px;
    color: #ffd7d0;
    margin: 28px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

/* ── Lore Codex ──────────────────────────────────────────── */
.codex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.codex-card {
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.9);
    cursor: pointer;
    transition: 0.2s ease;
}
.codex-card:hover {
    border-color: rgba(132, 208, 199, 0.4);
    transform: translateY(-2px);
}
.codex-card-tag {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--void);
    font-family: "Space Mono", monospace;
    margin-bottom: 6px;
}
.codex-card h4 {
    margin: 0 0 8px;
    font-family: "Cormorant Garamond", serif;
    font-size: 20px;
    color: var(--bone);
}
.codex-card p {
    margin: 0;
    color: var(--mist);
    font-size: 13px;
    line-height: 1.65;
}
.codex-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.codex-detail-panel {
    max-width: 560px;
    width: 100%;
    padding: 32px;
    border-radius: 24px;
    border: 1px solid rgba(132, 208, 199, 0.3);
    background: rgba(12, 12, 20, 0.98);
    position: relative;
}
.codex-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--mist);
    font-size: 20px;
    cursor: pointer;
}

/* ── Reading Stats ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
    text-align: center;
}
.stat-value {
    font-family: "Cormorant Garamond", serif;
    font-size: 3rem;
    color: var(--bone);
    line-height: 1;
    margin-bottom: 6px;
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--mist);
    font-family: "Space Mono", monospace;
}

/* ── Badges ──────────────────────────────────────────────── */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.badge-card {
    padding: 18px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.9);
    text-align: center;
    transition: 0.2s ease;
}
.badge-card.earned {
    border-color: rgba(212, 168, 48, 0.5);
    background: rgba(212, 168, 48, 0.06);
}
.badge-card.locked {
    opacity: 0.4;
    filter: grayscale(1);
}
.badge-icon {
    font-size: 36px;
    margin-bottom: 8px;
}
.badge-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--bone);
    margin-bottom: 4px;
}
.badge-desc {
    font-size: 11px;
    color: var(--mist);
    line-height: 1.4;
}

/* ── Streak bar ──────────────────────────────────────────── */
.streak-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
    border-radius: 18px;
    background: linear-gradient(
        135deg,
        rgba(207, 47, 47, 0.12),
        rgba(138, 43, 226, 0.08)
    );
    border: 1px solid rgba(207, 47, 47, 0.25);
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.streak-num {
    font-family: "Cormorant Garamond", serif;
    font-size: 4rem;
    line-height: 1;
    color: #ff8c5a;
}
.streak-label {
    color: var(--mist);
    font-size: 13px;
}
.streak-label strong {
    display: block;
    color: var(--bone);
    font-size: 16px;
}

/* ── Follow Button ───────────────────────────────────────── */
.follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(132, 208, 199, 0.4);
    background: rgba(132, 208, 199, 0.06);
    color: #a8ddd6;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    font-family: "Space Mono", monospace;
    letter-spacing: 0.06em;
}
.follow-btn:hover {
    background: rgba(132, 208, 199, 0.14);
    border-color: rgba(132, 208, 199, 0.7);
}
.follow-btn.following {
    background: rgba(132, 208, 199, 0.18);
    border-color: rgba(132, 208, 199, 0.8);
    color: #84d0c7;
}

/* ── Inline Paragraph Reactions ─────────────────────────── */
.para-reaction-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: -8px 0 14px 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.novel-p:hover + .para-reaction-row,
.para-reaction-row:hover {
    opacity: 1;
}
.para-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s ease;
    color: var(--mist);
}
.para-reaction-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}
.para-reaction-btn.reacted {
    background: rgba(138, 43, 226, 0.15);
    border-color: rgba(138, 43, 226, 0.5);
    color: #c4a0ff;
}
.para-reaction-count {
    font-size: 11px;
}

/* ── Spoiler Controls ────────────────────────────────────── */
.spoiler-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.05);
    margin-bottom: 20px;
}
.spoiler-toggle-bar span {
    color: #ff8c8c;
    font-size: 13px;
}
.spoiler-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.spoiler-toggle.on {
    background: #ff6b6b;
}
.spoiler-toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s;
}
.spoiler-toggle.on::after {
    transform: translateX(20px);
}
.spoiler-hidden {
    filter: blur(8px);
    user-select: none;
    transition: filter 0.3s;
}
.spoiler-hidden.revealed {
    filter: none;
    user-select: text;
}

/* ── Profile Cropper + Moderation Queue ─────────────────── */
.avatar-crop-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
    margin-top: 14px;
    max-width: 100%;
    overflow: hidden;
}
.avatar-crop-wrap[hidden] {
    display: none;
}
.avatar-crop-wrap canvas {
    width: 100%;
    max-width: min(320px, 100%);
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #111;
}
.avatar-crop-controls {
    display: grid;
    gap: 10px;
    min-width: 0;
}
.avatar-crop-controls label {
    color: var(--mist);
    font-size: 13px;
    letter-spacing: 0;
}
.moderation-card {
    overflow: hidden;
}
.moderation-toolbar {
    margin: 12px 0;
}
.moderation-queue {
    display: grid;
    gap: 14px;
}
.moderation-item {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.035);
}
.moderation-item-head,
.moderation-preview-row,
.moderation-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.moderation-item-head h4 {
    margin: 6px 0 4px;
}
.moderation-item-head p,
.moderation-payload p {
    margin: 4px 0;
    color: var(--mist);
}
.moderation-payload {
    margin: 12px 0;
    overflow-wrap: anywhere;
}
.moderation-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex: 0 0 auto;
}
.moderation-status {
    text-transform: capitalize;
    font-size: 13px;
}
.moderation-pending {
    color: #f4d47c;
}
.moderation-approved {
    color: #7fe3a1;
}
.moderation-rejected,
.ghost-btn.danger {
    color: #ff8c8c;
}
.moderation-empty {
    padding: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: var(--mist);
}

@media (max-width: 720px) {
    .avatar-crop-wrap,
    .moderation-item-head,
    .moderation-preview-row,
    .moderation-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }
    .moderation-actions .input-field,
    .moderation-actions button {
        width: 100%;
    }
}

/* ── Feedback Button ─────────────────────────────────────── */
.feedback-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(138, 43, 226, 0.5);
    color: #c4a0ff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: 0.2s ease;
    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.2);
}
.feedback-fab:hover {
    background: rgba(138, 43, 226, 0.15);
    transform: scale(1.08);
}
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 201;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 80px;
}
.feedback-modal {
    width: min(100%, 480px);
    padding: 28px;
    border-radius: 24px 24px 0 0;
    background: rgba(12, 12, 20, 0.98);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-bottom: none;
}
.feedback-modal h3 {
    margin: 0 0 16px;
    font-family: "Cormorant Garamond", serif;
    font-size: 22px;
}
.feedback-type-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.feedback-type-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--mist);
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}
.feedback-type-btn.active {
    border-color: rgba(138, 43, 226, 0.7);
    color: #c4a0ff;
    background: rgba(138, 43, 226, 0.1);
}
.feedback-modal textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 14px;
    resize: vertical;
    font-family: "Bricolage Grotesque", sans-serif;
}

/* ── Character Detail Card ───────────────────────────────── */
.char-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
}
.char-detail-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        rgba(207, 47, 47, 0.2),
        rgba(138, 43, 226, 0.2)
    );
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex: 0 0 auto;
}
.char-relation-list {
    display: grid;
    gap: 8px;
}
.char-relation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
}
.char-relation-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--void);
    font-family: "Space Mono", monospace;
    flex: 0 0 60px;
}

/* ── Unlock Milestones ───────────────────────────────────── */
.unlock-card {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.9);
    margin-bottom: 14px;
    transition: 0.2s ease;
}
.unlock-card.unlocked {
    border-color: rgba(212, 168, 48, 0.5);
}
.unlock-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 0 10px;
    overflow: hidden;
}
.unlock-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #84d0c7, #d4a830);
    transition: width 0.4s ease;
}
.unlock-content-reveal {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(212, 168, 48, 0.06);
    border: 1px solid rgba(212, 168, 48, 0.2);
    font-size: 14px;
    color: var(--bone);
    line-height: 1.7;
}

/* ── Previously On ───────────────────────────────────────── */
.recap-card {
    padding: 18px 20px;
    border-radius: 14px;
    border-left: 3px solid rgba(207, 47, 47, 0.6);
    background: rgba(207, 47, 47, 0.04);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(246, 238, 232, 0.8);
}
.recap-card strong {
    display: block;
    font-family: "Space Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--blood);
    margin-bottom: 6px;
}

/* ── Recommendations ─────────────────────────────────────── */
.rec-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.9);
    cursor: pointer;
    transition: 0.2s ease;
    margin-bottom: 10px;
}
.rec-card:hover {
    border-color: rgba(132, 208, 199, 0.4);
    transform: translateX(4px);
}
.rec-reason {
    font-size: 11px;
    color: var(--void);
    font-family: "Space Mono", monospace;
    letter-spacing: 0.06em;
}

/* ── Responsive overrides ────────────────────────────────── */
@media (max-width: 560px) {
    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .codex-grid {
        grid-template-columns: 1fr;
    }
    .feedback-fab {
        bottom: 96px;
    }
}

/* ── UI Polish ───────────────────────────────────────────── */

/* Better search input on focus */
.search-bar-wrap input:focus {
    border-color: rgba(132, 208, 199, 0.8) !important;
    box-shadow: 0 0 0 3px rgba(132, 208, 199, 0.12) !important;
}

/* Nicer filter chips */
.filter-chip {
    transition: all 0.18s ease;
}
.filter-chip.active {
    background: rgba(132, 208, 199, 0.18) !important;
    border-color: rgba(132, 208, 199, 0.7) !important;
    color: #84d0c7 !important;
}

/* Stats cards glow on hover */
.stat-card:hover {
    border-color: rgba(132, 208, 199, 0.3);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}
.stat-value {
    background: linear-gradient(135deg, #ffe8df, #ff8c5a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Badge card shimmer for earned */
.badge-card.earned {
    background: linear-gradient(
        135deg,
        rgba(212, 168, 48, 0.1),
        rgba(212, 168, 48, 0.04)
    ) !important;
}
.badge-card.earned .badge-icon {
    filter: drop-shadow(0 0 8px rgba(212, 168, 48, 0.5));
}

/* Timeline hover lift */
.timeline-item:hover {
    border-color: rgba(132, 208, 199, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Codex card subtle gradient */
.codex-card {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.04),
        rgba(255, 255, 255, 0.01)
    ) !important;
}
.codex-card:hover {
    border-color: rgba(132, 208, 199, 0.45) !important;
    box-shadow: 0 4px 20px rgba(132, 208, 199, 0.08);
}

/* Feedback FAB pulse on page load */
@keyframes fabPulse {
    0% {
        box-shadow: 0 4px 20px rgba(138, 43, 226, 0.2);
    }
    50% {
        box-shadow: 0 4px 28px rgba(138, 43, 226, 0.45);
    }
    100% {
        box-shadow: 0 4px 20px rgba(138, 43, 226, 0.2);
    }
}
.feedback-fab {
    animation: fabPulse 3s ease-in-out infinite;
}

/* Streak bar responsive */
@media (max-width: 560px) {
    .streak-bar {
        padding: 14px 16px;
    }
    .streak-num {
        font-size: 3rem;
    }
    .search-bar-wrap input {
        font-size: 15px;
        padding: 12px 44px 12px 16px;
    }
}

/* Community tab always visible in app mode */
.native-app .mobile-nav [data-view="community"] {
    display: inline-flex !important;
}

/* App mode: show community in both navs */
.native-app #nav-community-btn {
    display: inline-flex !important;
}

/* Better scroll on mobile for tag filters */
.tag-filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tag-filter-bar::-webkit-scrollbar {
    display: none;
}
.tag-filter-bar .filter-chip {
    flex: 0 0 auto;
}

/* Search result items */
.search-result-item:last-child {
    margin-bottom: 0;
}

/* Previously-on recap card */
.recap-card strong {
    color: #ff6b6b;
}

/* ── Push notification button ─────────────────────────────── */
#push-enable-btn {
    transition: all 0.2s ease;
    flex: 0 0 auto !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}
#push-enable-btn .push-label {
    display: inline;
}
@media (max-width: 1400px) {
    #push-enable-btn .push-label {
        display: none;
    }
    #push-enable-btn {
        padding: 6px 8px !important;
    }
}
#push-enable-btn:hover {
    border-color: rgba(132,208,199,0.5) !important;
    color: #84d0c7 !important;
    background: rgba(132,208,199,0.08) !important;
}
#push-enable-btn.push-active {
    border-color: rgba(132,208,199,0.7) !important;
    color: #84d0c7 !important;
    background: rgba(132,208,199,0.12) !important;
}

/* ── In-app notification items ────────────────────────────── */
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { border-left: 3px solid rgba(138,43,226,0.7); background: rgba(138,43,226,0.04); }
.notif-title { font-size: 13px; font-weight: 700; color: var(--bone); margin-bottom: 2px; }
.notif-body { font-size: 12px; color: var(--mist); line-height: 1.4; }
.notif-time { font-size: 11px; color: rgba(175,160,149,0.6); margin-top: 4px; font-family: "Space Mono", monospace; }
.notif-empty { padding: 20px 16px; font-size: 13px; color: var(--mist); text-align: center; }

/* Manga teaser and profile upload polish */
.manga-teaser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.manga-teaser-card {
    position: relative;
    overflow: hidden;
    min-height: 260px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(132, 208, 199, 0.12), transparent 35%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
        #09090c;
    padding: 22px;
    box-shadow: var(--shadow);
    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

.manga-teaser-card:hover {
    transform: translateY(-4px);
    border-color: rgba(132, 208, 199, 0.34);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.manga-teaser-card::after {
    content: "";
    position: absolute;
    inset: auto -20% -35% -20%;
    height: 60%;
    background: radial-gradient(circle, rgba(207, 47, 47, 0.2), transparent 58%);
    pointer-events: none;
}

.manga-teaser-card strong {
    display: block;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1;
    color: var(--bone);
}

.manga-teaser-card p {
    color: var(--mist);
    line-height: 1.65;
}

.manga-teaser-tag {
    display: inline-flex;
    margin-bottom: 18px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(132, 208, 199, 0.28);
    color: #9fe7dd;
    font-size: 11px;
    font-family: "Space Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.avatar-upload-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 152px;
    padding: 24px;
    border: 1px dashed rgba(132, 208, 199, 0.42);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(132, 208, 199, 0.08), transparent),
        rgba(255, 255, 255, 0.035);
    color: var(--bone);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.avatar-upload-zone:hover,
.avatar-upload-zone.dragging {
    transform: translateY(-2px);
    border-color: rgba(132, 208, 199, 0.78);
    background: rgba(132, 208, 199, 0.1);
}

.avatar-upload-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.avatar-upload-copy {
    text-align: center;
    display: grid;
    gap: 8px;
}

.avatar-upload-copy strong {
    font-size: 18px;
}

.avatar-preview-row {
    display: grid;
    grid-template-columns: minmax(180px, 320px) minmax(112px, 150px);
    gap: 16px;
    align-items: center;
    margin-top: 18px;
    max-width: 100%;
    overflow: hidden;
}

.avatar-circle-preview {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.28);
}

.avatar-crop-controls .crop-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.public-profile-card {
    display: grid;
    gap: 22px;
}

.public-profile-hero {
    display: flex;
    gap: 18px;
    align-items: center;
}

.public-profile-hero img,
.clickable-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
}

.clickable-avatar {
    width: 42px;
    height: 42px;
    cursor: pointer;
}

.profile-link-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.profile-link-btn:hover {
    color: #84d0c7;
}

.public-profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.public-profile-stats span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--mist);
    background: rgba(255, 255, 255, 0.035);
}

.profile-feed-grid {
    display: grid;
    gap: 12px;
}

@media (max-width: 640px) {
    .avatar-preview-row {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .avatar-circle-preview {
        width: 118px;
        height: 118px;
    }

    .avatar-crop-controls .crop-button-row {
        display: grid;
        grid-template-columns: 1fr;
    }
}


/* ── Banner editor ─────────────────────────────────────────────────── */
.banner-upload-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 112px;
    padding: 22px;
    border: 1px dashed rgba(207, 47, 47, 0.42);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(207, 47, 47, 0.07), transparent),
        rgba(255, 255, 255, 0.03);
    color: var(--bone);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.banner-upload-zone:hover,
.banner-upload-zone.dragging {
    transform: translateY(-2px);
    border-color: rgba(207, 47, 47, 0.72);
    background: rgba(207, 47, 47, 0.1);
}

.banner-upload-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Banner canvas — wide 3:1 ratio */
#banner-crop-canvas {
    width: 100%;
    max-width: 540px;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    display: block;
}

.banner-preview-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
    margin-top: 18px;
    max-width: 100%;
}

/* Small inline banner thumbnail */
.banner-strip-preview {
    width: 120px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.28);
    flex-shrink: 0;
}

/* Profile header card with banner */
.profile-banner-header {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(18, 20, 28, 0.96);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.profile-banner-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, rgba(207,47,47,0.18), rgba(132,208,199,0.12));
}

.profile-banner-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, rgba(207,47,47,0.12), rgba(132,208,199,0.08));
}

.profile-banner-body {
    padding: 0 24px 24px;
    position: relative;
}

.profile-banner-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(18,20,28,0.96);
    background: rgba(255,255,255,0.06);
    margin-top: -40px;
    margin-bottom: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.45);
    position: relative;
    z-index: 2;
}

.profile-banner-info {
    flex: 1;
    min-width: 0;
}

.profile-banner-info h1 {
    margin: 0 0 4px;
    font-family: "Cormorant Garamond", serif;
    font-size: 24px;
    line-height: 1;
}

.profile-banner-bio {
    margin: 4px 0 0;
    color: var(--mist);
    font-size: 13px;
    line-height: 1.55;
    max-width: 60ch;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Bio textarea */
.bio-field {
    width: 100%;
    min-height: 90px;
    max-height: 200px;
    resize: vertical;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.04);
    color: var(--bone);
    font: inherit;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color 0.18s ease;
}

.bio-field:focus {
    outline: none;
    border-color: rgba(132,208,199,0.5);
    background: rgba(255,255,255,0.06);
}

.bio-counter {
    text-align: right;
    font-size: 11px;
    color: var(--mist);
    margin-top: 4px;
}

@media (max-width: 640px) {
    .avatar-crop-controls .crop-button-row {
        display: grid;
        grid-template-columns: 1fr;
    }
    .banner-preview-row {
        grid-template-columns: 1fr;
    }
    .profile-banner-img,
    .profile-banner-placeholder {
        aspect-ratio: 3/1;
    }
    .profile-banner-avatar {
        width: 64px;
        height: 64px;
    }
}


/* Reader tools polish: app-grade sheet, no overlap, touch-safe controls */
.reader.tools-open .reader-toolbar {
    gap: 14px;
    padding: 18px;
    background:
        radial-gradient(circle at 12% 0%, rgba(174, 42, 62, 0.18), transparent 28%),
        linear-gradient(180deg, rgba(22, 22, 25, 0.98), rgba(8, 8, 10, 0.98));
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.62),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.reader.tools-open .toolbar-pill {
    flex: 1 1 270px;
    min-width: min(100%, 270px);
    gap: 10px;
    padding: 16px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
        rgba(20, 20, 23, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.reader.tools-open .toolbar-pill:first-child,
.reader.tools-open .toolbar-pill.bookmark-card {
    flex-basis: 360px;
}

.reader.tools-open .toolbar-pill .toolbar-note {
    display: block;
}

.reader.tools-open .toolbar-value {
    font-size: clamp(18px, 1.7vw, 24px);
    letter-spacing: 0;
}

.reader.tools-open .pill-label {
    color: rgba(246, 238, 232, 0.62);
    letter-spacing: 0.16em;
}

.reader.tools-open .toolbar-actions {
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 8px;
}

.reader.tools-open .toolbar-actions .ghost-btn,
.reader.tools-open .toolbar-pill select,
.reader.tools-open .toolbar-pill input[type="range"] {
    min-height: 46px;
    border-radius: 12px;
}

.reader.tools-open .toolbar-actions .ghost-btn {
    padding: 10px 12px;
    font-size: 14px;
}

.reader.tools-open .toolbar-pill select {
    font-size: 15px;
    background-color: rgba(255, 255, 255, 0.075);
}

.reader.tools-open #tts-status,
.reader.tools-open #bookmark-status {
    min-height: 22px;
}

.tts-highlight {
    color: #19110d;
    background: linear-gradient(135deg, #ffe08a, #ffb35c);
    box-shadow:
        0 0 0 1px rgba(255, 227, 156, 0.7),
        0 8px 20px rgba(255, 151, 65, 0.22);
}

@media (max-width: 820px) {
    .reader.tools-open .reader-toolbar {
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        top: max(58px, env(safe-area-inset-top));
        bottom: max(74px, env(safe-area-inset-bottom));
        padding: 10px;
        gap: 10px;
        border-radius: 18px;
        overscroll-behavior: contain;
    }

    .reader.tools-open .toolbar-pill {
        width: 100%;
        min-width: 0;
        padding: 14px;
        border-radius: 13px;
    }

    .reader.tools-open .toolbar-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reader.tools-open .toolbar-actions .ghost-btn,
    .reader.tools-open .toolbar-pill select,
    .reader.tools-open .toolbar-pill input[type="range"] {
        min-height: 48px;
        font-size: 15px;
    }
}

@media (max-width: 430px) {
    .reader.tools-open .toolbar-actions {
        grid-template-columns: 1fr;
    }

    .reader.tools-open .toolbar-value {
        font-size: 20px;
    }
}


/* Mobile reader tool cards must never flex-shrink over their controls */
@media (max-width: 820px) {
    .reader.tools-open .reader-toolbar > .toolbar-pill,
    .reader.tools-open .reader-toolbar > .toolbar-pill:first-child,
    .reader.tools-open .reader-toolbar > .toolbar-pill.export-card,
    .reader.tools-open .reader-toolbar > .toolbar-pill.bookmark-card,
    .reader.tools-open .reader-toolbar > .toolbar-pill.chapter-card,
    .reader.tools-open .reader-toolbar > .toolbar-pill.status {
        flex: 0 0 auto !important;
        flex-basis: auto !important;
        height: auto !important;
        min-height: max-content;
        overflow: visible;
    }
}

.public-profile-banner {
    width: 100%;
    aspect-ratio: 3/1;
    background-size: cover;
    background-position: center;
    border-radius: 12px 12px 0 0;
    margin: -24px -24px 16px -24px;
    width: calc(100% + 48px);
}

/* Chat Input UI */
.chat-input-wrapper {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 6px 10px;
    transition: border-color 0.2s, background 0.2s;
}

.chat-input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--mist);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.chat-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow-y: auto;
    min-height: 24px;
    max-aspect-ratio: 3/1;
    padding: 6px 4px;
    background: transparent;
    border: none;
    color: var(--fg);
    line-height: 1.4;
    outline: none;
    margin: 0;
    display: block;
    scrollbar-width: none;
}

.chat-textarea::-webkit-scrollbar {
    display: none;
}

.chat-send-btn {
    background: var(--brand);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--brand-hover);
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* GIF Modal */
.gif-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.gif-modal {
    background: #1a1c23;
    border: 1px solid var(--line);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.gif-modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 8px;
}

.gif-modal-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--fg);
    border-radius: 20px;
    padding: 8px 16px;
    outline: none;
}

.gif-modal-input:focus {
    border-color: var(--brand);
}

.gif-modal-close {
    background: none;
    border: none;
    color: var(--mist);
    cursor: pointer;
    padding: 4px;
}

.gif-modal-close:hover {
    color: var(--fg);
}

.gif-modal-grid {
    padding: 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex: 1;
}

.gif-item {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.2s;
}

.gif-item:hover {
    transform: scale(1.02);
}

.chat-selected-gif-preview {
    position: absolute;
    bottom: 100%;
    left: 16px;
    margin-bottom: 8px;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--brand);
    display: none;
    z-index: 10;
}
