:root {
    --k-accent: #f97316;
    --k-text: #ffffff;
    --k-dim: rgba(255, 255, 255, 0.6); 
    --k-glass: rgba(255, 255, 255, 0.08); 
    --k-border: rgba(255, 255, 255, 0.1);
}

/* 1. MAIN PLAYER CONTAINER (Standard App Takeover) */
#koba-bloom-root {
    width: 100vw !important;
    height: 100dvh !important; /* Updated with your mobile fix */
    max-width: 100% !important;
    position: fixed; 
    top: 0;
    left: 0;
    z-index: 99999; /* STAYS: Keeps player on top of all WP elements */
    border-radius: 0 !important;
    aspect-ratio: auto;
    overflow: hidden; /* STAYS: Prevents accidental scroll overflow */
}

/* --- ACCESSIBILITY: JUBILEE FLIP CARD STYLING --- */
.jubilee-card-container {
    perspective: 1000px;
    width: 280px;
    height: 400px;
    margin: 15px;
    cursor: pointer;
    display: inline-block;
}

.jubilee-card {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.jubilee-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px; /* Smoother, modern corners */
    background: #161b22;
    border: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.card-front {
    justify-content: space-between;
    align-items: center;
}

.card-front img {
    width: 100%;
    height: 70%;
    object-fit: cover;
    border-radius: 8px;
}

.card-back {
    transform: rotateY(180deg);
    font-size: 16px; /* Easier readability for older eyes */
    line-height: 1.6;
    color: #e2e8f0;
    overflow-y: auto;
    text-align: left;
}

/* Fix Native Fullscreen State (ONLY active when expanded) */
#koba-bloom-root.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
    background: #000 !important; /* Pitch black for videos */
}

/* Ensure Video Object Fit is perfect in fullscreen */
.k-video-element { 
    width: 100%; 
    height: auto; 
    max-height: 70vh !important; 
    object-fit: contain; 
    border-radius: 8px; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.5); 
}

/* Keep the centered KOBA-I logo clear of the video canvas. The matching
   height reduction preserves space for the timeline and playback controls. */
#koba-bloom-root.k-mode-video .k-video-viewport {
    margin-top: 48px;
    height: calc(100% - 48px) !important;
    max-height: calc(70vh - 48px) !important;
}

#koba-bloom-root.k-mode-video .k-video-element {
    max-height: calc(70vh - 48px) !important;
}

/* =========================================================================
   THE IMMERSIVE BACKGROUND CANVAS
   ========================================================================= */
.k-bloom-bg {
    position: fixed; 
    inset: 0; /* Snaps perfectly to all 4 edges */
    width: 100vw; 
    height: 100vh;
    background-size: cover; 
    background-position: center;
    
    /* 🚀 THE FIX: Removed the 120% zoom and 50px blur. 
       Just slightly dimmed and saturated so the glassmorphism pops! */
    filter: brightness(0.65) saturate(1.2); 
    
    z-index: 1;
    transition: all 0.5s ease-in-out;
}

/* E-Reader View Mode: Darkens the backdrop to focus eyes on text */
.k-reader-mode-active .k-bloom-bg {
    filter: blur(0px) brightness(0.08); 
}

/* Logo */
.k-bloom-logo { 
    position: absolute; 
    top: 20px; 
    left: 50%;
    transform: translateX(-50%); /* Centers logo */
    width: clamp(190px, 18vw, 250px);
    height: auto;
    max-width: 36vw;
    object-fit: contain;
    z-index: 100; 
}

.k-bloom-back-to-store {
    position: absolute;
    top: max(18px, env(safe-area-inset-top));
    left: max(18px, env(safe-area-inset-left));
    z-index: 100001;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(7, 10, 15, 0.82);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    backdrop-filter: blur(8px);
}

.k-bloom-back-to-store:hover,
.k-bloom-back-to-store:focus-visible {
    border-color: #f97316;
    color: #ffffff;
    outline: 2px solid transparent;
}

/* 2. INTERFACE LAYOUT */
.k-bloom-interface {
    position: absolute; inset: 0; z-index: 10;
    display: grid; grid-template-columns: 1fr 340px;
}

.k-bloom-stage { 
    display: flex; flex-direction: column; 
    justify-content: center; align-items: center; 
    padding: 30px; position: relative; min-width: 0;
}

.k-bloom-cover { 
    width: 260px; height: 260px; 
    background-size: cover; background-position: center;
    border-radius: 8px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6); 
    margin-bottom: 35px; border: 1px solid rgba(255,255,255,0.1);
}

.k-cover-art-stage {
    flex: 0 0 auto;
    text-align: center;
}

.k-bloom-cover-img {
    display: block;
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    margin: 0 auto 35px;
}

/* 3. CONTROLS */
.k-bloom-controls { 
    width: 100%; 
    max-width: 650px; /* 🚀 Increased slightly to give breathing room for edge actions */
    display: flex; 
    flex-direction: column; 
    gap: 18px; 
}
.k-scrubber { 
    width: 100%; 
    height: 6px; 
    background: rgba(255,255,255,0.15); 
    border-radius: 3px; 
    cursor: pointer; 
    position: relative; 
}
.k-progress { height: 100%; background: var(--k-accent); width: 0%; border-radius: 3px; position: relative; box-shadow: 0 0 15px rgba(249, 115, 22, 0.4); }
.k-time-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--k-dim); font-weight: 500; margin-top: -12px; }

