/* ══════════════════════════════════════════════════
   Magicadia Reader — Public-Facing Reader Styles
   ══════════════════════════════════════════════════ */

/* ── Vellum Fonts (shared with Books Studio) ── */
@font-face {
    font-family: 'Alegreya';
    font-weight: normal;
    font-style: normal;
    src: url('../magicadia_books/fonts/Alegreya-Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'Great Vibes';
    font-weight: normal;
    font-style: normal;
    src: url('../magicadia_books/fonts/GreatVibes-Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'RockSalt';
    font-weight: normal;
    font-style: normal;
    src: url('../magicadia_books/fonts/RockSalt-Regular.ttf') format('truetype');
}

/* ── Reader Auth (in Snapshot Header) ── */
.reader-snapshot-auth {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px 28px;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 28px;
    text-align: center;
}


.reader-auth-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reader-auth-name-row strong {
    color: #3792d4;
    font-size: 1.05rem;
}

.reader-edit-name {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #888;
    text-decoration: none;
    padding: 3px;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}

.reader-edit-name svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.reader-edit-name:hover {
    color: var(--gold);
}

.reader-auth-tier {
    color: #aaa;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.reader-auth-guest {
    color: #ccc;
    font-size: 1.05rem;
}

.reader-auth-guest-hint {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.reader-login-link,
.reader-logout-link {
    color: #888;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.75rem;
    transition: color 0.15s;
    padding: 5px 50px;
    margin-top: 20px;
    border: 1px solid var(--gold);
    border-radius: 4px;
}

.reader-login-link:hover,
.reader-logout-link:hover {
    color: var(--bg-panel);
    background-color: var(--gold);
}

/* ── Patreon Sign-In Button ── */
.reader-patreon-signin {
    display: inline-block;
    color: #fff;
    background: #ff424d;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 20px;
    border-radius: 4px;
    transition: background 0.15s;
}
.reader-patreon-signin:hover {
    background: #e0353f;
    color: #fff;
}
.reader-patreon-signin .patreon-icon {
    margin-right: 4px;
}

/* ── Name Modal ── */
.reader-name-intro {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── Modal Error ── */
.reader-login-error {
    background-color: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #f08080;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    margin-bottom: 12px;
}
.reader-resend-sent {
    color: #6fcf97;
    font-style: italic;
}

/* ── Reader Layout ── */
/* When reading a book, lock the page so the three-panel layout fills the viewport */
html.reader-active {
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body.reader-active {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1025px) {
    body.reader-active .header-top {
        display: none;
    }
}

body.reader-active .site-footer {
    padding: 0px 20px 20px;
    flex-shrink: 0;
}

body.reader-active .footer-content {
    display: none;
}

.reader-book {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════
   Landing View
   ══════════════════════════════════════════════════ */

.reader-landing {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-dark);
}

.reader-landing-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px;
}

/* ── Book Listings ── */
.book-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.book-listing {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    overflow: hidden; /* contain the float */
}

.book-listing-top {
    overflow: hidden; /* clearfix for float */
}

.book-listing-cover {
    float: left;
    width: 265px;
    margin: 0 24px 16px 0;
    border: 2px solid var(--gold);
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--bg-dark);
}

.book-listing-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.book-listing-info {
    /* no flex needed — text flows around the floated cover */
}

.book-listing-title {
    color: var(--gold);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.book-listing-series {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
    margin-bottom: 16px;
}

.book-listing-desc {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.4;
    margin: 0;
    white-space: pre-line;
}

.book-listing-desc-empty {
    color: var(--text-dim);
    font-style: italic;
}

.book-listing-coming-soon {
    clear: both;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-style: italic;
}

/* ── Locked Book Styling ── */
.book-listing-locked-card {
    opacity: 0.5;
    filter: grayscale(60%);
    pointer-events: none;
    position: relative;
}
.book-listing-locked-card .book-listing-link-read {
    display: none;
}
.book-listing-locked {
    clear: both;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.92rem;
    text-align: center;
}
.book-locked-icon {
    font-size: 1.1rem;
}

/* ── Book Listing Links ── */
.book-listing-links {
    clear: both;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.book-listing-link {
    display: inline-block;
    padding: 8px 18px;
    border: 2px solid var(--gold);
    border-radius: 6px;
    color: var(--gold);
    background-color: transparent;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.book-listing-link:hover {
    background-color: var(--gold);
    color: var(--bg-panel);
}

.book-listing-link-read {
    background-color: var(--gold);
    color: var(--bg-panel);
}

.book-listing-link-read:hover {
    background-color: var(--gold-hover);
    border-color: var(--gold-hover);
}

.book-listing-link-read-top {
    display: none;
}

/* ── Beta Access Form ── */
.beta-access-form {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.beta-access-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
.beta-pass-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
    width: 200px;
}
.beta-pass-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════
   Book Reader View
   ══════════════════════════════════════════════════ */

.reader-book {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Snapshot Header ── */
/* ── Early Preview Banner ── */
.reader-preview-banner {
    text-align: center;
    padding: 6px 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background-color: rgba(212, 175, 55, 0.08);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.reader-snapshot {
    display: flex;
    gap: 20px;
    padding: 16px 24px;
    border-bottom: 2px solid var(--gold);
    background-color: var(--bg-panel);
    flex-shrink: 0;
    align-items: flex-start;
}

.reader-snapshot-portrait {
    width: 100px;
    height: 143px;
    flex-shrink: 0;
    border: 2px solid var(--gold);
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reader-snapshot-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait-placeholder {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-align: center;
}

.reader-snapshot-info {
    flex: 1;
    min-width: 0;
}

.reader-snapshot-series {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.reader-snapshot-title {
    color: var(--gold);
    font-size: 1.3rem;
    margin: 4px 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Purchase Links (inline) ── */
.reader-snapshot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reader-purchase-link {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.15s;
}

.reader-purchase-link:hover {
    border-color: var(--gold);
    color: var(--gold);
    background-color: rgba(212, 175, 55, 0.08);
}

/* ── Mobile Panel Tabs ── */
.reader-mobile-tabs {
    display: none; /* hidden on desktop, shown on mobile */
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.reader-mobile-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.reader-mobile-tab:hover { color: var(--text-light); }
.reader-mobile-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ══════════════════════════════════════════════════
   Three-Panel Layout
   ══════════════════════════════════════════════════ */

.chapters-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ── Left Panel: Chapter List ── */
.chapters-list-panel {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background-color: var(--bg-panel);
}

.chapter-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.chapter-list-item:hover {
    background-color: var(--bg-input);
}

.chapter-list-item.active {
    background-color: var(--bg-input);
    border-left-color: var(--gold);
}

.chapter-list-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.chapter-list-title {
    display: block;
    font-size: 1.1rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-list-item.active .chapter-list-title {
    color: var(--gold);
}


/* ── Locked Chapter Items ── */
.chapter-list-item.locked {
    opacity: 0.7;
}

.chapter-list-item.locked .chapter-list-title {
    color: var(--text-dim);
}

.chapter-list-item.locked:hover {
    background-color: var(--bg-input);
}

.chapter-list-lock {
    font-size: 0.75rem;
    margin-left: 4px;
    vertical-align: 2px;
}

.chapter-list-tier {
    display: block;
    font-size: 0.72rem;
    color: var(--gold);
    margin-top: 2px;
    line-height: 1.3;
    opacity: 1;
}
.chapter-list-coming-soon {
    color: #3498db;
}

/* Future chapters — dimmed, no interaction */
.chapter-list-item.future {
    opacity: 0.35;
    cursor: default;
}
.chapter-list-item.future:hover {
    background-color: transparent;
}
.chapter-list-item.future .chapter-list-title {
    color: var(--text-dim);
}

/* ── Center Panel: Chapter Text ── */
.chapter-text-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    background-color: var(--bg-dark);
    transition: background-color 0.3s, color 0.3s;
}

.chapter-text-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
}

/* ── Reader Controls (sticky bar) ── */
.reader-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: -24px;
    margin: -24px -32px 20px -32px;
    padding: 10px 32px;
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    z-index: 10;
    transition: background-color 0.3s;
}

.reader-chapter-label {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
}

.reader-controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reader-font-size {
    display: flex;
    align-items: baseline;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.reader-font-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 700;
    font-family: Georgia, serif;
    transition: all 0.15s;
    padding: 6px 14px;
}

.reader-font-btn:hover {
    color: var(--gold);
    background-color: rgba(212, 175, 55, 0.1);
}

.reader-font-decrease {
    font-size: 0.85rem;
    border-right: 1px solid var(--border);
}

.reader-font-increase {
    font-size: 1.3rem;
}

.reader-mode-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 5px 11px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

.reader-mode-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* ── Chapter Display Body ── */
.chapter-display-body {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ── Chapter Reactions ── */
.chapter-reactions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.reactions-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.reaction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    min-width: 54px;
}
.reaction-btn:hover:not(:disabled) {
    border-color: #d4af37;
    background-color: rgba(212, 175, 55, 0.08);
}
.reaction-btn.active {
    border-color: #d4af37;
    background-color: rgba(212, 175, 55, 0.15);
}
.reaction-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.reaction-emoji {
    font-size: 1.4rem;
    line-height: 1;
}
.reaction-count {
    font-size: 0.72rem;
    color: var(--text-dim);
    min-height: 14px;
}
.reaction-btn.active .reaction-count {
    color: #d4af37;
    font-weight: 600;
}
.reactions-login-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* ── Chapter Navigation (prev/next) ── */
.chapter-nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.chapter-nav-link {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    max-width: 220px;
}

.chapter-nav-link:hover {
    border-color: var(--gold);
    background-color: rgba(212, 175, 55, 0.06);
}

.chapter-nav-prev { align-items: flex-start; }
.chapter-nav-next { align-items: flex-end; }

.chapter-nav-direction {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 2px;
}

.chapter-nav-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

.chapter-nav-locked {
    opacity: 0.5;
}

/* ── Chapter Locked Message ── */
.chapter-locked-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0px 20px;
    color: var(--text-muted);
}

.chapter-locked-icon {
    font-size: 3rem;
    margin-bottom: 0;
    opacity: 0.6;
}

.chapter-locked-message h3 {
    color: var(--gold);
    font-size: 1.4rem;
    margin: 0 0 10px 0;
}

.chapter-display-body .chapter-locked-message p {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    line-height: 1.6;
    text-indent: 0;
    text-align: center;
    color: #4ccaf0;
}

.chapter-locked-hint {
    font-size: 0.95rem !important;
    color: #7d9cf9 !important;
}

.chapter-locked-patreon {
    font-size: 0.95rem !important;
    color: #08b808 !important;
}

.chapter-locked-hint a {
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
}

.chapter-locked-hint a:hover {
    color: #e8c84a;
}

.chapter-locked-requirement {
    font-size: 1.05rem !important;
    color: var(--text-light) !important;
    margin-bottom: 8px !important;
}

.chapter-locked-requirement strong {
    color: var(--gold);
}

.chapter-locked-upgrade {
    font-size: 0.95rem !important;
}

.chapter-locked-upgrade a {
    color: #08b808;
    text-decoration: underline;
    font-weight: 600;
}

.chapter-locked-upgrade a:hover {
    color: #0ae00a;
}

.chapter-locked-hr {
    width: 60%;
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.chapter-locked-benefits {
    list-style: disc;
    text-align: left;
    color: #08b808;
    font-size: 0.95rem;
    line-height: 1.8;
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.chapter-locked-benefits em {
    font-style: italic;
}

.chapter-locked-flavor {
    max-width: 500px;
    line-height: 1.6;
}

.chapter-locked-cta {
    font-weight: 600;
    color: var(--gold) !important;
    margin-top: 8px !important;
}

.chapter-locked-pill {
    display: block;
    max-width: 500px;
    width: 100%;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 0px 24px;
    margin-top: 16px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.chapter-locked-pill,
.chapter-locked-pill * {
    text-decoration: none !important;
}

.chapter-locked-pill:hover {
    background: rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.chapter-locked-pill-aa {
    background: rgba(55, 212, 102, 0.16);
}
.chapter-locked-pill-aa:hover {
    background: rgba(55, 212, 102, 0.25);
}

.chapter-locked-pill-tr {
    background: rgba(55, 146, 212, 0.23);
}
.chapter-locked-pill-tr:hover {
    background: rgba(55, 146, 212, 0.32);
}

.chapter-locked-pill-ghc {
    background: rgba(255, 23, 208, 0.28);
}
.chapter-locked-pill-ghc:hover {
    background: rgba(255, 23, 208, 0.37);
}

.chapter-locked-pill-badge {
    display: inline-block;
    background: #e8c84a;
    color: #1a1a2e;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.chapter-locked-other-options {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
}

.chapter-locked-pill-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0;
}

.chapter-locked-pill-desc {
    font-size: 0.95rem;
    color: #b8d7df;
    line-height: 1.5;
    margin-bottom: 0;
}

.chapter-locked-pill-perks {
    list-style: disc;
    text-align: left;
    color: #a5aba5;
    font-size: 0.9rem;
    line-height: 1.3;
    margin: 0;
    margin-bottom: 8px;
    padding-left: 20px;
}

/* Light mode */
.chapter-text-panel.reader-light-mode .chapter-locked-pill {
    background: rgba(138, 109, 27, 0.06);
    border-color: #8a6d1b;
}
.chapter-text-panel.reader-light-mode .chapter-locked-pill:hover {
    background: rgba(138, 109, 27, 0.12);
}
.chapter-text-panel.reader-light-mode .chapter-locked-pill-title {
    color: #8a6d1b;
}
.chapter-text-panel.reader-light-mode .chapter-locked-pill-perks {
    color: #069006;
}

/* ══════════════════════════════════════════════════
   Vellum Chapter Content Styling
   ══════════════════════════════════════════════════ */

.chapter-display-body p {
    margin: 0;
    text-align: justify;
}

.chapter-display-body p.subsq {
    text-indent: 1.5em;
}

.chapter-display-body p.first {
    text-indent: 0;
}

.chapter-display-body .first-letter {
    font-size: 2.8em;
    float: left;
    line-height: 1;
    margin-right: 4px;
    margin-top: 2px;
    color: var(--gold);
    font-weight: 700;
}

.chapter-display-body .case-upper {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Scene breaks */
.chapter-display-body p.scene-break,
.chapter-display-body p.implicit-break.scene-break {
    text-indent: 0;
    text-align: center;
    margin: 1.5em 0;
    color: var(--text-dim);
    letter-spacing: 0.3em;
}

.chapter-display-body p.scene-break::after,
.chapter-display-body p.implicit-break.scene-break::after {
    content: "* * *";
}

/* Ornamental breaks */
.chapter-display-body .ornamental-break .ornamental-break-block { display: none; }
.chapter-display-body .ornamental-break .ornamental-break-as-text {
    text-align: center;
    margin: 1.5em 0;
    color: var(--text-dim);
    letter-spacing: 0.3em;
    text-indent: 0;
}

/* Written notes */
.chapter-display-body .written-note {
    margin: 1.2em 1.5em;
    padding: 12px 16px;
    background-color: #173459;
    border: 1px solid #4b75bb;
    border-radius: 6px;
    font-family: 'RockSalt', cursive;
    font-size: 0.85rem;
    line-height: 2.4;
}

.chapter-display-body .written-note p { text-indent: 0; }

.chapter-display-body .written-note-alignment-center-content,
.chapter-display-body p.written-note-alignment-center-content { text-align: center; }

.chapter-display-body .written-note-alignment-right-content,
.chapter-display-body p.written-note-alignment-right-content { text-align: right; }

/* Blockquote attribution */
.chapter-display-body .blockquote-attribution {
    font-size: 0.85rem;
    margin-top: 8px;
    font-style: normal;
    font-family: 'Alegreya', serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: right;
}

.chapter-display-body .blockquote-attribution::before { content: "— "; }

/* Text conversations — iMessage style */
.chapter-display-body .text-conversation { margin: 1em 0; }

.chapter-display-body .transmission-group {
    clear: both;
    overflow: hidden;
    margin: 4px 0;
}

.chapter-display-body .transmission.received .text-conversation-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 4px;
    padding: 8px 14px;
    display: inline-block;
    max-width: 80%;
    text-indent: 0;
}

.chapter-display-body .transmission.sent .text-conversation-content {
    background-color: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px 12px 4px 12px;
    padding: 8px 14px;
    display: inline-block;
    max-width: 80%;
    float: right;
    text-indent: 0;
}

/* Alignment blocks */
.chapter-display-body .alignment-block-content-center {
    text-align: center;
    text-indent: 0;
}

.chapter-display-body .alignment-block-align-center ~ .alignment-block-align-center {
    width: 80%;
    margin: 1.2em auto;
    padding: 14px 20px;
    background-color: #173459;
    border: 1px solid #4b75bb;
    border-radius: 6px;
}

.chapter-display-body .alignment-block .implicit-break.basic-break { height: 0.8em; }

/* Inline images */
.chapter-display-body .inline-image { text-align: center; margin: 1.5em 0; }
.chapter-display-body .inline-image img { max-width: 100%; border-radius: 6px; }

/* Block quotes */
.chapter-display-body blockquote.prose,
.chapter-display-body blockquote.verse {
    margin: 1.2em 1.5em;
    padding-left: 12px;
    border-left: 3px solid var(--gold);
    color: var(--text-muted);
    font-style: italic;
}

.chapter-display-body blockquote.prose p,
.chapter-display-body blockquote.verse p { text-indent: 0; text-align: left; }

/* Links */
.chapter-display-body a { color: var(--gold); text-decoration: underline; }
.chapter-display-body a:hover { color: #e8c84a; }

/* Underline / strikethrough */
.chapter-display-body .underline { text-decoration: underline; }
.chapter-display-body .strikethrough { text-decoration: line-through; }

/* ══════════════════════════════════════════════════
   Light Mode
   ══════════════════════════════════════════════════ */

.chapter-text-panel.reader-light-mode { background-color: #dadada; }

.chapter-text-panel.reader-light-mode .reader-controls {
    background-color: #dadada;
    border-bottom-color: #b0b0b0;
}

.chapter-text-panel.reader-light-mode .reader-chapter-label { color: #555; }
.chapter-text-panel.reader-light-mode .reader-font-btn { color: #666; }
.chapter-text-panel.reader-light-mode .reader-font-btn:hover { color: #333; background-color: rgba(0, 0, 0, 0.08); }
.chapter-text-panel.reader-light-mode .reader-font-size,
.chapter-text-panel.reader-light-mode .reader-font-decrease { border-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .reader-mode-btn { color: #666; border-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .reader-mode-btn:hover { color: #333; border-color: #333; }

.chapter-text-panel.reader-light-mode .chapter-display-body { color: #222; }
.chapter-text-panel.reader-light-mode .chapter-display-body .first-letter { color: #8a6d1b; }

.chapter-text-panel.reader-light-mode .chapter-display-body p.scene-break,
.chapter-text-panel.reader-light-mode .chapter-display-body p.implicit-break.scene-break { color: #999; }

.chapter-text-panel.reader-light-mode .chapter-display-body .written-note {
    background-color: #c0cfe0;
    border-color: #7a9dc4;
}

.chapter-text-panel.reader-light-mode .chapter-display-body .alignment-block-align-center ~ .alignment-block-align-center {
    background-color: #c0cfe0;
    border-color: #7a9dc4;
}

.chapter-text-panel.reader-light-mode .chapter-display-body .transmission.received .text-conversation-content {
    background-color: #c8c8c8;
    border-color: #aaa;
}

.chapter-text-panel.reader-light-mode .chapter-display-body .transmission.sent .text-conversation-content {
    background-color: rgba(140, 110, 20, 0.2);
    border-color: rgba(140, 110, 20, 0.4);
}

.chapter-text-panel.reader-light-mode .chapter-display-body a { color: #8a6d1b; }

.chapter-text-panel.reader-light-mode .chapter-display-body blockquote.prose,
.chapter-text-panel.reader-light-mode .chapter-display-body blockquote.verse {
    color: #555;
    border-left-color: #8a6d1b;
}

/* Light mode locked message */
.chapter-text-panel.reader-light-mode .chapter-locked-message { color: #555; }
.chapter-text-panel.reader-light-mode .chapter-locked-message h3 { color: #8a6d1b; }
.chapter-text-panel.reader-light-mode .chapter-locked-hint { color: #888; }
.chapter-text-panel.reader-light-mode .chapter-locked-hint a { color: #8a6d1b; }
.chapter-text-panel.reader-light-mode .chapter-locked-hr { border-top-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .chapter-locked-benefits { color: #069006; }
.chapter-text-panel.reader-light-mode .chapter-locked-requirement { color: #333 !important; }
.chapter-text-panel.reader-light-mode .chapter-locked-requirement strong { color: #8a6d1b; }
.chapter-text-panel.reader-light-mode .chapter-locked-upgrade a { color: #069006; }

/* Light mode chapter nav */
.chapter-text-panel.reader-light-mode .chapter-reactions { border-top-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .reaction-btn { border-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .reaction-btn:hover:not(:disabled) { border-color: #8a6d1b; background-color: rgba(140, 110, 20, 0.08); }
.chapter-text-panel.reader-light-mode .reaction-btn.active { border-color: #8a6d1b; background-color: rgba(140, 110, 20, 0.15); }
.chapter-text-panel.reader-light-mode .reaction-btn.active .reaction-count { color: #8a6d1b; }
.chapter-text-panel.reader-light-mode .reactions-login-hint { color: #888; }
.chapter-text-panel.reader-light-mode .chapter-nav { border-top-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .chapter-nav-link { border-color: #b0b0b0; }
.chapter-text-panel.reader-light-mode .chapter-nav-link:hover { border-color: #8a6d1b; background-color: rgba(140, 110, 20, 0.08); }
.chapter-text-panel.reader-light-mode .chapter-nav-direction { color: #8a6d1b; }
.chapter-text-panel.reader-light-mode .chapter-nav-title { color: #666; }

/* ══════════════════════════════════════════════════
   Right Panel: Characters Sidebar
   ══════════════════════════════════════════════════ */

.characters-panel {
    width: 235px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
}

.characters-panel-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.characters-panel-header h4 {
    color: var(--gold);
    font-size: 0.88rem;
    margin: 0;
}

.characters-panel-body {
    flex: 1;
    overflow-y: auto;
}

/* ── Character Cards ── */
.chapter-char-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px 10px;
    border-bottom: 1px solid #385a93;
    cursor: pointer;
    transition: background-color 0.15s;
}

.chapter-char-item:hover {
    background-color: var(--bg-input);
}

.chapter-char-portrait {
    width: 150px;
    height: 150px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border);
    background-color: var(--bg-dark);
    margin-bottom: 6px;
    flex-shrink: 0;
}

.chapter-char-portrait:has(img) {
    background: none;
    border-color: transparent;
}

.chapter-char-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chapter-char-portrait-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.6rem;
}

.chapter-char-name {
    font-size: 0.90rem;
    color: var(--text-light);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.chapter-char-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════
   Character Detail Slide-Out Panel
   ══════════════════════════════════════════════════ */

.char-detail-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.char-detail-overlay.active { opacity: 1; visibility: visible; }

.char-detail-panel {
    position: absolute;
    top: 0;
    right: -520px;
    width: 500px;
    max-width: calc(100% - 200px);
    height: 100%;
    background-color: var(--bg-panel);
    border-left: 2px solid var(--gold);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.char-detail-panel.active { right: 220px; }

/* ── Detail Header / Snapshot ── */
.char-detail-header {
    position: relative;
    padding: 16px 20px;
    border-bottom: 2px solid var(--gold);
    background-color: var(--bg-nav);
    flex-shrink: 0;
}

.char-detail-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1;
}

.char-detail-close:hover { border-color: var(--color-danger); color: var(--color-danger); }

.char-detail-snapshot {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.char-detail-portrait {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border: 2px solid var(--gold);
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-detail-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-detail-info { flex: 1; min-width: 0; }

.char-detail-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.char-detail-name {
    color: var(--gold);
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-detail-level-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.char-detail-level-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.char-detail-level-value {
    padding: 3px 8px;
    background-color: var(--bg-input);
    border: none;
    color: var(--text);
    border-radius: 4px;
    font-size: 0.88rem;
    text-align: center;
    font-weight: 700;
    min-width: 28px;
    display: inline-block;
}

.char-detail-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 6px;
}

/* ── Stat pills ── */
.char-detail-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ── Detail Tabs ── */
.char-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-panel);
    flex-shrink: 0;
}

.char-detail-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.char-detail-tab:hover { color: var(--text-light); }
.char-detail-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Detail Body ── */
.char-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.cd-section-label {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.cd-section-label:not(:first-child) { margin-top: 16px; }

.cd-description-text {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.cd-desc-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
}

.cd-desc-field { color: var(--gold); font-weight: 600; width: 120px; flex-shrink: 0; }
.cd-desc-value { color: var(--text-light); flex: 1; }

/* Inventory */
.cd-equip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 4px;
}

.cd-equip-item-thumb {
    width: 36px;
    height: 36px;
    border-radius: 3px;
    border: 1px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

.cd-equip-item-info { flex: 1; min-width: 0; }

.cd-equip-item-name {
    color: var(--text);
    font-weight: 600;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-equip-slot-label {
    color: var(--text-dim);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cd-equip-bonuses { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cd-equip-bonus { color: var(--color-stat); font-size: 0.68rem; }

/* Skills / Spells */
.cd-skill-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.82rem;
}

.cd-skill-name { color: var(--text); font-weight: 600; flex: 1; min-width: 0; }
.cd-skill-source { color: var(--text-dim); font-size: 0.68rem; font-style: italic; flex-shrink: 0; }
.cd-skill-passive { color: var(--text-muted); font-size: 0.65rem; font-style: italic; }

.cd-empty-msg {
    color: var(--text-dim);
    font-size: 0.82rem;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* ── Custom Scrollbar ── */
.chapters-list-panel::-webkit-scrollbar,
.characters-panel-body::-webkit-scrollbar,
.char-detail-body::-webkit-scrollbar,
.chapter-text-panel::-webkit-scrollbar {
    width: 6px;
}

.chapters-list-panel::-webkit-scrollbar-track,
.characters-panel-body::-webkit-scrollbar-track,
.char-detail-body::-webkit-scrollbar-track,
.chapter-text-panel::-webkit-scrollbar-track {
    background: transparent;
}

.chapters-list-panel::-webkit-scrollbar-thumb,
.characters-panel-body::-webkit-scrollbar-thumb,
.char-detail-body::-webkit-scrollbar-thumb,
.chapter-text-panel::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 3px;
}

/* ── Mobile Drawer ── */
.mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}
.mobile-drawer-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.3s ease, visibility 0s 0s; }

.mobile-drawer {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    background: var(--bg-panel);
    border-radius: 16px 16px 0 0;
    z-index: 9001;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease, visibility 0s 0.3s;
    visibility: hidden;
    pointer-events: none;
}
.mobile-drawer.active { transform: translateY(0); visibility: visible; pointer-events: auto; transition: transform 0.3s ease, visibility 0s 0s; }

.mobile-drawer-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}
.mobile-drawer-handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
}

.mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 8px;
    border-bottom: 1px solid var(--border);
}
.mobile-drawer-title {
    font-weight: 700;
    color: var(--gold);
    font-size: 1rem;
}
.mobile-drawer-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}
.mobile-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* ── Mobile Nav Buttons (hidden on desktop) ── */
.rpg-pill-mobile-nav {
    display: none;
}

/* ── Header Book Info (mobile only) ── */
.header-book-info {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.header-book-cover {
    width: 40px;
    height: 55px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}
.header-book-tier {
    font-size: 0.6rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.header-book-label {
    font-size: 0.65rem;
    color: #797272;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.header-book-title {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 600;
    line-height: 1.2;
}

/* ── Mobile Nav Button Pulse Notification ── */
@keyframes pulse-gold-glow {
    0% { box-shadow: 0 0 4px rgba(212, 175, 55, 0.3); }
    50% { box-shadow: 0 0 14px rgba(212, 175, 55, 0.8), 0 0 24px rgba(212, 175, 55, 0.4); }
    100% { box-shadow: 0 0 4px rgba(212, 175, 55, 0.3); }
}

.rpg-pill-mobile-nav-btn.pulse-notify {
    animation: pulse-gold-glow 0.6s ease-in-out 5;
}

.rpg-pill-mobile-nav-btn.has-unseen {
    background: rgba(55, 205, 212, 0.4);
    color: #ffc300;
    border-color: rgba(55, 205, 212, 0.5);
}

.rc-tab.pulse-notify {
    animation: rc-tab-bounce 0.5s ease-out 5;
}

@keyframes rc-tab-bounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(0.9); }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.rc-tab.has-unseen {
    position: relative;
}

.rc-tab.has-unseen::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #ffc300;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 195, 0, 0.6);
}

/* ── Locked Chapter Pills ── */
.chapter-locked-pill-aa { background: rgba(55, 212, 102, 0.16); }
.chapter-locked-pill-tr { background: rgba(55, 146, 212, 0.23); }
.chapter-locked-pill-ghc { background: rgba(255, 23, 208, 0.28); }
.chapter-locked-pill-perks { color: #a5aba5; }
.chapter-locked-pill-desc { color: #b8d7df; }

/* ══════════════════════════════════════════════════
   Tablet Responsive (769px – 1024px)
   ══════════════════════════════════════════════════ */

@media (min-width: 741px) and (max-width: 1024px) {
    /* Two-panel layout: chapters + text, no character panel */
    .characters-panel { display: none !important; }
    .chapters-list-panel { width: 180px; }
    .chapter-text-panel { padding-bottom: 120px; }

    /* Header: hide logo, show book info (same as mobile) */
    body.reader-active .site-footer { display: none !important; }
    body.reader-active .site-header { padding: 0 !important; }
    body.reader-active .logo-center { display: none !important; }
    body.reader-active .header-book-info { display: flex; flex: 1; }

    /* Snapshot: compact character pill (same as mobile) */
    .reader-snapshot { padding: 0; gap: 0; flex-wrap: nowrap; align-items: center; }
    .reader-snapshot-portrait { display: none; }
    .reader-snapshot-info { display: none; }
    .reader-snapshot-auth { min-width: unset; flex: 1; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0; gap: 0; background: none; border-radius: 0; }
    .reader-snapshot-auth:has(.rpg-pill-left) {
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        gap: 0 !important;
        padding: 8px 8px !important;
        align-items: center !important;
    }
    .rpg-pill-left { display: none !important; }
    .rpg-pill-right { display: none !important; }
    /* Col 1: Reader info */
    .rpg-pill-mobile-mini {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
        grid-row: 1;
        grid-column: 1;
        margin-left: 2vw;
        width: clamp(100px, 30vw, 150px);
        height: clamp(120px, 32vw, 170px);
        box-sizing: border-box;
        cursor: pointer;
    }
    .mobile-mini-name {
        font-size: clamp(0.65rem, 1.8vw, 0.85rem);
        font-weight: 500;
        color: #fff;
        margin-bottom: 5px;
    }
    .mobile-mini-avatar {
        width: clamp(70px, 24vw, 110px);
        height: clamp(60px, 21.5vw, 95px);
        border-radius: 50%;
        object-fit: cover;
    }
    .mobile-mini-tier {
        font-size: clamp(0.55rem, 1.5vw, 0.75rem);
        color: var(--text-muted);
        margin-top: 4px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    /* Col 2: Pots */
    .mobile-pots-row {
        display: flex !important;
        flex-direction: column;
        gap: 6px;
        grid-row: 1;
        grid-column: 2;
        align-self: center;
    }
    .mobile-pot { flex: 1; min-width: clamp(90px, 24vw, 140px); padding: 6px 8px; }
    /* Col 3: Miniature character */
    .mobile-mini-character {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
        grid-row: 1;
        grid-column: 3;
        width: clamp(100px, 30vw, 150px);
        height: clamp(120px, 32vw, 170px);
        cursor: pointer;
        margin-right: 2vw;
        margin-left: auto;
        justify-self: end;
        border: 1px solid rgba(212, 175, 55, 0.3);
        border-radius: 20px;
        padding: clamp(4px, 1.5vw, 10px);
        background: rgba(212, 175, 55, 0.06);
        box-sizing: border-box;
    }
    .mobile-mini-char-name {
        font-size: clamp(0.65rem, 1.8vw, 0.85rem);
        font-weight: 500;
        color: #fff;
        flex-shrink: 0;
    }
    .mobile-mini-char-canvas {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        width: 100%;
        position: relative;
    }
    .mobile-mini-char-canvas > div {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: scale(0.59) translateX(-50%) translateY(-67%);
        transform-origin: bottom left;
    }
    .mobile-mini-char-label {
        font-size: clamp(0.55rem, 1.5vw, 0.75rem);
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        position: relative;
        top: 5px;
    }
    .reader-snapshot-auth:has(.reader-auth-guest) { justify-content: center; text-align: center; padding: 12px 16px !important; }
    .reader-auth-guest { flex: 1 1 100%; min-width: 0; }
    .reader-auth-guest-hint { flex: 1 1 100%; font-size: 0.82rem; }
    .reader-patreon-signin { font-size: 0.82rem; padding: 6px 14px; }

    .rpg-pill-mobile-nav {
        display: flex;
        flex-basis: 100%;
        justify-content: center;
        gap: 12px;
        margin-top: 8px;
    }
    .rpg-pill-mobile-nav-btn {
        width: 75px;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: var(--gold);
        font-size: 1.6rem;
        cursor: pointer;
        line-height: 1;
    }
    .rpg-pill-mobile-nav-btn img { width: 30px; height: 25px; }
    .rpg-pill-mobile-nav-btn:active {
        background: rgba(212, 175, 55, 0.25);
    }

    /* Collectible cards in drawer — 5 per row on tablet */
    .mobile-drawer-body #rc-collectibles-list,
    .mobile-drawer-body #rc-pets-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    .mobile-drawer-body .rc-collectible-card {
        flex: 0 0 120px;
        width: 120px;
        margin-bottom: 0;
    }

    .mobile-drawer-body .rc-section {
        text-align: center;
    }
    .mobile-drawer-body .rc-section-header {
        text-align: center;
    }
    .mobile-drawer-body .rc-section-body {
        text-align: center;
    }
}

/* ══════════════════════════════════════════════════
   Mobile Responsive
   ══════════════════════════════════════════════════ */

@media (max-width: 740px) {
    /* Prevent iOS auto-zoom on input focus */
    input, textarea, select { font-size: 16px !important; }

    /* Landing */
    .reader-landing-inner { padding: 24px 16px; }
    .book-grid { gap: 20px; }
    .book-listing { padding: 16px; }
    .book-listing-cover { float: none; width: 100%; max-width: 280px; margin: 0 auto 16px; }
    .book-listing-title { font-size: 1.3rem; text-align: center; }
    .book-listing-series { text-align: center; }
    .book-listing-links { justify-content: center; }
    .book-listing-link-read-top { display: block; width: fit-content; margin: 0 auto 12px; text-align: center; }

    /* Mobile: hide footer when reading, compact header */
    body.reader-active .site-footer { display: none !important; }
    body.reader-active .site-header { padding: env(safe-area-inset-top, 0) 0 0 0 !important; }
    body.reader-active .logo-center { display: none !important; }
    body.reader-active .header-book-info { display: flex; flex: 1; }

    /* Snapshot header — hide portrait (moved to header), hide info, full width auth */
    .reader-snapshot { padding: 0; gap: 0; flex-wrap: nowrap; align-items: center; }
    .reader-snapshot-portrait { display: none; }
    .reader-snapshot-info { display: none; }
    .reader-snapshot-auth { min-width: unset; flex: 1; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0; gap: 0; background: none; border-radius: 0; }
    .reader-snapshot-auth:has(.rpg-pill-left) {
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        gap: 0 !important;
        padding: 8px 8px !important;
        align-items: center !important;
    }
    .rpg-pill-left { display: none !important; }
    .rpg-pill-right { display: none !important; }
    /* Col 1: Reader info */
    .rpg-pill-mobile-mini {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
        grid-row: 1;
        grid-column: 1;
        margin-left: 2vw;
        width: clamp(100px, 31vw, 150px);
        height: clamp(120px, 32vw, 170px);
        box-sizing: border-box;
    }
    .mobile-mini-name {
        font-size: clamp(0.65rem, 1.8vw, 0.85rem);
        font-weight: 500;
        color: #fff;
        margin-bottom: 5px;
    }
    .mobile-mini-avatar {
        width: clamp(70px, 24vw, 110px);
        height: clamp(60px, 21.5vw, 95px);
        border-radius: 50%;
        object-fit: cover;
    }
    .mobile-mini-tier {
        font-size: clamp(0.55rem, 1.5vw, 0.75rem);
        color: var(--text-muted);
        margin-top: 4px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    /* Col 2: Pots */
    .mobile-pots-row {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        grid-row: 1;
        grid-column: 2;
        align-self: center;
    }
    .mobile-pot { flex: 1; min-width: clamp(90px, 32vw, 140px); padding: 4px 8px; }
    /* Col 3: Miniature character */
    .mobile-mini-character {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
        grid-row: 1;
        grid-column: 3;
        width: clamp(100px, 30vw, 150px);
        height: clamp(120px, 32vw, 170px);
        cursor: pointer;
        margin-right: 2vw;
        margin-left: auto;
        justify-self: end;
        border: 1px solid rgba(212, 175, 55, 0.3);
        border-radius: 20px;
        padding: clamp(4px, 1.5vw, 10px);
        background: rgba(212, 175, 55, 0.06);
        box-sizing: border-box;
    }
    .mobile-mini-char-name {
        font-size: clamp(0.65rem, 1.8vw, 0.85rem);
        font-weight: 500;
        color: #fff;
        flex-shrink: 0;
    }
    .mobile-mini-char-canvas {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        width: 100%;
        position: relative;
    }
    .mobile-mini-char-canvas > div {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: scale(0.55) translateX(-50%) translateY(-80%);
        transform-origin: bottom left;
    }
    .mobile-mini-char-label {
        font-size: clamp(0.55rem, 1.5vw, 0.75rem);
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        position: relative;
        top: 5px;
    }
    /* Miniature pill pulse after item/pet drop */
    .mobile-mini-character.mini-pill-pulse {
        animation: mini-pill-glow 0.5s ease 4;
    }
    @keyframes mini-pill-glow {
        0%, 100% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); border-color: rgba(212, 175, 55, 0.3); }
        50%      { box-shadow: 0 0 16px rgba(212, 175, 55, 0.6); border-color: var(--gold); }
    }
    .reader-snapshot-auth:has(.reader-auth-guest) { justify-content: center; text-align: center; padding: 12px 16px !important; }
    .reader-auth-guest { flex: 1 1 100%; min-width: 0; }
    .reader-auth-guest-hint { flex: 1 1 100%; font-size: 0.82rem; }
    .reader-patreon-signin { font-size: 0.82rem; padding: 6px 14px; }

    .rpg-pill-mobile-nav-btn {
        width: 75px;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: var(--gold);
        font-size: 1.6rem;
        cursor: pointer;
        line-height: 1;
    }

    .rpg-pill-mobile-nav-btn img { width: 30px; height: 25px; }
    .rpg-pill-mobile-nav-btn:active {
        background: rgba(212, 175, 55, 0.25);
    }



    /* Mobile pot pills — horizontal layout */
    .rc-pots-section {
        gap: 8px;
        padding: 8px;
    }
    .rc-pot {
        flex-direction: row;
        align-items: center;
        text-align: left;
        max-width: none;
        gap: 8px;
    }
    .rc-pot-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .rc-pot-info {
        flex: 1;
        min-width: 0;
    }
    .rc-pot-label {
        margin-bottom: 2px;
    }

    /* Hide mobile tabs — replaced by chapter label tap */
    .reader-mobile-tabs { display: none !important; }

    /* Mobile chapter label — tappable link to open slide-in */
    .reader-chapter-label {
        color: var(--gold) !important;
        cursor: pointer;
    }
    .reader-chapter-label::after {
        content: ' \25BC';
        font-size: 0.65em;
        opacity: 0.7;
    }

    /* Mobile: always show text panel, hide chapters/characters panels */
    .chapters-layout { flex-direction: column; flex: 1; }
    .chapters-list-panel { display: none !important; }
    .characters-panel { display: none !important; }

    .chapter-text-panel {
        padding: 16px 20px 120px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        display: block !important;
    }

    /* Reader controls */
    .reader-controls { margin: -16px -20px 16px -20px; padding: 8px 20px; top: -16px; }

    /* Character detail: full overlay on mobile */
    .char-detail-panel {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }

    .char-detail-panel.active { right: 0; }

    /* Character card portraits smaller on mobile */
    .chapter-char-portrait { width: 120px; height: 120px; }

    /* Body picker in mobile */
    .char-body-picker { gap: 12px; }
    .char-body-img { width: 110px; height: 165px; }

    /* Collectible cards in drawer — 3 per row on phone */
    .mobile-drawer-body #rc-collectibles-list,
    .mobile-drawer-body #rc-pets-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    .mobile-drawer-body .rc-collectible-card {
        flex: 0 0 calc((100% - 20px) / 3);
        width: calc((100% - 20px) / 3);
        margin-bottom: 0;
    }

    .mobile-drawer-body .rc-section {
        text-align: center;
    }
    .mobile-drawer-body .rc-section-header {
        text-align: center;
    }
    .mobile-drawer-body .rc-section-body {
        text-align: center;
    }

    /* Modal padding on mobile */
    .modal-content { padding: 14px !important; }

    /* Snapshot auth grid tweaks (mobile) */
    .reader-snapshot-auth:has(.rpg-pill-left) { gap: 0; padding: 0 !important; }

    /* Journal/Recipe/Collectible overlays — fit on small screens */
    #pet-celebration-overlay {
        align-items: center !important;
        padding: 10px !important;
        overflow-y: auto !important;
    }
    .pc-content {
        width: 80vw !important;
        max-width: 80vw !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        padding: 24px 20px !important;
    }
    .pc-content.pc-content-wide {
        max-width: 95vw !important;
    }
    .pc-emoji {
        font-size: 5rem !important;
        margin-bottom: 8px !important;
    }
    .pc-emoji > img {
        width: 140px !important;
        height: 140px !important;
    }
    .pc-title {
        font-size: 1.2rem !important;
    }
    .pc-description {
        max-height: 200px !important;
        overflow-y: auto !important;
    }
    .pc-description.pc-desc-body {
        max-height: 35vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .pc-recipe-directions {
        max-height: 120px !important;
    }
}

/* ══════════════════════════════════════════════════
   Onboarding Showcase Carousel
   ══════════════════════════════════════════════════ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onboarding-carousel {
    width: 100%;
    max-width: 440px;
    position: relative;
}

.onboarding-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: onboarding-fade-in 0.4s ease;
}

.onboarding-slide.active {
    display: flex;
}

@keyframes onboarding-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.onboarding-slide-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.onboarding-slide-title {
    color: var(--gold);
    font-family: 'Alegreya', serif;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 10px;
}

.onboarding-slide-text {
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.5;
    max-width: 380px;
    margin: 0 0 20px;
}

/* ── Next / Start buttons ── */
.onboarding-next-btn,
.onboarding-consent-btn,
.onboarding-start-btn {
    padding: 12px 36px;
    border: 2px solid var(--gold);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.onboarding-next-btn,
.onboarding-consent-btn {
    background: transparent;
    color: var(--gold);
}

.onboarding-next-btn:hover,
.onboarding-consent-btn:hover {
    background: rgba(212, 175, 55, 0.15);
}

.onboarding-start-btn {
    background: var(--gold);
    color: var(--bg-panel);
    font-size: 1.1rem;
    padding: 14px 44px;
}

.onboarding-start-btn:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
}

/* ── Slide subtext ── */
.onboarding-slide-subtext {
    color: #b4b074;
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 380px;
    margin: 12px 0 8px;
    text-align: center;
}

/* ── Decline link ── */
.onboarding-decline-link {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    margin-top: 16px;
}

.onboarding-decline-link:hover {
    color: var(--text-light);
}

/* ── Dot indicators ── */
.onboarding-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s;
}

.onboarding-dot.active {
    background: var(--gold);
}

/* ── Mock containers ── */
.onboarding-mock {
    width: 100%;
    max-width: 380px;
    margin-bottom: 16px;
}

/* ── Slide 1: Feature icons ── */
.onboarding-feature-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.onboarding-feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 72px;
}

.onboarding-feature-icon {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.08);
}

.onboarding-feature-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Slide 2: Quest card mock ── */
.onboarding-quest-card {
    background: linear-gradient(160deg, #1a1a2e, #16213e);
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.onboarding-quest-icon {
    font-size: 2.5rem;
    margin-bottom: 6px;
}

.onboarding-quest-name {
    color: var(--gold);
    font-family: 'Alegreya', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.onboarding-quest-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.onboarding-quest-rewards {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.onboarding-reward-pill {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.onboarding-quest-btn {
    display: inline-block;
    background: var(--gold);
    color: var(--bg-panel);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 24px;
    border-radius: 6px;
}

/* ── Slide 3: Character + collectibles ── */
.onboarding-char-row {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.onboarding-char-card {
    background: linear-gradient(160deg, #1a1a2e, #16213e);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    padding: 14px 24px;
    text-align: center;
    min-width: 180px;
}

.onboarding-char-avatar {
    font-size: 2.2rem;
    margin-bottom: 4px;
}

.onboarding-char-name {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.onboarding-char-level {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.onboarding-char-xp-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.onboarding-char-xp {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    transition: width 1s ease;
}

.onboarding-collectible-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.onboarding-collectible-card {
    width: 110px;
    border: 2px solid;
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.onboarding-collectible-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
}

.onboarding-collectible-emoji {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.onboarding-collectible-name {
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
}

/* ── Slide 5: Tier preview ── */
.onboarding-tier-stack {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

a.onboarding-tier-card,
.onboarding-tier-card {
    flex: 1;
    max-width: 200px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: left;
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, background 0.2s;
}

a.onboarding-tier-card:hover {
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(212, 175, 55, 0.05);
}

.onboarding-tier-card:not(.onboarding-tier-highlight) {
    max-height: 300px;
    margin-top: 35px;
    background: rgba(100, 201, 154, 0.2);
}

a.onboarding-tier-highlight,
.onboarding-tier-highlight {
    border-color: var(--gold);
    background: rgba(60, 145, 208, 0.39);
}

.onboarding-tier-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: var(--bg-panel);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.onboarding-tier-name {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 8px;
    text-align: center;
}

.onboarding-tier-price {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 8px;
}

.onboarding-tier-perks {
    list-style: none;
    padding: 0;
    margin: 0;
}

.onboarding-tier-perks li {
    color: var(--text-light);
    font-size: 0.72rem;
    line-height: 1.3;
    padding: 3px 0 3px 14px;
    position: relative;
}

.onboarding-tier-perks li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 0.6rem;
}

.onboarding-tier-highlight .onboarding-tier-perks li::before {
    content: '★';
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
    .onboarding-overlay {
        padding: 16px;
    }

    .onboarding-slide-title {
        font-size: 1.3rem;
    }

    .onboarding-slide-text {
        font-size: 0.85rem;
    }

    .onboarding-feature-row {
        gap: 14px;
    }

    .onboarding-feature-icon {
        font-size: 1.8rem;
        width: 50px;
        height: 50px;
    }

    .onboarding-collectible-row {
        gap: 6px;
    }

    .onboarding-collectible-card {
        width: 95px;
        padding: 8px 4px;
    }

    .onboarding-collectible-emoji {
        font-size: 1.4rem;
    }

    .onboarding-collectible-name {
        font-size: 0.65rem;
    }

    .onboarding-tier-card {
        padding: 12px 8px;
    }

}

/* ══════════════════════════════════════════════════
   Landscape Overlay — phones only
   ══════════════════════════════════════════════════ */

.landscape-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 22, 40, 0.97);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}

.landscape-overlay-content {
    max-width: 300px;
}

.landscape-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: landscape-rotate 2s ease-in-out infinite;
}

.landscape-overlay-content p {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.5;
}

@keyframes landscape-rotate {
    0%, 100% { transform: rotate(90deg); }
    50% { transform: rotate(0deg); }
}

@media (max-width: 900px) and (orientation: landscape) {
    .landscape-overlay { display: flex; }
}

/* Catch larger touch devices (tablets like Kindle Fire) in landscape */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
    .landscape-overlay { display: flex; }
}

@media (min-width: 741px) and (max-width: 1024px) {
    .reader-landing-inner { padding: 32px 24px; }
    .book-listing-cover { width: 220px; }
    .book-listing-title { font-size: 1.4rem; }
    .chapters-list-panel { width: 180px; }
    .characters-panel { width: 180px; }
    .chapter-char-portrait { width: 130px; height: 130px; }
    .char-detail-panel.active { right: 180px; }
    .reader-snapshot-portrait { width: 80px; height: 114px; }
}

/* ══════════════════════════════════════════════════════════════
   Character Creation Modal
   ══════════════════════════════════════════════════════════════ */

.char-create-step h2 {
    text-align: center;
    color: var(--gold);
    margin-bottom: 12px;
}

.char-create-step > p {
    text-align: center;
    margin-bottom: 16px;
}

/* Character creation modals — readable font size */
#char-create-welcome-modal .modal-content,
#char-create-avatar-modal .modal-content,
#char-create-profession-modal .modal-content {
    font-size: 1rem;
}

#char-create-welcome-modal .modal-content h2,
#char-create-avatar-modal .modal-content h2,
#char-create-profession-modal .modal-content h2 {
    font-size: 1.5rem;
}

/* Class Grid */

/* Avatar Grid */
/* ── Miniature Body Picker ── */
/* ── Avatar Grid (character creation step 2) ── */
.char-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 3px;
    margin-bottom: 24px;
}

.char-avatar-card {
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.2s;
}

.char-avatar-card:hover {
    border-color: var(--gold);
}

.char-avatar-card.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.char-avatar-card img {
    width: 175px;
    height: 175px;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .char-avatar-card img {
        width: 130px;
        height: 130px;
    }
}

.char-avatar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ── Body Picker (character creation step 2) ── */
.char-body-picker {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.char-body-option {
    text-align: center;
    cursor: pointer;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s;
}

.char-body-option:hover {
    border-color: var(--gold);
}

.char-body-option.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.char-body-img {
    width: 140px;
    height: 210px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.char-body-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.char-body-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.char-body-option.selected .char-body-label {
    color: var(--gold);
}

/* Create Summary */
.char-create-summary {
    text-align: center;
    padding: 20px;
}

.char-create-summary p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* ── Level-Up Toast ── */
.level-up-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid var(--gold);
    color: var(--gold);
    font-family: 'Alegreya', serif;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 16px 36px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4), 0 8px 24px rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    text-align: center;
    letter-spacing: 0.5px;
}

.level-up-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Complete Book Button ── */
.complete-book-wrap {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

#complete-book-btn {
    background: linear-gradient(135deg, #2d6a1e 0%, #1a4a10 100%);
    border: 2px solid var(--gold);
    color: var(--gold);
    font-family: 'Alegreya', serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

#complete-book-btn:hover {
    background: linear-gradient(135deg, #3a8a26 0%, #2d6a1e 100%);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.3);
}

#complete-book-btn:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* ══════════════════════════════════════════════════
   Reader Character Sidebar
   ══════════════════════════════════════════════════ */

.reader-char-panel .characters-panel-body {
    padding: 0;
}

/* ── Sidebar Icon Tabs ── */

.rc-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    background-color: #354d6c;
    flex-shrink: 0;
}

.rc-tab {
    flex: 1;
    padding: 4px 4px 0px;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 2.25rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-tab:last-child { border-right: none; }
.rc-tab:hover { color: var(--text-light); }
.rc-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.rc-tab img { width: 35px; height: 30px; }

/* ── Expanded Collection Drawer (desktop only) ── */
.rc-expanded-drawer {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    z-index: 100;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.rc-expanded-drawer.active {
    display: flex;
    transform: translateX(0);
}
.rc-expanded-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.rc-expanded-drawer-title {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rc-expanded-drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}
.rc-expanded-drawer-close:hover {
    color: var(--text-light);
}
.rc-expanded-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.rc-expanded-drawer-body .rc-collectible-card {
    display: inline-flex;
    width: 120px;
}
.expanded-collectibles .rc-collectible-card {
    height: 185px;
}
.expanded-pets .rc-collectible-card {
    height: 140px;
}
.rc-expanded-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

/* ── Ghost Content Banner (guests only) ── */
.ghost-banner {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s ease, opacity 0.6s ease;
    opacity: 0;
    background: rgba(55, 71, 208, 0.25);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    cursor: pointer;
}
.ghost-banner:hover {
    background: rgba(55, 71, 208, 0.35);
}
.ghost-banner.open {
    max-height: 60px;
    opacity: 1;
}
.ghost-banner-text {
    display: block;
    padding: 10px 16px;
    color: #b0bfff;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
    font-style: italic;
}

.rc-tab-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.rc-tab-pane { display: none; }
.rc-tab-pane.active { display: block; }

/* ── Character Card ── */
.rc-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 12px 12px;
    border-bottom: 1px solid var(--border);
}

.rc-avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
}

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

.rc-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'Alegreya', serif;
}

.rc-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: 2px;
}

.rc-level-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.rc-level-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-light);
}

.rc-tier-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    letter-spacing: 0.5px;
}

/* ── Miniature Card ── */
.rc-miniature-card {
    text-align: center;
    padding: 12px;
}

.rc-mini-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 8px;
}

.rc-mini-canvas {
    position: relative;
    width: 200px;
    height: 280px;
    margin: 0 auto 12px;
    overflow: hidden;
}
@media (min-width: 1025px) {
    .rc-mini-canvas {
        height: 290px;
    }
}

.rc-mini-canvas img {
    position: absolute;
    top: 0;
    left: 0;
}

.rc-manage-btn {
    display: inline-block;
    padding: 6px 18px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.rc-manage-btn:hover {
    background: rgba(212, 175, 55, 0.2);
}

/* ── Magic Pots ── */
.rc-pots-section {
    display: flex;
    gap: 16px;
    padding: 10px 12px;
    justify-content: center;
}

.rc-pot {
    flex: 1;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.rc-pot-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-pot-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.rc-pot-info {
    width: 100%;
}

.rc-pot-bar-wrap {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rc-pot-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.rc-pot-bar-reaction {
    background: linear-gradient(90deg, #3498db, #5dade2);
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.4);
}

.rc-pot-bar-quest {
    background: linear-gradient(90deg, #c9a226, #d4af37);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

.rc-pot-text {
    font-size: 0.68rem;
    color: #807e7e;
}

/* Pulse flash when pot increments */
@keyframes rc-pot-pulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.08); }
    60%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

@keyframes rc-pot-bar-flash {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.8); }
    100% { filter: brightness(1); }
}

.rc-pot.pot-pulse {
    animation: rc-pot-pulse 0.5s ease;
}

.rc-pot.pot-pulse .rc-pot-bar {
    animation: rc-pot-bar-flash 0.6s ease;
}

/* Unseen collectibles — dim pots with "New Items / Tap to View" overlay */
.rc-pot.pot-unseen,
.mobile-pot.pot-unseen {
    position: relative;
    opacity: 0.5;
}

.pot-unseen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.pot-unseen-title {
    color: #ffc300;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.pot-unseen-sub {
    color: #fff;
    font-size: 0.65rem;
    font-weight: 500;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
    margin-top: 1px;
}

/* New collectible drop — pulse the pot pill 5x with gold glow */
.rc-pot.pot-new-drop,
.mobile-pot.pot-new-drop {
    animation: pot-new-drop-pulse 0.6s ease-in-out 5;
}

@keyframes pot-new-drop-pulse {
    0%   { box-shadow: 0 0 4px rgba(212, 175, 55, 0.2); transform: scale(1); }
    50%  { box-shadow: 0 0 18px rgba(212, 175, 55, 0.8), 0 0 30px rgba(212, 175, 55, 0.4); transform: scale(1.08); }
    100% { box-shadow: 0 0 4px rgba(212, 175, 55, 0.2); transform: scale(1); }
}

/* Full pot glow */
@keyframes rc-pot-full-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(212, 175, 55, 0.3); }
    50%      { box-shadow: 0 0 20px rgba(212, 175, 55, 0.7), 0 0 40px rgba(212, 175, 55, 0.3); }
}

.rc-pot.pot-full {
    animation: rc-pot-full-glow 1.5s ease infinite;
    border-radius: 8px;
}

/* ── Sections ── */
.rc-section {
    border-bottom: 1px solid var(--border);
}

.rc-section-header {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rc-filter-select {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-light);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.mobile-drawer-header .rc-filter-select,
.rc-expanded-drawer-header .rc-filter-select {
    margin-left: auto;
    margin-right: 8px;
}

.rc-section-body {
    padding: 4px 12px 10px;
}

.rc-empty {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
}


/* ── Inventory Grid + Profession — REMOVED (miniatures conversion) ── */

/* ── Collapsible Sections ── */
.rc-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rc-toggle-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.rc-toggle-arrow.rc-open {
    transform: rotate(180deg);
}

.rc-collapsed {
    display: none;
}

.rc-health-row {
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    font-size: 1.05rem;
}

.rc-health-label {
    font-weight: 600;
    color: var(--gold);
    margin-right: 6px;
}

.rc-health-val {
    font-weight: 700;
    color: #5dde5d;
}

.rc-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.rc-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.03);
}

.rc-pill-label {
    color: var(--text-muted);
    font-weight: 400;
}

.rc-pill-val {
    color: var(--gold);
    font-weight: 700;
}

/* ── Pet Pills ── */
.rc-collectible-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
    margin-bottom: 8px;
    justify-content: flex-start;
    overflow: hidden;
}

#rc-collectibles-list .rc-collectible-card {
    height: 185px;
}

.rc-collectible-card:last-child { margin-bottom: 0; }

.rc-collectible-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold);
}

.rc-collectible-card-emoji {
    font-size: 3.5rem;
    line-height: 1;
}

.rc-collectible-card-img {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-collectible-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.rc-collectible-card-name {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
    margin-top: 4px;
    text-align: center;
    line-height: 1.2;
}

.rc-collectible-card-type {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    text-align: center;
}
.rc-collectible-card-character {
    font-size: 0.72rem;
    color: var(--gold);
    font-style: italic;
    margin-top: 1px;
}

/* ── Quest Log Items ── */
.rc-quest-log-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border-radius: 8px;
}
.rc-quest-log-item:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--gold); }
.rc-quest-log-name { font-size: 0.78rem; color: var(--text-light); }

/* ── Opt-out Message ── */
/* ── Tier Gate (locked tab message) ── */

.rc-tier-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 6px;
}
.rc-tier-gate-block .rc-tier-gate {
    padding: 0px 20px;
}

.rc-guest-gate-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 18px 14px 20px;
    margin: 0 10px 12px;
    text-align: center;
}

.rc-guest-gate-pill .rc-tier-gate {
    padding: 0;
}

.rc-guest-gate-signin-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.rc-guest-gate-pill-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.rc-tier-gate-area {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 8px;
}

.rc-tier-gate-label {
    font-size: 0.7rem;
    color: #7a90d0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rc-tier-gate-req {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 10px;
}

.rc-tier-gate-rec {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6ecf6e;
    margin-bottom: 12px;
}

.rc-tier-gate-signin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: #ff424d;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}

.rc-tier-gate-signin:hover {
    background: #e0333d;
    color: #fff;
}

.rc-tier-gate-signin .patreon-icon {
    font-size: 0.9rem;
}

.rc-tier-gate-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}

.rc-tier-gate-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--gold);
}

.rc-opt-out-msg {
    text-align: center;
    padding: 16px 12px;
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.rc-opt-out-msg a {
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
}

.rc-opt-out-msg a:hover {
    color: #e8c84a;
}

/* ══════════════════════════════════════════════════
   RPG Profile Pill (in snapshot header)
   ══════════════════════════════════════════════════ */

.reader-snapshot-auth:has(.rpg-pill-left) {
    flex-direction: row;
    gap: 0;
    padding: 10px 20px;
    align-items: center;
}

.rpg-pill-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.rpg-pill-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
}

.rpg-pill-avatar-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Alegreya', serif;
}

.rpg-pill-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.rpg-pill-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpg-pill-name-row strong {
    color: var(--text);
    font-size: 0.9rem;
}

.rpg-pill-details-btn {
    font-size: 0.7rem;
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
}

.rpg-pill-details-btn:hover {
    color: #e8c84a;
}

.rpg-pill-level-class {
    display: none;
}

.rpg-pill-xp-wrap {
    display: none;
}

.rpg-pill-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.rpg-pill-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 0.7rem;
}

/* ══════════════════════════════════════════════════
   View Details Slide-Out Panel
   ══════════════════════════════════════════════════ */

.vd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.vd-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.vd-panel {
    position: fixed;
    top: 0;
    left: -380px;
    width: 380px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    overflow: hidden;
}

.vd-panel.active {
    left: 0;
}

/* Desktop: slide from right instead of left */
@media (min-width: 1025px) {
    .vd-panel {
        left: auto;
        right: -380px;
        border-right: none;
        border-left: 1px solid var(--border);
        transition: right 0.3s ease;
    }
    .vd-panel.active {
        left: auto;
        right: 0;
    }
}

.vd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.vd-header h3 {
    color: var(--gold);
    font-size: 1rem;
    margin: 0;
}

.vd-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

.vd-close:hover {
    color: var(--text);
}

.vd-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
}

/* VD Fields */
.vd-field {
    margin-bottom: 18px;
}

.vd-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.vd-field-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    padding: 8px 12px;
    box-sizing: border-box;
    font-family: inherit;
}
.vd-field-input:focus {
    outline: none;
    border-color: var(--gold);
}

.vd-tier-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text);
}

.vd-upgrade-link {
    font-size: 0.78rem;
    color: var(--gold);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.vd-upgrade-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.vd-save-row {
    position: sticky;
    bottom: -16px;
    padding: 12px 0 20px;
    text-align: center;
    background: var(--bg-panel);
}
.vd-save-row .btn-save {
    min-width: 120px;
}

.vd-avatar-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 4px;
    padding-bottom: 60px;
}

/* Avatar grid: always show scrollbar */
.vd-avatar-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.05);
}
.vd-avatar-grid::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 6px;
}
.vd-avatar-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.vd-avatar-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.vd-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s;
    background: rgba(255,255,255,0.03);
}

.vd-avatar-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
}

.vd-avatar-card.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
}

.vd-avatar-card img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.vd-avatar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

/* VD Sections */
.vd-section {
    margin-bottom: 18px;
}

.vd-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.vd-empty {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-style: italic;
}

/* Entity items (skills, spells, inventory) */
.vd-entity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.vd-entity-item:last-child {
    border-bottom: none;
}

.vd-entity-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
}

.vd-entity-item small {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--text-dim);
}

/* Settings */
.vd-settings {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.vd-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.vd-setting-row label:first-child {
    font-size: 0.82rem;
    color: var(--text-light);
}

.vd-danger {
    justify-content: flex-end;
    margin-top: 12px;
}

/* Toggle switch */
.vd-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.vd-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.vd-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.vd-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.vd-toggle input:checked + .vd-toggle-slider {
    background: var(--gold);
}

.vd-toggle input:checked + .vd-toggle-slider::before {
    transform: translateX(16px);
}

/* ══════════════════════════════════════════════════
   Quest Modal & Puzzle Engine
   ══════════════════════════════════════════════════ */

.quest-modal .modal-content {
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border: 2px solid var(--gold);
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.2), 0 0 80px rgba(212, 175, 55, 0.08);
}

.quest-intro-icon {
    font-size: 3.5rem;
    text-align: center;
    margin-bottom: 8px;
}

.quest-modal-title {
    color: var(--gold);
    font-family: 'Alegreya', serif;
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 10px 0;
    letter-spacing: 0.5px;
}

.quest-modal-desc {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: center;
}

.quest-rewards-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.quest-rewards-preview {
    margin-bottom: 8px;
}

.quest-reward-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.quest-reward-row-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.quest-reward-row-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.quest-reward-row-name {
    font-weight: 600;
    color: var(--gold);
}

.quest-reward-row-value {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.quest-intro-actions {
    justify-content: center;
}

.quest-intro-actions .btn {
    font-size: 1.05rem;
    padding: 10px 32px;
}

.quest-opt-out-link {
    color: var(--text-muted) !important;
    font-size: 0.82rem;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.quest-opt-out-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Puzzle header */
.quest-puzzle-header {
    margin-bottom: 16px;
}


.quest-puzzle-title {
    color: var(--text);
    font-size: 1.1rem;
    margin: 4px 0 0 0;
}

/* Puzzle body */
.puzzle-question {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.5;
}

.puzzle-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: -8px 0 16px 0;
}

.puzzle-blank {
    background: rgba(212, 175, 55, 0.2);
    padding: 2px 12px;
    border-radius: 4px;
    color: var(--gold);
    font-weight: 700;
}

.puzzle-quote {
    font-family: 'Alegreya', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-light);
    padding: 12px 16px;
    border-left: 3px solid var(--gold);
    margin-bottom: 12px;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 0 6px 6px 0;
}

.puzzle-scrambled {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    letter-spacing: 4px;
    margin-bottom: 16px;
    font-family: 'Alegreya', serif;
}

/* Choice buttons */
.puzzle-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.puzzle-choice-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 0.92rem;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
}

@media (hover: hover) {
    .puzzle-choice-btn:hover {
        border-color: var(--gold);
        background: rgba(212, 175, 55, 0.08);
    }
}

.puzzle-choice-btn:focus {
    outline: none;
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
}
.puzzle-choice-btn:active,
.puzzle-choice-btn.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
}

/* True/False layout */
.puzzle-tf {
    flex-direction: row;
    gap: 12px;
}

.puzzle-tf-btn {
    flex: 1;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px;
}

/* Spot the lie: statement buttons */
.puzzle-statement-btn {
    text-align: left;
    line-height: 1.4;
}

/* Sequence */
.puzzle-sequence {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.puzzle-seq-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    cursor: grab;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    user-select: none;
}

@media (hover: hover) {
    .puzzle-seq-item:hover {
        border-color: var(--gold);
        background: rgba(212, 175, 55, 0.06);
        box-sizing: border-box;
    }
}

.puzzle-seq-text {
    flex: 1;
}

.puzzle-seq-placeholder {
    border: 2px dashed var(--gold);
    border-radius: 6px;
    background: rgba(212, 175, 55, 0.08);
    height: 42px;
    margin-bottom: 0;
}

.ui-sortable-helper {
    border-color: var(--gold);
    background: var(--bg-card) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    cursor: grabbing !important;
}

/* Match pairs */
.puzzle-match-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.puzzle-match-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.puzzle-match-btn {
    padding: 10px 12px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

@media (hover: hover) {
    .puzzle-match-btn:hover {
        border-color: var(--gold);
    }
}

.puzzle-match-selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.15);
}

.puzzle-match-paired {
    border-color: #2d8a4e;
    background: rgba(45, 138, 78, 0.15);
    cursor: default;
}

/* Submit button */
.puzzle-submit-btn {
    margin-top: 8px;
}

/* Feedback */
/* Challenge progress indicator */
.quest-challenge-progress {
    text-align: center;
    margin-bottom: 14px;
}

.challenge-progress-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
}

.quest-puzzle-feedback {
    text-align: center;
    min-height: 30px;
    margin-top: 12px;
}

.puzzle-feedback-correct {
    color: #2d8a4e;
    font-weight: 700;
    font-size: 1.1rem;
}

.puzzle-feedback-wrong {
    color: #e74c3c;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Puzzle feedback toast overlay */
.puzzle-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 100001;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    text-align: center;
}
.puzzle-toast-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.puzzle-toast-correct {
    color: #fff;
    background: rgba(45, 138, 78, 0.92);
    box-shadow: 0 0 30px rgba(45, 138, 78, 0.5);
}
.puzzle-toast-wrong {
    color: #fff;
    background: rgba(231, 76, 60, 0.92);
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
}

/* Shake animation */
@keyframes puzzleShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.puzzle-shake {
    animation: puzzleShake 0.4s ease;
}

/* ── Referee Modal ── */
.referee-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.referee-option {
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.referee-option:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.referee-option h3 {
    font-size: 0.95rem;
    color: var(--gold);
    margin: 0 0 6px;
}

.referee-option p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.4;
}

.referee-option .btn {
    font-size: 0.78rem;
    padding: 6px 16px;
}

.referee-reward-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

/* Quest Complete Celebration Overlay */
#quest-complete-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 18, 40, 0.97);
}

.qc-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.qc-particle {
    position: absolute;
    top: -10px;
    border-radius: 50%;
    opacity: 0.9;
    animation: wv-fall linear forwards;
}

.qc-content {
    position: relative;
    z-index: 1;
    text-align: center;
    background: var(--surface-card);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 40px 48px;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.3), 0 0 80px rgba(212, 175, 55, 0.1);
    max-width: 420px;
    width: 90%;
}

