:root {
    --marble-bg: #060607;
    --gold: #dfba53;
    --gold-dark: #b89332;
    --charcoal: #e5e5e7;
    --parchment-dark: #141416;
    --parchment-inner: #1c1c1f;
    --roman-font: 'Cinzel', 'Georgia', serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--marble-bg);
    color: var(--charcoal);a
    display: flex;
    min-height: 100vh;
    position: relative;
    font-family: 'Playfair Display', 'Georgia', serif;
    overflow-x: hidden;
}

/* ==========================================================================
   Separated GPU Canvas Layer (Isolated from Card Hovers)
   ========================================================================== */
.canvas-isolated-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    contain: strict;
    isolation: isolate;
    backface-visibility: hidden;
    transform: translateZ(0); 
}

#marble-canvas {
    width: 100%;
    height: 100%;
    filter: url(#marble-turbulence);
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle, transparent 20%, rgba(0,0,0,0.95) 100%);
    pointer-events: none;
}

.page-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

/* ==========================================================================
   SPA Viewport Container & Height-Clamped View Engine
   ========================================================================== */
#spa-viewport-container {
    flex: 1;
    position: relative;
    min-height: 100vh;
    width: 100%;
}

.spa-view {
    display: none;
    width: 100%;
    opacity: 0;
}

.spa-view.active-view {
    display: block;
    animation: fadeInView 0.16s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes fadeInView {
    from {
        opacity: 0;
        transform: translate3d(0, 6px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* ==========================================================================
   Desktop Sidebar Layout
   ========================================================================== */
.sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: rgba(10, 10, 12, 0.98);
    border-right: 1px solid rgba(223, 186, 83, 0.2);
    box-shadow: 6px 0 25px rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    padding: 35px 22px;
    box-sizing: border-box;
    gap: 20px;
    z-index: 50;
    overflow-y: auto;
    contain: content;
}

.sidebar h1 {
    font-size: 1.35rem;
    margin: 0;
    font-family: var(--roman-font);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    text-shadow: 0px 2px 4px rgba(0,0,0,0.8);
    line-height: 1.3;
    text-align: center;
    font-weight: 400;
}

.changelog-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(223, 186, 83, 0.15);
    border-radius: 4px;
    padding: 12px;
    overflow-y: auto;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
    contain: content;
}

.changelog-box h3 {
    font-family: var(--roman-font);
    color: var(--gold);
    font-size: 0.9rem;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(223, 186, 83, 0.15);
    padding-bottom: 5px;
    font-weight: 400;
}

.changelog-item {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #b0b0b2;
}

.changelog-date {
    font-family: var(--roman-font);
    font-size: 0.72rem;
    color: var(--gold-dark);
    margin-bottom: 3px;
    font-weight: 400;
}

.changelog-item a {
    color: var(--gold);
    text-decoration: underline;
    text-decoration-color: rgba(223, 186, 83, 0.35);
    transition: color 0.1s ease, text-decoration-color 0.1s ease;
}

.changelog-item a:hover {
    color: #ffffff;
    text-decoration-color: var(--gold);
}

.sidebar-widget-container {
    display: flex;
    justify-content: center;
    width: 100%;
    border-top: 1px solid rgba(223, 186, 83, 0.15);
    padding-top: 15px;
}

.chatbots-webring-widget {
    margin: 0 auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.sidebar-navigation-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid rgba(223, 186, 83, 0.15);
    border-bottom: 1px solid rgba(223, 186, 83, 0.15);
    padding: 10px 0;
    box-sizing: border-box;
}

.nav-menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--roman-font);
    font-size: 0.82rem;
    color: #bbb;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
    transition: color 0.1s ease, border-color 0.1s ease, background-color 0.1s ease;
}

.nav-menu-link:hover {
    color: var(--gold);
    background-color: rgba(223, 186, 83, 0.04);
    border-color: rgba(223, 186, 83, 0.15);
}

.nav-menu-link.active-page {
    color: #fff;
    background-color: rgba(223, 186, 83, 0.1);
    border-color: rgba(223, 186, 83, 0.35);
    box-shadow: inset 0 0 6px rgba(223, 186, 83, 0.1);
}

.nav-icon {
    font-size: 0.72rem;
    color: var(--gold);
    line-height: 1;
    display: flex;
    align-items: center;
}

.nav-label-text {
    flex: 1;
    line-height: 1.2;
}

/* ==========================================================================
   Mobile Hamburger Toggle Button & Backdrop Overlay
   ========================================================================== */