/* --- ACCESSIBILITY: HIGH-CONTRAST PLUMP BUTTONS --- */
.k-buttons {
    background: rgba(0,0,0,0.55); /* Slightly darker glass opacity for better icon contrast */
    backdrop-filter: blur(12px);  /* Smooth frosted overlay matching layout aesthetics */
    padding: 12px 24px;           /* 🚀 Reduced top/bottom padding slightly, maximized horizontal footprint */
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 🚀 Forces layout items to utilize the full span instead of clustering in center */
    gap: 15px; 
    width: 100%;                  /* Forces the pill container to expand out to the max-width boundary */
    box-sizing: border-box;
    transition: all 0.3s ease; 
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.k-btn-icon, .k-btn-main {
    background: transparent !important;
    border: none !important;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: none !important;
    color: #ffffff; 
    transition: transform 0.2s ease, opacity 0.2s;
}

/* Massive target zones for human thumbs and fingers */
.k-btn-icon { width: 48px; height: 48px; }
.k-btn-main { width: 64px; height: 64px; margin: 0 15px; }

/* Enforcing large scalable vector sizes */
.k-btn-icon svg { width: 32px !important; height: 32px !important; fill: #ffffff !important; display: block; }
.k-btn-main svg { width: 48px !important; height: 48px !important; fill: #ffffff !important; display: block; }

.k-btn-icon:active, .k-btn-main:active { transform: scale(1.15); }
.k-btn-icon:hover, .k-btn-main:hover { opacity: 0.85; }

.k-actions { 
    display: flex; 
    align-items: center;
    justify-content: center;
    gap: 15px; 
}

/* TABLET VIEW OVERRIDES */
@media (max-width: 1024px) {
    .k-buttons { padding: 15px 18px; gap: 20px; }
    .k-btn-main { margin: 0 8px; }
}

/* MOBILE VIEW OVERRIDES */
@media (max-width: 768px) {
    .k-buttons { padding: 15px 12px; gap: 16px; border-radius: 12px; }
    .k-btn-main { margin: 0 4px; }
}

/* TABS */
.k-tabs { display: flex; gap: 20px; padding: 20px 30px 10px 30px; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 10px; }
.k-tab { background: none; border: none; color: white; font-size: 15px; font-weight: 600; cursor: pointer; padding-bottom: 8px; position: relative; }
.k-tab.active { color: var(--k-accent); }
.k-tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: var(--k-accent); }

/* LIST ITEMS (CHAPTERS) */
.k-list { padding: 0 15px; }
.k-list-item { 
    padding: 16px 20px; 
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    cursor: pointer; 
    border: none;
    font-size: 15px; 
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background 0.2s, color 0.2s;
}
.k-list-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.k-list-item.active { 
    background: rgba(255, 255, 255, 0.1); /* Frosted pill effect */
    color: white; 
    font-weight: 700;
}
.k-list-item.active svg { color: var(--k-accent); }

/* 5. MINI PLAYER */
.koba-mini-container { width: 100%; min-height: 90px; background: #09090b; border-radius: 12px; padding: 15px 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.25); border: 1px solid #27272a; box-sizing: border-box; font-family: -apple-system, sans-serif; display: flex; align-items: center; }
.k-mini-shell { display: flex; align-items: center; gap: 20px; width: 100%; }
.k-mini-cover { width: 60px; height: 60px; border-radius: 8px; background-size: cover; background-position: center; flex-shrink: 0; border: 1px solid var(--k-border); }
.k-mini-play-btn { width: 50px; height: 50px; border-radius: 50%; background: white; color: black; border:none; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding-left: 3px; transition: transform 0.2s; }
.k-mini-info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.k-mini-title { color: white; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 10px; }
.k-mini-scrubber { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; cursor: pointer; position: relative; }
.k-mini-progress { height: 100%; background: var(--k-accent); width: 0%; border-radius: 3px; }

/* =========================================================================
   CATALOG BOOKSHELF
   Desktop: responsive grid. Mobile: touch-first snap carousel.
   ========================================================================= */
.jubilee-catalog-groups {
    display: grid;
    gap: 34px;
    width: 100%;
}

.jubilee-catalog-group {
    min-width: 0;
}

.jubilee-catalog-group-title {
    margin: 0;
    color: #f9b437;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    font-weight: 800;
    line-height: 1.2;
}

.jubilee-bookshelf-track {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 240px));
    justify-content: center;
    gap: 20px;
    width: 100%;
    padding: 20px 0;
    box-sizing: border-box;
}

.jubilee-bookshelf-card {
    width: 100%;
    min-width: 0;
    max-width: 240px;
    height: 450px;
    perspective: 1000px;
    transform-style: preserve-3d;
    cursor: pointer;
    outline: none;
}

.jubilee-bookshelf-card:focus-visible {
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.5);
}

.jubilee-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.jubilee-card-inner.is-flipped {
    transform: rotateY(180deg);
}

.jubilee-card-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #30363d;
    border-radius: 12px;
    background: #161b22;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.jubilee-card-back {
    transform: rotateY(180deg);
}

.jubilee-card-cover {
    width: 100%;
    height: 210px;
    object-fit: cover;
    border-radius: 8px;
}

.jubilee-card-title {
    min-height: 2.5em;
    margin: 10px 0 4px;
    overflow: hidden;
    color: #ffffff;
    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.25;
}

.jubilee-card-primary {
    margin-top: auto;
}

.jubilee-card-back-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #ffffff;
    font-family: sans-serif;
}

.jubilee-card-back-header h4 {
    margin: 0;
    font-size: 1rem;
}