.qc-shake {
    animation: wv-shake-anim 0.5s ease, wv-appear 0.5s ease forwards !important;
}

.qc-icon {
    font-size: 4.5rem;
    margin-bottom: 12px;
    animation: wv-icon-pulse 1.5s ease infinite;
}

.qc-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--gold);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.qc-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 20px;
}

.qc-rewards {
    margin-bottom: 24px;
    text-align: left;
}

.qc-reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.qc-reward-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.qc-reward-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.qc-reward-name {
    font-weight: 600;
    color: var(--gold);
}

.qc-reward-value {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.qc-inventory-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 8px 0 4px;
}

.qc-dismiss {
    font-size: 1rem;
    padding: 10px 32px;
}

/* ══════════════════════════════════════════════════════════════
   Pet Drop Celebration Overlay
   ══════════════════════════════════════════════════════════════ */

#pet-celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

@keyframes wv-appear {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes wv-fall {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(100vh); }
}

@keyframes wv-shake-anim {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.pc-particle {
    position: absolute;
    top: -10px;
    border-radius: 50%;
    opacity: 0;
    animation: wv-fall linear forwards;
}

.pc-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px 48px;
    background: linear-gradient(160deg, #1a1a2e, #16213e);
    border: 2px solid var(--gold);
    border-radius: 16px;
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.3), 0 0 120px rgba(212, 175, 55, 0.1);
    opacity: 0;
    transform: scale(0.8);
    max-height: 80vh; /* fallback — JS overrides with window.innerHeight */
    max-width: 380px;
    display: flex;
    flex-direction: column;
}
.pc-content-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    min-height: 0;
    padding-top: 16px;
}
.pc-content .pc-dismiss {
    flex-shrink: 0;
    margin-top: 6px;
}
.pc-content.pc-animate-in {
    animation: wv-appear 0.5s ease forwards;
    animation-delay: 0.1s;
}

