/* --- PODCUBE EXPLORER STYLES (COMPREHENSIVE EDITION) --- */
:root {
    --primary: #1768da;
    --primary-dim: #e1e8f3;
    --primary-subtle: #f1f2f5;
    --primary-dark: #0d4da1;
    --bg-body: #fFfFfF;
    --bg-panel: #fafafa;
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --text-dim: #777777;
    --border: #1768da;
    --success: #1768da;
    --warning: #1768da;
    --danger: #ff4444;
    --code-bg: #1768da;
    --code-text: #ffffff;
    --orange: #f18701;
    --green: #11bb74;

    --monitor-height: 40px;
    --transport-height: 80px;

    touch-action: manipulation;
    /* ── TYPE SCALE (9 steps) ────────────────────────────────── */
    /* Only px values. em values are parent-relative and cannot   */
    /* safely be CSS custom properties (they resolve at :root).   */
    --fs-xs: 10px;
    /* Micro labels, tags, uppercase meta       */
    --fs-sm: 12px;
    /* Compact UI: buttons, tabs, small values  */
    --fs-base: 12px;
    /* Primary body & secondary body (was 13px) */
    --fs-md: 14px;
    /* Readable prose, transport title          */
    --fs-lg: 18px;
    /* Controls, diagnostic values (was 16px)   */
    --fs-xl: 20px;
    /* HUD values, overlay titles (was 22px)    */
    --fs-2xl: 24px;
    /* Display/share card text (was 28px)       */
    --fs-3xl: 32px;
    /* Large play button icon                   */
    --fs-display: 40px;
    /* Trophy icons, lightbox close (was 48px)  */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-top-left-radius: 2px;
    border-top-right-radius: 2px;

    scrollbar-color: var(--primary-dark) var(--primary-dim);
    scrollbar-width: thin;
}

/* --- DISABLE ACCIDENTAL HIGHLIGHTING ON INTERACTIVE UI --- */
button,
.icon-btn,
.hero-btn,
.tab-button,
.user-badge,
input[type="range"],
label,
/* Prevents highlighting text when rapidly clicking checkboxes */
.bhs-layout-wrapper,
/* The Spheroid scanner */
.spacetime-timeline-container,
/* The timeline track */
.pc-game-container,
/* The interactive game stage */
.pc-controls-strip,
/* Game D-Pad and action buttons */
.global-transport,
/* The bottom playback bar */
.defrig-container,
/* The defrigulator hardware */
.queue-item,
.pc-preview-item {
    user-select: none;
    -webkit-user-select: none;
    /* Required for iOS/Safari */
}

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

html,
body {
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

body {
    font-family: "Libertinus Math", serif;
    background: var(--bg-body);
    color: var(--text-main);
    padding: 30px 40px calc(var(--transport-height) + var(--monitor-height) + 20px + env(safe-area-inset-bottom, 0px)) 40px;

    /* GLOBAL SCROLL: Allow the window to handle scrolling */
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    /* Force scrollbar to prevent layout shift */
    display: block;
    /* Remove flex column constraint */
    max-width: 950px;
    margin: auto;
    border-left: 1px solid var(--primary-dim);
    border-right: 1px solid var(--primary-dim);

}

button {
    user-select: none;
}

header {
    flex: 0 0 auto;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px double var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
    /* Ensure opacity */
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
h4,
.ep-title {
    font-family: "Libertinus Math", serif;
    font-weight: 700;
    margin-bottom: 5px;
}

.label,
button,
.tab-button {
    font-family: "Fustat", sans-serif;
}

header {
    flex: 0 0 auto;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px double var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
    /* Ensure opacity */
}

.header-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-right: 15px;
}

h1 {
    font-size: 2em;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.subtitle {
    font-family: "Fustat";
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
}

/* --- TABS --- */

.sticky-top {
    display: contents;
}

.tabs-wrapper {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-body);
    padding-top: 10px;
    padding-bottom: 0px;

    /* 1. Pull the wrapper outward to neutralize the body's 40px padding */
    margin-left: -40px;
    margin-right: -40px;

    /* 2. Push the inner tab buttons back into alignment with the content */
    padding-left: 40px;
    padding-right: 40px;
}

.tabs {
    display: flex;
    align-items: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    width: 100%;
    padding-bottom: 10px;

    -ms-overflow-style: none;
    scrollbar-width: none;
}


.tab-button {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--text-muted);

    /*border-bottom: 1px solid transparent; /* old look */
    margin-left: 5px;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .tab-button:hover {
        color: var(--primary);


    }
}

.tab-button.active {
    color: var(--primary);
    background: var(--bg-body);
    border-color: var(--primary);


    /*border-bottom: 1px solid var(--bg-panel);  /* Solid white bottom border to mask the container line */

    /* CHANGE top: 1px TO margin-bottom */
    margin-bottom: 0px;

    position: relative;
    z-index: 2;
}

/* --- CONTENT AREA (SCROLLABLE) --- */

.filter-toggle-cb,
.filter-toggle-btn {
    display: none;

}

.tab-content {
    display: none;
    flex: 1;
    overflow: visible;
    padding-right: 5px;
}

.tab-content.active {
    display: block;
    flex-direction: column;
    margin-top: 15px;
}

.section {
    margin-bottom: 30px;
    margin-top: 10px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-subtitle {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- ARCHIVE REGISTRY LAYOUT --- */
.registry-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.registry-sidebar {
    background: var(--primary-subtle);
    border: 1px solid var(--primary);
    padding: 15px;
    overflow-y: auto;
    max-height: fit-content;

}

.registry-results {
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
}

/* --- EPISODE CARDS --- */
.ep-card {
    display: flex;
    background: var(--bg-body);
    border: 1px solid var(--primary);
    margin-bottom: 10px;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    align-items: stretch;
}

@media (hover: hover) {
    .ep-card:hover {
        border-color: var(--primary);
        transform: translateX(3px);
        box-shadow: 3px 3px 0 rgba(23, 104, 218, 0.1);
    }
}

.ep-card.selected {
    border-color: var(--primary);
    background: var(--primary-dim);
    box-shadow: 0 0 0 2px var(--primary);
}

.btn-queue.selected {
    background-color: var(--primary-dark);
    color: var(--primary-dim);
}

.ep-status-strip {
    width: 6px;
    background: #eee;
    flex-shrink: 0;
}

.ep-card.playing .ep-status-strip {
    background: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.ep-content {
    padding: 12px 15px;
    flex: 1;
    min-width: 0;
}

.ep-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    gap: 10px;
}

.ep-title {
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ep-date {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: bold;
    color: var(--text-muted);
    white-space: nowrap;
}

.ep-duration {
    margin-left: auto;
    font-family: "Fustat", sans-serif;
}

.ep-meta-row {
    display: flex;
    gap: 10px;
    font-size: var(--fs-base);
    color: var(--text-muted);
    margin-bottom: 4px;
    align-items: center;

}

.ep-tag {
    background: #eee;
    padding: 2px 6px;

    font-size: var(--fs-xs);
    font-family: "Fustat";
    text-transform: uppercase;
    font-weight: 600;
}

.ep-location {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
    margin-bottom: 4px;
}

.ep-played-icon {
    display: none;
    color: var(--success);
    font-size: var(--fs-md);
    margin-right: 6px;
    vertical-align: baseline;
}

.ep-card.is-played .ep-played-icon,
.related-ep-card.is-played .ep-played-icon {
    display: inline-block;
}

/* Integrity Bar */
.integrity-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
    /* Ensure it spans the full width */
}

.integrity-text {
    font-size: var(--fs-xs);
    font-family: "Fustat";
    font-weight: 700;
    color: var(--text-muted);
    min-width: 30px;
    flex-shrink: 0;
}

/* New styling for the relocated duration */
.integrity-wrapper .ep-duration {
    margin-left: auto;
    /* Pushes the duration to the far right */
    font-family: "Fustat";
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.integrity-container {
    height: 4px;
    background: #f0f0f0;
    width: 100%;
    overflow: hidden;
}

.integrity-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.ep-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    border-left: 1px solid var(--primary-dim);
    gap: 5px;
    background: var(--primary-subtle);
}

.icon-btn {
    border: 1px solid var(--text-dim);
    background: var(--bg-panel);
    color: var(--text);
    cursor: pointer;
    padding: 5px 10px;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    font-family: "Fustat";
    font-weight: 600;
    transition: all 0.15s ease;

}

@media (hover: hover) {
    .icon-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-dim);
    }
}

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

.reset-btn {
    background: var(--primary-dark) !important;
    color: var(--bg-panel);
    width: 100%;
}



/* --- INSPECTOR STYLES --- */
.inspector-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

/* New Inspector Header Card */
.inspector-header-card {
    background: var(--bg-panel);
    border: 3px double var(--primary);
    padding: 15px;
    margin-bottom: 20px;
    margin-top: 10px;
    position: relative;
}

.inspector-header-card::before {
    content: "Transmission Report";
    position: absolute;
    top: -8px;
    left: 15px;
    background: var(--bg-panel);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.inspector-empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.inspector-empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-main);
}

/* Loaded State - Summary Card */
.inspector-summary {
    display: flex;
    flex-direction: column;

}

.inspector-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.insp-nav-buttons {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--primary-dim);
}

.insp-nav-counter {
    font-size: var(--fs-xs);
    align-self: center;
    font-family: "Fustat", sans-serif;
    text-transform: uppercase;
}

.inspector-title {
    font-size: 1.8em;
    color: var(--primary);
    line-height: 1.2;
    flex: 1;
    min-width: 200px;
}



.inspector-summary-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inspector-header-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px 5px;
    padding-top: 5px;
}

.inspector-header-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    /* Prevents grid blowout from unbroken text */
}

