/* Global Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base Body Styles */
body {
    font-family: var(--font-family-player, 'Arial', sans-serif);
    background-color: #1a1a1a; /* Dark background for the page */
    color: var(--player-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent body scrollbars */
    user-select: none; /* Prevent text selection within player */
    cursor: var(--player-cursor, default); /* Default cursor, can be overridden by skin */
    -webkit-font-smoothing: antialiased; /* For better text rendering */
    -moz-osx-font-smoothing: grayscale; /* For better text rendering */
}

/* CSS Variables for Skinnability (Default Skin - Classic Winamp Grey) */
:root {
    /* Main Player Colors */
    --player-bg: #2d2d2d; /* Main background for windows */
    --player-border: #000; /* Outer border of the main container */
    --player-text: #c0c0c0; /* General text color */
    --player-accent: #00ff00; /* Green display text, active states */
    --player-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5); /* Drop shadow for container */

    /* 3D Border Effects */
    --border-light: rgba(255, 255, 255, 0.2); /* Light side of 3D border */
    --border-dark: rgba(0, 0, 0, 0.5); /* Dark side of 3D border */

    /* Buttons (General) */
    --button-bg: #808080;
    --button-text: #000;
    --button-hover-bg: #a0a0a0;
    --button-active-bg: #606060;

    /* Input/Display Fields */
    --input-bg: #000;
    --input-text: var(--player-accent); /* Green text on black background */
    --progress-bar-fill: var(--player-accent); /* Color for progress/volume bar fill */

    /* Window Header */
    --window-header-bg: #1a1a1a;
    --window-header-text: #c0c0c0;
    --window-control-bg: #606060;
    --window-control-hover-bg: #808080;
    --window-control-active-bg: #404040;

    /* Playlist Specific */
    --playlist-item-bg: transparent;
    --playlist-item-hover-bg: rgba(255, 255, 255, 0.1);
    --playlist-item-active-bg: rgba(255, 255, 255, 0.2);
    --playlist-item-playing-bg: #000080; /* Dark blue for playing item */
    --playlist-item-playing-text: #ffffff; /* White text for playing item */

    /* Scrollbar */
    --scrollbar-thumb-color: var(--button-bg);
    --scrollbar-track-color: var(--player-bg);

    /* Context Menu */
    --context-menu-bg: #2d2d2d;
    --context-menu-border: #000;
    --context-menu-text: #c0c0c0;
    --context-menu-hover-bg: #000080;
    --context-menu-hover-text: #ffffff;

    /* Equalizer */
    --eq-slider-thumb: var(--player-accent);
    --eq-slider-track: var(--input-bg);
    --eq-control-bg: var(--button-bg);
    --eq-control-text: var(--button-text);
    --eq-control-hover-bg: var(--button-hover-bg);
    --eq-control-active-bg: var(--button-active-bg);

    /* Layout */
    --player-window-gap: 4px; /* Gap between windows in the main container */
    --font-family-player: 'Arial', sans-serif; /* Can be overridden by a pixel font */
    --player-cursor: default; /* Can be 'url(path/to/cursor.cur), auto' for custom cursors */
}

/* Modern Skin Example (to be applied via JS body class) */
body.modern-skin {
    --player-bg: #4a4a4a;
    --player-border: #333;
    --player-text: #e0e0e0;
    --player-accent: #ff6600; /* Orange accent */
    --button-bg: #6a6a6a;
    --button-text: #e0e0e0;
    --button-hover-bg: #7a7a7a;
    --button-active-bg: #5a5a5a;
    --input-bg: #2a2a2a;
    --input-text: var(--player-accent);
    --window-header-bg: #3a3a3a;
    --window-header-text: #e0e0e0;
    --window-control-bg: #5a5a5a;
    --window-control-hover-bg: #6a6a6a;
    --window-control-active-bg: #4a4a4a;
    --playlist-item-playing-bg: #ff6600;
    --playlist-item-playing-text: #ffffff;
    --context-menu-bg: #3a3a3a;
    --context-menu-border: #222;
    --context-menu-text: #e0e0e0;
    --context-menu-hover-bg: var(--player-accent);
    --context-menu-hover-text: #ffffff;
    --eq-slider-thumb: var(--player-accent);
    --eq-slider-track: var(--input-bg);
    --eq-control-bg: var(--button-bg);
    --eq-control-text: var(--button-text);
    --eq-control-hover-bg: var(--button-hover-bg);
    --eq-control-active-bg: var(--button-active-bg);
    /* Note: If custom cursors are used, ensure the path is correct */
    /* --player-cursor: url('assets/cursors/modern.cur'), auto; */
}


