:root {
    --bg-page: #0b0b0b;
    --bg-panel: #121212;
    --bg-search: #1e1e1e;
    --accent: #ff8c00;
    --text-main: #f1f1f1;
    --text-dim: #8e8e8e;
    --font-main: 'Space Grotesk', sans-serif;
    --radius: 16px;
    --margin: 12px;
}

/* Loading splash: full-viewport overlay shown at app start while init runs.
   Same background as the page so the transition into the app is invisible
   except for the wordmark fading out. pointer-events on the splash blocks
   clicks until JS removes the splash; .splash-hidden triggers the fade. */
.loading-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Generous fade so the wordmark settles gracefully into the UI. */
    transition: opacity 0.8s ease-out, visibility 0s linear 0.8s;
}
.loading-splash.splash-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.splash-wordmark {
    /* Large and prominent. Capped so it never feels comical on very wide
       displays. The 200x48 viewBox scales to give the V's roughly 130-200px
       of height depending on window width — clearly the focal point. */
    width: min(70vw, 800px);
    height: auto;
}
/* Match the sidebar wordmark's typography: same font-family, weight 700,
   the same dim base + bright wave layering. The wave SVG already animates
   internally via <animateTransform>; we add no additional CSS animation. */
.splash-wordmark text {
    font-family: var(--font-main);
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 34px;
}
.splash-wordmark .brand-base { fill: var(--text-main); fill-opacity: 0.18; }
.splash-wordmark .brand-wave { fill-opacity: 1; }

/* Wave animation. The path inside the wave pattern slides 40 SVG units to
   the right and repeats, identical to the SMIL animation used in the
   sidebar wordmark. CSS-driven so it starts on the first painted frame —
   SMIL was running ~half a second late on first load. */
.splash-wave-path {
    animation: splashWaveSlide 2.4s linear infinite;
}
@keyframes splashWaveSlide {
    from { transform: translate(0, 0); }
    to   { transform: translate(40px, 0); }
}

/* Material Symbols Thin */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    display: inline-block;
    vertical-align: middle;
}

.scrollable::-webkit-scrollbar { width: 8px; }
.scrollable::-webkit-scrollbar-track { background: transparent; }
.scrollable::-webkit-scrollbar-thumb { 
    background: #252525; 
    border-radius: 10px; 
    border: 2px solid var(--bg-panel); 
}

* { box-sizing: border-box; }
body, html {
    margin: 0; padding: 0;
    font-family: var(--font-main);
    font-weight: 300;
    background-color: var(--bg-page);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    grid-template-rows: 1fr 100px;
    height: 100vh;
    padding: var(--margin);
    gap: var(--margin);
    transition: grid-template-columns 0.3s ease;
}

.sidebar-collapsed { grid-template-columns: 80px 1fr 300px; }

aside, main, .right-panel {
    background-color: var(--bg-panel);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    min-height: 0;
    position: relative;
}

/* Bottom-up gradient overlay on each panel, communicating that the panel
   ends there (content beneath this area fades into the panel background).
   pointer-events:none so clicks pass through to the underlying content. */
aside::after, main::after, .right-panel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    pointer-events: none;
    z-index: 5;
    /* Match the panel's rounded bottom corners so the overlay doesn't stick
       out of the panel visually. */
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    background: linear-gradient(
        to top,
        rgba(18, 18, 18, 0.95) 0%,
        rgba(18, 18, 18, 0.85) 35%,
        rgba(18, 18, 18, 0.70) 50%,
        rgba(18, 18, 18, 0.40) 65%,
        rgba(18, 18, 18, 0.10) 80%,
        rgba(18, 18, 18, 0) 100%
    );
}

aside { padding: 24px 16px; position: relative; }
.sidebar-header {
    height: 80px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: stretch;
    flex-shrink: 0;
}
.brand-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding-bottom: 12px;
}

/* Two wordmarks live in the same slot. The "full" (VIBEO) shows when the
   sidebar is expanded; the "compact" (V) shows when collapsed. Stacked
   absolutely so swapping is just an opacity flip. */