/* 50% width for medium-long data */
.inspector-header-item.span-2 {
    grid-column: span 2;
}

/* 100% width for massive data */
.inspector-header-item.full-width {
    grid-column: 1 / -1;
}

.inspector-header-label {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.05em;
}

.inspector-header-value {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-main);
    word-wrap: break-word;
    line-height: 1.4;
}





/* --- CATALOGING STATES (ARCHIVE LIST) --- */

/* Suppressed: Dimmed out and grayscaled to represent "noise" */
.ep-card.is-suppressed {
    opacity: 0.45;
    filter: grayscale(100%);
}

.ep-card.is-suppressed:hover {
    opacity: 0.8;
    /* Make it readable if they hover over it */
}

/* Verified: Highlighted with an orange border to denote "important data" */
.ep-card.is-verified {
    border-color: var(--green);
    border-left: 4px solid var(--green);
}

html.dark-theme .ep-card.is-verified {
    border-color: var(--green);
}

/* =========================================================
   INSPECTOR DASHBOARD (ACTIONS & CATALOGING)
   ========================================================= */

.inspector-dashboard {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--primary-dim);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Row 1: Playback & Print Buttons */
.playback-row {
    flex-wrap: wrap;
    /* Allows wrapping on extremely narrow screens */
}

.playback-row .inspector-action-btn {
    flex: 1 1 auto;
    /* Distribute space evenly across the 4 buttons */
}


.verification-row {

    padding-top: 10px;
    border-top: 1px solid var(--primary-dim);
}

/* Row 3 & 4: Annotations */
.annotations-row {
    flex-direction: column;
    gap: 8px;
}

.passenger-tags-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    margin: 0;
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.passenger-tags-hint {
    font-weight: normal;
    opacity: 0.6;
    text-transform: none;
    letter-spacing: normal;
}

.passenger-tag-input {
    width: 100%;
    margin-bottom: 0;
}

/* Tag Pills (System & Passenger) */
.inspector-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.inspector-tag-pill {
    background: var(--primary-dim);
    color: var(--primary-dark);
    padding: 5px 12px;
    font-size: var(--fs-sm);
    font-family: "Fustat", sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;

    /* Flex layout to support inline remove buttons */
    display: inline-flex;
    align-items: end;
    gap: 6px;
}

@media (hover: hover) {
    .inspector-tag-pill:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }
}

/* The remove button injected into passenger tags */
.inspector-tag-pill .remove-tag {
    opacity: 0.5;
    font-size: var(--fs-md);
    line-height: 1;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .inspector-tag-pill:hover .remove-tag {
        color: var(--bg-panel);
        opacity: 0.8;
    }

    .inspector-tag-pill .remove-tag:hover {
        color: var(--danger);
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Archive Card STAGE Button */
.ep-actions .btn-print.staged {
    background: var(--primary-dark);
    color: var(--bg-panel);
}

/* Inactive Catalog States */
.insp-btn-ok {
    background: var(--bg-body) !important;
    border-color: var(--green) !important;
    color: var(--green) !important;
}

.insp-btn-no {
    background: var(--bg-body) !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.insp-btn-print {
    background: var(--bg-body) !important;
    border-color: var(--primary-dark) !important;
    color: var(--primary-dark) !important;
}

@media(hover: hover) {
    .insp-btn-ok:hover {
        background: var(--green) !important;
        border-color: var(--green) !important;
        color: var(--bg-body) !important;
    }

    .insp-btn-no:hover {
        background: var(--danger) !important;
        border-color: var(--danger) !important;
        color: var(--bg-body) !important;
    }

    .insp-btn-print:hover {
        background: var(--primary-dark) !important;
        border-color: var(--primary-dark) !important;
        color: var(--bg-body) !important;
    }
}

/* Active Catalog States */
.active-catalog.insp-btn-ok {
    background: var(--green) !important;
    border-color: var(--green) !important;
    color: var(--bg-body) !important;
}

.active-catalog.insp-btn-no {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: var(--bg-body) !important;
}

.active-catalog.insp-btn-print {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: var(--bg-body) !important;
}

/* Mobile handling: Drop to a 2-column grid */
@media (max-width: 768px) {
    .inspector-header-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .inspector-header-item.span-2 {
        grid-column: 1 / -1;
        /* Span 2 items take full width on mobile */
    }
}

.inspector-meta-line {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    color: #666;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.inspector-meta-line .label {
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    font-size: var(--fs-xs);
    letter-spacing: 0.05em;
}

.inspector-meta-line .value {
    color: var(--text-main);
    font-weight: 600;
    text-transform: uppercase;
}

.inspector-meta-line .separator {
    color: #ccc;
}

.inspector-action-btn {
    border: 1px solid var(--primary);
    background: var(--bg-panel);
    color: var(--primary);
    padding: 8px 16px;
    font-family: "Fustat";
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .inspector-action-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }

    .inspector-action-btn.primary:hover {
        background: var(--primary-dark);
    }

}

.inspector-action-btn.primary {
    background: var(--primary);
    color: var(--bg-panel);
}

/* Report Body */
.inspector-report-body {
    display: none;
}

.inspector-report-body.loaded {
    display: block;
}

/* Inspector Split Row (Side-by-side panels) */
.inspector-split-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
    padding-top: 5px;
}

/* Drop to a single column on mobile */
@media (max-width: 768px) {
    .inspector-split-row {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

.inspector-section {
    margin-bottom: 25px;
}

.inspector-section-title {
    letter-spacing: 0.05em;
    color: var(--text);
    font-family: "Libertinus Math";
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

/* Prose Style Content */
.inspector-prose {
    font-size: var(--fs-md);
    line-height: 1.7;
    color: var(--text-main);
}

.inspector-prose p {
    margin-bottom: 12px;
}

.inspector-prose strong {
    font-weight: 500;
}

.inspector-prose .code-inline {
    font-family: "Fustat";
    font-size: var(--fs-base);
    background: #f5f5f5;
    padding: 2px 6px;
    color: var(--text-main);
    font-weight: 600;
}

/* Callout Boxes - for important info */
.inspector-callout {
    margin: 15px 0;
    font-size: var(--fs-base);
}

.inspector-callout-title {
    font-family: "Fustat";
    font-size: var(--fs-xs);
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.inspector-callout-content {
    color: var(--text-main);
    line-height: 1.5;
}

/* Data Grid - for structured lists */
.inspector-data-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 20px;
    font-size: var(--fs-base);
    margin: 15px 0;
    padding: 0;
}

.inspector-data-grid .data-label {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    text-align: right;
}

.inspector-data-grid .data-value {
    color: var(--text-main);
    font-weight: 500;
}

.inspector-data-grid .data-value.code {
    font-family: "Fustat";
    font-size: var(--fs-base);
    font-weight: 600;
}

/* Tag Pills */
.inspector-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.inspector-tag-pill {
    background: var(--primary-dim);
    color: var(--primary-dark);
    padding: 5px 12px;
    font-size: var(--fs-sm);
    font-family: "Fustat";
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .inspector-tag-pill:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }
}

/* Related Episodes - Compact List */
.inspector-related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.inspector-related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .inspector-related-item:hover {
        background: var(--primary-dim);
    }
}

.inspector-related-item-info {
    flex: 1;
    min-width: 0;
}

.inspector-related-item-title {
    font-size: var(--fs-base);
    font-weight: 600;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspector-related-item-meta {
    font-size: var(--fs-xs);
    color: #777;
    font-family: "Fustat";
}

.inspector-related-item-arrow {
    color: var(--primary);
    font-weight: 700;
    margin-left: 10px;
}

/* Description Block */
.inspector-description-block {
    padding: 0;
    font-size: var(--fs-md);
    line-height: 1.7;
    color: var(--text-muted);
    max-height: 400px;
    overflow-y: auto;
    margin: 15px 0;
}

.inspector-description-block:empty::before {
    content: "No description available";
    color: #999;
    font-style: italic;
}

.doubleborder {
    border: 3px double var(--primary);
    padding: 15px 12px 12px 12px;
    margin-top: 10px;
    position: relative;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.doubleborder::after {
    /* Grabs the text from the HTML attribute */
    content: attr(data-label);

    position: absolute;
    top: -8px;
    /* Offset to sit on the border */
    left: 10px;

    background: var(--bg-body);
    /* Masks the border behind the text */
    padding: 0 6px;

    /* Typography matches your Hero style */
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inspector-field {
    border: 3px double var(--primary);
    padding: 15px 12px 12px 12px;
    margin-top: 10px;
    position: relative;
    width: 100%;
    max-width: 100%;

}


.inspector-field-value,
.inspector-field-value.code {
    font-family: "Fustat";
    font-size: var(--fs-base);
    background: #f5f5f5;
    padding: 4px 6px;

}

.inspector-field-value.empty {
    color: #999;
    font-style: italic;
}

.inspector-code-block {
    background: var(--code-bg);
    color: var(--code-text);
    font-family: monospace;
    font-size: var(--fs-sm);
    padding: 15px;

    overflow-x: auto;
    max-height: 450px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.inspector-code-block.live-updating {
    animation: updateFlash 0.3s ease;
}

@keyframes updateFlash {

    0%,
    100% {
        background: var(--code-bg);
    }

    50% {
        background: #2a2a2a;
    }
}

.inspector-description {
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    padding: 15px;
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--text-muted);

    max-height: 300px;
    overflow-y: auto;
}

.inspector-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inspector-tag {
    background: var(--primary-dim);
    color: var(--primary-dark);
    padding: 4px 10px;

    font-size: var(--fs-sm);
    font-family: "Fustat";
    font-weight: 600;
}

/* --- DATA TABS --- */
.data-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.data-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--primary-dim);
    border-bottom: none;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: "Fustat";
    color: var(--text-muted);
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .data-tab-btn:hover {
        color: var(--primary);
        background: var(--bg-panel);
    }
}

.data-tab-btn.active {
    color: var(--primary);
    background: var(--bg-body);
    border-color: var(--text-dim);
    border-bottom-color: var(--bg-panel);
    margin-bottom: -2px;
}

.data-panel {
    display: none;
}

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

/* ========== PLAYBACK CONTROL PANEL ========== */

/* Now Playing Card (keeps double border) */
.player-now-playing-card {
    background: var(--bg-panel);
    border: 3px double var(--primary);
    padding: 25px;
    margin-bottom: 20px;
    margin-top: 10px;
    position: relative;
}

.player-now-playing-card::before {
    content: "Playback Engine";
    position: absolute;
    top: -8px;
    left: 15px;
    background: var(--bg-panel);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.player-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.player-card-label {
    font-family: "Fustat";
    font-size: var(--fs-xs);
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    letter-spacing: 0.05em;
}

.player-card-time {
    font-family: "Fustat";
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-main);
}

.time-separator {
    margin: 0 4px;
    color: #ccc;
}

.player-card-title {
    font-size: 1.8em;
    color: var(--primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.player-card-meta {
    font-family: "Fustat";
    font-size: var(--fs-base);
    color: #666;
    margin-bottom: 20px;
}

.player-scrubber-wrapper {
    margin-bottom: 20px;
}

.player-transport-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    /* Allows wrapping on mobile */
}



.player-transport-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.player-transport-btn {
    width: 50px;
    height: 50px;
    border: 1px solid var(--text-dim);
    background: var(--bg-panel);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .player-transport-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
        transform: scale(1.05);
    }

    .player-transport-btn-play:hover {
        background: var(--primary-dark);
    }
}

.player-transport-btn-play {
    width: 60px;
    background: var(--primary);
    color: var(--bg-panel);
}



.player-transport-main-group {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

/* Radio section alignment */
.player-radio-section {
    padding: 5px 15px;
    background: var(--primary-dim);
    border-right: 3px double var(--primary);

}

/* Mobile logic: Force the Radio Mode to a new row */
@media (max-width: 768px) {
    .player-transport-row {
        flex-direction: column;
        /* Stack the groups vertically */
        gap: 15px;
    }

    .player-transport-main-group {
        width: 100%;
        justify-content: flex-start;
        /* Buttons fill the width on mobile */
    }

}

.player-settings-bar {
    display: flex;
    gap: 30px;
    justify-content: space-between;
    align-items: center;
}

.player-setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-setting-label {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 50px;
    margin-bottom: 0;
}

.player-setting-slider {
    width: 120px;
}

.player-setting-value {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-main);
    min-width: 40px;
}

.player-setting-select {
    padding: 4px 8px;
    font-family: "Fustat";
    font-size: var(--fs-sm);
    border: 1px solid #ddd;
    background: var(--bg-panel);
    margin-bottom: 0;
}

/* Queue Section (brigistics-style, no double border wrapper) */
.player-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 3px double var(--primary);
    flex-wrap: wrap;
    gap: 10px;
}

.player-section-header h3 {
    margin: 0;
}

.player-queue-actions {
    display: flex;
    gap: 8px;
}

.player-queue-btn {
    border: 1px solid var(--primary);
    background: var(--bg-panel);
    color: var(--primary);
    padding: 6px 14px;
    font-family: "Fustat";
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .player-queue-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }
}

.player-queue-stats-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: "Fustat";
    font-size: var(--fs-sm);
    color: #666;
    padding: 12px 0;
    margin-bottom: 0;
}