/* Main WebAmp Container */
/* This container acts as the desktop for the Winamp windows */
#webamp-container {
    background-color: var(--player-bg);
    border: 1px solid var(--player-border);
    box-shadow: var(--player-shadow);
    color: var(--player-text);
    padding: var(--player-window-gap);
    position: relative; /* For absolute positioning of draggable windows */
    overflow: hidden; /* Hide overflow if windows are positioned outside the container */
    min-width: 275px; /* Winamp classic width */
    max-width: 90vw;
    min-height: 116px; /* Main player height */
    max-height: 90vh;
    font-family: var(--font-family-player);
    /* Performance hint for transformations */
    will-change: transform, top, left, width, height;
}

/* Individual Player Windows (Main, Playlist, EQ) */
.window {
    background-color: var(--player-bg);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
    padding: 2px; /* Inner padding for the window content area */
    display: flex;
    flex-direction: column;
    position: absolute; /* Allows independent dragging and positioning */
    top: 0; /* Default position, will be set by JS */
    left: 0; /* Default position, will be set by JS */
    z-index: 10; /* Default z-index */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3); /* Shadow for individual windows */
    /* Transition for smooth movement/resize, add will-change for performance */
    transition: transform 0.1s ease-out, top 0.1s ease-out, left 0.1s ease-out, width 0.1s ease-out, height 0.1s ease-out;
    will-change: transform, top, left, width, height;
}

/* Window Header (Title Bar) */
.window-header {
    background-color: var(--window-header-bg);
    color: var(--window-header-text);
    height: 16px; /* Classic Winamp header height */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    font-size: 0.7em;
    cursor: grab; /* Indicates draggable */
    margin-bottom: 2px; /* Gap between header and content */
}

.window-header:active {
    cursor: grabbing;
}

.window-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.window-controls {
    display: flex;
    gap: 2px;
}

/* Window Control Buttons (Minimize, Maximize, Close) */
.window-controls button {
    width: 12px; /* Small, square buttons */
    height: 12px;
    background-color: var(--window-control-bg);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
    cursor: pointer;
    font-size: 0.6em; /* Smaller font for symbols */
    color: var(--window-header-text);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s ease;
    outline: 1px dashed var(--player-accent); /* Custom focus for a11y */
    outline-offset: 1px;
    flex-shrink: 0; /* Prevent shrinking on small screens */
}

.window-controls button:hover {
    background-color: var(--window-control-hover-bg);
}

.window-controls button:active,
.window-controls button:focus { /* Add focus state */
    background-color: var(--window-control-active-bg);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Specific button symbols (can be replaced with background images for authenticity) */
.minimize-button::before { content: '_'; }
.maximize-button::before { content: '[]'; }
.close-button::before { content: 'X'; }

/* Window States controlled by JS */
.window.minimized .window-content {
    display: none;
}

.window.minimized {
    height: 20px !important; /* Only header visible */
    padding: 0; /* Remove padding when minimized */
    overflow: hidden; /* Hide overflow */
    min-height: unset !important; /* Allow smaller height */
}

.window.maximized {
    width: calc(100% - var(--player-window-gap) * 2) !important; /* Fill container minus padding */
    height: calc(100% - var(--player-window-gap) * 2) !important;
    top: var(--player-window-gap) !important; /* Override JS positioning */
    left: var(--player-window-gap) !important; /* Override JS positioning */
    transform: none !important; /* Remove centering transform */
    z-index: 999; /* Bring to front */
}

.window.hidden {
    display: none !important; /* Force hide other windows when one is maximized */
}

/* Main Player Window */
#main-player {
    width: 275px; /* Classic Winamp width */
    height: 116px; /* Classic Winamp height */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center initially */
    z-index: 11; /* Higher z-index for main player */
    resize: both; /* Allow resizing, JS will manage min/max */
    min-width: 275px;
    min-height: 116px;
}