.jubilee-card-synopsis {
    flex: 1;
    margin: 14px 0;
    padding-right: 7px;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #e2e8f0;
    font: 400 0.9rem/1.55 sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.jubilee-card-back-action {
    flex: 0 0 auto;
}

.jubilee-product-price {
    margin: 4px 0 12px;
    color: #34d399;
    font-family: sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.jubilee-catalog-action {
    display: block;
    padding: 10px;
    border-radius: 6px;
    border: 0 !important;
    background: #f97316 !important;
    color: #000000 !important;
    font-family: sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.jubilee-catalog-action--buy {
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(249, 115, 22, 0.24);
}

#jubilee-catalog-root .jubilee-catalog-action--buy {
    border-color: #f97316 !important;
    background-color: #f97316 !important;
    color: #000000 !important;
}

#jubilee-catalog-root .jubilee-catalog-action--buy:hover,
#jubilee-catalog-root .jubilee-catalog-action--buy:focus-visible {
    border-color: #ea580c !important;
    background-color: #ea580c !important;
    color: #000000 !important;
}

.jubilee-catalog-action--owned {
    background: #10b981 !important;
    color: #000000 !important;
}

.jubilee-catalog-action:hover,
.jubilee-catalog-action:focus-visible {
    background: #ea580c !important;
    color: #000000 !important;
}

.jubilee-catalog-action--owned:hover,
.jubilee-catalog-action--owned:focus-visible {
    background: #059669 !important;
    color: #000000 !important;
}

.jubilee-catalog-action:focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.38);
    outline-offset: 2px;
}