.queue-stat-item {
    font-weight: 600;
}

.queue-stat-separator {
    color: #ccc;
}

.player-queue-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    background: var(--bg-panel);
}

.player-queue-list:empty::before {
    content: "Queue is empty — add transmissions from the Browse tab or activate Radio Mode";
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
    font-size: var(--fs-md);
}

.player-radio-section {
    padding: 5px 15px;
    background: var(--primary-dim);
    border-right: 3px double var(--primary);
    margin-left: auto;
}

.player-radio-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.player-radio-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--orange);
}

.player-radio-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-radio-label strong {
    font-family: "Fustat";
    font-size: var(--fs-base);
    color: var(--text-main);
}

.player-radio-desc {
    font-family: "Fustat";
    font-size: var(--fs-xs);
    color: #666;
}

/* Section Titles */
.player-section-title {
    font-size: 1em;
    color: var(--text-main);
    font-family: "Libertinus Math", serif;
    font-weight: 700;
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 3px double var(--primary);
}

/* Playlist Controls */
.player-playlist-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 12px 0;
}

.player-playlist-input {
    flex: 1;
    margin: 0;
    padding: 8px 12px;
    font-family: "Fustat";
    font-size: var(--fs-base);
    border: 1px solid #ddd;
}

/* Audio Diagnostics (visible, integrated into document flow) */
.player-diagnostic-prose {
    font-size: var(--fs-base);
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
    margin-top: 10px;
}

.player-diagnostic-prose p {
    margin: 0;
}

.player-diagnostic-callout {
    padding: 0;
    margin-bottom: 20px;
}

.player-diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.player-diagnostic-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.player-diagnostic-label {
    font-family: "Fustat";
    font-size: var(--fs-xs);
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.player-diagnostic-value {
    font-family: "Fustat";
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-main);
}

.player-live-data-title {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    margin-top: 20px;
}

/* Legacy Playback Control Panel (keep for compatibility) */
.playback-control-panel {
    background: var(--bg-panel);
    border: 3px double var(--primary);
    padding: 25px;
    margin-top: 10px;
    margin-bottom: 20px;
    position: relative;
}

/* Document annotation label */
.playback-control-panel::before {
    content: "Primary Controls";
    position: absolute;
    top: -8px;
    left: 15px;
    background: var(--bg-panel);
    padding: 0 8px;
    font-family: "Fustat", sans-serif;
    border: inherit;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== PLAYBACK BAR (BUTTON ROW) ========== */
.playback-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    padding: 0;
    background: transparent;
    border: none;
}

/* Control buttons styling */
.control-btn {
    width: 60px;
    height: 60px;
    border: 2px solid var(--primary);
    background: var(--bg-panel);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

@media (hover: hover) {
    .control-btn:hover {
        background: var(--primary-dim);
        transform: scale(1.08);
    }
}

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

/* Play button special styling */
.control-btn-large.control-btn-play {
    width: 90px;
    height: 90px;
    border: 3px solid var(--primary);
    background: var(--primary);
    color: var(--bg-panel);
    font-size: var(--fs-3xl);
}

@media (hover: hover) {
    .control-btn-large.control-btn-play:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }
}

/* Remove separator */
.bar-separator {
    display: none;
}

/* Input groups (volume, rate) */
.bar-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f8f8;
    border: 1px solid var(--primary-dim);
    padding: 8px 12px;
    flex-shrink: 0;
}

.bar-input-group label {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.bar-input-group input {
    width: 150px;
    margin: 0;
    padding: 4px;
}

.bar-input-group select {
    padding: 4px 6px;
    margin: 0;
    width: auto;
    font-size: var(--fs-sm);
}

/* ========== PLAYBACK SCRUBBER & TIME ========== */
.playback-scrubber-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid var(--primary-dim);
    margin-top: 20px;
}

.playback-time {
    font-family: "Fustat";
    font-size: var(--fs-base);
    font-weight: 700;
    color: #666;
    min-width: 45px;
    text-align: center;
    text-transform: uppercase;
}

.playback-scrubber {
    flex: 1;
    height: 6px;
    background: #e8e8e8;
    cursor: pointer;
    position: relative;
    overflow: visible;
    border: 1px solid var(--primary-dim);
    touch-action: none;
}

.playback-scrubber-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
    position: relative;
}

.playback-scrubber-handle {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 2px 4px rgba(23, 104, 218, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease;
}

@media (hover: hover) {
    .playback-scrubber:hover .playback-scrubber-handle {
        opacity: 1;
    }
}

/* ========== QUEUE MANAGEMENT SECTION ========== */
/* Queue stats styling (legacy) */
.queue-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    font-size: var(--fs-xs);
    font-family: "Fustat";
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid var(--primary);
    background: var(--bg-panel);
    color: var(--primary);
}

.badge-info {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* Queue list container */
#playerQueueList {
    border: 1px solid var(--primary-dim);
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    margin-left: 15px;
    background: var(--bg-panel);
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: var(--bg-panel);
    transition: all 0.15s ease;
    gap: 12px;
}

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

@media (hover: hover) {
    .queue-item:hover {
        background: var(--primary-dim);
    }
}

.queue-item.current {
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.queue-item-number {
    font-weight: 700;
    color: var(--primary);
    font-family: "Fustat";
    font-size: var(--fs-sm);
    min-width: 25px;
    text-align: center;
}

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

.queue-item-title {
    font-size: var(--fs-base);
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: "Fustat";
}

.queue-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.queue-item-actions button {
    width: auto;
    height: 24px;

    padding: 0 5px;
    border: 1px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .queue-item-actions button:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }
}


/* ========== PLAYLISTS SECTION ========== */

.playlist-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    background: transparent;
    padding: 0;
    border: none;
}

.playlist-controls input {
    flex: 1;
    margin-bottom: 0;
    padding: 8px 10px;
    border: 1px solid var(--primary);
}

.playlist-controls button {
    margin-bottom: 0;
}

.playlist-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 400px));
    gap: 15px;
    margin-top: 10px;

    filter: drop-shadow(4px 4px 3px rgba(0, 0, 0, 0.2));
}

