:root {
    --bg-dark: #031520;
    --card-bg: #072331;
    --card-hover: #0c3144;
    --sidebar-bg: #041a27;
    --accent-orange: #fbaa19;
    --teal-border: rgba(71, 195, 212, 0.2);
    --text-main: #e2e8f0;
    --text-muted: #88a0b0;
    --cyan-icon: #47c3d4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    background-color: var(--bg-dark);
    color: var(--text-main); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
input, button, select { font-family: inherit; font-size: inherit; }

/* Splash Screen */
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); display: flex; justify-content: center; align-items: center;
    z-index: 9999; transition: opacity 0.8s ease, visibility 0.8s;
}
.splash-logo { width: 100px; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.08); opacity: 1; } }
#splash-screen.fade-out { opacity: 0; visibility: hidden; }

/* Top Bar */
.top-bar {
    display: flex; align-items: center; background: rgba(2, 14, 22, 0.95);
    border-bottom: 1px solid var(--teal-border); height: 38px; padding: 0 16px;
    font-size: 0.82rem; position: sticky; top: 0; z-index: 100;
}
.top-bar-left {
    display: flex; align-items: center; gap: 18px; color: #64b5f6;
    font-weight: 500; white-space: nowrap; padding-right: 20px;
    border-right: 1px solid var(--teal-border); flex-shrink: 0;
}
.ticker-wrap { flex: 1; overflow: hidden; white-space: nowrap; padding-left: 15px; }
.ticker { display: inline-block; animation: scrollTicker 180s linear infinite; font-size: 0.82rem; }
@keyframes scrollTicker { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }
.ticker-link { color: var(--text-main); text-decoration: none; margin-right: 20px; }
.ticker-link:hover { color: var(--accent-orange); }

/* Main Layout */
.app-layout { display: flex; width: 100%; min-height: calc(100vh - 38px); }
.workspace { flex: 1; padding: 30px 40px; max-width: 1400px; }