/* Desktop: shrink popup elements when viewport height shrinks (browser zoom) */
@media (min-width: 769px) and (max-height: 700px) {
    .pc-content { padding: 24px 36px; }
    .pc-emoji { font-size: 3.5rem; margin-bottom: 8px; }
    .pc-emoji > img { width: 110px; height: 110px; }
    .pc-no-pulse .pc-emoji { margin-bottom: 8px; }
}
@media (min-width: 769px) and (max-height: 550px) {
    .pc-content { padding: 16px 28px; }
    .pc-emoji { font-size: 2.5rem; margin-bottom: 4px; }
    .pc-emoji > img { width: 80px; height: 80px; }
    .pc-no-pulse .pc-emoji { margin-bottom: 4px; }
    .pc-name { font-size: 1rem; }
    .pc-description.pc-desc-body { max-height: 180px; }
}
@media (min-width: 769px) and (max-height: 400px) {
    .pc-content { padding: 10px 20px; }
    .pc-emoji { font-size: 2rem; margin-bottom: 2px; }
    .pc-emoji > img { width: 60px; height: 60px; }
    .pc-no-pulse .pc-emoji { margin-bottom: 2px; }
    .pc-name { font-size: 0.9rem; }
    .pc-description.pc-desc-body { max-height: 120px; }
}