#main-player .window-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 18px); /* Account for header height + margin */
    justify-content: space-between;
}

/* Display Area (Track Info, Visualizer) */
#display-area {
    background-color: var(--input-bg);
    color: var(--input-text);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 4px;
    height: 50px; /* Approx height for display area */
    font-size: 0.8em;
    overflow: hidden;
}

#current-track-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 16px; /* Single line */
}

#visualizer-canvas {
    width: 100%;
    height: 30px; /* Space for visualizer */
    background-color: rgba(0, 0, 0, 0.3); /* Slightly transparent background */
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Time Display */
#time-display {
    background-color: var(--input-bg);
    color: var(--input-text);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 2px 4px;
    font-size: 0.8em;
    text-align: right;
    margin-top: 2px;
    display: flex; /* Make it a flex container */
    justify-content: space-between; /* Space out current and total time */
}

#current-time {
    flex-grow: 1;
    text-align: left;
}

#total-time {
    text-align: right;
}

/* Progress Slider */
#progress-slider {
    -webkit-appearance: none; /* Override default slider styles */
    appearance: none;
    width: 100%;
    height: 8px; /* Slimmer slider */
    background: var(--input-bg);
    outline: 1px dashed var(--player-accent);
    outline-offset: 1px;
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    margin-top: 2px;
}

/* Progress Slider Thumb (Handle) */
#progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--progress-bar-fill); /* Green thumb */
    border: 1px solid var(--progress-bar-fill); /* Small border */
    cursor: grab;
    border-radius: 2px;
}

#progress-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--progress-bar-fill);
    border: 1px solid var(--progress-bar-fill);
    cursor: grab;
    border-radius: 2px;
}

#progress-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px var(--player-accent); /* Focus style for thumb */
}

#progress-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 2px var(--player-accent);
}

/* Controls Area (Buttons, Volume, Modes) */
#controls {
    display: flex;
    flex-wrap: wrap; /* Allow controls to wrap if space is tight */
    gap: 2px;
    margin-top: 2px;
}

/* Generic Control Buttons */
.control-button, .action-button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8em;
    text-transform: uppercase;
    outline: 1px dashed var(--player-accent);
    outline-offset: 1px;
    transition: background-color 0.1s ease;
    min-width: 30px; /* Ensure buttons have minimum size */
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none; /* For potential future anchor buttons */
}

.control-button:hover, .action-button:hover {
    background-color: var(--button-hover-bg);
}

.control-button:active, .action-button:active,
.control-button:focus, .action-button:focus { /* Add focus state */
    background-color: var(--button-active-bg);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Specific button sizes/styles */
#prev-button, #play-button, #pause-button, #stop-button, #next-button {
    width: 40px; /* Wider playback buttons */
}
#play-button::before { content: '▶'; }
#pause-button::before { content: '||'; }
#stop-button::before { content: '■'; }
#prev-button::before { content: '«'; }
#next-button::before { content: '»'; }

/* Volume Controls */
#volume-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-grow: 1; /* Allows volume controls to take available space */
}

#volume-slider {
    -webkit-appearance: none; /* Override default slider styles */
    appearance: none;
    width: 100%;
    height: 8px; /* Slimmer slider */
    background: var(--input-bg);
    outline: 1px dashed var(--player-accent);
    outline-offset: 1px;
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    margin: 0;
}

/* Slider Thumb (Handle) */
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--progress-bar-fill); /* Green thumb */
    border: 1px solid var(--progress-bar-fill); /* Small border */
    cursor: grab;
    border-radius: 2px; /* Slight rounding for the thumb */
}

#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--progress-bar-fill);
    border: 1px solid var(--progress-bar-fill);
    cursor: grab;
    border-radius: 2px;
}

#volume-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px var(--player-accent); /* Focus style for thumb */
}

#volume-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 2px var(--player-accent);
}

#mute-button {
    width: 40px; /* Small mute button */
}
#mute-button::before { content: '🔇'; } /* Mute symbol */