.brand-wordmark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: block;
}
.brand-wordmark text {
    font-family: var(--font-main);
    font-weight: 700;
    letter-spacing: 0.04em;
}
.brand-wordmark .brand-base {
    fill: var(--text-main);
    fill-opacity: 0.18;
}
.brand-wordmark .brand-wave { fill-opacity: 1; }

/* Full wordmark: wide, fills the sidebar's content area. */
.brand-full {
    width: 100%;
    height: auto;
    aspect-ratio: 200 / 48;
}
.brand-full text { font-size: 34px; }

/* Compact wordmark: square, fills the 48px-ish content area of the
   collapsed 80px sidebar. */
.brand-compact {
    width: 48px;
    height: 48px;
}
.brand-compact text { font-size: 34px; }

/* Default: show full wordmark, hide compact. */
.brand-full { opacity: 1; }
.brand-compact { opacity: 0; }

/* Collapsed: flip which one is visible. */
.sidebar-collapsed .brand-full { opacity: 0; }
.sidebar-collapsed .brand-compact { opacity: 1; }

.nav-link {
    display: flex; align-items: center; gap: 18px;
    color: var(--text-dim); text-decoration: none;
    padding: 12px 14px; border-radius: 10px; transition: 0.2s;
}
/* Let the label expand so any trailing element (e.g. now-playing indicator)
   sits flush against the right edge of the link. */
.nav-link .nav-text { flex: 1; min-width: 0; }

/* Sidebar Hover Effect matched to list results */
.nav-link:hover { background: rgba(255,255,255,0.03); color: white; }
.nav-link.active { color: white; background: var(--bg-search); }
.nav-link.active .material-symbols-outlined { color: var(--accent); }

.sidebar-collapsed .nav-text { display: none; }
.sidebar-collapsed .sidebar-header { justify-content: center; }

.main-header {
    height: 80px;
    padding: 0 31px;
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.toggle-container { width: 40px; display: flex; align-items: center; }
.toggle-btn { color: var(--text-dim); cursor: pointer; transition: opacity 0.3s ease; }

.search-capsule {
    display: flex; align-items: center; 
    background-color: var(--bg-search);
    width: 580px; height: 42px; 
    border-radius: 21px; padding: 0 16px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Wrapper lets us position the suggestion dropdown directly under the capsule */
.search-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 580px;
    height: 42px;
    display: flex;
    align-items: center;
}
.search-wrap .search-capsule {
    position: relative;
    left: auto;
    transform: none;
    width: 100%;
}

.suggest-dropdown {
    position: absolute;
    top: calc(100% + 6px);  /* just below the capsule */
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 6px;
    z-index: 500;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    max-height: 360px;
    overflow-y: auto;
}
.suggest-dropdown::-webkit-scrollbar { width: 6px; }
.suggest-dropdown::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }

.suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 300;
    user-select: none;
}
.suggest-item.active,
.suggest-item:hover {
    background: var(--bg-search);
}
.suggest-icon {
    color: var(--text-dim);
    font-size: 18px !important;
    flex-shrink: 0;
}
.suggest-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text-main); font-family: var(--font-main); 
    font-weight: 300; padding: 0 12px; font-size: 0.95rem;
}

.main-content { flex: 1; padding: 10px 40px 80px 40px; overflow-y: auto; }
.page-view { display: none; }
.page-view.active { display: block; }

/* Shared section label — same style as the old #viewLabel */
.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 24px;
}

/* Start page: top row (Top Result card + Songs list) */
.start-top-row {
    display: grid;
    /* Top Result column is sized to its content (image + padding).
       Songs column takes all remaining space. */
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 32px;
    margin-bottom: 56px;
    align-items: start;
}
.top-result-column {
    min-width: 0;
    /* Reserve width equal to the populated card: 220 image + 2×24 padding. */
    width: 268px;
}
.songs-column {
    min-width: 0;
    /* Reserve approximate height so the layout doesn't jump as songs stream in.
       ~5 rows × ~60px + label space. */
    min-height: 380px;
}