.pc-bonus-drop {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    letter-spacing: 0.03em;
}

.pc-emoji {
    font-size: 5rem;
    margin-bottom: 4px;
    animation: wv-icon-pulse 1.5s ease infinite;
}

.pc-no-pulse .pc-emoji {
    animation: none;
    margin-bottom: 4px;
}

.drop-preview-canvas {
    height: 270px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .drop-preview-canvas {
        height: 50vw;
    }
}

/* Drop celebration — existing layers fade down */
.drop-layer-dim {
    animation: drop-fade-down 1s ease forwards;
}
@keyframes drop-fade-down {
    from { opacity: 1; }
    to   { opacity: 0.65; }
}

/* Drop celebration — glow behind the new piece */
.drop-layer-glow {
    filter: blur(8px) brightness(1.8);
    opacity: 0.6;
    animation: drop-glow-pulse 3s ease-in-out infinite;
}
@keyframes drop-glow-pulse {
    0%, 100% { opacity: 0.4; filter: blur(8px) brightness(1.6); }
    50%      { opacity: 0.7; filter: blur(12px) brightness(2.0); }
}

/* Drop celebration — new piece container */
.drop-layer-new {
    position: relative;
    overflow: visible;
    animation: drop-new-pulse 1.5s ease-in-out infinite;
}
.drop-layer-new img {
    display: block;
    overflow: visible;
}
@keyframes drop-new-pulse {
    0%, 100% { filter: brightness(1.0) drop-shadow(0 0 2px rgba(212, 175, 55, 0.2)); }
    50%      { filter: brightness(1.4) drop-shadow(0 0 16px rgba(212, 175, 55, 0.9)); }
}

