:root {
    /* Light Mode Variables (Technical/Sketchy) */
    --bg-body: #ece5d7;
    --bg-panel: rgba(255, 255, 255, 0.6);
    --bg-hover: rgba(0, 0, 0, 0.05);
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --border-color: #1a1a1a;
    --waveform-bg: rgba(0, 0, 0, 0.1); 
    --waveform-fill: #1a1a1a;
    --ring-color: #f97316;
}

[data-theme="dark"] {
    /* Dark Mode Variables (Industrial/Night) */
    --bg-body: #121212;
    --bg-panel: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.08);
    --text-main: #ece5d7;
    --text-muted: #888888;
    --border-color: #ece5d7;
    --waveform-bg: rgba(255, 255, 255, 0.15);
    --waveform-fill: #ece5d7;
    --ring-color: #f97316;
}

/* Prevent Image Dragging Globally */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    pointer-events: none; /* Allows clicking through overlays, careful with functional images */
}

/* Re-enable pointer events for functional images if any, or wrap them */
.artwork-container img {
    pointer-events: none;
}

html, body {
    overflow-x: hidden; /* Fixes mobile layout issues where large SVGs cause horizontal scrolling */
    width: 100%;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.4s ease, color 0.4s ease;
    font-family: 'Space Mono', monospace;
}

/* SVG Highlights */
.highlight-wrapper {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    z-index: 10;
}

.highlight-scribble {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Scale increased to 4.2 */
    transform: translate(-50%, -50%) scale(4.2) rotate(-5deg);
    width: 120%;
    height: 120%;
    z-index: 20; /* Sits ON TOP of the text */
    pointer-events: none;
    opacity: 0.9;
    /* Orange filter for #f97316 */
    filter: invert(53%) sepia(63%) saturate(2689%) hue-rotate(345deg) brightness(99%) contrast(98%);
    mix-blend-mode: multiply; /* Helps text readability underneath in light mode */
}

[data-theme="dark"] .highlight-scribble {
     mix-blend-mode: normal; /* Normal for dark mode to ensure visibility */
}

/* Dark Mode: Ensure DAW icons are visible (inverted) */
[data-theme="dark"] .daw-icons {
    filter: invert(1) brightness(0.8);
}

/* Technical Borders */
.tech-border {
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0px var(--border-color);
    transition: all 0.3s ease;
}

/* Player Vault */
.player-vault {
    width: 100%;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.sample-row {
    height: 56px; 
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}
.sample-row:last-child { border-bottom: none; }
.sample-row:hover { background-color: var(--bg-hover); }
.sample-row.active-row { background-color: var(--bg-hover); }

/* Unified Grid/Flex System */
.vault-row, .vault-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    gap: 16px;
}

.vault-header {
    height: 48px;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.vault-row {
    height: 100%;
}

/* COLUMN DEFINITIONS */
.col-play { width: 32px; flex-shrink: 0; display: flex; justify-content: center; }
.col-info { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.col-wave { width: 120px; flex-shrink: 0; display: flex; align-items: center; }
.col-meta { width: 60px; flex-shrink: 0; text-align: center; font-size: 0.8rem; }
.col-action { width: 40px; flex-shrink: 0; display: flex; justify-content: flex-end; }

@media (min-width: 768px) {
    .col-play { width: 48px; }
    .col-wave { width: 280px; }
    .col-meta { width: 80px; }
}

/* Specialized Layout for One Shots */
.hide-bpm .col-bpm { display: none !important; }
.hide-bpm .col-wave { width: 140px; }

@media (min-width: 768px) {
    .hide-bpm .col-wave { width: 220px; }
}

/* Waveform Inner */
.waveform-container {
    position: relative;
    height: 36px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.waveform-svg { width: 100%; height: 100%; display: block; }
.waveform-bg { fill: var(--waveform-bg); }
.waveform-fill { fill: var(--waveform-fill); }
.waveform-progress-wrap {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    clip-path: inset(0 100% 0 0);
    z-index: 2;
    pointer-events: none;
    border-right: 2px solid var(--ring-color);
}

/* Controls */
.btn-control {
    color: var(--text-main);
    transition: transform 0.1s;
    opacity: 0.7;
    cursor: pointer;
}
.btn-control:hover { transform: scale(1.1); opacity: 1; color: var(--ring-color); }
.btn-loop.active { color: var(--ring-color); opacity: 1; }

/* Typography */
.font-tech { font-family: 'Space Mono', monospace; }
.title-sub { color: var(--text-muted); font-size: 0.7rem; }

/* Animations */
.sample-container {
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 2000px;
    overflow: hidden;
}
.sample-container.collapsed { max-height: 280px; }

/* Icon rotation for character */
.char-icon {
    transform: rotate(-5deg);
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(5px 5px 0px rgba(0,0,0,0.1));
}
.char-icon:hover {
    transform: rotate(0deg) scale(1.05);
}
[data-theme="dark"] .char-icon {
    filter: invert(1) brightness(0.9) drop-shadow(5px 5px 0px rgba(255,255,255,0.1));
}

/* Artwork Styles */
.artwork-container {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: 8px 8px 0px var(--border-color);
}
.artwork-container img {
    transition: transform 0.5s ease;
}
.artwork-container:hover img {
    transform: scale(1.02);
}

/* Tech Box Hover Effects */
.tech-box .default-content {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.tech-box .hover-content {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    pointer-events: none;
}
.tech-box:hover .default-content {
    opacity: 0;
    transform: translateY(-10px);
}
.tech-box:hover .hover-content {
    opacity: 1;
}

/* Ticker Animation */
@keyframes ticker-move {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}
.ticker-wrapper {
    display: flex;
    overflow: hidden;
    mask-image: linear-gradient(to right, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
}
.ticker-content {
    display: flex;
    white-space: nowrap;
    animation: ticker-move 30s linear infinite;
}
.ticker-item {
    flex-shrink: 0;
    padding-right: 1.5rem;
}

/* Loader */
#loader {
    position: fixed;
    inset: 0;
    background-color: var(--bg-body);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}
.loader-bar-bg {
    width: 200px;
    height: 4px;
    background: var(--text-muted);
    opacity: 0.2;
    margin-top: 1rem;
}
.loader-bar-fill {
    height: 100%;
    background: var(--ring-color);
    width: 0%;
    transition: width 0.2s linear;
}

/* Buy Tooltip */
#buy-tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--text-main);
    color: var(--bg-body);
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 4px 4px 0px var(--ring-color);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}