/* When empty, switch to block layout to fill width */
.playlist-list.empty {
    display: block;
}

.playlist-card {
    border: 3px double var(--primary);
    background: var(--bg-panel);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.1s ease;
}

@media (hover: hover) {
    .playlist-card:hover {
        transform: translateY(-2px);
        background: var(--primary-dim);
    }
}

.mini-qr-container {
    width: 100px;
    height: 100px;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-card .playlist-name {
    font-size: var(--fs-md);
    height: 34px;
    /* Limits to ~2 lines */
    overflow: hidden;
    margin-bottom: 4px;
}

.playlist-card .playlist-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
}

/* Empty state for playlists */
.playlist-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: var(--fs-base);
    background: #f8f8f8;
    border: 1px dashed var(--primary-dim);
    font-family: "Fustat";
}

.playlist-import-controls {
    background: #f0f4f8;
    border: 1px solid #d1d9e6;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.playlist-import-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.playlist-import-row input {
    margin-bottom: 0;
    background: var(--bg-panel);
    font-family: monospace;
    font-size: var(--fs-sm);
}

/* --- PUNCHCARD READER (New & Clean) --- */
.punchcard-reader-wrapper {
    background: var(--primary-dim);
    border: 3px double var(--primary);
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Drag & Drop Hover State */
.punchcard-reader-wrapper.drag-active {
    background: var(--bg-panel);
    box-shadow: 0 0 15px var(--primary);
    border-color: var(--primary-dark);
}

.punchcard-reader-wrapper.drag-active::after {
    content: "DROP PUNCHCARD IMAGE HERE";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 104, 218, 0.9);
    color: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    font-size: var(--fs-md);
    letter-spacing: 0.1em;
    z-index: 10;
    pointer-events: none;
}

.punchcard-label {
    margin-bottom: 8px;
    display: block;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
}

.punchcard-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: space-between;
}

.punchcard-row:last-child {
    margin-bottom: 0;
}

.punchcard-input {
    margin: 0;
    flex: 1;
    font-family: monospace;
    border: 1px solid var(--primary);
    background: var(--bg-panel);
}

.punchcard-btn {
    background: var(--primary);
    color: white;
    padding: 0 20px;
    border: 1px solid var(--primary);
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .punchcard-btn:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }
}

.punchcard-issue-btn {
    /* Styles for the "Issue" button specifically if needed, inheriting from above */
    background: var(--bg-panel);
    color: var(--primary);
}

@media (hover: hover) {
    .punchcard-issue-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .punchcard-row {
        flex-direction: column;
        gap: 8px;
    }

    .punchcard-btn {
        padding: 10px;
    }

    .punchcard-btn-clr {
        padding: 0px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .punchcard-row.punchcard-top-row {
        flex-direction: row;
    }
}

/* ========== BUFFER & AUDIO STATE SECTION ========== */

/* Status grid boxes */


.stat-box {
    border: 1px solid var(--primary);
    padding: 15px;
    background: var(--bg-panel);
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.stat-box label {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    color: #777;
    margin-bottom: 8px;
    font-weight: 700;
}

.stat-num {
    font-size: 1.6em;
    color: var(--primary);
    font-family: "Libertinus Math";
    font-weight: 700;
    margin: 0;
}

/* ========== LIVE PLAYBACK DATA SECTION ========== */

.live-data-container {
    position: relative;
    background: var(--code-bg);
    border: 1px solid #333;
}

.live-data-container::before {
    content: "● LIVE";
    position: absolute;
    top: 8px;
    right: 12px;
    color: #ff4444;
    font-size: var(--fs-xs);
    font-weight: 700;
    font-family: "Fustat";
    z-index: 10;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#livePlaybackData {
    background: var(--code-bg);
    color: var(--code-text);
    font-family: monospace;
    font-size: var(--fs-sm);
    padding: 15px;
    max-height: 350px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    margin: 0;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 768px) {
    .playback-bar {
        gap: 8px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
    }

    .control-btn-large.control-btn-play {
        width: 70px;
        height: 70px;
        font-size: var(--fs-2xl);
    }

    .bar-input-group {
        flex-direction: column;
        gap: 4px;
    }

    .bar-input-group input {
        width: 100px;
    }

    .playback-scrubber-container {
        flex-wrap: wrap;
        gap: 8px;
    }



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

    .radio-btn {
        align-items: center;
        justify-content: flex-end;
    }
}

/* --- RELATED EPISODES --- */
.related-ep-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    margin-bottom: 8px;

    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .related-ep-card:hover {
        border-color: var(--primary);
        background: var(--primary-dim);
        transform: translateX(2px);
    }
}

.related-ep-info {
    flex: 1;
    min-width: 0;
}

.related-ep-title {
    font-size: var(--fs-base);
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-ep-meta {
    font-size: var(--fs-xs);
    color: #777;
    font-family: "Fustat";
}

.related-ep-score {
    font-size: var(--fs-sm);
    color: var(--primary);
    font-weight: 700;
    font-family: "Fustat";
    margin-left: 10px;
}

/* --- CONTROLS --- */
input,
select {
    width: 100%;
    padding: 7px;
    margin-bottom: 12px;
    border: 1px solid var(--primary-dark);
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-base);
    background: var(--bg-panel);
    color: var(--text);
    transition: border-color 0.15s ease;
}

input[type="range"] {
    -webkit-appearance: none;
    /* Remove default browser styling */
    appearance: none;
    border: none;
    /* Remove the border inherited from generic input */
    padding: 0;
    /* Remove padding inherited from generic input */
    background: var(--text-muted);
    height: 4px;
    /* Thin track */
    margin: 10px 0;
    /* Give it breathing room */
    cursor: pointer;

    /* THE MAGIC FIX: This sets the thumb and filled track color */
    accent-color: var(--primary);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim);
}

label {
    display: block;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    color: #777;
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* --- GLOBAL TRANSPORT --- */
.global-transport {
    position: fixed;
    bottom: calc(var(--monitor-height) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    height: var(--transport-height);
    background: var(--bg-panel);
    border-top: 3px double var(--primary);
    border-left: 1px solid var(--primary-dim);
    border-right: 1px solid var(--primary-dim);
    display: flex;
    flex-direction: column;
    padding: 12px 30px;
    z-index: 100;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 950px;
    margin: 0 auto;
}

.transport-toggle-btn {
    display: none;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    border-bottom: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 101;
    color: var(--primary);
}

.transport-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Rotate chevron when expanded */
.global-transport.expanded .transport-toggle-btn svg {
    transform: rotate(180deg);
}

.transport-main {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

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

.transport-title {
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-md);
    margin-bottom: 2px;
}

.transport-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.transport-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transport-label {
    font-size: var(--fs-md);
}

.transport-select {
    padding: 4px 8px;
    margin: 0;
    font-size: var(--fs-sm);
    min-width: 80px;
}

.transport-slider {
    width: 120px;
    margin: 0;
}

.transport-value {
    font-family: "Fustat";
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #666;
    min-width: 40px;
}

.control-btn {
    width: 45px;
    height: 30px;
    border: 1px solid var(--primary);
    background: var(--bg-panel);
    cursor: pointer;
    font-size: var(--fs-lg);
    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.15s ease;
    flex-shrink: 0;
}

.control-btn.control-btn-play {
    background: var(--primary);
    color: var(--bg-panel);
    border-color: var(--primary);
}

@media (hover: hover) {
    .control-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
        border-color: var(--primary);
        transform: scale(1.05);
    }

    .control-btn.control-btn-play:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }
}

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

.scrubber {
    flex: 1;
    height: 6px;
    background: var(--primary-dim);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.scrubber-fill {
    height: 100%;
    background: var(--orange);
    width: 0%;
    transition: width 0.1s linear;
}

/* --- CODE MONITOR --- */
.code-monitor {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--monitor-height) + env(safe-area-inset-bottom, 0px));
    /* Add padding so the text stays centered in the usable area */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--code-bg);
    color: var(--code-text);
    display: flex;
    align-items: center;
    padding: 0 30px;
    font-family: monospace;
    font-size: var(--fs-base);
    z-index: 101;
    max-width: 950px;
    margin: 0 auto;
    border-top: 2px solid var(--primary-dark);
}

.monitor-prompt {
    opacity: 1;
    margin-right: 10px;
    color: var(--orange);
}

.monitor-text-wrapper {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;

    /* Adds a subtle fade to the right edge so it doesn't hard-cut */
    -webkit-mask-image: linear-gradient(to right, black 95%, transparent 100%);
    mask-image: linear-gradient(to right, black 95%, transparent 100%);
}

.monitor-text {
    display: inline-block;
    white-space: nowrap;
    /* Removed text-overflow: ellipsis so the full text renders for the slide */
}

/* Dynamically added by JS when text is too long */
.monitor-text.marquee-active {
    animation: monitorMarquee var(--marquee-dur) linear infinite alternate;
}

/* Pauses at 0%->15% so you can read the start, then slides, then pauses at the end */
@keyframes monitorMarquee {

    0%,
    15% {
        transform: translateX(0);
    }

    85%,
    100% {
        transform: translateX(var(--marquee-dist));
    }
}

.monitor-timestamp {
    opacity: 1;
    font-size: var(--fs-xs);
    margin-left: 20px;
    color: var(--bg-body);
}

/* --- STATS GRID --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    width: 94%;
    margin: auto;
}

.stat-box {
    border: 1px solid var(--primary);
    padding: 15px;
    background: var(--bg-panel);

    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.distribution-grid {
    display: grid;
    gap: 12px;
    width: 94%;
    grid-template-columns: 1fr;
    margin-left: auto;
}

.geo-distribution-grid {
    display: grid;
    gap: 12px;
    width: 94%;
    margin-left: auto;
    /* Default (Mobile): Stack them */
    grid-template-columns: 1fr;
}