.pc-emoji > img {
    display: block;
    margin: 0 auto;
    width: 120px;
    height: 120px;
    object-fit: contain;
}
@media (min-width: 769px) {
    .pc-emoji .pc-collectible-img {
        width: 120px;
        height: 120px;
        object-fit: contain;
        border-radius: 50%;
    }
    .pc-content-wide .pc-title {
        font-size: 1.2rem;
    }
    .pc-content-wide .pc-name {
        font-size: 1.0rem;
    }
}

.pc-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.2;
    margin-bottom: 2px;
    /* color set via JS inline style based on pet theme */
}

.pc-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 4px;
}

.pc-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 6px;
    font-style: italic;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: center;
    padding: 0 4px;
}

.pc-description.pc-desc-body {
    text-align: left;
    font-style: normal;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
}

.pc-content.pc-content-wide {
    max-width: 500px;
}

/* Journal scroll box */
.pc-journal-scroll {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: var(--text-light);
    line-height: 1.6;
    text-align: left;
    padding: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
}


/* Recipe popup styles */
.pc-recipe-desc {
    margin-bottom: 12px;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
}

.pc-recipe-section-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    margin-top: 10px;
}

.pc-recipe-ingredients {
    list-style: disc;
    padding-left: 20px;
    margin: 0 0 12px;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.pc-recipe-directions {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
}

.pc-dismiss {
    font-weight: 700;
    padding: 10px 32px !important;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    /* background color set via JS inline style based on pet theme */
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.pc-dismiss:hover {
    transform: scale(1.05);
}

/* ══════════════════════════════════════════════════════════════
   Sidebar Pets Grid
   ══════════════════════════════════════════════════════════════ */

.rc-collectibles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 6px;
    padding: 8px 12px;
}

.rc-collectible-cell {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    border: 1px solid transparent;
}

.rc-collectible-cell:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--gold);
}