.mobile-menu-toggle-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(10, 10, 12, 0.9);
    border: 1.5px solid var(--gold);
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    z-index: 2600; /* Stacks above backdrop and sidebar */
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    backdrop-filter: blur(4px);
    transition: opacity 0.15s ease, transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.mobile-menu-toggle-btn:hover {
    background: rgba(20, 20, 24, 0.95);
    border-color: #fff;
    transform: scale(1.04);
}

.hamburger-bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--gold);
    border-radius: 1px;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.mobile-menu-toggle-btn.is-active .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle-btn.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle-btn.is-active .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.sidebar-mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 4, 5, 0.78);
    backdrop-filter: blur(4px);
    z-index: 2400; /* Directly beneath .sidebar (2500) */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.sidebar-mobile-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

body.modal-open .mobile-menu-toggle-btn,
body:has(.modal.smooth-active) .mobile-menu-toggle-btn,
body:has(.expansion-lightbox:not([style*="display: none"])) .mobile-menu-toggle-btn,
body:has(.contact-fallback-backdrop.fallback-active) .mobile-menu-toggle-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
}

/* ==========================================================================
   Gallery Grid Structure (Zero-Delay Hardware Composited Engine)
   ========================================================================== */
.gallery-container {
    padding: 40px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    contain: layout style;
    isolation: isolate;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 24px;
    width: 100%;
    align-content: start;
}

.card-item.unhydrated-card {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.card-item {
    display: block;
    text-decoration: none;
    background: #0a0a0c;
    border: 1.5px solid rgba(223, 186, 83, 0.18);
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 2 / 3;
    height: auto;

    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;
    backface-visibility: hidden;
    transform: translateZ(0);

    /* Ultra-light instantaneous transform transition with 0 CPU chug */
    transition: transform 0.08s ease, border-color 0.08s ease;
}

.card-item:hover {
    transform: translate3d(0, -4px, 0);
    border-color: var(--gold);
}

.card-img-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background-color: #060607;
}

.card-img-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.14s ease-out;
}

.card-img-container img.loaded {
    opacity: 1;
}

.card-overlay {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 30px 10px 10px 10px;
    box-sizing: border-box;
    background: linear-gradient(to top, rgba(10, 10, 12, 0.95) 0%, rgba(10, 10, 12, 0.6) 50%, rgba(10, 10, 12, 0) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    z-index: 2;
}

.card-name {
    font-family: var(--roman-font);
    color: var(--gold);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9), 0 0 5px rgba(0,0,0,0.8);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-skeleton {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(110deg, #101012 30%, #1c1c22 45%, #101012 60%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    z-index: 1;
    transition: opacity 0.12s ease;
}

@keyframes skeleton-shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.dl-ring-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    background: rgba(13, 13, 15, 0.85);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 5;
    transition: transform 0.08s ease, background 0.08s ease, color 0.08s ease;
}

.dl-ring-btn:hover {
    background: var(--gold);
    color: #111;
    transform: scale(1.08);
}

.dl-ring-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.card-dl-anchor {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    opacity: 1;
}

/* ==========================================================================
   Detail Modals (Smooth Fade In & Out Transitions)
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 4, 5, 0); 
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: background-color 0.18s ease-out, opacity 0.18s ease-out;
}

.modal.smooth-active {
    background-color: rgba(4, 4, 5, 0.94);
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(135deg, #0a0a0c 0%, #111115 100%);
    border: 1.5px solid rgba(223, 186, 83, 0.4);
    border-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 850px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 65px rgba(0,0,0,0.95);
    transform: translate3d(0, 8px, 0) scale(0.97);
    opacity: 0;
    backface-visibility: hidden;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.16s ease-out;
}

.modal.smooth-active .modal-content {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    border-bottom: 1.5px solid rgba(223, 186, 83, 0.3);
    background: rgba(17, 17, 18, 0.8);
}

.modal-header h2 {
    margin: 0;
    font-family: var(--roman-font);
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.esc-hint {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    letter-spacing: 1px;
}

.close-btn {
    font-size: 2rem;
    color: var(--gold);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-weight: 400;
    transition: color 0.1s ease, transform 0.08s ease;
}

.close-btn:hover {
    color: #fff;
    transform: scale(1.08);
}

.modal-body-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
    display: flex;
}

.modal-body {
    width: 100%;
    height: 100%;
    display: flex;
}

.recycled-character-profile-root {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 25px;
    box-sizing: border-box;
}

.modal-body a {
    color: var(--gold) !important;
    text-decoration: underline;
    text-decoration-color: rgba(223, 186, 83, 0.4);
    transition: color 0.1s ease;
}

.modal-body a:hover {
    color: #fff !important;
    text-decoration-color: var(--gold);
}

/* ==========================================================================
   Character Overview Modal Sidebar & Content Layout
   ========================================================================== */
.character-overview {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    align-items: stretch;
}

.character-overview img {
    width: 180px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 240px;
    border-radius: 4px;
    border: 1.5px solid rgba(223, 186, 83, 0.5);
    background: #111;
    object-fit: cover;
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    object-position: var(--modal-img-pos-desktop, center);
}

.overview-details {
    flex: 1;
    min-width: 0;
}

.creators-notes {
    background: var(--parchment-dark);
    border-left: 3px solid var(--gold);
    padding: 15px;
    margin-top: 10px;
    border-radius: 0 4px 4px 0;
    font-style: italic;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    color: #ccc;
    border: 1px solid rgba(223, 186, 83, 0.15);
    word-break: break-word;
}

.modal-body h1, .modal-body h2, .modal-body h3, .modal-body h4, .modal-body strong.bold-header {
    font-family: var(--roman-font) !important;
    color: var(--gold) !important;
    letter-spacing: 1.8px !important;
    text-transform: uppercase !important;
    border-bottom: 1px dashed rgba(223, 186, 83, 0.3);
    padding-bottom: 5px;
    margin-top: 1.2rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 400 !important;
    display: block;
}

/* ==========================================================================
   Shared Accordion Core Layout
   ========================================================================== */
.accordion-item {
    margin-bottom: 12px;
    border: 1.5px solid rgba(223, 186, 83, 0.25);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    background: var(--parchment-dark);
}

.accordion-header {
    background-color: var(--parchment-dark);
    color: var(--gold);
    font-family: var(--roman-font);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 15px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(223, 186, 83, 0.15);
    transition: background-color 0.1s ease, color 0.08s ease;
}

.accordion-header:hover {
    background-color: #242428;
    color: #fff;
}

.accordion-header::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--gold);
    transition: transform 0.12s ease;
}