.top-result-card {
    background: #161616;
    border-radius: 14px;
    padding: 24px;
    transition: background 0.2s;
    /* Reserve the populated size so the card doesn't pop into existence tiny
       then grow. Height matches: 220 image + 20 margin + ~70 text block. */
    min-width: 220px;
    min-height: 290px;
    box-sizing: content-box;
}
.top-result-card:hover {
    background: #1c1c1c;
}
.top-card-img {
    /* Fixed dimensions so the card (sized to max-content) has predictable width. */
    width: 220px;
    height: 220px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.top-card-title {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.2;
    /* Constrain to match image width so long titles wrap rather than
       stretching the max-content card. */
    max-width: 220px;
    word-wrap: break-word;
}
.top-card-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    max-width: 220px;
}
.top-card-artist {
    font-size: 0.85rem;
    color: var(--text-dim);
    max-width: 220px;
    word-wrap: break-word;
}

/* Featuring / albums grid — wraps to multiple rows rather than scrolling
   horizontally. Tiles stretch to fill the row evenly so there's no dead
   space on the right. */
.albums-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 24px 20px;
    padding-bottom: 8px;
}

.album-tile {
    /* Width is controlled by the grid column — no fixed width here. */
    min-width: 0;
    cursor: pointer;
    transition: opacity 0.15s;
    user-select: none;
}
.album-tile:hover { opacity: 0.85; }
.album-tile-img {
    /* Square tile that matches the column width. */
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    background: #1c1c1c;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    margin-bottom: 10px;
}
.album-tile-title {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 400;
    margin-bottom: 4px;
    /* Truncate titles longer than the tile width. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.album-tile-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Album tabs in sidebar */
.album-link .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
#albumsNav { margin-top: 8px; }

/* Start-page related content sections */
.related-section {
    margin-bottom: 40px;
}
.related-section .section-label {
    margin-bottom: 18px;
}
.related-loading {
    color: var(--text-dim);
    font-size: 0.9rem;
    padding: 10px 0;
}

/* Empty-state prompt shown on Search and Start tabs before content */
.empty-state {
    color: var(--text-dim);
    font-size: 0.95rem;
    padding: 40px 0;
    text-align: left;
}

/* Section header — aligns the label with an optional inline spinner */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.section-header .section-label {
    margin-bottom: 0;
}

/* Right-aligned action link in a section header (e.g., "SHOW MORE"). */
.section-action {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}
.section-action:hover { color: var(--text-main); }

/* Small inline spinner that sits next to section headers. Matches the header
   text height (~14px) so it looks like a sibling glyph rather than a separate
   loading banner. Hidden by default; add .active to show. */
.header-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #2a2a2a;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    display: none;
    flex-shrink: 0;
}
.header-spinner.active { display: inline-block; }