.already-purchased-link {
    display: block;
    margin-top: 9px;
    color: #94a3b8;
    font: 500 0.78rem/1.35 sans-serif;
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.already-purchased-link:hover,
.already-purchased-link:focus-visible {
    color: #cbd5e1;
}

.jubilee-purchase-unavailable {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 10px;
    background: rgba(120, 53, 15, 0.28);
    color: #fde68a;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
}

@media (max-width: 640px) {
    .jubilee-bookshelf-track {
        display: flex;
        justify-content: flex-start;
        gap: 16px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scroll-padding-inline: 16px;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 20px 16px;
    }

    .jubilee-bookshelf-track::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    .jubilee-bookshelf-card {
        flex: 0 0 min(78vw, 240px);
        width: min(78vw, 240px);
        min-width: min(78vw, 240px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

/* =========================================================================
   6. READING MODE (Sovereign Portrait Canvas)
   ========================================================================= */
/* 🚀 THE FIXED READER ENGINE */
.k-read-scrollbox { 
    display: none; 
    width: 95vw !important;      /* Use 95% of width to avoid touching screen edges */
    max-width: 800px !important; 
    height: 90vh !important;     /* Changed from 75vh to 90vh to maximize real estate */
    margin: 5vh auto;            /* Vertical centering */
    position: relative;
    
    background: rgba(10, 15, 25, 0.9) !important; 
    backdrop-filter: blur(20px) !important;
    border-radius: 12px !important; 
    
    /* Perfect Swipe Snapping */
    overflow-x: auto !important; 
    overflow-y: hidden !important; 
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
}

.k-ebook-content { 
    display: flex !important;
    flex-direction: row !important;
    height: 100% !important; /* Forces the content to fill the scrollbox height */
    width: 100% !important;
}

.k-ebook-page {
    width: 100% !important; 
    flex-shrink: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically centers the text block */
    padding: 0 40px !important; 
    box-sizing: border-box;
    scroll-snap-align: center !important; 
}

.k-ebook-page p {
    font-family: 'Atkinson Hyperlegible', 'Georgia', serif !important;
    font-size: 20px !important; 
    line-height: 1.8 !important; 
    color: #e2e8f0 !important;
    margin: 0;
}

/* THEME CYCLER CLASSES (Must be global) */
.k-theme-dark .k-read-scrollbox { background: rgba(10, 15, 25, 0.85) !important; color: #e2e8f0 !important; }
.k-theme-light .k-read-scrollbox { background: #ffffff !important; color: #111827 !important; }
.k-theme-sepia .k-read-scrollbox { background: #fbf0d9 !important; color: #5f4b32 !important; }
.k-theme-eink .k-read-scrollbox { background: #ffffff !important; color: #000000 !important; border-radius: 0 !important; border: none !important; }

.k-ebook-content { 
    display: flex !important;
    flex-direction: row !important;
    height: 100% !important;
    width: 100% !important;
    box-sizing: border-box; 
}

.k-ebook-page {
    width: 100% !important; 
    flex-shrink: 0 !important;
    display: flex;
    align-items: center; 
    justify-content: center;
    padding: 0 40px !important; 
    box-sizing: border-box;
    scroll-snap-align: center !important; 
}

/* Paragraphs within the page */
.k-ebook-page p {
    font-family: 'Atkinson Hyperlegible', 'Georgia', serif !important;
    font-size: 20px !important; 
    line-height: 1.8 !important; 
    color: #e2e8f0 !important; 
    text-align: left !important;
    margin: 0;
    max-width: 600px; /* Ensures lines don't get too long */
}
.k-read-scrollbox::-webkit-scrollbar { display: none !important; }

/* The Text Container */
.k-ebook-content { 
    display: flex !important;
    flex-direction: row !important;
    height: 100% !important;
    width: 100% !important;
    padding: 0 !important; 
    box-sizing: border-box; 
}

/* 🚀 Each Page is an Anchor Point */
.k-ebook-page {
    width: 100% !important; 
    flex-shrink: 0 !important;
    display: flex;
    align-items: center; 
    padding: 0 40px !important; /* Safe padding for text */
    box-sizing: border-box;
    scroll-snap-align: center !important; 
    
    /* 🚀 THE MAGIC: Forces text to break into horizontal pages */
    column-width: calc(850px - 160px); /* Max width minus padding */
    column-gap: 160px; /* Gap must exactly equal padding to prevent text peeking */
    column-rule: 1px solid transparent; 
    
    /* High-End Typography */
    font-family: 'Atkinson Hyperlegible', 'Georgia', serif;
    font-size: 20px; 
    line-height: 1.85; 
    color: #e2e8f0; 
    text-align: left;
}

/* Pagination Control Buttons */
.k-page-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0 80px;
    box-sizing: border-box;
}

.k-page-btn {
    background: #7C2B22; /* Matches your mockup deep red */
    color: #F9B437; /* Matches your mockup gold */
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.k-page-btn:hover { background: #5a1f18; transform: translateY(-2px); }
.k-page-btn:active { transform: translateY(1px); }

/* Standard Text Formatting */
.k-ebook-content h1, .k-ebook-content h2, .k-ebook-content h3 { 
    color: #ffffff; margin-top: 0; margin-bottom: 30px; font-weight: 700;
    letter-spacing: -0.02em; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 15px;
}
.k-ebook-content p { margin-bottom: 25px; text-indent: 1.5em; }

/* Kills the audio interface when Reading Mode activates */
#koba-bloom-root.k-mode-reading .k-bloom-cover,
#koba-bloom-root.k-mode-reading .k-video-element { 
    display: none !important; 
}

/* Hides controls only for dedicated E-Books in reading mode */
#koba-bloom-root.k-media-ebook.k-mode-reading .k-bloom-controls {
    display: none !important;
}

/* Activates the text canvas */
#koba-bloom-root.k-mode-reading .k-read-scrollbox { 
    display: block !important; 
}

/* Formatting Rules for the actual book text */
.k-ebook-content h1, .k-ebook-content h2, .k-ebook-content h3 { 
    color: #ffffff; 
    margin-top: 0;
    margin-bottom: 30px; 
    font-weight: 700;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.k-ebook-content p { 
    margin-bottom: 25px; 
    text-indent: 1.5em; /* Classic book indentation */
}

/* Transcript Word Highlighting */
.k-word { opacity: 0.6; transition: all 0.2s; cursor: pointer; display: inline-block; margin: 0 2px; }
.k-word:hover { opacity: 1; color: white; }
.k-word.active { opacity: 1; color: var(--k-accent); font-weight: 700; transform: scale(1.1); text-shadow: 0 0 10px rgba(249, 115, 22, 0.4); }#koba-bloom-root.k-mode-reading .k-bloom-cover,
#koba-bloom-root.k-mode-reading .k-video-element { display: none !important; }
#koba-bloom-root.k-mode-reading .k-read-scrollbox { display: block !important; }

.k-word { opacity: 0.6; transition: all 0.2s; cursor: pointer; display: inline-block; margin: 0 2px; line-height: 1.6; font-size: 16px; }
.k-word:hover { opacity: 1; color: white; }
.k-word.active { opacity: 1; color: var(--k-accent); font-weight: 700; transform: scale(1.1); text-shadow: 0 0 10px rgba(249, 115, 22, 0.4); }

/* --- INVISIBLE SCROLLBARS --- */
.k-list::-webkit-scrollbar, .k-read-scrollbox::-webkit-scrollbar { 
    display: none !important; 
    width: 0 !important; 
    background: transparent !important; 
}
.k-list, .k-read-scrollbox { 
    -ms-overflow-style: none !important; 
    scrollbar-width: none !important; 
}

.k-mini-play-btn svg {
    width: 24px; height: 24px; display: block; fill: currentColor; margin: 0 auto;
}
.k-mini-play-btn svg { width: 20px; height: 20px; color: black; }

/* MOBILE LAYOUT CONTENT FLOW RULES */
@media (max-width: 900px) {
    .k-bloom-logo {
        top: max(10px, env(safe-area-inset-top));
        width: min(24vw, 130px);
        height: auto;
        max-width: none;
    }

    .k-bloom-interface { 
        grid-template-columns: 1fr; 
        grid-template-rows: 1fr auto; 
    }
    .k-bloom-cover {
        width: 50vw; 
        height: 50vw;
        max-width: 200px;
        max-height: 25vh; 
        margin-bottom: 15px;
    }
    .k-bloom-stage {
        padding: 15px;
        padding-top: calc(76px + env(safe-area-inset-top));
        justify-content: flex-start;
    }

    .k-bloom-cover-img {
        width: min(48vw, 25vh, 220px);
        height: min(48vw, 25vh, 220px);
        margin-bottom: 15px;
    }
}

@media (max-width: 900px) and (max-height: 600px) {
    .k-bloom-logo {
        width: min(22vw, 120px);
        height: auto;
        max-width: none;
    }

    .k-bloom-stage {
        padding-top: calc(58px + env(safe-area-inset-top));
    }

    .k-bloom-cover-img {
        width: min(42vw, 22vh, 180px);
        height: min(42vw, 22vh, 180px);
    }
}

/* KOBA-I wordmark: compact, centered, and secondary to the cover artwork. */
.k-bloom-logo,
.koba-player-logo,
.bloom-header-logo img,
#jubilee-bloom-root img[src*="koba-logo"],
#koba-bloom-root img[src*="koba-logo"] {
    width: auto !important;
    max-width: 140px !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 auto 12px !important;
    display: block !important;
}

@media (max-width: 640px) {
    .k-bloom-logo,
    .koba-player-logo,
    .bloom-header-logo img,
    #jubilee-bloom-root img[src*="koba-logo"],
    #koba-bloom-root img[src*="koba-logo"] {
        max-width: 100px !important;
    }
}

/* THEME LAYOUT SANITIZATION CLEANUP */
body.single-koba_publication #sidebar,        
body.single-koba_publication #secondary,
body.single-koba_publication .et_pb_widget_area_right { display: none !important; }
body.single-koba_publication #main-content,
body.single-koba_publication #left-area { width: 100% !important; max-width: 100% !important; padding: 0 !important; float: none !important; }

/* --- SOVEREIGN SECURITY LOCK SCREEN STYLES --- */
.koba-lock-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 20px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin: 30px auto;
    max-width: 500px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.koba-lock-icon {
    width: 60px !important;
    height: 60px !important;
    margin-bottom: 20px;
    fill: #b3261e; 
}

.koba-lock-text h3 {
    margin: 0 0 8px 0 !important;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
}

.koba-lock-text p {
    margin: 0 0 25px 0 !important;
    font-size: 15px;
    color: #666;
}

.koba-lock-btn {
    display: inline-block;
    padding: 12px 28px;
    background-color: #f57c00;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    transition: background-color 0.2s ease;
}

.koba-lock-btn:hover {
    background-color: #e65100;
}

/* --- DESKTOP SIDEBAR & VIEW BOUNDARIES --- */
@media (min-width: 769px) {
    .k-bloom-sidebar { 
        background: rgba(10, 10, 10, 0.6); 
        backdrop-filter: blur(20px); 
        border-left: 1px solid var(--k-border); 
        display: flex; 
        flex-direction: column;
        height: 100vh; 
    }

    .k-list { 
        display: flex; 
        flex-direction: column; 
        flex-grow: 1;
        max-height: calc(100vh - 60px); 
        overflow-y: auto !important; 
        -webkit-overflow-scrolling: touch; 
    }
}

/* --- MOBILE SPECIFIC SCROLL LOCK REPAIRS --- */
@media (max-width: 768px) {
    .k-actions {
        width: 100%;
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px solid rgba(255,255,255,0.1); 
        border-left: none; 
        padding-left: 0;
        margin-left: 0;
    }
    
    .k-btn-icon { width: 44px; height: 44px; }
    .k-btn-main { width: 60px; height: 60px; }

    .k-bloom-sidebar {
        display: none;
        width: 100%; 
        margin-top: 10px; 
    }

    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar {
        display: flex;
        flex-direction: column;
    }

    .k-list {
        height: 35vh !important; 
        max-height: 300px !important; 
        overflow-y: auto !important; 
        padding-bottom: 20px; 
    }
}

/* Compact video layouts keep the active media and controls inside the usable
   viewport. The chapter menu is a reversible second grid row, never a cover-art
   mode switch. */
@media (orientation: landscape) and (max-height: 600px) {
    .k-bloom-interface {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .k-bloom-stage {
        box-sizing: border-box;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
        justify-content: flex-start;
        padding: calc(42px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    #koba-bloom-root.k-mode-video .k-video-viewport {
        flex: 1 1 auto;
        min-height: 0;
        height: auto !important;
        max-height: calc(100dvh - 142px) !important;
        margin-top: 0;
    }

    #koba-bloom-root.k-mode-video .k-video-element {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
    }

    .k-bloom-controls {
        flex: 0 0 auto;
        gap: 4px;
        max-width: min(760px, calc(100vw - 24px));
    }

    .k-buttons {
        padding: 4px 10px;
        gap: 8px;
    }

    .k-btn-icon { width: 36px; height: 36px; }
    .k-btn-main { width: 44px; height: 44px; margin: 0 4px; }
    .k-btn-icon svg { width: 24px !important; height: 24px !important; }
    .k-btn-main svg { width: 34px !important; height: 34px !important; }

    .k-bloom-sidebar {
        display: none;
        width: 100%;
        max-height: 32dvh;
        overflow: hidden;
        background: rgba(10, 10, 10, 0.92);
    }

    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar {
        display: flex;
        flex-direction: column;
    }

    #koba-bloom-root.k-chapter-menu-open .k-list {
        height: auto !important;
        max-height: calc(32dvh - 54px) !important;
    }
}

/* =========================================================================
   THE JUBILEE DUAL EXPERIENCE MODAL OVERRIDES
   ========================================================================= */

/* The Immersive Background Canvas (Fixed: Crisp & Flush) */
.k-bloom-bg {
    position: fixed; 
    inset: 0; 
    width: 100vw; 
    height: 100vh;
    background-size: cover; 
    background-position: center;
    /* 🚀 THE FIX: Zoom and Blur completely removed from the override */
    filter: brightness(0.65) saturate(1.2); 
    z-index: 1;
    transition: all 0.5s ease-in-out;
}

/* E-Reader View Mode: Kills visual audio elements to highlight high-end typography */
.k-reader-mode-active .k-bloom-bg {
    filter: brightness(0.08); /* 🚀 Removed the blur toggle since the canvas is crisp now */
}

.k-reader-mode-active .k-audio-visualizer-canvas,
.k-reader-mode-active .k-wave-scrubber-container {
    display: none !important;
}

.k-reader-mode-active .k-text-scrolling-canvas {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Georgia', serif;
    font-size: 19px;
    line-height: 1.8;
    color: #e2e8f0;
    overflow-y: auto;
    height: 75vh;
}

/* BLOOM PLAYER - PREMIUM STICKY FOOTER */
.bloom-player-root {
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  padding-bottom: 120px;
}

.bloom-sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  padding: 24px 40px;
  z-index: 9999;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Master Play Button - Thumb Optimized */
.bloom-btn-master-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  transition: transform 0.1s;
}

.bloom-btn-master-play:active {
  transform: scale(0.93);
}

/* Timeline Scrub Bar */
.bloom-scrub-bar {
  flex-grow: 1;
  height: 6px;
  cursor: pointer;
  border-radius: 3px;
  border: none;
  outline: none;
}

/* 🚀 NATIVE FULLSCREEN COVER FIXED ROUTINE */
:-webkit-full-screen {
    background: #090d16 !important; /* Elegant fallback deep space slate */
}

/* Forces the active fullscreen container element to inherit your live custom background variable stream */
:fullscreen, [data-koba-player-root]:fullscreen {
    background-image: var(--bg-image-url) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Keeps your signature dark frosted overlay active even on your monitor's base layer */
:fullscreen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(9, 13, 22, 0.45) !important;
    backdrop-filter: blur(25px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(140%) !important;
    z-index: -1;
}

/* Portrait: Optimize for narrow phones (Single Column) */
@media (orientation: portrait) {
    .k-ebook-content {
        column-count: 1 !important; 
        column-width: 100% !important;
        column-gap: 0px !important;
    }
}

/* Landscape: Optimize for wider screens (Tablets/Laptops/FlexBooks) */
@media (orientation: landscape) {
    .k-read-scrollbox {
        max-width: 1100px !important; /* Wider canvas for landscape */
        height: 80vh !important;
    }

    .k-ebook-content {
        /* 🚀 THE DUAL-COLUMN ENGINE */
        column-count: 2 !important; 
        column-width: 450px !important; /* Each column roughly 450px */
        column-gap: 80px !important;    /* Clean gutter between columns */
        column-fill: balance !important; /* Balances text evenly between columns */
        
        height: 100% !important;
        padding: 0 60px !important;
        box-sizing: border-box;
    }
}

/* =========================================================================
   7. READER THEMES & FORCED PORTRAIT CANVAS
   ========================================================================= */

/* 🚀 FORCED PORTRAIT: Locks the canvas to an optimal reading width */
.k-read-scrollbox { 
    max-width: 720px !important; 
    margin: 0 auto; /* Centers the column on large screens */
    transition: background 0.4s ease, color 0.4s ease;
}

.k-ebook-content {
    column-width: 100vw !important; /* Ensures the JS swipe math works perfectly */
}

/* 🌙 DARK MODE (Default) */
.k-theme-dark .k-read-scrollbox {
    background: rgba(10, 15, 25, 0.85) !important;
    backdrop-filter: blur(35px) saturate(120%) !important;
    color: #e2e8f0 !important;
}
.k-theme-dark .k-ebook-content p { color: #e2e8f0 !important; }

/* ☀️ DAY MODE */
.k-theme-light .k-read-scrollbox {
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15) !important;
}
.k-theme-light .k-ebook-content p { color: #111827 !important; }

/* 📜 SEPIA MODE */
.k-theme-sepia .k-read-scrollbox {
    background: #fbf0d9 !important;
    color: #5f4b32 !important;
    box-shadow: 0 20px 50px rgba(95, 75, 50, 0.15) !important;
}
.k-theme-sepia .k-ebook-content p { color: #5f4b32 !important; }

/* 📟 E-INK HARDWARE MODE (Triggered dynamically on Nook/Kindle) */
.k-theme-eink .k-read-scrollbox {
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    scroll-behavior: auto !important; /* 🚀 Kills animations for E-Ink */
}
.k-theme-eink .k-ebook-content p { 
    color: #000000 !important; 
    font-weight: 500 !important; 
}

/* Floating Theme Button */
.k-theme-toggle-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(124, 43, 34, 0.8); /* KOBA Red */
    color: #F9B437; /* KOBA Gold */
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-transform: uppercase;
}

/* Nook specific optimizations */
@media (prefers-reduced-motion: reduce) {
    .k-read-scrollbox {
        scroll-behavior: auto !important;
    }
}

/* --- EMERGENCY REPAIR: FORCE RENDER --- */
#koba-bloom-root.k-mode-reading .k-read-scrollbox {
    display: block !important;
    visibility: visible !important;
    width: 90vw !important;
    max-width: 800px !important;
    height: 75vh !important;
    background: rgba(10, 15, 25, 0.9) !important;
}

#koba-bloom-root .k-ebook-content {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    column-count: 1 !important; /* Force single column to fix the blank/overflow */
}

/* Ensure the wrapper doesn't hide the content */
#bloom-player-wrapper {
    display: block !important;
    visibility: visible !important;
}

/* ==========================================================================
   📚 UNIFIED KOBA-I IMMERSIVE E-READER PRESENTATION LAYER
   ========================================================================== */

.k-reader-surface,
#book-area,
.k-bloom-text-canvas {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    
    /* 1. MAX DESKTOP BOUNDARY: Keeps optimal 60-75 character scanning width on 1920x1080 screens */
    max-width: 680px !important; 
    margin: 0 auto !important;

    /* 2. CORE READABILITY SIZING & FONTS */
    font-family: "Atkinson Hyperlegible", Georgia, serif !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    color: rgba(255, 255, 255, 0.9) !important;
    letter-spacing: -0.01em !important;

    /* 3. FLUID RESPONSIVE ENGINE: 16px on mobile scales up dynamically to 20px on desktops */
    font-size: clamp(16px, 1.2vw + 12px, 20px) !important;
    line-height: 1.75 !important;
    
    /* 4. BALANCED PADDING GRID */
    padding: clamp(20px, 5vh, 60px) max(15px, 4vw) !important;
}

/* 🏷️ CLASSIC BOOK TYPESETTING: FIRST PARAGRAPH DEFINITION */
.k-reader-surface p:first-of-type,
.k-bloom-text-canvas p:first-of-type {
    text-indent: 0 !important;
    margin-top: 24px !important;
}

/* 🚀 AUTOMATIC PARAGRAPH INDENTATION: SUBSEQUENT PARAGRAPHS */
.k-reader-surface p + p,
.k-bloom-text-canvas p + p {
    text-indent: 2em !important; /* Standard publishing layout indent */
    margin-top: 0 !important;    /* Drops messy web spacing gaps between consecutive blocks */
    margin-bottom: 0 !important;
}

/* 🖼️ INLINE MEDIA ASSET CONTAINMENT */
.k-reader-surface img,
.k-bloom-text-canvas img {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
    margin: 32px auto !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}

/* 👑 CHAPTER TITLE CAPITALS RULES */
.k-reader-surface h2,
.k-bloom-text-canvas h1,
.k-bloom-text-canvas h2 {
    font-family: sans-serif !important;
    text-transform: uppercase !important; /* Uniform structural capitalization */
    letter-spacing: 0.15em !important;
    color: var(--k-accent, #F9B437) !important; /* Matches custom neon branding accent */
    text-align: center !important;
    margin-bottom: 40px !important;
    font-weight: 700 !important;
}

/* 📱 SMARTPHONE VIEWPORT TUNING */
@media (max-width: 480px) {
    .k-bloom-text-canvas,
    .k-reader-surface {
        line-height: 1.65 !important; /* Snugs lines slightly on compact phone displays */
        text-align: left !important;   /* Keeps portrait edge alignments clean */
    }
}

/* ==========================================================================
   P0 CROSS-DEVICE PUBLICATION SHELL
   This final layer deliberately overrides the older width-only responsive
   rules without changing the desktop player architecture.
   ========================================================================== */
:root {
    --k-shell-header: 58px;
    --k-shell-gap: 10px;
    --k-shell-gap-compact: 6px;
    --k-safe-top: env(safe-area-inset-top, 0px);
    --k-safe-right: env(safe-area-inset-right, 0px);
    --k-safe-bottom: env(safe-area-inset-bottom, 0px);
    --k-safe-left: env(safe-area-inset-left, 0px);
    --k-touch-target: 44px;
    --k-drawer-max: min(52dvh, 420px);
}

#koba-bloom-root {
    height: 100vh !important;
    height: 100svh !important;
    height: 100dvh !important;
}

.k-primary-transport,
.k-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.k-video-presentation-exit {
    display: none;
}

.k-hidden-for-video-presentation {
    display: none !important;
}

/* Phones use a dedicated single-column composition with two intentional
   control rows and an overlay drawer that never replaces the media stage. */
@media (max-width: 767px) {
    .k-bloom-back-to-store {
        top: calc(var(--k-safe-top) + 7px);
        left: calc(var(--k-safe-left) + 8px);
        min-width: var(--k-touch-target);
        min-height: var(--k-touch-target);
        padding: 0 10px;
        font-size: 0;
        border-radius: 10px;
        backdrop-filter: none;
    }

    .k-bloom-back-to-store::after {
        content: "\2190  Store";
        font-size: 13px;
    }

    .k-bloom-logo,
    #koba-bloom-root img[src*="koba-logo"] {
        top: calc(var(--k-safe-top) + 8px) !important;
        max-width: 86px !important;
        margin: 0 !important;
    }

    .k-bloom-interface {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
        height: 100%;
    }

    .k-bloom-stage {
        box-sizing: border-box;
        min-width: 0;
        min-height: 0;
        height: 100%;
        padding: calc(var(--k-shell-header) + var(--k-safe-top)) calc(12px + var(--k-safe-right)) calc(10px + var(--k-safe-bottom)) calc(12px + var(--k-safe-left));
        gap: var(--k-shell-gap-compact);
        justify-content: flex-start;
        overflow: hidden;
    }

    .k-cover-art-stage {
        flex: 1 1 auto;
        min-height: 0;
        align-items: center;
        justify-content: center;
    }

    #koba-bloom-root.k-mode-audio .k-cover-art-stage {
        display: flex !important;
    }

    #koba-bloom-root.k-mode-video .k-cover-art-stage,
    #koba-bloom-root.k-mode-video .k-bloom-cover-img {
        display: none !important;
    }

    .k-bloom-cover-img {
        width: min(54vw, 27dvh, 184px) !important;
        height: min(54vw, 27dvh, 184px) !important;
        margin: 0 auto 6px !important;
    }

    #koba-bloom-root.k-mode-video .k-video-viewport {
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        aspect-ratio: 16 / 9;
    }

    #koba-bloom-root.k-mode-video .k-video-element {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .k-bloom-controls {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        gap: 5px;
    }

    .k-scrubber {
        min-height: 12px;
        background-clip: content-box;
        padding-block: 3px;
        box-sizing: border-box;
    }

    .k-time-row {
        margin-top: -6px;
    }

    .k-buttons {
        display: grid;
        grid-template-rows: auto auto;
        gap: 5px;
        padding: 5px 8px calc(5px + var(--k-safe-bottom));
        border-radius: 12px;
    }

    .k-primary-transport,
    .k-actions {
        width: 100%;
        min-width: 0;
        justify-content: space-evenly;
        gap: 2px;
    }

    .k-actions {
        margin: 0;
        padding: 3px 0 0;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .k-btn-icon {
        width: var(--k-touch-target);
        height: var(--k-touch-target);
        min-width: var(--k-touch-target);
        min-height: var(--k-touch-target);
    }

    .k-btn-main {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        margin: 0 2px;
    }

    .k-btn-icon svg { width: 25px !important; height: 25px !important; }
    .k-btn-main svg { width: 40px !important; height: 40px !important; }

    .k-bloom-sidebar,
    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar {
        position: absolute;
        z-index: 250;
        left: calc(8px + var(--k-safe-left));
        right: calc(8px + var(--k-safe-right));
        bottom: calc(8px + var(--k-safe-bottom));
        width: auto;
        max-height: var(--k-drawer-max);
        margin: 0;
        overflow: hidden;
        border: 1px solid rgba(255,255,255,.16);
        border-radius: 14px;
        background: rgba(7,10,15,.97);
        box-shadow: 0 -18px 50px rgba(0,0,0,.5);
        backdrop-filter: none;
    }

    .k-bloom-sidebar { display: none; }
    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar { display: flex; }
    #koba-bloom-root.k-chapter-menu-open .k-list {
        height: auto !important;
        max-height: calc(var(--k-drawer-max) - 58px) !important;
        overflow-y: auto !important;
    }
}