/* Playback Modes (Shuffle, Repeat) */
#playback-modes {
    display: flex;
    gap: 2px;
}

#shuffle-button, #repeat-button {
    width: 60px; /* Wider buttons for text */
    font-size: 0.7em;
}

/* Active state for shuffle/repeat */
#shuffle-button.active, #repeat-button.active {
    background-color: var(--player-accent);
    color: var(--button-bg); /* Inverted text color */
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Repeat mode specific visual cues */
#repeat-button::before { content: 'Repeat'; } /* Default text */
#repeat-button.repeat-all::before { content: 'Repeat All'; }
#repeat-button.repeat-one::before { content: 'Repeat 1'; }

/* Player Bottom Actions (Add Files, Skin Selector, Toggle Buttons) */
#player-bottom-actions {
    display: flex;
    flex-wrap: wrap; /* Allow controls to wrap if space is tight */
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

#add-files-button {
    flex-grow: 1; /* Take available space */
    width: auto;
}

#skin-selector {
    background-color: var(--button-bg);
    color: var(--button-text);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8em;
    outline: 1px dashed var(--player-accent);
    outline-offset: 1px;
    height: 24px; /* Match button height */
    -webkit-appearance: none; /* Remove default select styling */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 16px;
    padding-right: 25px; /* Make space for the custom arrow */
}

#skin-selector:hover {
    background-color: var(--button-hover-bg);
}

#skin-selector:focus {
    background-color: var(--button-active-bg);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}


/* Playlist Window */
#playlist-window {
    width: 275px; /* Same width as main player for alignment */
    height: 200px; /* Example height, can be resized */
    top: calc(50% + 116px/2 + var(--player-window-gap)); /* Below main player */
    left: 50%;
    transform: translateX(-50%); /* Center below */
    display: flex;
    flex-direction: column;
    resize: vertical; /* Allow vertical resizing */
    min-height: 100px;
    overflow: hidden; /* Hide content overflow, playlist UL will scroll */
}

#playlist-window .window-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensure UL takes full height and scrolls */
}

#playlist {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto; /* Enable scrolling for long playlists */
    font-size: 0.8em;
    padding: 2px 0; /* Padding for list items */
    background-color: var(--input-bg); /* Background for playlist area */
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    color: var(--player-text);
}

#playlist li {
    padding: 2px 5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: var(--playlist-item-bg);
    color: var(--player-text);
    transition: background-color 0.1s ease;
}

#playlist li:hover {
    background-color: var(--playlist-item-hover-bg);
}

#playlist li.playing {
    background-color: var(--playlist-item-playing-bg);
    color: var(--playlist-item-playing-text);
}

#playlist li:focus { /* Add focus state for playlist items */
    outline: 1px dashed var(--player-accent);
    outline-offset: -1px; /* Inside the border */
}

/* Empty playlist message */
#playlist li.empty-playlist-message {
    font-style: italic;
    color: rgba(var(--player-text), 0.7);
    text-align: center;
    padding: 10px;
    cursor: default;
}

/* Dragging/Dropping Playlist Items */
#playlist li.dragging {
    opacity: 0.5;
    border: 1px dashed var(--player-accent);
}

#playlist li.drag-over {
    background-color: var(--playlist-item-active-bg);
}


/* Custom Scrollbar for Playlist */
#playlist::-webkit-scrollbar {
    width: 8px; /* Width of the scrollbar */
}

#playlist::-webkit-scrollbar-track {
    background: var(--scrollbar-track-color); /* Color of the track */
    border-left: 1px solid var(--border-dark);
    border-top: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

#playlist::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb-color); /* Color of the scroll thumb */
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
}

#playlist::-webkit-scrollbar-thumb:hover {
    background-color: var(--button-hover-bg);
}

/* Equalizer Window */
#equalizer-window {
    width: 275px;
    height: 116px; /* Same height as main player */
    top: calc(50% - 116px/2 - var(--player-window-gap)); /* Above main player */
    left: calc(50% + 275px/2 + var(--player-window-gap)); /* To the right of main player */
    z-index: 9; /* Lower z-index */
    display: none; /* Hidden by default until implemented in JS */
    resize: both; /* Allow resizing, JS will manage min/max */
    min-width: 275px;
    min-height: 116px;
}