/* 6-Column Layout Trick for 2-top, 3-bottom */
@media (min-width: 768px) {
    .geo-distribution-grid {
        width: 90%;
        margin: auto;
        grid-template-columns: repeat(6, 1fr);
    }

    .distribution-grid {
        width: 90%;
        margin: auto;
        grid-template-columns: 33% 33% 33%;
    }

    /* First 2 items take 50% (3/6) */
    .geo-distribution-grid>*:nth-child(1),
    .geo-distribution-grid>*:nth-child(2) {
        grid-column: span 3;
    }

    /* Next 3 items take 33% (2/6) */
    .geo-distribution-grid>*:nth-child(3),
    .geo-distribution-grid>*:nth-child(4),
    .geo-distribution-grid>*:nth-child(5) {
        grid-column: span 2;
    }
}

/* --- HIERARCHY COLUMNS --- */
.hierarchy-col {
    flex: 1;
    padding: 0 10px;
    height: 320px;
    overflow-y: auto;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}

.geo-col {
    min-height: 200px;
    max-height: 300px;
}

.hierarchy-title {
    border-bottom: 3px double var(--primary);
    padding: 12px 12px 8px 0px;
    /* Added padding here to replace container padding */
    margin-bottom: 0;
    /* REMOVED: Margin creates transparent gap; use padding instead */
    font-size: var(--fs-md);
    position: sticky;
    top: -15px;
    background-color: var(--bg-panel);
    z-index: 10;
}

/* New class to add padding to the list content so it aligns with the header */
.hierarchy-list {
    padding: 0 0px 12px 12px;
}

.hierarchy-item {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-base);
    padding: 4px 6px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.15s ease;
}

@media (hover: hover) {
    .hierarchy-item:hover {
        background: var(--primary-dim);
    }
}

.hi-name,
.hi-count {
    font-family: 'Fustat';
}

.hi-count {
    font-weight: 700;
    color: var(--primary);
}

/* --- CONSOLE --- */
#api .section {
    display: flex;
    flex-direction: column;

}

/* Ensure the output box is the part that scrolls */
.console-output {
    background: #f5f5f5;
    padding: 12px;
    margin-top: 10px;
    font-family: monospace;
    font-size: var(--fs-sm);
    border: 1px solid var(--primary);
    flex: 1;
    /* Allows it to take up available space */
    height: 300px;
    /* Gives it a fixed base height */
    overflow-y: scroll;
    /* Forces the scrollbar to be active */
    display: flex;
    height: 300px;
    max-height: 300px;
    /* Limits the total height of the console section */
    flex-direction: column;
    /* Keeps entries stacking correctly */
}

.console-entry {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.console-prompt {
    color: #777;
    margin-bottom: 5px;
    font-weight: 600;
}

.console-result {
    margin: 0;
    white-space: pre-wrap;
    color: #222;
}

.console-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.console-input-container input {
    flex: 1;
    margin-bottom: 0;
}

.stat-num {
    font-size: 1.8em;
    color: var(--primary);
    font-family: "Libertinus Math";
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-lbl {
    font-size: var(--fs-base);
    text-transform: uppercase;
    color: #666;
    font-family: "Fustat";
    font-weight: 600;
    letter-spacing: 0.05em;
}



/* --- QUEUE LIST --- */
.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: var(--bg-panel);
    transition: background 0.15s ease;
    cursor: grab;
}

@media (hover: hover) {
    .queue-item:hover {
        background: #f9f9f9;
    }
}

.queue-item.current {
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    cursor: default;
}

.queue-item[draggable="true"]:not(.current) {
    cursor: grab;
}

.queue-item[draggable="true"]:not(.current):active {
    cursor: grabbing;
}

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

.queue-item-title {
    font-size: var(--fs-base);
    font-weight: 600;
    margin-bottom: 2px;
}

.queue-item-number {
    font-weight: 700;
    margin-right: 8px;
    color: var(--primary);
}

.queue-item-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: "Fustat";
}

.queue-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.queue-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- PLAYLISTS --- */
.playlist-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #eee;
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    background: var(--bg-panel);
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .playlist-item:hover {
        border-color: var(--primary);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }
}

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

.playlist-name {
    font-weight: 700;
    font-size: var(--fs-base);
    margin-bottom: 2px;
    color: var(--primary);
}

.playlist-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: "Fustat";
}

.playlist-actions {
    display: flex;
    gap: 6px;
    margin-left: 10px;
}

/* --- BADGES --- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: var(--fs-xs);
    font-family: "Fustat";
    font-weight: 700;
    text-transform: uppercase;

    letter-spacing: 0.03em;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: var(--bg-panel)3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: var(--primary-dim);
    color: var(--primary-dark);
}

/* --- EMPTY STATES --- */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: var(--fs-md);
}

.empty-state-icon {
    font-size: var(--fs-display);
    opacity: 0.3;
    margin-bottom: 15px;
}

/* --- API REFERENCE STYLES --- */
.api-section {
    margin-bottom: 30px;
    background: var(--bg-body);
    border: 3px double var(--primary);

    padding: 20px;
}

.api-section h4 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--primary);
}

.api-methods {
    display: grid;
    gap: 15px;
}

.api-method {
    border-left: 3px solid var(--primary-dim);
    padding-left: 15px;
}

.api-signature {
    font-family: monospace;
    font-size: var(--fs-base);
    color: var(--primary);
    background: var(--primary-dim);
    padding: 4px 8px;

    display: inline-block;
    margin-bottom: 6px;
}

.api-method p,
.api-method li {
    font-size: var(--fs-base);
    color: #666;
    margin: 0;
}

/* --- DRAG AND DROP --- */

#playerQueueList {
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    /* Allow vertical scroll, block horizontal/zoom */
}

.queue-drag-handle {
    display: flex !important;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    margin-right: 8px;
    touch-action: none;
    cursor: grab;
}

.queue-item {
    touch-action: pan-y;
    user-select: none;
    /* Ensure no native dragging */
    -webkit-user-drag: none;
    cursor: pointer;
}

@media (hover: hover) {
    .queue-item:hover .queue-drag-handle {
        opacity: 0.4;
    }
}

.queue-item.current .queue-drag-handle {
    opacity: 0.1;
}

.drag-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.queue-item.dragging {
    opacity: 0.5;
    background: var(--primary-dim);
    border: 2px dashed var(--primary);
    cursor: grabbing;
}

.dragging-ghost {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    /* Allows code to see what is underneath the ghost */
    opacity: 0.95;
    background: var(--bg-panel);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary);
    list-style: none;
    margin: 0;
    padding: 10px;
    display: flex;
    align-items: center;
}

.queue-drop-indicator {
    height: 3px;
    background: var(--primary);
    margin: -2px 0;
    animation: dropPulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(23, 104, 218, 0.5);
}

.queue-drop-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