/* Tablets remain single-stage layouts. This explicitly eliminates the former
   769-900px conflict where a 100vh sidebar became a second grid row. */
@media (min-width: 768px) and (max-width: 1023px) {
    .k-bloom-interface {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
    }

    .k-bloom-stage {
        box-sizing: border-box;
        height: 100%;
        min-height: 0;
        padding: calc(72px + var(--k-safe-top)) calc(24px + var(--k-safe-right)) calc(18px + var(--k-safe-bottom)) calc(24px + var(--k-safe-left));
        overflow: hidden;
    }

    .k-bloom-cover-img {
        width: min(42vw, 30dvh, 280px) !important;
        height: min(42vw, 30dvh, 280px) !important;
        margin-bottom: 16px !important;
    }

    .k-buttons {
        padding: 10px 16px;
    }

    .k-bloom-sidebar,
    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar {
        position: absolute;
        z-index: 250;
        display: none;
        left: max(24px, var(--k-safe-left));
        right: max(24px, var(--k-safe-right));
        bottom: calc(18px + var(--k-safe-bottom));
        width: auto;
        height: auto;
        max-height: min(46dvh, 480px);
        overflow: hidden;
        border-radius: 16px;
        background: rgba(7,10,15,.97);
    }

    #koba-bloom-root.k-chapter-menu-open .k-bloom-sidebar { display: flex; }
    #koba-bloom-root.k-chapter-menu-open .k-list {
        height: auto !important;
        max-height: calc(min(46dvh, 480px) - 60px) !important;
        overflow-y: auto !important;
    }
}