#equalizer-window .window-content {
    height: calc(100% - 18px); /* Account for header height + margin */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: var(--player-text);
    background-color: var(--input-bg);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 5px;
}

#eq-bands {
    display: flex;
    gap: 5px;
    height: calc(100% - 30px); /* Leave space for controls at the bottom */
    align-items: flex-end; /* Align sliders to the bottom */
    width: 100%;
    justify-content: space-around;
    padding-bottom: 5px; /* Small padding before controls */
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Push freq label to bottom, slider above */
    height: 100%;
    flex-shrink: 0; /* Prevent shrinking too much */
    width: 10%; /* Divide space among 10 bands */
}

/* Vertical EQ Slider Styling */
.eq-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 10px; /* Width of the slider track */
    height: 80px; /* Height of the slider track */
    background: var(--eq-slider-track);
    outline: none;
    border: 1px solid var(--border-dark);
    margin: 0;
    cursor: ns-resize;
    writing-mode: bt-lr; /* For Firefox, makes it vertical */
    direction: rtl; /* For IE/Edge, makes value increase upwards */
    margin-bottom: 5px; /* Space between slider and freq label */
}

/* Specific styles for Webkit (Chrome/Safari) */
.eq-slider::-webkit-slider-runnable-track {
    width: 10px;
    height: 80px;
    background: var(--eq-slider-track);
    border: 1px solid var(--border-dark);
}

.eq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px; /* Thumb width */
    height: 10px; /* Thumb height */
    background: var(--eq-slider-thumb);
    border: 1px solid var(--eq-slider-thumb);
    cursor: grab;
    border-radius: 1px;
    box-shadow: 0 0 0 1px var(--player-accent); /* Always show a subtle outline */
    margin-top: -1px; /* Adjust thumb position to sit on the track */
}

/* Specific styles for Mozilla Firefox */
.eq-slider::-moz-range-track {
    width: 10px;
    height: 80px;
    background: var(--eq-slider-track);
    border: 1px solid var(--border-dark);
}

.eq-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--eq-slider-thumb);
    border: 1px solid var(--eq-slider-thumb);
    cursor: grab;
    border-radius: 1px;
    box-shadow: 0 0 0 1px var(--player-accent);
}

.eq-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px var(--player-accent); /* Stronger focus outline */
}

.eq-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 2px var(--player-accent);
}

.eq-freq {
    font-size: 0.6em;
    color: var(--player-text);
    white-space: nowrap;
    text-align: center;
}

/* Equalizer Controls (Presets, Reset) */
#eq-controls {
    display: flex;
    gap: 5px;
    width: 100%;
    justify-content: center;
    margin-top: auto; /* Push to bottom */
}

#eq-preset-selector, #eq-reset-button {
    background-color: var(--eq-control-bg);
    color: var(--eq-control-text);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
    padding: 3px 6px;
    cursor: pointer;
    font-size: 0.7em;
    outline: 1px dashed var(--player-accent);
    outline-offset: 1px;
    height: 20px; /* Smaller height for EQ controls */
}

#eq-preset-selector {
    flex-grow: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 3px center;
    background-size: 14px;
    padding-right: 20px;
}

#eq-preset-selector:hover, #eq-reset-button:hover {
    background-color: var(--eq-control-hover-bg);
}

#eq-preset-selector:active, #eq-reset-button:active,
#eq-preset-selector:focus, #eq-reset-button:focus {
    background-color: var(--eq-control-active-bg);
    border-top: 1px solid var(--border-dark);
    border-left: 1px solid var(--border-dark);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Drag and Drop Feedback */
#webamp-container.drag-over {
    border: 1px dashed var(--player-accent);
    box-shadow: 0 0 10px var(--player-accent);
}