/* Search loading state — spinner + text shown while MB verifies results */
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 0;
    gap: 16px;
}
.search-loading-text {
    color: var(--text-dim);
    font-size: 0.9rem;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #2a2a2a;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* TRACK LIST */
.track-row {
    display: grid; 
    grid-template-columns: 40px 50px 1fr auto;
    align-items: center; 
    padding: 15px 30px 15px 15px; 
    border-radius: 12px;
    cursor: pointer; 
    transition: 0.2s; 
    gap: 20px; 
    color: var(--text-main);
    margin: 0; 
}
/* Zebra-striping: every other row picks up the Top Result card's
   background color (#161616) so lists feel cohesive with the Start tab.
   Hover overrides this with the accent-tinted row hover color regardless
   of whether the row was zebra-striped or not. */
.track-row:nth-child(even) { background: #161616; }
.track-row:hover,
.track-row:nth-child(even):hover { background: rgba(255,255,255,0.03); }
.track-row.playing,
.track-row:nth-child(even).playing { background: var(--bg-search); }

/* Drag-reorder feedback (only shown while user drags a row in a list view) */
.track-row.drag-source { opacity: 0.35; }
.track-row.drag-over { box-shadow: inset 0 2px 0 0 var(--accent); }
.track-row[draggable="true"] { cursor: grab; }
.track-row[draggable="true"]:active { cursor: grabbing; }

.track-row.playing .t-index { 
    color: var(--accent) !important; 
    font-weight: 500; 
}

.t-index { font-size: 0.9rem; color: var(--text-dim); text-align: center; }
.t-img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.t-info { overflow: hidden; }
.t-title { font-weight: 400; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.t-artist { color: var(--text-dim); font-size: 0.85rem; }
.t-dur { color: var(--text-dim); text-align: right; font-size: 0.85rem; min-width: 40px; }

.right-panel { overflow: hidden; }
.right-panel-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 24px; padding-bottom: 80px; }

/* Top-right image: shows track thumbnail by default, or artist logo when found.
   Logos are usually transparent wide PNGs, so we give them padding + no radius
   so they breathe on the dark panel instead of looking cramped. */
#rpImg.is-logo {
    background: transparent;
    border-radius: 0;
    padding: 12px 8px;
    object-fit: contain;
    max-height: 140px;
    width: 100%;
}

.about-box { margin-top: 15px; }
.about-header { font-weight: 450; font-size: 1.1rem; margin-bottom: 12px; color: var(--text-main); }
.about-txt { font-size: 0.85rem; color: var(--text-dim); line-height: 1.6; }

footer { 
    grid-column: 1 / 4; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    position: relative;
    padding: 0 20px;
}

.now-playing { display: flex; align-items: center; gap: 15px; width: 320px; overflow: hidden; }
.now-playing img { width: 56px; height: 56px; border-radius: 8px; flex-shrink: 0; }

/* Oscilloscope divider — replaces the old <hr> under track info.
   Thin orange line when idle (amplitude is zero), animates to a live waveform
   when audio plays. Height is intentionally small so it reads as a divider. */
.osc-divider {
    width: 100%;
    height: 28px;
    margin: 20px 0;
    display: flex;
    align-items: center;
}
.osc-divider canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Volume controls in the bottom-right footer slot */
.volume-slot {
    width: 320px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-right: 20px;
}
.volume-icon {
    font-size: 34px !important;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s;
    user-select: none;
}
.volume-icon:hover { color: var(--text-main); }
.volume-icon.muted { color: var(--accent); }

/* Cast icon sits to the left of the mute icon. The "cast" glyph reads
   denser/bolder than volume_mute at the same size, so we shrink it and
   trim the optical-size axis so the strokes feel comparable to the mute
   icon's weight. .active turns it the same accent orange used by the
   shuffle/repeat buttons, signalling that a cast session is live. */
.volume-icon.devices-icon {
    font-size: 22px !important;
    font-variation-settings: 'opsz' 24, 'wght' 300;
}
.volume-icon.devices-icon.active,
.volume-icon.devices-icon.active:hover {
    color: var(--accent) !important;
}

.volume-slider {
    -webkit-appearance: none;
    width: 120px;
    background: transparent;
    cursor: pointer;
}

/* Wrapper so the tooltip can position absolutely above the slider */
.volume-slider-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Volume tooltip — matches the context menu visual style (dark bg, subtle border) */
.volume-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.volume-tooltip.visible {
    opacity: 1;
}

.player-center { 
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
    width: 550px; 
}

.playback-btns { display: flex; align-items: center; gap: 24px; }
.play-icon { font-size: 44px !important; color: white; cursor: pointer; transition: color 0.2s; }
.play-icon.playing { color: var(--accent) !important; }

.control-icon { font-size: 24px !important; color: var(--text-dim); cursor: pointer; transition: color 0.2s; }
.skip-ctrl { font-size: 34px !important; }

.playback-btns .control-icon:hover, 
.playback-btns .play-icon:hover { 
    color: var(--accent) !important; 
}

.btn-orange { color: var(--accent) !important; }

.progress-wrap { width: 100%; display: flex; align-items: center; gap: 12px; }
.time-label { font-size: 0.7rem; color: var(--text-dim); min-width: 35px; }

input[type="range"] { -webkit-appearance: none; flex: 1; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track {
    height: 2px;
    /* Two-tone track: orange up to --progress%, then dim gray beyond.
       Hard stop via `0%` gradient trick so there's no blend. */
    background: linear-gradient(to right,
        var(--accent) 0%,
        var(--accent) var(--progress, 0%),
        #333 var(--progress, 0%),
        #333 100%);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 10px; width: 10px; border-radius: 50%; background: white; margin-top: -4px;
}
/* Firefox uses different pseudo-elements */
input[type="range"]::-moz-range-track {
    height: 2px;
    background: linear-gradient(to right,
        var(--accent) 0%,
        var(--accent) var(--progress, 0%),
        #333 var(--progress, 0%),
        #333 100%);
    border: none;
}
input[type="range"]::-moz-range-thumb {
    height: 10px; width: 10px; border-radius: 50%; background: white; border: none;
}

/* ============================================================
   Sidebar: Lists section
   ============================================================ */
.sidebar-divider {
    border: 0;
    border-top: 1px solid #222;
    margin: 20px 8px;
}

.lists-header {
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0 14px;
    margin-bottom: 10px;
    height: 16px;
}

.sidebar-collapsed .sidebar-divider { margin: 20px 4px; }
.sidebar-collapsed .lists-header { visibility: hidden; }

#listsNav {
    /* Let it scroll if many lists accumulate */
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
#listsNav::-webkit-scrollbar { width: 6px; }
#listsNav::-webkit-scrollbar-thumb { background: #252525; border-radius: 6px; }

.list-link .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

/* Search tab's label changes to the query; ellipsize if long */
#navSearchLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

/* Sidebar nav-link currently driving playback — glows orange even when viewing elsewhere */
.nav-link.is-playing-source,
.nav-link.is-playing-source .nav-text {
    color: var(--accent);
}
.nav-link.is-playing-source .material-symbols-outlined {
    color: var(--accent);
}

/* "music_cast" right-side indicator on each nav-link.
   Hidden by default; shown only on the link currently sourcing playback,
   where it slowly blinks to draw the eye to the active source. Same size
   as the list/nav icons so it lines up visually.
   The !important on the default `display: none` is needed because the
   shared `.material-symbols-outlined` base rule sets `display: inline-block`
   at equal specificity, and source order alone wasn't winning consistently. */
.now-playing-indicator {
    display: none !important;
    margin-left: auto;
    color: var(--accent);
}
.nav-link.is-playing-source .now-playing-indicator {
    display: inline-block !important;
    animation: now-playing-blink 1.6s ease-in-out infinite;
}
/* Hide the indicator entirely when the sidebar is collapsed (label hidden) */
.sidebar-collapsed .now-playing-indicator { display: none !important; }

@keyframes now-playing-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* ============================================================
   Context menu
   ============================================================ */
.ctx-menu {
    position: fixed;
    z-index: 1000;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 4px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    font-size: 0.85rem;
    color: var(--text-main);
    user-select: none;
}

.ctx-item {
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    white-space: nowrap;
}

.ctx-item:hover {
    background: var(--bg-search);
}

.ctx-item.has-submenu:hover,
.ctx-item.submenu-open {
    background: var(--bg-search);
}

.ctx-item.submenu-open .ctx-submenu {
    display: block;
}

.ctx-arrow {
    color: var(--text-dim);
    font-size: 1rem;
    margin-left: 12px;
}

.ctx-separator {
    height: 1px;
    background: #2a2a2a;
    margin: 4px 6px;
}

.ctx-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -5px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 4px;
    min-width: 180px;
    max-height: 360px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    /* No left margin: the submenu touches the parent edge directly so the
       cursor cannot fall through a gap and accidentally close it. */
    margin-left: 0;
}

.ctx-submenu::-webkit-scrollbar { width: 6px; }
.ctx-submenu::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }

/* ============================================================
   Modal dialog
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 28px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 450;
    margin-bottom: 20px;
    color: var(--text-main);
}

.modal-input {
    width: 100%;
    background: var(--bg-search);
    border: 1px solid #2a2a2a;
    color: var(--text-main);
    font-family: var(--font-main);
    font-weight: 300;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 24px;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-btn-cancel {
    background: transparent;
    color: var(--text-dim);
}
.modal-btn-cancel:hover { color: var(--text-main); }

.modal-btn-ok {
    background: var(--accent);
    color: #111;
    font-weight: 500;
}
.modal-btn-ok:hover { filter: brightness(1.1); }

/* Danger variant for destructive confirm buttons (delete list, etc.) */
.modal-btn-danger {
    background: #e33b3b;
    color: #fff;
}
.modal-btn-danger:hover { filter: brightness(1.1); }

.modal-message {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 24px;
}