.accordion-item.active > .accordion-header::after {
    transform: rotate(-180deg);
}

.accordion-content {
    display: none;
    padding: 20px;
    background: var(--parchment-inner);
    line-height: 1.6;
    color: #ddd;
    word-break: break-word;
}

.nested-accordion {
    margin-top: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(223, 186, 83, 0.15);
}

.nested-accordion .accordion-header {
    background-color: rgba(15, 15, 17, 0.6);
    padding: 12px 15px;
    font-size: 0.9rem;
    letter-spacing: 1.5px;
}

.nested-accordion .accordion-content {
    padding: 15px;
    background: #151517;
}

.nested-entry {
    border-bottom: 1px dashed rgba(223, 186, 83, 0.152);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.nested-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.nested-title {
    font-family: var(--roman-font);
    font-weight: 400;
    color: var(--gold);
    margin-bottom: 8.5px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ==========================================================================
   Example Message Dialogue Splits
   ========================================================================== */
.example-dialogue-block-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.example-speech-block {
    background: rgba(14, 14, 18, 0.45);
    border: 1px solid rgba(223, 186, 83, 0.15);
    border-radius: 6px;
    padding: 14px 18px;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.example-speech-block.speaker-character {
    border-left: 3px solid var(--gold);
    background: rgba(223, 186, 83, 0.02);
}

.example-speech-block.speaker-user {
    border-left: 3px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.01);
}

.example-speech-header {
    font-family: var(--roman-font);
    color: var(--gold) !important;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px dashed rgba(223, 186, 83, 0.15);
    padding-bottom: 4px;
    margin: 0;
    line-height: 1.4;
    user-select: none;
}

.example-speech-block.speaker-user .example-speech-header {
    color: #dfba53 !important;
}

.example-speech-body {
    font-size: 0.92rem;
    line-height: 1.62;
    color: #ddd;
    word-break: break-word;
}

.example-speech-body p {
    margin: 0 0 10px 0;
}

.example-speech-body p:last-child {
    margin-bottom: 0;
}

pre {
    background: #101011;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    white-space: pre-wrap;
    color: #ccc;
    font-size: 0.9rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 12, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(223, 186, 83, 0.15);
    border-top: 3px solid var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Refined Lightbox and Controls Header
   ========================================================================== */
.expansion-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000; 
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.lightbox-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 4, 5, 0.98);
    cursor: zoom-out;
}

.lightbox-custom-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 15px 30px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end; 
    z-index: 4100;
}