/* Tooltips (Basic styling for title attribute) */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    background-color: var(--context-menu-bg);
    color: var(--context-menu-text);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.7em;
    white-space: nowrap;
    z-index: 10000; /* Ensure tooltip is on top */
    pointer-events: none; /* Allow clicks through the tooltip */
    left: 50%; /* Center relative to the hovered element */
    transform: translateX(-50%) translateY(5px);
    bottom: 100%; /* Position above the element */
    margin-bottom: 5px;
    border: 1px solid var(--context-menu-border);
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background-color: var(--context-menu-bg);
    border: 1px solid var(--context-menu-border);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    padding: 5px 0;
    z-index: 10001; /* Above tooltips */
    font-size: 0.8em;
    color: var(--context-menu-text);
    min-width: 150px;
    list-style: none; /* In case it's a UL */
}

.context-menu-item { /* Changed from div to class for more specific targeting */
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.1s ease, color 0.1s ease;
    outline: none; /* Remove default outline for menu items, handle with hover/active */
}

.context-menu-item:hover,
.context-menu-item:focus { /* Add focus state for accessibility */
    background-color: var(--context-menu-hover-bg);
    color: var(--context-menu-hover-text);
}


/* Basic Responsiveness / Adaptive Layout */
@media (max-width: 768px) {
    body {
        min-height: auto;
        align-items: flex-start;
        padding: 10px;
        overflow-y: auto; /* Allow scrolling on smaller screens if content overflows */
        user-select: auto; /* Allow text selection on mobile for easier interaction */
    }

    #webamp-container {
        width: 100%;
        max-width: 100%;
        min-width: unset;
        height: auto;
        max-height: unset;
        display: flex; /* Re-enable flex for stacking */
        flex-direction: column; /* Re-enable flex direction for stacking */
        padding: 5px;
        gap: 5px;
        box-shadow: none; /* Remove container shadow for mobile */
        overflow: visible; /* Allow windows to be fully visible if they exceed container */
    }

    /* Stack windows vertically and make them take full width */
    .window {
        position: relative; /* Change to relative for stacking */
        width: 100%;
        left: 0 !important; /* Override JS positioning */
        top: auto !important; /* Override JS positioning */
        transform: none !important; /* Remove centering transform */
        margin-bottom: var(--player-window-gap); /* Add gap between stacked windows */
        box-shadow: none; /* Remove individual window shadow for a flatter mobile look */
        resize: none !important; /* Disable resizing on mobile */
        min-height: unset !important; /* Allow natural height */
        height: auto !important; /* Allow natural height */
        /* Remove transitions for responsiveness to avoid layout issues */
        transition: none !important;
        will-change: auto; /* Reset will-change */
    }

    .window.maximized { /* Maximize behavior changes on mobile */
        width: 100% !important;
        height: auto !important;
        top: auto !important;
        left: auto !important;
        z-index: auto !important;
        margin-bottom: var(--player-window-gap);
    }

    .window.hidden {
        display: none !important;
    }

    #main-player {
        height: auto; /* Allow height to adjust */
        min-height: 116px;
    }

    #playlist-window {
        height: auto;
        min-height: 150px; /* Ensure playlist is visible */
        resize: none !important; /* Disable vertical resize on mobile */
    }

    #equalizer-window {
        /* On smaller screens, EQ might be hidden by default but can be toggled */
        /* display: none; */
    }

    #controls {
        justify-content: center; /* Center controls */
    }

    /* Adjust progress slider and volume slider for better touch interaction */
    #progress-slider, #volume-slider {
        height: 12px; /* Make sliders easier to tap */
    }
    #progress-slider::-webkit-slider-thumb, #volume-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    #progress-slider::-moz-range-thumb, #volume-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    #skin-selector {
        font-size: 0.9em; /* Slightly larger text for touch */
        padding: 6px 10px;
        padding-right: 30px;
        height: 30px;
    }

    #add-files-button,
    #toggle-playlist-button,
    #toggle-eq-button,
    #toggle-visualizer-button {
        padding: 6px 10px;
        height: 30px;
    }

    .control-button, .action-button {
        padding: 6px 10px;
        height: 30px;
    }
    .window-controls button {
        width: 24px;
        height: 24px;
        font-size: 1em;
    }
    .window-header {
        height: 24px;
        font-size: 1em;
    }
}

/* Placeholder for the initial index.html content to be hidden (if any before JS loads) */
body > h1, body > p {
    display: none;
}