/* ══ Dice Roll Quest (D20 Style) ══ */

/* Quest name */
.dice-quest-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    margin-bottom: 8px;
}

.dice-scenario {
    font-family: 'Alegreya', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-light);
    padding: 12px 16px;
    margin-bottom: 20px;
    background: rgba(55, 205, 212, 0.22);
    border-radius: 6px;
    border-radius: 0 6px 6px 0;
    line-height: 1.6;
}

/* Instruction text */
.d20-instructions {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.d20-tier-name-safe { color: #2ecc71; }
.d20-tier-name-normal { font-size: 1.3rem; color: #37a0d4; }
.d20-tier-name-bold { color: #e74c3c; }

.d20-tap-instruction {
    font-size: 0.9rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 8px;
    font-weight: 600;
}

/* ── D20 Die Shape ── */
.d20-die {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(45deg);
    border: 2px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

.d20-die-value {
    display: block;
    transform: rotate(-45deg);
    font-family: 'Alegreya', serif;
    font-weight: 800;
    color: var(--text-light);
    line-height: 1;
}

/* Small threshold dice */
.d20-die-sm {
    width: 60px;
    height: 60px;
    border-radius: 8px;
}

.d20-die-sm .d20-die-value {
    font-size: 1.4rem;
}

/* Large roll die */
.d20-die-lg {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
}

.d20-die-lg:hover:not(.d20-spinning):not(.d20-landed) {
    transform: rotate(45deg) scale(1.08);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    border-color: var(--gold);
}

.d20-die-lg .d20-die-value {
    font-size: 2.2rem;
    color: var(--gold);
}

/* Tier colors for threshold dice */
.d20-safe {
    border-color: rgba(46, 204, 113, 0.5);
    background: rgba(46, 204, 113, 0.08);
}
.d20-safe .d20-die-value { color: #2ecc71; }

.d20-normal {
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(212, 175, 55, 0.08);
}
.d20-normal .d20-die-value { color: var(--gold); }

.d20-bold {
    border-color: rgba(231, 76, 60, 0.5);
    background: rgba(231, 76, 60, 0.08);
}
.d20-bold .d20-die-value { color: #e74c3c; }

/* ── Threshold Row ── */
.d20-threshold-row {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 28px;
}

.d20-threshold {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.d20-threshold-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

/* ── Roll Area ── */
.d20-roll-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
}

.d20-roll-prompt {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* ── Spin Animation ── */
.d20-spinning {
    animation: d20Spin 0.6s linear infinite;
    pointer-events: none;
}

@keyframes d20Spin {
    0%   { transform: rotate(45deg) scale(1); }
    25%  { transform: rotate(135deg) scale(1.05); }
    50%  { transform: rotate(225deg) scale(1); }
    75%  { transform: rotate(315deg) scale(1.05); }
    100% { transform: rotate(405deg) scale(1); }
}

/* Landed state — default (safe) */
.d20-landed {
    pointer-events: none;
    transform: rotate(45deg);
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.12);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
}
.d20-landed .d20-die-value {
    color: #2ecc71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

/* ── Failed Roll ── */
.d20-landed-fail {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.12);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
    pointer-events: auto;
    cursor: pointer;
}
.d20-landed-fail .d20-die-value {
    color: #e74c3c;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}
.d20-too-low {
    color: #e74c3c;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
    animation: d20-too-low-fade-in 0.3s ease;
}
@keyframes d20-too-low-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Matched Tier Highlight ── */
.d20-matched .d20-die {
    animation: d20MatchShake 0.5s ease, d20MatchPulse 0.8s ease-in-out 0.5s infinite;
}

.d20-matched .d20-die-sm {
    transform: rotate(45deg) scale(1.15);
}

.d20-matched .d20-threshold-label {
    color: var(--text-light);
    font-size: 0.85rem;
}

.d20-matched[data-tier="safe"] .d20-die {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.2);
    box-shadow: 0 0 24px rgba(46, 204, 113, 0.6);
}
.d20-matched[data-tier="safe"] .d20-threshold-label { color: #2ecc71; }

.d20-matched[data-tier="normal"] .d20-die {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.2);
    box-shadow: 0 0 24px rgba(212, 175, 55, 0.6);
}
.d20-matched[data-tier="normal"] .d20-threshold-label { color: var(--gold); }

.d20-matched[data-tier="bold"] .d20-die {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    box-shadow: 0 0 24px rgba(231, 76, 60, 0.6);
}
.d20-matched[data-tier="bold"] .d20-threshold-label { color: #e74c3c; }

@keyframes d20MatchShake {
    0%, 100% { transform: rotate(45deg) scale(1.15) translateX(0); }
    20%      { transform: rotate(45deg) scale(1.15) translateX(-4px); }
    40%      { transform: rotate(45deg) scale(1.15) translateX(4px); }
    60%      { transform: rotate(45deg) scale(1.15) translateX(-3px); }
    80%      { transform: rotate(45deg) scale(1.15) translateX(2px); }
}

@keyframes d20MatchPulse {
    0%, 100% { transform: rotate(45deg) scale(1.15); opacity: 1; }
    50%      { transform: rotate(45deg) scale(1.22); opacity: 0.85; }
}

/* ── Quest Complete Tier Message ── */
.qc-tier-message {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 14px;
    font-style: italic;
    line-height: 1.8;
}

.qc-tier-label {
    font-style: normal;
    font-size: 1.15rem;
}

.qc-tier-label {
    font-weight: 700;
    font-style: normal;
}
.qc-tier-safe { color: #2ecc71; }
.qc-tier-normal { color: var(--gold); }
.qc-tier-bold { color: #e74c3c; }

/* ══════════════════════════════════════════════════════════════
   Collectibles Chest Button (sidebar)
   ══════════════════════════════════════════════════════════════ */

.rc-chest-bar {
    display: flex;
    justify-content: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rc-chest-label {
    font-family: 'Alegreya', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
}

/* Clickable pot (opens collectibles panel) */
.rc-pot-clickable {
    cursor: pointer;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    padding: 8px 12px;
    background: rgba(212, 175, 55, 0.06);
    transition: all 0.15s;
}
.rc-pot-clickable:hover {
    background: rgba(212, 175, 55, 0.14);
    border-color: rgba(212, 175, 55, 0.5);
}

/* ── Mobile-only elements (hidden on desktop) ── */
.rpg-pill-mobile-mini {
    display: none;
}

.mobile-pots-row {
    display: none;
}

.mobile-mini-character {
    display: none;
}

.mobile-pot {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    padding: 6px 8px;
}

.mobile-pot-icon {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    margin-bottom: 2px;
}
.cl-count-badge {
    display: none;
    position: absolute;
    top: -6px;
    left: 70%;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: #11b43a;
    border-radius: 8px;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.mobile-pot-label {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.mobile-pot-bar-wrap {
    display: block;
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.mobile-pot-bar {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.mobile-pot-text {
    font-size: 0.58rem;
    color: #807e7e;
}

/* ══════════════════════════════════════════════════════════════
   Collectibles Panel
   ══════════════════════════════════════════════════════════════ */

.cl-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10010;
}
.cl-overlay.active {
    display: block;
}

.cl-panel {
    position: fixed;
    top: 50px;
    right: -520px;
    width: 480px;
    max-width: 95vw;
    height: calc(100vh - 50px);
    background: #0e1325;
    border-left: 2px solid rgba(212, 175, 55, 0.25);
    z-index: 10011;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cl-panel.active {
    right: 0;
}

.cl-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    flex-shrink: 0;
}

.cl-title {
    font-family: 'Alegreya', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.cl-filter {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 5px 8px;
    color: #e0e0e0;
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.cl-filter:focus {
    border-color: var(--gold);
}

.cl-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ccc;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 10px;
    line-height: 1.2;
    transition: all 0.15s;
    flex-shrink: 0;
}
.cl-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.cl-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.cl-grid .rc-collectible-card {
    width: auto;
    height: auto;
    min-height: 140px;
    margin-bottom: 0;
    flex: none;
}

.cl-grid .rc-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #555;
    font-size: 0.85rem;
    padding: 30px 0;
}

@media (max-width: 768px) {
    .cl-panel {
        width: 100%;
        max-width: 100vw;
        right: -110vw;
    }

    .cl-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* ══════════════════════════════════════════════════════════════
   Customize Miniature Panel
   ══════════════════════════════════════════════════════════════ */

.cm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10010;
}
.cm-overlay.active {
    display: block;
}

.cm-panel {
    position: fixed;
    top: 50px;
    right: -480px;
    width: 400px;
    max-width: 90vw;
    height: calc(100dvh - 50px);
    background: #0e1325;
    border-left: 2px solid rgba(212, 175, 55, 0.25);
    z-index: 10011;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cm-panel.active {
    right: 0;
}

.cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    flex-shrink: 0;
}

.cm-title {
    font-family: 'Alegreya', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
}

.cm-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ccc;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 10px;
    line-height: 1.2;
    transition: all 0.15s;
}
.cm-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.cm-body {
    flex: 1;
    overflow: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.cm-scroll-area {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.05);
}
.cm-scroll-area::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 6px;
}
.cm-scroll-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.cm-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

/* Preview */
.cm-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* Body Switch Toggle — stacked vertically to the left of preview */
.cm-body-switch {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cm-body-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 4px 6px;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cm-body-option:hover {
    border-color: rgba(212, 175, 55, 0.3);
}
.cm-body-option.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
}
.cm-body-thumb {
    width: 32px;
    height: 48px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
}
.cm-body-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cm-preview-canvas {
    position: relative;
    width: 174px;
    height: 261px;
    margin: 0 auto;
    overflow: hidden;
}
@media (min-width: 769px) and (max-height: 800px) {
    .cm-preview-canvas {
        width: 140px;
        height: 210px;
    }
}
@media (min-width: 769px) and (max-height: 650px) {
    .cm-preview-canvas {
        width: 110px;
        height: 165px;
    }
    .cm-preview { margin-bottom: 8px; }
    .cm-name-row { margin-bottom: 4px; }
    .cm-body-thumb { width: 24px; height: 36px; }
    .cm-body-option { padding: 2px 4px; font-size: 0.5rem; }
}

.cm-preview-canvas img {
    position: absolute;
    top: 0;
    left: 0;
}

/* Sections */
.cm-section {
    margin-bottom: 18px;
}

.cm-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    position: sticky;
    top: 0;
    background: #0e1325;
    z-index: 1;
    padding-top: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cm-share-btn {
    font-size: 0.65rem;
    padding: 2px 10px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 4px;
    color: var(--gold);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}
.cm-share-btn:hover {
    background: rgba(212, 175, 55, 0.25);
}

/* Name Row */
.cm-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}

.cm-name-label {
    color: var(--gold);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.cm-name-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.cm-name-input:focus {
    border-color: var(--gold);
}

.cm-save-row {
    padding-top: 16px;
    text-align: center;
}
.cm-save-row .btn-save {
    min-width: 120px;
}

/* Equipment Slot Row */
.cm-slot {
    margin-bottom: 10px;
}

.cm-slot-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.cm-slot-items {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cm-item {
    position: relative;
    width: 56px;
    height: 56px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s;
}
.cm-item:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}
.cm-item.cm-equipped {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}
.cm-item.cm-equipped::after {
    content: '✓';
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 0.65rem;
    color: var(--gold);
    font-weight: 700;
}

.cm-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cm-item-empty {
    width: 56px;
    height: 56px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.7rem;
    cursor: pointer;
}
.cm-item-empty:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.cm-item-name {
    font-size: 0.65rem;
    color: #aaa;
    text-align: center;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 56px;
}

/* Rarity borders */
.cm-item.cm-rarity-rare {
    border-color: rgba(52, 152, 219, 0.5);
}
.cm-item.cm-rarity-rare.cm-equipped {
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}
.cm-item.cm-rarity-epic {
    border-color: rgba(212, 175, 55, 0.5);
}
.cm-item.cm-rarity-epic.cm-equipped {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* Color swatches */
.cm-colors {
    display: none;
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    gap: 6px;
    flex-wrap: wrap;
}
.cm-colors.active {
    display: flex;
}

.cm-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.15s;
}
.cm-color-swatch:hover {
    transform: scale(1.15);
}
.cm-color-swatch.cm-color-active {
    border-color: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}
.cm-color-swatch.cm-color-default {
    background: linear-gradient(135deg, #888 50%, #aaa 50%);
}

/* Pet slot */
.cm-pet-slot {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cm-pet-empty {
    color: #555;
    font-size: 0.82rem;
    font-style: italic;
}

/* Mobile */
@media (max-width: 768px) {
    .cm-panel {
        width: 100%;
        max-width: 100vw;
        right: -110vw;
    }
}

/* ══════════════════════════════════════════════════
   Mobile Chapter Slide-In Panel
   ══════════════════════════════════════════════════ */

.mobile-chapters-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10010;
}
.mobile-chapters-overlay.active {
    display: block;
}

.mobile-chapters-panel {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: var(--bg-panel);
    border-right: 2px solid rgba(212, 175, 55, 0.25);
    z-index: 10011;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
}
.mobile-chapters-panel.active {
    left: 0;
}

.mobile-chapters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    padding-top: calc(14px + env(safe-area-inset-top, 0));
    border-bottom: 1px solid var(--border);
}
.mobile-chapters-header h3 {
    color: var(--gold);
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}
.mobile-chapters-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}
.mobile-chapters-close:hover {
    color: var(--text-light);
}

.mobile-chapters-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-chapter-item {
    padding: 10px 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.mobile-chapter-item:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.04);
}
.mobile-chapter-item.active {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    font-weight: 600;
}
.mobile-chapter-item.locked {
    opacity: 0.5;
}
.mobile-chapter-item.future {
    opacity: 0.25;
    cursor: default;
}
.mobile-chapter-item.future:hover {
    color: var(--text-muted);
    background: transparent;
}
.mobile-chapter-sub {
    font-size: 0.7rem;
    color: #3498db;
    margin-top: 2px;
}
.mobile-chapter-item .chapter-lock-icon {
    margin-left: 6px;
    font-size: 0.75em;
}