@keyframes dropPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* --- RESPONSIVE & MOBILE --- */
@media (max-width: 768px) {
    :root {
        --transport-height: 140px;
        /* Taller footer for stacked controls */
        --monitor-height: 30px;
        touch-action: manipulation;
    }

    body {
        padding: 15px 15px calc(var(--transport-height) + var(--monitor-height) + 10px + env(safe-area-inset-bottom, 0px)) 15px;
        /* SCROLL FIX: Allow body to scroll naturally on mobile */
        height: auto;
        overflow-y: auto;
        display: block;
    }

    .tabs-wrapper {
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* SCROLL FIX: Remove internal tab scrolling */
    .tab-content {
        overflow: visible;
        height: auto;
        display: none;
        /* Override flex */
    }

    .tab-content.active {
        display: block;
        /* Stack content naturally */
    }

    /* 2. Header: Stack Logo & Text */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        position: relative;
        z-index: 15;
    }

    .header-logo {
        width: 50px;
        height: 50px;
        margin-right: 5px;
    }

    h1 {
        font-size: 1.5em;
    }

    #statusIndicator {
        align-self: flex-start;
        margin-top: 5px;
    }



    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex: 0 0 auto;
        font-size: var(--fs-base);
        padding: 8px 12px;
    }

    .tab-content {
        overflow-x: hidden;
    }

    /* 3. Registry: Collapsible Sidebar & Flow Layout */
    .registry-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
        height: auto;
        /* Remove fixed height constraints */
    }

    /* Hide the checkbox logic */
    .filter-toggle-cb {
        display: none;
    }

    .registry-sidebar {
        max-height: none;
        resize: none;
        border-bottom: 3px double var(--primary);
        padding: 10px 15px;
        overflow: visible;
        /* Let it grow */
    }

    /* Header with Toggle Button */
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0;
        /* Tight when collapsed */
    }

    .filter-toggle-btn {
        background: var(--bg-panel);
        border: 1px solid var(--primary);
        color: var(--primary);
        padding: 4px 12px;
        font-family: "Fustat", sans-serif;
        font-size: var(--fs-sm);
        font-weight: 700;
        cursor: pointer;
        display: block;
        /* Visible on mobile */
    }

    /* Default State: Content Hidden */
    .sidebar-content {
        display: none;
        margin-top: 15px;
        border-top: 1px solid #eee;
        padding-top: 15px;
    }

    /* Expanded State: Content Visible (The Hack) */
    .filter-toggle-cb:checked~.sidebar-content {
        display: block;
        animation: slideDown 0.2s ease-out;
    }

    .filter-toggle-cb:checked~.sidebar-header .toggle-icon {
        content: "Hide ▴";
        /* Change text via CSS if supported, or just rely on icon rotation */
    }

    /* Results: Remove internal scrolling, let the page scroll */
    .registry-results {
        padding-right: 0;
        overflow: visible;
        height: auto;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* 4. Global Transport: Stacked Layout */
    /* 4. Global Transport: Mobile Logic */
    .transport-toggle-btn {
        display: flex;
        /* Visible on Mobile */
    }

    .global-transport {
        /* Default: COLLAPSED State */
        height: 50px;
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
    }

    /* EXPANDED State */
    .global-transport.expanded {
        height: 190px;
        /* Space for everything */
    }

    .transport-main {
        flex-wrap: nowrap;
        /* Keep on one line in collapsed mode */
        justify-content: space-between;
        margin-bottom: 0;
        gap: 10px;
        align-items: center;
    }

    /* Info: Compact by default */
    .transport-info {
        width: auto;
        order: 0;
        /* Natural order: Prev, Info, Play, Next */
        text-align: left;
        margin: 0;
        padding: 0;
        flex: 1;
        border: none;
    }

    .transport-title {
        font-size: var(--fs-base);
        margin-bottom: 0;
    }

    .transport-info .meta {
        font-size: var(--fs-base) !important;
        display: none;
        /* Hide time in mini mode to save space */
    }

    /* Show Time only when expanded */
    .global-transport.expanded .transport-info .meta {
        display: block;
    }

    .global-transport.expanded .transport-main {
        flex-wrap: wrap;
    }

    /* Controls (Vol/Speed): HIDDEN by default */
    .transport-controls {
        display: none;
        width: 100%;
        justify-content: space-between;
        margin-top: 15px;
        padding-top: 10px;
        border-top: 1px solid #f0f0f0;
        opacity: 0;
        transition: opacity 0.2s ease 0.1s;
    }

    .global-transport.expanded .transport-controls {
        display: flex;
        opacity: 1;
    }

    /* Scrubber: HIDDEN by default */
    .scrubber {
        display: none;
        margin-top: 12px;
    }

    .global-transport.expanded .scrubber {
        display: block;
    }

    .transport-control-group {
        font-size: var(--fs-base);
    }

    .transport-slider {
        width: 80px;
    }

    /* 5. Playback Tab: Wrap elements */
    .playback-control-panel {
        padding: 15px;
        margin-top: 20px;
    }

    .playback-main-controls {
        gap: 10px;
    }

    .control-btn-large {
        width: 60px;
        height: 60px;
        font-size: var(--fs-lg);
    }

    .control-btn-large.control-btn-play {
        width: 70px;
        height: 70px;
        font-size: var(--fs-2xl);
    }

    .playback-bar {
        padding: 5px;
    }

    .bar-input-group label {
        display: none;
    }

    /* Save space */
    .bar-input-group input {
        width: 60px !important;
        margin: 0;
    }

    .bar-separator {
        display: none;
    }

    /* 6. Grids */
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .inspector-grid {
        grid-template-columns: 1fr;
    }

    /* 7. Code Monitor */
    .code-monitor {
        padding: 0 10px;
        font-size: var(--fs-xs);
    }

    /* -- BRIGISTICS HERO MOBILE --*/
    .brigistics-hero {
        flex-direction: column;
        /* Stack vertically for mobile */
        padding: 15px;
        gap: 15px;
        justify-content: center !important;
    }

    .hero-logo {
        flex: 0 0 100px;
        /* Keep logo at a readable "stamp" size */
        max-height: 100px;
        order: -1;
        /* Image stays on top */
        display: none !important;
    }

    .hero-actions {
        width: 100%;
        max-width: none;
    }

    .hero-btn {
        padding: 8px 12px;
        /* Shrink button height */
        max-width: 100%;
    }

    .hero-btn-text strong {
        font-size: var(--fs-base);
        /* Ensure text doesn't look "huge" on small screens */
    }

}

/* --- BRIGISTICS HERO --- */

.brigistics-hero,
.about-hero {
    display: flex;
    flex-direction: row;
    /* Horizontal for desktop */
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 2.5%;
    background: var(--bg-panel);
    border: 3px double var(--primary);
    /* Official double border */
    margin-bottom: 30px;
    position: relative;
    margin-top: 15px;
}

/* Document Annotation */
.brigistics-hero::before {
    content: "Fast Access Ready Transmissions";
    position: absolute;
    top: -8px;
    left: 10px;
    background: var(--bg-panel);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.hero-logo {
    flex: 0 1 200px;
    /* Allows logo to shrink but sets base size */
    max-height: 230px;
    width: auto;
    object-fit: contain;
    padding: 5px;
}

/* --- THE "ACTION" BUTTONS --- */
.hero-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.1s steps(2);
}

.hero-btn-icon {
    color: var(--orange);
    font-size: 1.5em;
}

@media (hover: hover) {
    .hero-btn:hover {
        background: var(--primary);
        color: var(--bg-panel);
    }


    .hero-btn:hover .hero-btn-text strong,
    .hero-btn:hover .hero-btn-text span {
        color: var(--bg-panel);
    }
}

.hero-btn-text strong {
    display: block;
    font-family: "Libertinus Math", serif;
    /* Document serif font */
    color: var(--text-main);
    line-height: 1.1;
    font-size: 1.5em;
}

.hero-btn-text span {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    color: #666;
    text-transform: uppercase;
}

/* --- PLAYLIST SHARING --- */

/* Sharing Panel */
#sharingSectionPanel {
    margin-top: 20px;
}

.sharing-playlist-header {
    padding: 12px;
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    margin-bottom: 16px;
}

.sharing-name {
    font-weight: 700;
    font-size: var(--fs-md);
    color: var(--primary);
    margin-bottom: 4px;
}

.sharing-meta {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    font-family: "Fustat";
}

.sharing-qr-section {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid var(--primary-dim);
    margin-bottom: 16px;
    min-height: 240px;
}

.sharing-qr {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sharing-qr canvas {
    max-width: 100%;
    height: auto;
}

.sharing-code-section,
.sharing-url-section {
    margin-bottom: 16px;
}

.sharing-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-family: "Fustat";
    letter-spacing: 0.5px;
}

.sharing-code-box {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: var(--code-bg);
    padding: 10px;
    border: 1px solid var(--primary);
}

.sharing-code-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: var(--fs-sm);
    color: var(--code-text);
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    word-break: break-all;
    line-height: 1.4;
}

.sharing-code-box .icon-btn {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: var(--fs-base);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--code-text);
    color: var(--code-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .sharing-code-box .icon-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
}

.sharing-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sharing-actions .player-queue-btn {
    flex: 1;
    min-width: 100px;
}


/* --- PLAYLIST SHARING CARD (Generated dynamically) --- */
.pc-share-card-container {
    font-family: "Fustat", sans-serif;
    width: 400px;
    color: #fafafa;
    background: #fff;
    border: 4px double #1768da;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;

    clip-path: polygon(0 0,
            /* Top Left */
            calc(100% - 125px) 0,
            /* Top Right Start */
            100% 125px,
            /* Right Side Drop */
            100% 100%,
            /* Bottom Right */
            0 100%
            /* Bottom Left */
        );
    margin: 2em;
    transition: transform 0.2s ease, filter 0.2s ease;

}

.pc-share-card-container.interactive::after {
    content: "";
    position: absolute;

    /* VERTICAL FIX: Moves up to overlap the top border */
    top: -10px;

    /* HORIZONTAL FIX: 
       100% is the padding-box width. 
       We subtract 121px (125px cut size minus 4px border width).
       This lands exactly on the start of the cut. 
    */
    left: calc(100% - 110px);

    /* Length: Hypotenuse of 125x125 is ~177px. We use 180px to be safe. */
    width: 180px;

    /* Thickness */
    height: 16px;

    background: #1768da;

    /* ROTATION: Pivot around the top-left corner of the bar */
    transform-origin: top left;
    transform: rotate(45deg);

    /* Layering */
    z-index: 20;
    pointer-events: none;
}

/* Background grid effect */
.pc-share-card-bg {
    pointer-events: none;
}

.pc-share-header {
    background: #1768da;
    color: #fafafa;
    font-family: "Libertinus Math";
    padding: 5px;
    font-weight: 800;
    font-size: var(--fs-2xl);
    z-index: 1;
    border-bottom: 2px solid #fafafa;
}

.pc-share-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
}

.pc-share-title {
    font-family: "Libertinus Math", serif;
    font-size: var(--fs-2xl);
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.1;
    max-width: 230px;
    color: #000;
}