.lightbox-custom-header .header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lightbox-custom-header .esc-hint {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    letter-spacing: 1px;
}

.lightbox-custom-header .close-btn {
    font-size: 2rem;
    color: var(--gold);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-weight: 400;
    transition: color 0.1s ease, transform 0.08s ease;
}

.lightbox-custom-header .close-btn:hover {
    color: #fff;
    transform: scale(1.08);
}

.lightbox-content-wrapper {
    position: relative;
    z-index: 4050;
    max-width: 85vw;
    max-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content-wrapper img {
    max-width: 100%;
    max-height: 80vh;
    border: 1.5px solid var(--gold);
    border-radius: 4px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.95);
    object-fit: contain;
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%); 
    background: rgba(20, 20, 22, 0.85);
    border: 1.5px solid rgba(223, 186, 83, 0.45);
    color: var(--gold);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 4100;
    user-select: none;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: transform 0.08s ease, background 0.08s ease, color 0.08s ease;
}

.lightbox-nav-btn:hover {
    background: var(--gold);
    color: #111113;
    border-color: var(--gold);
    transform: translateY(-50%) scale(1.06);
}

.lightbox-prev { left: 35px; }
.lightbox-next { right: 35px; }

@media (max-width: 768px) {
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
    .lightbox-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   Image Gallery Carousel Track
   ========================================================================== */
.carousel-section {
    margin-top: 5px;
    margin-bottom: 25px;
    background: rgba(14, 14, 17, 0.45);
    border: 1px solid rgba(223, 186, 83, 0.15);
    border-radius: 4px;
    padding: 18px;
    box-sizing: border-box;
    width: 100%;
}

.carousel-container {
    display: flex;
    align-items: center;
    position: relative;
    gap: 15px;
}

.carousel-track-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    gap: 16px;
    width: max-content;
    will-change: transform;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-btn {
    background: rgba(20, 20, 22, 0.9);
    border: 1.5px solid rgba(223, 186, 83, 0.35);
    color: var(--gold);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    line-height: 1;
    z-index: 10;
    transition: transform 0.08s ease, background 0.08s ease;
}

.carousel-btn:hover {
    background: var(--gold);
    color: #111113;
    transform: scale(1.06);
}

.carousel-btn:disabled,
.carousel-btn.disabled-btn {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.carousel-item-img-wrapper {
    flex: 0 0 auto;
    height: 150px; 
    border: 1.5px solid rgba(210, 180, 80, 0.25);
    border-radius: 3px;
    overflow: hidden;
    background-color: #0c0c0e;
    cursor: zoom-in;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.08s ease, transform 0.12s ease;
}

.carousel-item-img-wrapper:hover {
    border-color: var(--gold);
    transform: scale(1.02); 
}

.carousel-img {
    height: 100%;
    width: auto; 
    object-style: cover;
    pointer-events: auto;
    display: block;
}

/* ==========================================================================
   Dedicated FAQ SPA Viewport
   ========================================================================== */
.faq-container {
    padding: 40px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    contain: layout style;
    isolation: isolate;
}

.faq-content-sheet {
    width: 100%;
    max-width: 900px;
    background: rgba(12, 12, 15, 0.88);
    border: 1.5px solid rgba(223, 186, 83, 0.25);
    border-radius: 6px;
    padding: 40px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.85);
    box-sizing: border-box;
}

.faq-header-block {
    border-bottom: 1.5px solid rgba(223, 186, 83, 0.3);
    padding-bottom: 25px;
    margin-bottom: 30px;
}

.faq-header-block h2 {
    margin: 0;
    font-family: var(--roman-font);
    font-size: 1.5rem;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 400;
}

.faq-support-subtext {
    font-size: 0.85rem;
    color: #a0a0a5;
    margin: 10px 0 0 0;
    line-height: 1.5;
    font-style: italic;
    letter-spacing: 0.5px;
}

.faq-support-subtext a {
    color: var(--gold);
    text-decoration: underline;
    text-decoration-color: rgba(223, 186, 83, 0.3);
    transition: all 0.1s ease;
}

.faq-support-subtext a:hover {
    color: #fff;
    text-decoration-color: var(--gold);
}

.faq-content-sheet .accordion-item {
    border-color: rgba(223, 186, 83, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    background: var(--parchment-dark);
}

.faq-content-sheet .accordion-content {
    background: var(--parchment-inner);
    color: #ddd;
}

/* ==========================================================================
   Contact Fallback Modal Popup System
   ========================================================================== */
.contact-fallback-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(4, 4, 5, 0);
    z-index: 5000;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    transition: background-color 0.14s ease-out;
}

.contact-fallback-backdrop.fallback-active {
    background-color: rgba(4, 4, 5, 0.94);
}

.contact-fallback-card {
    background: linear-gradient(135deg, #0a0a0c 0%, #111115 100%);
    border: 1.5px solid rgba(223, 186, 83, 0.4);
    border-radius: 6px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.98);
    opacity: 0;
    transition: transform 0.14s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.12s ease-out;
}

.contact-fallback-backdrop.fallback-active .contact-fallback-card {
    transform: scale(1);
    opacity: 1;
}

.contact-fallback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1.5px solid rgba(223, 186, 83, 0.3);
    background: rgba(17, 17, 18, 0.85);
}