@media (min-width: 1024px) {
    .k-primary-transport,
    .k-actions {
        display: contents;
    }
}

/* Phone short-landscape video is a true presentation layer. The video node is
   never recreated; only its containing layout changes. */
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
    #koba-bloom-root.k-mode-video .k-bloom-stage {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        padding: var(--k-safe-top) var(--k-safe-right) var(--k-safe-bottom) var(--k-safe-left);
        gap: 0;
    }

    #koba-bloom-root.k-mode-video .k-video-viewport {
        min-height: 0;
        height: 100% !important;
        max-height: none !important;
        margin: 0 !important;
    }

    #koba-bloom-root.k-video-presentation .k-bloom-logo,
    #koba-bloom-root.k-video-presentation ~ .k-bloom-back-to-store,
    #koba-bloom-root.k-video-presentation .k-bloom-back-to-store {
        display: none !important;
    }

    #koba-bloom-root.k-video-presentation .k-bloom-stage {
        position: absolute;
        inset: 0;
        display: block;
        padding: 0;
        background: #000;
    }

    #koba-bloom-root.k-video-presentation .k-video-viewport {
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: auto;
    }

    #koba-bloom-root.k-video-presentation .k-bloom-controls {
        position: absolute;
        z-index: 20;
        left: calc(12px + var(--k-safe-left));
        right: calc(12px + var(--k-safe-right));
        bottom: calc(6px + var(--k-safe-bottom));
        width: auto;
        max-width: none;
        padding: 26px 8px 0;
        background: linear-gradient(transparent, rgba(0,0,0,.88));
    }

    #koba-bloom-root.k-video-presentation .k-buttons {
        display: flex;
        flex-direction: row;
        padding: 2px 8px;
        gap: 6px;
    }

    #koba-bloom-root.k-video-presentation .k-primary-transport,
    #koba-bloom-root.k-video-presentation .k-actions {
        width: auto;
        flex: 1 1 auto;
        border: 0;
        padding: 0;
    }

    #koba-bloom-root.k-video-presentation .k-video-presentation-exit {
        position: absolute;
        z-index: 30;
        top: calc(6px + var(--k-safe-top));
        left: calc(8px + var(--k-safe-left));
        display: grid;
        place-items: center;
        width: var(--k-touch-target);
        height: var(--k-touch-target);
        border: 1px solid rgba(255,255,255,.5);
        border-radius: 50%;
        background: rgba(0,0,0,.72);
        color: #fff;
        font: 700 28px/1 system-ui, sans-serif;
        cursor: pointer;
    }

    #koba-bloom-root.k-video-presentation .k-bloom-sidebar,
    #koba-bloom-root.k-video-presentation.k-chapter-menu-open .k-bloom-sidebar {
        left: auto;
        top: calc(8px + var(--k-safe-top));
        right: calc(8px + var(--k-safe-right));
        bottom: calc(8px + var(--k-safe-bottom));
        width: min(42vw, 360px);
        max-height: none;
    }
}

/* Graceful degradation for constrained browsers. */
@supports not (backdrop-filter: blur(1px)) {
    .k-buttons,
    .k-bloom-sidebar,
    .k-bloom-back-to-store {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}