.pc-share-meta {
    font-size: var(--fs-base);
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pc-share-qr-frame {
    background: #fafafa;
    padding: 10px;
    border: 2px solid #1768da;
    margin-bottom: 25px;
    margin-top: 25px;
}

.pc-share-footer {
    background: #1768da;
    color: #fafafa;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
    text-align: center;
}

.pc-share-code-box {
    color: #fafafa;
    font-family: "Fustat";
    font-size: var(--fs-xs);
    word-break: break-all;
    margin-top: 10px;
}

.pc-share-label {
    font-size: var(--fs-base);
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}



/* The Action Bar (Replaces the Import Code footer) */
.pc-share-actions {
    background: #e1e8f3;
    border-top: 2px solid #1768da;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
}

.pc-share-actions .icon-btn {
    width: 100%;
    justify-content: center;
    background: #fafafa;
    font-size: var(--fs-xs);
    padding: 6px 0;
    margin: 0;
    box-shadow: none;
}

.pc-share-actions .btn-load {
    border-color: #1768da;
    background: #1768da;
    color: #fafafa;
}

.pc-share-actions .btn-export {
    background: #fafafa;
    color: #555555;
}

@media (hover: hover) {
    .pc-share-actions .icon-btn:hover {
        background: #1768da;
        color: #fafafa;
    }

    .pc-share-actions .btn-load:hover {
        background: #fafafa;
        color: #1768da;
    }

    /* Hover effect only for the interactive on-screen ones */
    .pc-share-card-container.interactive:hover {
        transform: translateY(-3px);
        filter: drop-shadow(12px 12px 16px rgba(23, 104, 218, 0.3));
    }
}

.pc-share-card-container.interactive {
    width: auto !important;
}



/* mini cards used in UI */
.playlist-mini-card {
    border: 3px double #1768da;
    background: #fafafa;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease;
}

.mini-qr-preview {
    width: 80px;
    height: 80px;
    background: #f5f5f5;
    border: 1px solid #e1e8f3;
}

/* Responsive */
@media (max-width: 768px) {
    .sharing-qr-section {
        min-height: 200px;
    }

    .import-notification-text {
        flex-direction: column;
        align-items: flex-start;
    }

    .sharing-actions {
        flex-direction: column;
    }

    .sharing-actions .player-queue-btn {
        width: 100%;
    }
}

.pc-queue-preview {
    background: var(--bg-panel);
    border: 1px dashed var(--primary);
    padding: 10px;
    margin-bottom: 5px;
    max-height: 120px;
    overflow-y: auto;
    font-family: "Fustat", sans-serif;
}

.pc-preview-header {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

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

.pc-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-xs);
    color: var(--text-main);
    padding: 6px 0;
    /* Taller padding for easier clicking/dragging */
    border-bottom: 1px dotted var(--primary-dim);
    user-select: none;
    -webkit-user-select: none;
}

.pc-preview-item:last-child {
    border-bottom: none;
}

.pc-drag-handle {
    cursor: grab;
    opacity: 0.3;
    padding: 0 4px;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
    touch-action: none;
}

@media (hover: hover) {
    .pc-drag-handle:hover {
        opacity: 0.8;
    }
}

.pc-preview-title {
    flex: 1;
    /* Pushes the actions to the far right */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.pc-preview-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pc-preview-actions button {
    background: transparent;
    border: 1px solid var(--primary-dim);
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 2px;
    transition: all 0.15s;
    font-size: var(--fs-xs);
}

@media (hover: hover) {
    .pc-preview-actions button:hover {
        background: var(--primary-dim);
        color: var(--primary);
    }

    .pc-preview-actions button.btn-danger:hover {
        background: #f8d7da;
        color: var(--danger);
        border-color: var(--danger);
    }
}

.pc-preview-meta {
    color: var(--text-muted);
    font-family: monospace;
}

.pc-preview-empty {
    color: #999;
    font-style: italic;
    font-size: var(--fs-xs);
    text-align: center;
    padding: 10px 0;
}

/* Ensure the punchcard reader wrapper accommodates the new element gracefully */
.punchcard-reader-wrapper {
    display: flex;
    flex-direction: column;
}

/* --- PUNCHCARD EXPORT ANIMATION --- */

/* The overlay container that appears during export */
.pc-exporting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 104, 218, 0.1);
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* The horizontal scanning line */
.pc-export-scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    animation: pc-scan-move 1.5s linear infinite;
}

/* Status text that appears over the card */
.pc-export-status-text {
    background: var(--primary);
    color: var(--bg-panel);
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-md);
    font-weight: 700;
    padding: 4px 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 21;
}

@keyframes pc-scan-move {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Button loading state */
.icon-btn.is-exporting {
    background: var(--primary-dim) !important;
    color: var(--primary) !important;
    cursor: wait;
}


/* --- UTILITY CLASSES --- */
.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

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

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

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-center {
    text-align: center;
}

.margin-left-auto {
    margin-left: auto;
}


/* --- PRINTER ANIMATION --- */
/*
 * The mask is a transparent overflow:hidden container.
 * It has no visible border — the .punchcard-print-slot element
 * in the HTML owns the slot-opening visual.
 * The mask top aligns with the slot top; overflow:hidden clips
 * the card until it slides below the slot line.
 */

.pc-printer-mask {
    position: fixed;
    /* overridden to absolute by JS inline style */
    z-index: 9000;
    overflow: hidden;
    background: transparent;
    height: 0px;
    pointer-events: none;
}

/* The card inside the mask */
.pc-printer-mask .pc-share-card-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    /* Center it */
    margin: 0 !important;

    /* CRITICAL: Force dimensions so it can't be "narrow" */

    min-width: 300px !important;
    box-sizing: border-box;

    /* PRINTING ANIMATION (Slide Down) */
    transition: top 1.5s cubic-bezier(0.45, 0, 0.55, 1);
}

.pc-share-card-container.pop-in {
    animation: gridPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes gridPop {
    0% {
        opacity: 0;
        transform: scale(1.5) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* PHYSICS DROP STATE */
.pc-share-card-container.falling {
    position: fixed !important;
    z-index: 9999 !important;
    pointer-events: none;
    margin: 0 !important;

    /* Explicitly lock width again to prevent snapping */
    width: 300px !important;

    /* The Drop */
    animation: gravityDrop 0.8s ease-in forwards;
}

@keyframes gravityDrop {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(120vh) rotate(10deg);
        opacity: 1;
    }
}

/* --- SHRED ANIMATION --- */
@keyframes ripTop {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px) rotate(-5deg);
        opacity: 0;
    }
}

@keyframes ripBottom {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(100px) rotate(5deg);
        opacity: 0;
    }
}

.rip-piece {
    position: fixed;
    /* Lock to screen, ignore container flow */
    z-index: 9999;
    pointer-events: none;
    width: 350px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* --- USER PROFILE STYLES --- */
.user-badge {
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .user-badge:hover {
        background: var(--bg-panel);
    }
}

.status-login-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: flex-start;
    gap: 4px;
    flex-direction: row;
}

@media (max-width:768px) {
    .status-login-row {
        flex-direction: column;
    }
}

.notif-dot {
    background: var(--danger);
    color: var(--bg-panel);
    font-family: "Fustat";
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 50%;
}

.notification-card {
    background: var(--bg-panel);
    border-left: 3px solid var(--primary);
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.notification-card.unread {
    background: var(--primary-dim);
    border-left-color: var(--orange);
}

#prof-qr-container img {
    max-height: 100%;
}

/* ── PROFILE HERO ─────────────────────────────── */
.profile-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    background: var(--bg-panel);
    border: 3px double var(--primary);
    margin-bottom: 30px;
    position: relative;
    margin-top: 15px;
    flex-wrap: wrap;
}

.profile-hero::before {
    content: "Personnel Record";
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--bg-body);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--primary);
    background: var(--bg-panel);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-hero .hero-btn .hero-btn-icon {
    color: transparent;
    text-shadow: 0 0 var(--primary);
}

.profile-username {
    font-size: 1.8em;
    color: var(--primary);
    margin: 0 0 4px;
    line-height: 1;
}

.profile-role {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── ACHIEVEMENT FILTER BAR ───────────────────── */
.ach-filter-bar {
    display: flex;
    gap: 4px;
}

.ach-filter-btn {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border: 1px solid var(--primary);
    background: var(--bg-panel);
    color: var(--primary);
    cursor: pointer;
}

.ach-filter-btn.active {
    background: var(--primary);
    color: var(--bg-panel);
}

@media (hover: hover) {
    .ach-filter-btn:hover:not(.active) {
        background: var(--primary-dim);
    }
}

/* ── ACHIEVEMENT GALLERY ──────────────────────── */
.achievement-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    grid-auto-rows: 1fr;
    gap: 10px;

    max-height: 600px;
    overflow-y: auto;

    /* Visual styling to make it look like a distinct terminal pane */
    padding: 12px;
    background: var(--bg-panel);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.03);
}

@media (max-width: 768px) {
    .achievement-gallery {
        grid-template-columns: 1fr;
        max-height: 50vh;
    }
}