.contact-fallback-header h4 {
    margin: 0;
    font-family: var(--roman-font);
    color: var(--gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 400;
}

.contact-fallback-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fallback-close-btn {
    font-size: 1.8rem;
    color: var(--gold);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-weight: 400;
    transition: color 0.1s ease, transform 0.08s ease;
}

.fallback-close-btn:hover {
    color: #fff;
    transform: scale(1.08);
}

.contact-fallback-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-fallback-body p {
    margin: 0;
    font-size: 0.85rem;
    color: #bcbcbf;
    line-height: 1.5;
}

.contact-input-field-lock {
    display: flex;
    gap: 10px;
    width: 100%;
}

.contact-text-input {
    flex: 1;
    background: #09090b;
    border: 1.5px solid rgba(223, 186, 83, 0.25);
    border-radius: 4px;
    color: #fff;
    padding: 10px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.contact-text-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 5px rgba(223, 186, 83, 0.15);
}

.contact-copy-action {
    background: rgba(13, 13, 15, 0.85);
    border: 1.5px solid var(--gold);
    color: var(--gold);
    padding: 0 18px;
    font-family: var(--roman-font);
    font-size: 0.8rem;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.08s ease, color 0.08s ease;
}

.contact-copy-action:hover {
    background: var(--gold);
    color: #111;
}

/* ==========================================================================
   Responsive Mobile Breakpoint (<= 820px) — Multi-Card Dynamic Flow
   ========================================================================== */
@media (max-width: 820px) {
    body {
        flex-direction: column;
    }

    /* Full stacking context neutralization on mobile */
    .page-container {
        flex-direction: column;
        position: static !important;
        z-index: auto !important;
        isolation: auto !important;
    }

    .mobile-menu-toggle-btn {
        display: flex;
    }

    .sidebar-mobile-backdrop {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        z-index: 2500; /* Directly above backdrop (2400) */
        transform: translate3d(-100%, 0, 0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.95);
        border-right: 1px solid rgba(223, 186, 83, 0.35);
        padding: 65px 20px 30px 20px;
        transition: transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-sizing: border-box;
    }

    .sidebar h1 {
        font-size: 1.2rem;
        margin-top: 0;
        line-height: 1.3;
    }

    .sidebar.mobile-open {
        transform: translate3d(0, 0, 0);
    }

    /* Fluid Multi-Card Grid on Mobile (2, 3, or more cards depending on width) */
    .gallery-container {
        padding: 65px 14px 25px 14px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
        gap: 12px;
    }

    .faq-container {
        padding: 65px 14px 25px 14px;
    }

    .faq-content-sheet {
        padding: 20px;
    }

    .modal-content {
        height: 90vh;
    }

    /* Original 140px Ribbon Image in Card Modal */
    .character-overview {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .character-overview img {
        width: 100%;
        height: 140px;
        min-height: 140px;
        max-height: 140px;
        align-self: auto;
        object-fit: cover;
        object-position: var(--modal-img-pos-mobile, center 20%);
    }

    .creators-notes {
        font-size: 0.9rem;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 60px 10px 20px 10px;
    }

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

    .card-overlay {
        padding: 20px 6px 6px 6px;
    }

    .card-name {
        font-size: 0.82rem;
        letter-spacing: 1.2px;
    }

    .dl-ring-btn {
        width: 28px;
        height: 28px;
    }

    .dl-ring-btn svg {
        width: 14px;
        height: 14px;
    }
}