/* Workspace Header */
.workspace-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.main-title { font-size: 2.2rem; font-weight: 700; color: #ffffff; }
.header-tools { display: flex; gap: 8px; }
.tool-btn {
    background: var(--card-bg); border: 1px solid var(--teal-border); color: var(--text-main);
    padding: 6px 14px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.tool-btn:hover { background: var(--card-hover); border-color: #47c3d4; }
.tool-btn.red { color: #ff6b6b; }
.tool-btn.red:hover { background: rgba(255, 107, 107, 0.15); }

/* Search Bars */
.search-section { display: flex; flex-direction: column; gap: 12px; margin-bottom: 35px; width: 100%; max-width: 700px; margin-left: auto; margin-right: auto; }
.search-bar {
    display: flex; align-items: center; background: #041926; border: 1px solid var(--teal-border);
    border-radius: 8px; padding: 6px 14px; gap: 10px;
}
.search-bar input { background: transparent; border: none; outline: none; color: #ffffff; font-size: 0.95rem; flex: 1; }
.search-icon { color: var(--text-muted); font-size: 0.9rem; }
.engine-toggles { display: flex; gap: 4px; }
.engine-btn {
    background: transparent; border: none; color: var(--text-muted); padding: 4px 10px;
    font-size: 0.8rem; border-radius: 4px; cursor: pointer; font-weight: 600;
}
.engine-btn.active { background: var(--accent-orange); color: #000; }

/* Content Blocks */
.content-block { margin-bottom: 35px; }
.block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.block-header h3 { font-size: 1.2rem; font-weight: 600; }
.block-header.collapsible { cursor: pointer; }

.btn-orange {
    background: var(--accent-orange); border: none; color: #000; font-weight: 700;
    padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; transition: transform 0.15s;
}
.btn-orange:hover { transform: translateY(-1px); }

/* Master Links Grid */
.master-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 14px;
}
.master-card {
    background: var(--card-bg);
    border: 1px solid var(--teal-border);
    border-radius: 10px;
    aspect-ratio: 1 / 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.master-card:hover {
    border-color: var(--accent-orange);
    background: var(--card-hover);
    box-shadow: 0 0 12px rgba(251, 170, 25, 0.2);
}
.master-card.dragging, .sidebar-item.dragging, .sticky-note.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}
.master-card-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    margin-bottom: 8px;
    border-radius: 6px;
    pointer-events: none;
}
.master-card-title {
    color: var(--text-main);
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    pointer-events: none;
}

/* Card Controls - Matching Requested Icon Style */
.card-hover-toolbar {
    position: absolute;
    top: 6px;
    left: 6px;
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(3, 21, 32, 0.92);
    padding: 3px 6px;
    border-radius: 4px;
    z-index: 10;
}
.master-card:hover .card-hover-toolbar { display: flex; }

.toolbar-btn {
    background: transparent;
    border: none;
    color: var(--cyan-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
    transition: color 0.15s, transform 0.1s;
}
.toolbar-btn:hover { color: #ffffff; transform: scale(1.1); }
.toolbar-btn.del { color: #ff6b6b; }
.toolbar-btn.del:hover { color: #ff3333; }
.toolbar-btn.drag-handle { cursor: grab; }

/* Attached Notes Popover */
.card-notes-popover {
    position: absolute;
    top: 105%;
    left: 0;
    width: 230px;
    background: #02111b;
    border: 1px solid var(--accent-orange);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.75rem;
    color: #d0d8e0;
    z-index: 50;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    display: none;
    cursor: text;
}
.card-notes-popover:focus { outline: 1px solid #47c3d4; }
.master-card:hover .card-notes-popover { display: block; }
.card-notes-popover:empty:before {
    content: "Click to add notes...";
    color: rgba(226, 232, 240, 0.4);
}

/* Music Section */
.music-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 14px; }
.music-card {
    background: var(--card-bg); border: 1px solid var(--teal-border); border-radius: 12px;
    padding: 20px 15px; display: flex; flex-direction: column; align-items: center; transition: all 0.2s;
}
.music-card:hover { border-color: var(--accent-orange); background: var(--card-hover); }
.music-icon-circle {
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: bold; font-size: 1.1rem; margin-bottom: 10px; color: #fff;
}
.music-icon-circle.blue { background: #1e88e5; }
.music-icon-circle.green { background: #1ed760; }
.music-icon-circle.dark-blue { background: #0d47a1; }
.music-icon-circle.gold { background: var(--accent-orange); color: #000; }
.music-title { color: #fff; font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.music-sub { color: var(--text-muted); font-size: 0.78rem; }

.live-player-banner {
    background: var(--card-bg); border: 1px solid var(--teal-border); border-radius: 10px;
    padding: 12px 20px; display: flex; align-items: center; gap: 15px; transition: all 0.2s;
}
.live-player-banner:hover { border-color: var(--accent-orange); background: var(--card-hover); }
.player-icon-circle { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.player-info strong { display: block; color: #fff; font-size: 0.9rem; }
.player-info span { color: var(--text-muted); font-size: 0.78rem; }

/* Sticky Notes */
.notes-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.sticky-note {
    background: #ffe066; color: #111; border-radius: 8px; padding: 12px;
    min-height: 110px; display: flex; flex-direction: column; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s; cursor: grab;
}
.sticky-note:focus-within {
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    min-height: 150px;
}
.note-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.note-color-picker { display: flex; gap: 4px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; cursor: pointer; border: 1px solid rgba(0,0,0,0.2); }
.color-dot:hover { transform: scale(1.3); }
.note-body { flex: 1; outline: none; font-size: 0.85rem; font-weight: 600; white-space: pre-wrap; cursor: text; }

/* Right Sidebar */
.sidebar-right {
    width: 250px; background: var(--sidebar-bg); border-left: 1px solid var(--teal-border);
    padding: 20px 16px;
}
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.sidebar-header h3 { font-size: 1rem; color: #fff; }
.sidebar-list { display: flex; flex-direction: column; gap: 8px; }
.sidebar-item {
    background: #072230; border: 1px solid var(--teal-border); border-radius: 6px;
    padding: 8px 10px; display: flex; align-items: center; justify-content: space-between;
    font-size: 0.82rem; cursor: grab; transition: border-color 0.2s;
}
.sidebar-item:hover { border-color: var(--accent-orange); background: #0c3144; }
.sidebar-item a { color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; margin: 0 6px; }
.sidebar-item-actions { display: flex; gap: 6px; }
.sidebar-action-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 0.8rem; }
.sidebar-action-btn:hover { color: #fff; }
.sidebar-action-btn.del:hover { color: #ff6b6b; }

.add-btn-small { background: var(--card-bg); border: 1px solid var(--teal-border); color: var(--text-main); border-radius: 4px; padding: 2px 8px; cursor: pointer; }
.add-btn-small:hover { background: var(--accent-orange); color: #000; }