.ach-card {
    background: var(--bg-panel);
    border: 1px solid var(--primary-dim);
    padding: 14px;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ach-card.unlocked {
    border-color: var(--primary);
    border-top: 3px solid var(--primary);
}

.ach-card.hidden-goal.locked {
    opacity: 0.65;
    background: #f9f9f9;
}

.ach-card.locked {
    opacity: 0.75;
    background: var(--primary-dim);
}

.ach-card.locked .ach-icon {
    color: transparent;
    text-shadow: 0 0 #b0b8c8;
}

.ach-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.ach-icon {
    font-size: 1.6em;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1.3;
    color: transparent;
    text-shadow: 0 0 var(--primary);
}

.ach-meta {
    flex: 1;
}

.ach-title {
    font-family: "Libertinus Math", serif;
    font-size: 1em;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 4px;
    line-height: 1.2;
}

.ach-desc {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    color: #666;
    text-transform: uppercase;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.ach-status-badge {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 7px;
    position: absolute;
    top: 10px;
    right: 10px;
    letter-spacing: 0.05em;
    display: none;
}

.ach-status-badge.is-unlocked {
    background: var(--primary);
    color: var(--bg-panel);
}

.ach-status-badge.is-locked {
    background: var(--primary-dim);
    color: var(--primary);
}

.ach-reward {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--primary-dim);
    flex-shrink: 0;
}

.ach-reward-media-wrapper {
    height: 140px;
    width: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px;
    position: relative;
    margin-bottom: 8px;
    transition: opacity 0.2s ease;
}



.ach-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

@media (hover: hover) {
    .ach-reward-media-wrapper:hover {
        opacity: 0.9;
    }

    .ach-reward-media-wrapper:hover .ach-hover-overlay {
        opacity: 1;
    }

}

.ach-video-overlay {
    position: absolute;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ach-reward-caption {
    font-family: "Fustat", sans-serif;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    color: var(--primary);
    margin-top: 5px;
    letter-spacing: 0.04em;
}

/* ── LOCKED REWARD PLACEHOLDER ────────────────── */
.ach-reward-locked-wrapper {
    height: 140px;
    width: 100%;
    background: repeating-linear-gradient(-45deg,
            var(--primary-dim),
            var(--primary-dim) 8px,
            var(--bg-body) 8px,
            var(--bg-body) 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 5px;
    margin-bottom: 8px;
    border: 1px solid var(--bg-body);
    position: relative;
    overflow: hidden;
}

.ach-reward-locked-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ach-reward-lock-icon {
    font-size: 2em;
    color: transparent;
    text-shadow: 0 0 #b0b8c8;
    line-height: 1;
}

.ach-reward-lock-label {
    font-family: 'Fustat', sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9097a3ff;
}

.ach-reward-lock-sublabel {
    font-family: 'Fustat', sans-serif;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #969ba3ff;
    margin-top: -4px;
}

/* ── REWARD SECTION HEADER ────────────────────── */
.ach-reward-section-label {
    font-family: 'Fustat', sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    opacity: 0.5;
    margin-bottom: 8px;
}

.ach-card.locked .ach-reward-section-label {
    color: #aaa;
    opacity: 1;
}

/* ── FULLSCREEN LIGHTBOX ──────────────────────── */
.ach-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.ach-lightbox-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.ach-lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 3px double var(--primary);
    background: #777;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ach-lightbox-overlay.active .ach-lightbox-content {
    transform: scale(1);
}

.ach-lightbox-caption {
    color: var(--bg-panel);
    font-family: "Fustat", sans-serif;
    margin-top: 15px;
    font-size: var(--fs-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.ach-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--bg-panel);
    font-size: var(--fs-display);
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    padding: 10px;
    opacity: 0.7;
}

@media (hover: hover){
.ach-lightbox-close:hover {
    opacity: 1;
}}

/* ── NOTIFICATION LIST ────────────────────────────── */
.notifications-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.notification-card.read {
    opacity: 0.5;
    border-left-color: var(--primary-dim);
    background: var(--bg-panel);
    cursor: default !important;
}

@media (hover: hover){
.notification-card.read:hover {
    opacity: 0.7;
}}

/* ── MEMORY CARD (bottom) ─────────────────────── */

.login-code-hidden {
    filter: blur(5px);
    user-select: none;
    pointer-events: none;
    transition: filter 0.25s ease;
}

.login-code-visible {
    filter: none;
    user-select: all;
    transition: filter 0.25s ease;
}

/* --- DE-FRIGULATOR COMPONENT --- */
.defrig-container {
    position: relative;
    width: 280px;
    height: 130px;
    background: #111;
    border: 1px solid var(--primary-dim);
    border-radius: 4px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.defrig-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #1a1a1a;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.defrig-switches {
    display: flex;
    gap: 30px;
    margin-bottom: 15px;
}

/* Mechanical Toggle Switch */
.defrig-switch {
    width: 24px;
    height: 48px;
    background: #333;
    border: 2px solid #000;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8);
}

.defrig-switch::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 22px;
    background: linear-gradient(to bottom, #888, #555);
    border-radius: 2px;
    border-bottom: 3px solid #333;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6);
}

/* Toggle ON State */
.defrig-switch.on::after {
    transform: translateY(-20px);
    background: linear-gradient(to bottom, #ff4444, #aa0000);
    border-bottom: none;
    border-top: 3px solid #550000;
    box-shadow: 0 -4px 6px rgba(255, 68, 68, 0.4);
}

/* Switch 1: Primary Blue */
.defrig-switch:nth-child(1).on::after {
    background: linear-gradient(to bottom, #60a5fa, #2563eb);
    border-top: 3px solid #1e3a8a;
    box-shadow: 0 -4px 8px rgba(59, 130, 246, 0.5);
}

/* Switch 2: Warning Orange */
.defrig-switch:nth-child(2).on::after {
    background: linear-gradient(to bottom, #fb923c, #ea580c);
    border-top: 3px solid #7c2d12;
    box-shadow: 0 -4px 8px rgba(249, 115, 22, 0.5);
}

/* Switch 3: Success Green */
.defrig-switch:nth-child(3).on::after {
    background: linear-gradient(to bottom, #4ade80, #16a34a);
    border-top: 3px solid #14532d;
    box-shadow: 0 -4px 8px rgba(34, 197, 94, 0.5);
}

/* Defrigulate Button */
.defrig-btn {
    width: 90%;
    color: #555 !important;
    border-color: #444 !important;
    background: #222 !important;
    pointer-events: none;
    transition: all 0.3s ease;
}

.defrig-btn.ready {
    color: var(--bg-panel) !important;
    border-color: var(--danger) !important;
    background: var(--danger) !important;
    pointer-events: auto;
    cursor: pointer;
    animation: pulseDefrig 1.5s infinite;
}

@keyframes pulseDefrig {

    0%,
    100% {
        box-shadow: 0 0 5px transparent;
    }

    50% {
        box-shadow: 0 0 15px var(--danger);
    }
}

/* Cover Plate */
.defrig-plate {
    position: absolute;
    inset: 0;
    /* Uses your dynamic variables so it perfectly matches the active theme! */
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.5, 0, 0.8, 1), opacity 1s ease;
    z-index: 10;

}

/* Plate Falling Off */
.defrig-plate.removed {
    transform: translateY(120%) rotate(15deg);
    opacity: 0;
    pointer-events: none;
}

.defrig-plate-text {
    color: var(--text-muted);
    padding: 6px 12px;
    font-family: 'Fustat', sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.5;
}

/* Phillips Head Screws (Drawn with pure CSS) */
.defrig-screw {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-dim);
    border-radius: 50%;
    border: 0px solid #888;
    cursor: pointer;
    transition: transform 0.5s, opacity 1s ease-out;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.8), 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Draw the physical cross grooves perfectly centered */
.defrig-screw::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: var(--text-dim);
    transform: translate(-50%, -50%);
    box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5);
}

.defrig-screw::before {
    width: 8px;
    height: 2px;
}

/* Dark mode overrides for screws */
html.dark-theme .defrig-screw {
    background: var(--primary-dim);
    border-color: #333;
}

html.dark-theme .defrig-screw::before {
    background: #222;
}

@media (hover: hover){
/* Hover states */
.defrig-screw:hover {
    transform: scale(1.15);
    background: #e0e0e0;
}

html.dark-theme .defrig-screw:hover {
    background: #777;
}
}

/* Screw Falling Out */
.defrig-screw.removed {
    transform: translateY(0px) rotate(-160deg) scale(1.1) !important;
    opacity: 0;
    pointer-events: none;
}

.defrig-screw.topleft {
    top: 6px;
    left: 6px;
    transform: rotate(9deg)
}

.defrig-screw.topright {
    top: 6px;
    right: 6px;
    transform: rotate(30deg);
}

.defrig-screw.bottomleft {
    bottom: 6px;
    left: 6px;
    transform: rotate(20deg);
}

.defrig-screw.bottomright {
    bottom: 6px;
    right: 6px;
    transform: rotate(-25deg);
}

/* =========================================
   DARK MODE OVERRIDES
   ========================================= */

html.dark-theme {
    /* ── CORE SURFACES ── */
    /* Lifted from near-black to a deep slate navy for better legibility */
    --bg-body: #1a232e;
    /* Slightly lighter navy for cards and panels to create depth */
    --bg-panel: #1a2734;

    /* ── TYPOGRAPHY ── */
    /* A soft, off-white with a hint of blue to reduce eye strain */
    --text-main: #e2e8f0;
    /* Muted blue-grey for secondary labels and metadata */
    --text-muted: #94a3b8;
    /* Darker slate for less prominent UI elements */
    --text-dim: #64748b;

    /* ── PRIMARY ACCENTS ── */
    /* A vibrant, electric blue that remains clear against the slate background */
    --primary: #6ba5fc;
    /* A deep navy accent for active states and subtle containers */
    --primary-dim: #2d3a5a;
    /* The darkest blue tint, used for deep backgrounds behind text */
    --primary-subtle: #1e263a;
    /* A slightly brighter blue for hover effects and emphasis */
    --primary-dark: #7ab1ff;

    /* ── FUNCTIONAL ── */
    /* Derived from primary-dim to keep borders subtle but visible */
    --border: #2d3a5a;
    /* Matches the primary blue exactly to maintain the Terminal identity */
    --code-bg: #569aff;
    --code-text: #ffffff;
    /* High-visibility orange for warnings and progress markers */
    --orange: #ffb142;

    /* Maintaining semantic consistency with the light mode rules */
    --success: var(--primary);
    --warning: var(--primary);
    --danger: #ff5c5c;
}

/* ── Patch Block for Hardcoded Grays ── */

html.dark-theme .ep-tag,
html.dark-theme .inspector-field-value,
html.dark-theme .inspector-prose .code-inline,
html.dark-theme .mini-qr-preview,
html.dark-theme .playlist-empty-state,
html.dark-theme .sharing-qr-section {
    background: var(--primary-subtle);
    color: var(--text-main);
    border-color: var(--primary-dim);
}

html.dark-theme .queue-item,
html.dark-theme .playlist-item,
html.dark-theme .inspector-related-item,
html.dark-theme .player-transport-row,
html.dark-theme .player-transport-controls,
html.dark-theme .sidebar-content,
html.dark-theme .pc-preview-item {
    border-color: var(--primary-dim);
}

html.dark-theme .playlist-controls,
html.dark-theme .inspector-related-item:hover,
html.dark-theme .queue-item:hover {
    background: var(--primary-subtle);
}

/* Fix the Interactive Game Cards (from interactive.css) */
html.dark-theme .game-card,
html.dark-theme .game-card-score {
    background: var(--bg-panel);
}