/* www/css/style.css */
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&subset=cyrillic,cyrillic-ext,latin&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* Design Tokens Overview
   - Colors: --bg-*, --text-*, --accent-*, semantic aliases --color-*
   - Radii: --radius-sm/md/lg/xl/full
   - Shadows: --shadow-*, specialized glows like --shadow-glow-success
   - Spacing: --space-0-5, --space-1..6 (2px–32px)
   - Type scale: --font-size-xs..xl
*/

/* --- CSS Variables for Theming --- */
:root {
    /* --- COLOR & SURFACE TOKENS (NIGHT DEFAULTS) --- */
    --bg-primary: #2c2c2c;
    --bg-secondary: #333333;
    --bg-tertiary: #3d3d3d;
    --bg-quaternary: #484848;
    --text-primary: #ededed;
    --text-secondary: #bbb;
    --text-muted: #777;
    --text-dark-contrast: #333;
    --accent-color: #ffcd00;
    --accent-dark: #cc9a00;
    --accent-hover: #e0b800;
    --border-color: #3a3a3a;
    --light-border-color: #303030;
    --medium-border-color: #444;
    --soft-border-color: #4f4f4f;
    --button-bg: #ffcd00;
    --button-text: #333;
    --button-border: #cc9a00;
    --input-bg: #555;
    --input-border: #777;
    --input-text: #ddd;
    --vote-up-color: #ffae00;
    --vote-down-color: #ff5050;
    --tag-bg: var(--medium-border-color);
    --tag-text: #fff;
    --artwork-border: var(--medium-border-color);
    --artwork-bg: #222;
    --notification-bg-info: rgba(68, 68, 68, 0.9);
    --notification-bg-error: rgba(255, 80, 80, 0.9);
    --notification-bg-success: rgba(0, 150, 0, 0.9);
    --notification-bg-critical: rgba(200, 0, 0, 0.95);
    --notification-text-color: white;

    /* Semantic color aliases */
    --color-bg-primary: var(--bg-primary);
    --color-bg-secondary: var(--bg-secondary);
    --color-bg-tertiary: var(--bg-tertiary);
    --color-bg-quaternary: var(--bg-quaternary);
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-muted);
    --color-accent: var(--accent-color);
    --color-success-bg: rgba(0, 150, 0, 0.9);
    --color-success-strong: #4caf50;
    --color-success-strong-alt: #00e676;

    /* --- UNIVERSAL PLAYER DIMENSIONS --- */
    --player-bar-cover-size: 120px;
    --player-bar-padding: 10px;
    --player-bar-progress-height: 5px;
    --player-bar-content-height: calc(var(--player-bar-cover-size) + (2 * var(--player-bar-padding)));
    --player-element-height: calc(var(--player-bar-content-height) + var(--player-bar-progress-height));
    --player-bar-play-button-size: 50px;
    --player-bar-vote-button-icon-size: 22px;
    /* --player-bar-tag-font-size: 11px; /* Will be set in rem */
    --player-bar-volume-slider-width: 100px;
    /* Adjusted for mute button and percentage */
    /* --player-bar-title-font-size: 1.4em; /* Will be set in rem or em relative to parent */
    --player-bar-info-internal-padding: 10px;

    /* --- MOBILE SPECIFIC PLAYER DIMENSIONS (NEW) --- */
    --mobile-player-bar-cover-size: 96px;
    --mobile-player-bar-padding: 8px;

    /* --- SHADOW VARIABLES (soft, layered) --- */
    --shadow-color: rgba(15, 23, 42, 0.3);
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.25);
    --shadow-sm: 0 2px 4px 0 rgba(15, 23, 42, 0.22);
    --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.22);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.28);
    --shadow-xl: 0 25px 60px rgba(15, 23, 42, 0.32);
    --shadow-2xl: 0 35px 80px rgba(15, 23, 42, 0.4);
    --shadow-inner: inset 0 2px 4px 0 var(--shadow-color);
    /* Specialized glow shadows */
    --shadow-glow-success: 0 0 8px rgba(0, 230, 118, 0.6);

    /* --- BORDER RADIUS VARIABLES --- */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* --- SPACING SCALE (8pt-ish grid) --- */
    --space-0-5: 2px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* --- TYPE SCALE --- */
    --font-size-xs: 0.8rem;
    --font-size-sm: 0.9rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.15rem;
    --font-size-xl: 1.4rem;

    /* --- FONT FAMILY TOKENS --- */
    --font-family-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-family-ui: "Rubik", sans-serif;
    --font-family-mono: monospace;
    /* Scale UI font so Rubik matches Manrope apparent size (Rubik is slightly larger at same px) */
    --font-size-ui-scale: 0.98;

    /* --- MOTION TOKENS --- */
    --motion-fast: 150ms;
    --motion-normal: 200ms;
    --motion-slow: 300ms;
    --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* --- FOCUS RING TOKENS --- */
    --focus-ring-width: 3px;
    --focus-ring-width-sm: 2px;
    --focus-ring-color-primary: color-mix(in srgb, var(--accent-color) 50%, transparent);
    --focus-ring-color-soft: color-mix(in srgb, var(--accent-color) 30%, transparent);
}

/* --- Phase A (R1): prefers-reduced-motion — docs/FRONTEND_UX_EXECUTION_PLAN.md ---
   Applies only when the user enables "Reduce motion" / equivalent. Does not alter
   default :root tokens for users who keep full motion. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-fast: 0.01ms;
        --motion-normal: 0.01ms;
        --motion-slow: 0.01ms;
        --motion-ease: linear;
    }

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}

html {
    font-size: 87.5%;
    /* Sets 1rem = 14px if browser default is 16px */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.night-mode {
    --bg-primary: hsl(210, 10%, 12%);
    --bg-secondary: hsl(210, 10%, 16%);
    --bg-tertiary: hsl(210, 10%, 20%);
    --bg-quaternary: hsl(210, 10%, 24%);
    --text-primary: #ededed;
    --text-secondary: #bbb;
    --text-muted: hsl(210, 5%, 60%);
    --text-dark-contrast: #333;
    --accent-color: #ffcd00;
    --accent-dark: #cc9a00;
    --accent-hover: #e0b800;
    --border-color: hsl(210, 7%, 23%);
    --light-border-color: hsl(210, 7%, 19%);
    --medium-border-color: hsl(210, 7%, 26%);
    --soft-border-color: hsl(210, 7%, 21%);
    --button-bg: #ffcd00;
    --button-text: #333;
    --button-border: #cc9a00;
    --input-bg: hsl(210, 10%, 20%);
    --input-border: hsl(210, 8%, 35%);
    /* Softer input border */
    --input-text: #ddd;
    --vote-up-color: #ffae00;
    --vote-down-color: #ff5050;
    --tag-bg: var(--medium-border-color);
    --tag-text: #fff;
    --artwork-border: var(--medium-border-color);
    --artwork-bg: hsl(210, 10%, 10%);
    --notification-bg-info: hsla(210, 10%, 20%, 0.9);
    --notification-bg-error: rgba(255, 80, 80, 0.9);
    --notification-bg-success: rgba(0, 150, 0, 0.9);
    --notification-bg-critical: rgba(200, 0, 0, 0.95);
    --notification-text-color: white;
    --shadow-color: rgba(15, 23, 42, 0.32);
    --chat-bubble-self-bg: hsl(210, 25%, 30%);
    /* A sophisticated dark blue for night mode */
}

body.day-mode {
    /* Light, high-contrast, brand-aligned day palette */

    /* Backgrounds */
    --bg-primary: #e5e7eb;
    /* App frame / columns */
    --bg-secondary: #ffffff;
    /* Main cards / panels */
    --bg-tertiary: #f3f4f6;
    /* Sub-panels, chat area */
    --bg-quaternary: #d1d5db;
    /* Dividers, subtle strips */

    /* Text */
    --text-primary: #111827;
    /* Main text */
    --text-secondary: #374151;
    /* Secondary text */
    --text-muted: #6b7280;
    /* Muted labels, hints */
    --text-dark-contrast: #020617;
    /* Strongest contrast for buttons / pills */

    /* Brand accent (Trigger yellow) */
    --accent-color: #ffcd00;
    --accent-dark: #cc9a00;
    --accent-hover: #f2b800;

    /* Borders */
    --border-color: #cbd5e1;
    --light-border-color: #e5e7eb;
    --medium-border-color: #9ca3af;
    --soft-border-color: #edf2f7;

    /* Buttons */
    --button-bg: var(--accent-color);
    --button-text: var(--text-dark-contrast);
    --button-border: var(--accent-dark);

    /* Inputs */
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-text: var(--text-primary);

    /* Votes */
    --vote-up-color: #f59e0b;
    --vote-down-color: #ef4444;

    /* Tags and chips */
    --tag-bg: #e5e7eb;
    --tag-text: #1f2933;

    /* Artwork & cards */
    --artwork-border: var(--border-color);
    --artwork-bg: #f9fafb;

    /* Semantic day-mode aliases */
    --color-bg-primary: var(--bg-primary);
    --color-bg-secondary: var(--bg-secondary);
    --color-bg-tertiary: var(--bg-tertiary);
    --color-bg-quaternary: var(--bg-quaternary);
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-muted);
    --color-accent: var(--accent-color);
    --color-success-bg: rgba(34, 197, 94, 0.96);
    --color-success-strong: #16a34a;
    --color-success-strong-alt: #22c55e;
    --color-bg-header-day: #f9fafb;

    /* Notifications */
    --notification-bg-info: rgba(59, 130, 246, 0.96);
    --notification-bg-error: rgba(239, 68, 68, 0.96);
    --notification-bg-success: rgba(34, 197, 94, 0.96);
    --notification-bg-critical: rgba(220, 38, 38, 0.98);
    --notification-text-color: white;

    /* Chat bubbles */
    --chat-bubble-self-bg: #fff7dc;

    /* Shadows */
    --shadow-color: rgba(15, 23, 42, 0.10);
}

@media (max-width: 640px) {
    /* Ensure adequate touch targets for small icon buttons */
    .player-bar-vote-btn,
    .queue-action-btn,
    .close-button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* --- Basic Layout Styles --- */
body {
    font-family: var(--font-family-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-size: var(--font-size-md);
    /* Base font size (≈14px due to html rule) */
    line-height: 1.6;
    /* Base line height */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    transition: padding-top 0.3s ease-out, background-color 0.3s ease-out,
        color 0.3s ease-out;
}

body.no-scroll {
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    /* General heading line heights */
    line-height: 1.4;
    margin-top: 1.2em;
    /* Use em for spacing relative to font size */
    margin-bottom: 0.6em;
    font-weight: 600;
}

/* Constitution heading baseline; full styles live with the panel block below. */
#info-constitution-content h1 {
    margin-top: 0;
}

#main-header {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--space-1) var(--space-4);
    min-height: calc(var(--player-element-height) + 8px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    /* Using shadow instead of border */
    flex-wrap: nowrap;
    border-bottom: none;
    /* REMOVED BORDER */
    flex-shrink: 0;
    top: 0;
    z-index: 1000;
    position: sticky;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

/* Slightly lighter, distinct header bar in day mode */
body.day-mode #main-header {
    background-color: #f9fafb;
}

#header-player-slot {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-width: 450px;
    margin: var(--space-1) var(--space-4) var(--space-0-5);
    min-height: var(--player-element-height);
}

.header-section {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
}

.logo-section {
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 0;
    flex-shrink: 0;
}

.logo-section .logo-link img {
    max-height: 38px;
    display: block;
    margin-right: var(--space-1);
}

.listener-stats {
    font-size: 0.9rem;
    /* Approx 12.6px */
    color: var(--text-muted);
    align-items: center;
    white-space: nowrap;
    gap: 5px;
    flex-shrink: 0;
}

/* Right-side auth/upload section keeps row layout; no extra overrides needed */

.listener-stats span:first-child {
    font-size: inherit;
    /* Inherits 0.9rem */
    font-weight: 600;
}

.player-controls-section {
    display: none !important;
}

.auth-upload-section {
    flex-shrink: 0;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    margin-bottom: 0;
}

/* Styles for #audio-player (the player panel) */
#audio-player {
    position: relative;
    width: 100%;
    max-width: 850px;
    /* WIDER PLAYER */
    height: var(--player-element-height);
    background-color: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    overflow: hidden;
    padding: 0;
    margin: 0 auto;
    transition: all 0.3s ease-out;
}

/* Class for fixed player */
#audio-player.player-fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    /* Align to the left edge of the viewport */
    right: 0;
    /* Align to the right edge of the viewport */
    margin-left: auto;
    /* Center it with margin auto */
    margin-right: auto;
    /* Center it with margin auto */
    max-width: 950px;
    /* WIDER PLAYER */
    width: 100%;
    /* Take full width up to max-width */
    z-index: 1001;
    /* Higher than header */
    background-color: var(--bg-primary);
    /* Match header or distinct color */
    box-shadow: var(--shadow-lg);
    /* Add shadow when fixed */
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    /* Slightly larger bottom curves for spatial feel */
    border-top: none;
}


#audio-player .player-bar-content-wrapper {
    display: flex;
    align-items: center;
    padding: var(--player-bar-padding);
    flex-grow: 1;
    gap: var(--player-bar-padding);
    box-sizing: border-box;
    height: var(--player-bar-content-height);
}

#audio-player #player-bar-cover-art-container {
    width: var(--player-bar-cover-size);
    height: var(--player-bar-cover-size);
    flex: 0 0 var(--player-bar-cover-size);
    overflow: hidden;
}

#audio-player #player-bar-cover-art-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    border-radius: var(--radius-lg);
    border: 1px solid var(--artwork-border);
    background-color: var(--artwork-bg);
    box-shadow: var(--shadow-sm);
}

/* Phase G (R2/R13): now-playing cover crossfade — JS inserts under-layer + .cover-art-crossfading; on by default (see ui.js isNowPlayingCrossfadeEnabled) */
#audio-player #player-bar-cover-art-container.cover-art-stack {
    position: relative;
}

#audio-player #player-bar-cover-art-container.cover-art-stack #player-bar-cover-art-img,
#audio-player #player-bar-cover-art-container.cover-art-stack #player-bar-cover-art-img-under {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    border-radius: var(--radius-lg);
    border: 1px solid var(--artwork-border);
    background-color: var(--artwork-bg);
    box-shadow: var(--shadow-sm);
    transition: opacity var(--motion-normal) var(--motion-ease);
}

#audio-player #player-bar-cover-art-container.cover-art-stack #player-bar-cover-art-img {
    z-index: 2;
    opacity: 1;
}

#audio-player #player-bar-cover-art-container.cover-art-stack #player-bar-cover-art-img-under {
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

#audio-player #player-bar-cover-art-container.cover-art-stack.cover-art-crossfading #player-bar-cover-art-img {
    opacity: 0;
}

#audio-player #player-bar-cover-art-container.cover-art-stack.cover-art-crossfading #player-bar-cover-art-img-under {
    opacity: 1;
}

#current-track-artwork-container.cover-art-stack {
    position: relative;
    width: 100%;
    height: 100%;
}

#current-track-artwork-container.cover-art-stack #current-track-artwork,
#current-track-artwork-container.cover-art-stack #current-track-artwork-under {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--motion-normal) var(--motion-ease);
}

#current-track-artwork-container.cover-art-stack #current-track-artwork {
    z-index: 2;
    opacity: 1;
}

#current-track-artwork-container.cover-art-stack #current-track-artwork-under {
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

#current-track-artwork-container.cover-art-stack.cover-art-crossfading #current-track-artwork {
    opacity: 0;
}

#current-track-artwork-container.cover-art-stack.cover-art-crossfading #current-track-artwork-under {
    opacity: 1;
}

#player-bar-artist-title-display.now-playing-title-enter,
#current-track-artist-title.now-playing-title-enter {
    animation: nowPlayingTitleEnter var(--motion-normal) var(--motion-ease) both;
}

@keyframes nowPlayingTitleEnter {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
    }
}

/* --- START: CORRECTED PLAYER GRID LAYOUT --- */
#audio-player #player-bar-info-and-main-controls {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    /* Col 1 is flexible, Col 2 fits controls */
    align-items: flex-start;
    /* KEY CHANGE: Align items to the top */
    height: 100%;
    padding: 0 var(--player-bar-info-internal-padding);
    overflow: hidden;
    gap: 0 20px;
    /* 0 row gap, 20px column gap */
}

.player-info-stack {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align content to the top */
    gap: 8px;
    /* Space between text lines */
    min-width: 0;
    /* Important for text-overflow */
    height: 100%;
}

.player-control-cluster {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    /* KEY CHANGE: Stack controls vertically */
    align-items: center;
    justify-content: center;
    /* Center them vertically within their own column */
    gap: var(--space-4);
    /* Space between play and volume controls (≈16px) */
    height: 100%;
}

/* Generic empty state pattern (used by admin panels, can be reused elsewhere) */
.empty-state {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    text-align: left;
    font-size: 0.9rem;
}

.empty-state__title {
    margin: 0 0 0.25rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state__hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Skeleton loaders for structured lists */
@keyframes skeletonPulse {
    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
}

.skeleton-block {
    border-radius: var(--radius-md);
    background-color: rgba(148, 163, 184, 0.25);
    animation: skeletonPulse 1.2s ease-in-out infinite;
}

#audio-player #player-bar-artist-title-display {
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* Style for Title part */
#audio-player #player-bar-artist-title-display .title-name {
    display: block;
    /* Puts title on its own line */
    font-size: 1.6em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Style for Artist part, making it smaller */
#audio-player #player-bar-artist-title-display .artist-name {
    font-size: 1.1em;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


#audio-player #player-bar-tags-container {
    display: flex;
    justify-content: flex-start;
    overflow: hidden;
}

#audio-player #player-bar-tags {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent tags from wrapping */
    gap: 4px;
}

#audio-player #player-bar-uploader-container {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#audio-player #player-bar-uploader-container .player-bar-uploader-label {
    margin-right: 4px;
    font-weight: 500;
}

/* --- END: CORRECTED PLAYER GRID LAYOUT --- */


#audio-player #player-bar-play-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 0;
}

#audio-player #player-bar-play-controls .play-container,
#audio-player #player-bar-play-controls .stop-container {
    background-color: transparent;
    border-radius: var(--radius-full);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition:
        background-color var(--motion-normal) var(--motion-ease),
        box-shadow var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease);
    box-shadow: none;
    padding: 0;
    vertical-align: middle;
    position: relative;
}

#audio-player #player-bar-play-controls .play-container:hover,
#audio-player #player-bar-play-controls .stop-container:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

#audio-player #player-bar-play-controls .play-container:active,
#audio-player #player-bar-play-controls .stop-container:active {
    transform: translateY(0) scale(0.96);
    background-color: var(--bg-quaternary);
}

#audio-player #player-bar-play-controls .play-container img#playButton,
#audio-player #player-bar-play-controls .stop-container img#stopButton {
    width: 65px;
    height: var(--player-bar-play-button-size);
    display: block;
}

#audio-player #player-bar-play-controls .play-container.is-loading {
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 65px;
    height: var(--player-bar-play-button-size);
    overflow: hidden;
}

#audio-player #player-bar-play-controls .play-container.is-loading img#playButton {
    display: none;
}

#audio-player #player-bar-play-controls .play-container.is-loading::after {
    content: "";
    position: absolute;
    width: calc(var(--player-bar-play-button-size) * 0.7);
    height: calc(var(--player-bar-play-button-size) * 0.7);
    border: calc(var(--player-bar-play-button-size) * 0.1) solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#audio-player .player-bar-vote-btn {
    font-size: 0;
    font-weight: bold;
    line-height: 0;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    padding: 3px;
    min-width: calc(var(--player-bar-vote-button-icon-size) + 6px);
    min-height: calc(var(--player-bar-vote-button-icon-size) + 6px);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    opacity: 0.7;
    border-radius: var(--radius-md);
    transition:
        opacity var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease),
        border-color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        background-color var(--motion-normal) var(--motion-ease);
}

#audio-player .player-bar-vote-btn svg {
    width: var(--player-bar-vote-button-icon-size);
    height: var(--player-bar-vote-button-icon-size);
    stroke: currentColor;
    fill: none;
}

#audio-player .player-bar-vote-btn:hover {
    opacity: 1;
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    transform: translateY(-1px);
    background-color: var(--bg-tertiary);
}

#audio-player .player-bar-vote-btn:active {
    transform: translateY(0) scale(0.95);
    opacity: 0.9;
    background-color: var(--bg-quaternary);
}

#audio-player .player-bar-vote-btn.active-up,
#audio-player .player-bar-vote-btn.active-up:hover {
    opacity: 1;
    color: var(--vote-up-color);
    border-color: var(--vote-up-color);
    transform: translateY(-2px);
    background-color: transparent;
}

#audio-player .player-bar-vote-btn.active-up:active {
    transform: translateY(0px) scale(0.95);
}

#audio-player .player-bar-vote-btn.active-down,
#audio-player .player-bar-vote-btn.active-down:hover {
    opacity: 1;
    color: var(--vote-down-color);
    border-color: var(--vote-down-color);
    transform: translateY(-2px);
    background-color: transparent;
}

#audio-player .player-bar-vote-btn.active-down:active {
    transform: translateY(0px) scale(0.95);
}

#player-bar-mute-toggle-btn {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    transition:
        opacity var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease),
        border-color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        background-color var(--motion-normal) var(--motion-ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    height: 22px;
    /* Adjust to visually match slider height */
    width: 22px;
}

#player-bar-mute-toggle-btn svg {
    width: 18px;
    /* Icon size */
    height: 18px;
    stroke: currentColor;
}

#player-bar-mute-toggle-btn:hover {
    opacity: 1;
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    transform: scale(1.1);
    background-color: var(--bg-tertiary);
}

#player-bar-mute-toggle-btn:active {
    transform: scale(0.95);
    background-color: var(--bg-quaternary);
}


#audio-player #player-bar-volume-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#audio-player #player-bar-volume-container #volume {
    flex-grow: 0;
    /* Don't let it grow, use fixed width */
    flex-shrink: 0;
    /* Don't let it shrink */
    width: var(--player-bar-volume-slider-width);
    /* Use the variable for slider width */
    height: auto;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

#audio-player #player-bar-volume-container #volume .slider {
    width: 100%;
    height: 8px;
    background: var(--medium-border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    overflow: hidden;
    margin-top: 6px;
    transition: box-shadow 0.2s ease-in-out;
}

#audio-player #player-bar-volume-container #volume .slider:hover {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 20%, transparent);
}

#audio-player #player-bar-volume-container #volume .slider .bar {
    height: 100%;
    width: 50%;
    background: #ededed;
    border-radius: var(--radius-sm);
}

#audio-player #player-bar-volume-display {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 35px;
    /* Space for "100%" */
    text-align: left;
    font-weight: 400;
    display: inline-block;
    /* Make it visible */
}

#audio-player #player-bar-tags .tag {
    font-size: 0.7rem;
    /* Approx 9.8px */
    font-weight: 400;
    padding: 1px 4px;
    /* Reduced padding */
    background-color: var(--tag-bg);
    color: var(--tag-text);
    border-radius: var(--radius-xl);
    white-space: nowrap;
    /* Tags themselves should not wrap */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

#audio-player #player-bar-tags .tag:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
}

#audio-player #player-bar-uploader {
    /* This specific ID is now within #player-bar-uploader-container */
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-muted);
}

#audio-player .player-bar-progress-area {
    width: 100%;
    height: 2px;
    padding: 0;
    background-color: transparent;
    order: 1;
}

#audio-player .player-bar-progress-area .timer {
    height: 100%;
    width: 100%;
    background: var(--medium-border-color);
    border-radius: 999px;
    overflow: hidden;
}

#audio-player .player-bar-progress-area .timer .cursor {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    opacity: 0.8;
    transition: width 0.25s linear;
}

.desktop-only {
    display: none;
}

#mobile-nav-toggle {
    display: block;
    background: none;
    border: none;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 0;
    border-radius: var(--radius-md);
    transition:
        color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease);
}

#mobile-nav-toggle:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

#mobile-nav-toggle:active {
    transform: scale(0.95);
}

#mobile-nav-toggle:focus-visible {
    color: var(--accent-color);
    transform: scale(1.08);
}

#mobile-nav-toggle svg.feather-menu {
    width: 28px;
    height: 28px;
    stroke: currentColor;
}

/* R15 — hamburger → X when open (lines only; reduced motion → near-instant via Phase A) */
#mobile-nav-toggle svg.feather-menu line {
    transition:
        transform var(--motion-slow) var(--motion-ease),
        opacity var(--motion-fast) var(--motion-ease);
    transform-origin: center;
}

#mobile-nav-toggle[aria-expanded="true"] svg.feather-menu line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#mobile-nav-toggle[aria-expanded="true"] svg.feather-menu line:nth-child(2) {
    opacity: 0;
}

#mobile-nav-toggle[aria-expanded="true"] svg.feather-menu line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Phase E (R15): overlay fade + drawer slide — tokens for parity with reduced-motion */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--bg-primary) 70%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--motion-slow) var(--motion-ease),
        visibility var(--motion-slow) var(--motion-ease);
}

.mobile-nav-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    transform: translateX(-100%);
    transition:
        transform var(--motion-slow) var(--motion-ease),
        background-color var(--motion-slow) ease-out;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-sizing: border-box;
    overflow-y: auto;
}

.mobile-nav-menu.is-open {
    transform: translateX(0%);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-4);
}

.mobile-nav-header .logo-link img {
    max-height: 38px;
}

.close-button {
    color: var(--text-muted);
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0;
    cursor: pointer;
    line-height: 1;
    width: auto;
    height: auto;
    padding: 5px;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease-in-out, transform 0.15s ease-out;
}

.mobile-nav-header .close-button {
    position: static;
    padding: 8px;
}

.close-button svg.feather-x {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.close-button:hover,
.close-button:focus-visible {
    color: var(--accent-color);
    transform: rotate(90deg) scale(1.1);
}

.close-button:active {
    transform: rotate(0deg) scale(0.9);
}

.mobile-nav-section {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--soft-border-color);
}

.mobile-nav-section:last-child {
    border-bottom: none;
}

.mobile-nav-section .auth-links-container {
    display: block;
    white-space: normal;
}

.mobile-nav-section .auth-links-container a {
    display: block;
    margin: 5px 0;
    transition: color 0.2s ease-in-out;
}

.console-submit-box {
    border: 1px solid var(--button-border);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition:
        background-color var(--motion-normal) var(--motion-ease),
        border-color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    padding: 8px;
    height: auto;
    width: auto;
}

.console-submit-box:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-dark);
    color: var(--button-text);
    transform: translateY(-1px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.console-submit-box:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-xs);
}

.console-submit-box .label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease-in-out;
    font-size: 0;
}

.console-submit-box .label svg.feather-plus,
.console-submit-box .label svg.feather-upload {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.console-submit-box:hover .label {
    color: var(--button-text);
}

.mobile-nav-section .console-submit-box {
    padding: 12px;
    justify-content: center;
}

.mobile-nav-section .console-submit-box .label {
    margin-right: 0;
}

.mobile-nav-section .console-submit-box::after {
    content: none;
}

.mobile-nav-tabs a {
    display: block;
    padding: 12px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    /* Approx 14px, was 16px */
    font-weight: 600;
    border-bottom: 1px solid var(--soft-border-color);
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.mobile-nav-tabs a:hover {
    color: var(--accent-color);
    text-decoration: none;
    background-color: var(--bg-tertiary);
}

.mobile-nav-tabs a:last-child {
    border-bottom: none;
}

.mobile-nav-settings .setting-item {
    padding: 8px 0;
}

#mobile-lang-switcher-console {
    display: flex;
    gap: 6px;
}

#mobile-lang-switcher-console button,
#lang-switcher-console button {
    background: none;
    border: 1px solid var(--input-border);
    color: var(--input-text);
    font-family: var(--font-family-ui);
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    /* Approx 13px */
    cursor: pointer;
    padding: 5px 10px;
    margin: 0;
    opacity: 0.8;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease-in-out, opacity 0.2s ease-in-out,
        border-color 0.2s ease-in-out, transform 0.15s ease-out,
        color 0.2s ease-in-out;
}

#mobile-lang-switcher-console button.active,
#lang-switcher-console button.active {
    color: var(--text-primary);
    font-weight: bold;
    opacity: 1;
    background-color: var(--input-bg);
    border-color: var(--accent-color);
}

#mobile-lang-switcher-console button:hover:not(.active),
#lang-switcher-console button:hover:not(.active) {
    color: var(--text-primary);
    opacity: 1;
    background-color: var(--input-bg);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

#mobile-lang-switcher-console button:active:not(.active),
#lang-switcher-console button:active:not(.active) {
    transform: translateY(0) scale(0.95);
}

#styleswitch a svg.feather,
#mobile-styleswitch a svg.feather {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    margin-right: 6px;
    vertical-align: middle;
    transition: transform 0.2s ease-in-out;
}

#mobile-styleswitch a,
#styleswitch a {
    display: inline-flex;
    align-items: center;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    /* Approx 14px, was 1.1em */
    transition: transform 0.15s ease-out, color 0.2s ease-in-out;
}

#mobile-styleswitch a:hover,
#styleswitch a:hover {
    text-decoration: underline;
    transform: translateY(-1px);
    color: var(--accent-hover);
}

#mobile-styleswitch a:active,
#styleswitch a:active {
    transform: translateY(0) scale(0.98);
}

#main-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
    padding-bottom: 0 !important;
}

#playlist {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    overflow-y: auto;
    border-right: none;
    /* For mobile, border handled by desktop query */
    display: flex;
    flex-direction: column;
    width: 100%;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    /* Uses softer border */
    box-shadow: var(--shadow-md);
    /* Use shadow for separation */
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

#playlist .current {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0;
    border-bottom: none;
    /* Rely on shadow and background diff */
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

#playlist .current .base {
    cursor: pointer;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    min-height: 130px;
    box-sizing: border-box;
    transition: background-color 0.2s ease-in-out;
}

#playlist .current .base:hover {
    background-color: var(--bg-tertiary);
}

#playlist .current .cover {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border: 1px solid var(--artwork-border);
    background-color: var(--artwork-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#playlist .current .artwork img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

#playlist .current .song-info-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    justify-content: center;
    gap: 3px;
}

#playlist .current .artist-title-line {
    font-weight: 500;
    /* Rubik Medium */
    color: var(--text-primary);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 1rem;
    /* 14px */
    line-height: 1.4;
    margin-bottom: 3px;
}

#playlist .current .artist-title-line .title-name-ellipsis {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Match #playlist .current .rating .but — same row, same control size as up/down vote */
#playlist .current .artist-title-line .track-download-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 28px;
    min-height: 28px;
    padding: 3px;
    margin: 0;
    font-size: 0;
    line-height: 0;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    opacity: 0.7;
    vertical-align: middle;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, transform 0.15s ease-out,
        background-color 0.2s ease-in-out;
}

#playlist .current .artist-title-line .track-download-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

#playlist .current .artist-title-line .track-download-btn:hover:not(:disabled) {
    opacity: 1;
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

#playlist .current .artist-title-line .track-download-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

#playlist .current .artist-title-line .track-download-btn:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.4;
    transform: none !important;
    border-color: transparent;
    background-color: transparent;
}

/* Styles for the new uploader line in the playlist's current song display */
#playlist .current .uploader-line {
    font-size: 0.8rem;
    /* Approx 11.2px */
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 2px;
    /* Small space below tags */
}

#playlist .current .uploader-line .uploader-label {
    font-weight: 500;
    /* Rubik Medium */
}

#playlist .current .uploader-line #current-track-uploader-name a {
    /* If uploader name becomes a link */
    color: var(--accent-color);
}

#playlist .current .artist-title-line .title-name {
    font-weight: 400;
    /* Rubik Regular */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#playlist .current .artist-title-line .title-name:only-child {
    font-weight: 600;
    /* Rubik SemiBold */
}

#playlist .current .tags-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.857rem;
    /* Approx 12px */
}

#playlist .current .tags-line .tag {
    font-size: 0.785rem;
    /* Approx 11px */
    padding: 2px 5px;
    /* Adjusted */
    border-radius: var(--radius-xl);
}

.tag {
    font-size: 0.785rem;
    /* Approx 11px default */
    color: var(--tag-text);
    border-radius: var(--radius-sm);
    background-color: var(--tag-bg);
    display: inline-block;
    padding: 2px 5px;
    margin-right: 3px;
    margin-bottom: 2px;
    vertical-align: middle;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.tag:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
}

#playlist .current .rating {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 90px;
}

#playlist .current .rating .curnum {
    text-align: center;
    font-weight: 700;
    /* Keep rating number bold */
    font-size: 1.7rem;
    /* Approx 23.8px */
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1;
    min-width: 25px;
    display: inline-block;
    vertical-align: middle;
    transition: color 0.2s ease-in-out;
}

#playlist .current .rating .but {
    font-size: 0;
    font-weight: bold;
    line-height: 0;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    padding: 3px;
    min-width: 28px;
    min-height: 28px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    opacity: 0.7;
    border-radius: var(--radius-md);
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, transform 0.15s ease-out;
}

#playlist .current .rating .but svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

#playlist .current .rating .but:hover {
    opacity: 1;
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

#playlist .current .rating .but:active {
    transform: translateY(0) scale(0.95);
}

#playlist .current .rating .but.up.active-up,
#playlist .current .rating .but.up.active-up:hover {
    opacity: 1;
    color: var(--vote-up-color);
    border-color: var(--vote-up-color);
    transform: translateY(-2px);
}

#playlist .current .rating .but.up.active-up:active {
    transform: translateY(0px) scale(0.95);
}

#playlist .current .rating .but.down.active-down,
#playlist .current .rating .but.down.active-down:hover {
    opacity: 1;
    color: var(--vote-down-color);
    border-color: var(--vote-down-color);
    transform: translateY(-2px);
}

#playlist .current .rating .but.down.active-down:active {
    transform: translateY(0px) scale(0.95);
}

#playlist .current .timer#original-progress-bar-container {
    display: block;
    height: 4px;
    width: 100%;
    background: var(--text-muted);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

#playlist .current .timer#original-progress-bar-container .cursor {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    transition: width 0.25s linear;
    border-radius: inherit;
}

/* Expand/collapse: 0fr→1fr row + clip inner — animating max-height squeezed the grid and caused reflow jank */
#playlist .current .full {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    transition: grid-template-rows 0.35s ease-in-out, opacity 0.2s ease-in-out;
    background-color: var(--bg-tertiary);
    border-top: none;
    opacity: 0;
}

#playlist .current .full.expanded {
    grid-template-rows: 1fr;
    opacity: 1;
    /* Same cap as former max-height-only panel — avoids unbounded tall content */
    max-height: min(850px, 92vh);
}

#playlist .current .full .expanded-details-container {
    min-height: 0;
    overflow: hidden;
    padding: 15px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 15px;
    font-size: 0.857rem;
    color: var(--text-primary);
}

#playlist .current .full .expanded-details-container .details-col-main {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
    /* Important for flex/grid children */
}

#playlist .current .full .expanded-details-container .details-col-side {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
    /* Important for flex/grid children */
}

/* --- NEW: Redesigned Detail Section "Cards" --- */
.detail-section {
    background-color: var(--bg-primary);
    /* Use primary bg to feel "inset" */
    padding: 1.25rem;
    /* ~20px */
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-inner);
    /* Subtle inner shadow for depth */
    transition: background-color 0.3s ease-out;
    margin-bottom: 0;
    /* Margin is now handled by grid gap */
}


/* --- NEW: Redesigned Section Title --- */
.detail-section-title {
    font-size: 1rem;
    /* 14px */
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    /* Space between title and content */
    padding-bottom: 0;
    border-bottom: none;
    /* No more underline */
}


/* --- NEW: Redesigned External Links --- */
.track-external-links #current-track-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.track-external-links .service-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease-out;
}

.track-external-links .service-icon-link:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.track-external-links .service-icon-link img {
    width: 29px;
    /* Slightly increased for better visibility in a 40px box */
    height: 29px;
    transition: transform 0.2s ease-out;
}

.track-external-links .service-icon-link:hover img {
    transform: scale(1.1);
}

.track-external-links .service-icon-link svg {
    width: 29px;
    height: 29px;
    transition: transform 0.2s ease-out;
}

.track-external-links .service-icon-link:hover svg {
    transform: scale(1.1);
}

/* Feather icons need specific fill/stroke overrides */
.track-external-links .service-icon-link svg.feather {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* For SVGs where I used fill="currentColor" */
.track-external-links .service-icon-link svg:not(.feather) {
    fill: currentColor;
    stroke: none;
}


.track-artist-bio .bio-content {
    line-height: 1.6;
    max-height: 200px;
    /* Increased max-height */
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
    color: var(--text-secondary);
    font-size: 0.95em;
    /* Slightly larger bio text */
}

.track-artist-bio .bio-content p {
    margin: 0 0 1em;
}

.track-artist-bio .bio-content p:last-child {
    margin-bottom: 0;
}


/* --- NEW: Redesigned Song Stats --- */
.song-stats-area .song-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Increased gap between stat rows */
}

.song-stats-grid .stats-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    /* Align by text baseline */
    gap: 15px;
    font-size: 0.9rem;
    /* Approx 12.6px */
    border-bottom: 1px solid var(--soft-border-color);
    padding-bottom: 8px;
}

.song-stats-grid .stats-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.song-stats-grid .stats-row-single {
    justify-content: flex-start;
}

.song-stats-grid .stat-item {
    color: var(--text-primary);
    line-height: 1.4;
    text-align: left;
    /* Default to left */
    flex-shrink: 0;
    /* Prevent labels from shrinking */
}

.song-stats-grid .stat-item.stat-plays,
.song-stats-grid .stat-item.stat-skips,
.song-stats-grid .stat-item.stat-rating {
    text-align: right;
    flex-shrink: 1;
}

.song-stats-grid .stat-item strong {
    color: var(--text-secondary);
    margin-right: 8px;
    /* More space */
    font-weight: 500;
}

.song-stats-grid .stat-item span {
    font-weight: 600;
    /* Bolder value */
}

.song-stats-grid .stat-voters {
    flex: 1;
    min-width: 0;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    align-items: center;
    /* Vertically align label and tags */
}

.song-stats-grid .stat-voters .voter-tag {
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    /* Pill shape */
    font-size: 0.85em;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    line-height: 1;
}

.song-stats-grid .stat-voters .voter-tag:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
}

.history-header,
.history-item-content {
    display: grid;
    /* Вот магия: определяем колонки. */
    /* 1fr = 1 доля свободного пространства. Auto = ширина по контенту */
    grid-template-columns: 1fr auto auto auto;
    gap: 15px;
    /* Пространство между колонками */
    align-items: center;
    /* Выравниваем элементы по центру по вертикали */
    padding: 8px 12px;
}

/* Стилизация самого заголовка */
.history-header {
    background-color: var(--bg-quaternary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Общие стили для контента в ячейках */
.history-item-name,
.history-item-last-played,
.history-item-plays,
.history-item-rating {
    white-space: nowrap;
    min-width: 0;
    /* Важно для правильной работы с grid и overflow */
}

/* 1. Колонка с названием трека */
.history-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    /* Добавляем многоточие */
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
}

/* 2. Колонка времени */
.history-item-last-played {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 3. Колонка прослушиваний */
.history-item-plays {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    /* Добавим минимальную ширину для стабильности */
    min-width: 90px;
}

/* 4. Колонка рейтинга */
.history-item-rating {
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    /* Добавим минимальную ширину для стабильности */
    min-width: 60px;
}

/* Заголовкам задаем только выравнивание, размеры они возьмут из grid-шаблона */
.history-header-name {
    text-align: left;
}

.history-header-last-played {
    text-align: right;
}

.history-header-plays {
    text-align: center;
}

.history-header-rating {
    text-align: right;
}


/* Стили для цвета рейтинга в контенте остаются прежними */
.history-item-rating.voted-up {
    color: var(--vote-up-color);
}

.history-item-rating.voted-down {
    color: var(--vote-down-color);
}


.track-tags-expanded .tags_list_expanded {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* More space between tags */
}

.track-tags-expanded .tags_list_expanded .tag {
    background-color: var(--tag-bg);
    color: var(--tag-text);
    border-radius: var(--radius-md);
    /* Less rounded */
    padding: 4px 8px;
    display: inline-block;
    font-size: 0.9em;
    text-decoration: none;
}

.track-tags-expanded .tags_list_expanded .tag:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
}

.uploader-and-actions .admin-skip-and-sender-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 5px;
}

button.admin_skip_placeholder {
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.714rem;
    /* Approx 10px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, transform 0.15s ease-out,
        color 0.2s ease-in-out;
    opacity: 0.8;
    flex-shrink: 0;
    height: auto;
    margin: 0;
}

button.admin_skip_placeholder svg.feather-skip-forward {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

button.admin_skip_placeholder:hover {
    opacity: 1;
    background-color: var(--vote-down-color);
    border-color: var(--vote-down-color);
    color: var(--text-primary);
    transform: scale(1.05);
}

button.admin_skip_placeholder:active {
    transform: scale(0.98);
    filter: brightness(0.9);
}

#playlist .current .full .sender a {
    color: var(--accent-color);
    font-style: normal;
    transition: color 0.2s ease-in-out;
}

#playlist .current .full .sender a:hover {
    color: var(--accent-hover);
}

#playlist .innerl {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 0px;
}

#playlist .inner {
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    padding: 0;
}

#playlist .list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#playlist .item {
    border-bottom: 1px solid var(--light-border-color);
    /* Kept for list separation */
    background: var(--bg-secondary);
    cursor: default;
    padding: 0;
    transition: background-color 0.2s ease-in-out;
}

#playlist #upcomingQueue .item {
    border-bottom: 1px solid var(--border-color);
}

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

#playlist .item.my {
    background: color-mix(in srgb,
            var(--bg-secondary) 80%,
            var(--accent-color) 10%) !important;
}

/* --- NEW STYLES FOR UPCOMING QUEUE ITEMS (FLEXBOX BASED) --- */
#playlist #upcomingQueue .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

#playlist #upcomingQueue .item .queue-item-main-info {
    flex-grow: 1;
    min-width: 0;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2.5px;
}

#playlist #upcomingQueue .item .queue-item-main-info .title {
    white-space: normal;
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

#playlist #upcomingQueue .item .queue-item-main-info .uploader-queue {
    font-size: 0.785rem;
    font-weight: 400;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#playlist #upcomingQueue .item .queue-item-main-info .uploader-comment,
#playlist .current .uploader-comment:not([hidden]),
#audio-player #player-bar-uploader-comment:not([hidden]) {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 1px;
    white-space: normal;
    overflow: hidden;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

#audio-player #player-bar-uploader-comment:not([hidden]) {
    font-size: 0.8rem;
    margin-top: 2px;
}

#playlist .current .uploader-comment:not([hidden]) {
    margin-top: 2px;
    max-width: 100%;
}

.queue-item-tags-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.queue-item-tags-line .tag {
    font-size: 0.714rem;
    font-weight: 400;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    opacity: 0.8;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    margin-right: 4px;
    vertical-align: baseline;
}

#playlist #upcomingQueue .item .queue-item-meta-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#playlist #upcomingQueue .item .queue-item-meta-actions .time {
    font-size: 0.785rem;
    color: var(--text-muted);
    text-align: center;
    min-width: 40px;
}


.queue-item-votes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 65px;
}

.queue-vote-btn {
    background-color: transparent;
    border: 1px solid var(--medium-border-color);
    color: var(--text-secondary);
    padding: 1px 3px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    transition: border-color 0.15s ease-in-out, color 0.15s ease-in-out, opacity 0.15s ease-in-out, transform 0.15s ease-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    opacity: 0.7;
}

.queue-vote-btn svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 3;
    fill: none;
}

.queue-vote-btn:hover:not(:disabled) {
    border-color: var(--accent-color);
    color: var(--accent-color);
    opacity: 1;
    transform: scale(1.1) translateY(-1px);
}

.queue-vote-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.queue-vote-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

#playlist #upcomingQueue .item .queue-item-meta-actions .queue-vote-btn.active-up {
    border-color: var(--vote-up-color);
    color: var(--vote-up-color);
    opacity: 1;
    background-color: transparent;
    transform: scale(1.1) translateY(-1px);
}

#playlist #upcomingQueue .item .queue-item-meta-actions .queue-vote-btn.active-up:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--vote-up-color) 80%, black);
    color: color-mix(in srgb, var(--vote-up-color) 80%, black);
}


#playlist #upcomingQueue .item .queue-item-meta-actions .queue-vote-btn.active-down {
    border-color: var(--vote-down-color);
    color: var(--vote-down-color);
    opacity: 1;
    background-color: transparent;
    transform: scale(1.1) translateY(-1px);
}

#playlist #upcomingQueue .item .queue-item-meta-actions .queue-vote-btn.active-down:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--vote-down-color) 80%, black);
    color: color-mix(in srgb, var(--vote-down-color) 80%, black);
}


.queue-vote-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 16px;
    text-align: center;
    padding: 0 2px;
    line-height: 1;
    transition: all 0.2s ease-in-out;
}

.queue-vote-count.updated {
    transform: scale(1.3);
    color: var(--accent-color);
}


.queue-remove-btn {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    transition: all 0.15s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    min-width: 18px;
    min-height: 18px;
}

.queue-remove-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
}

.queue-remove-btn:hover {
    border-color: var(--vote-down-color);
    color: var(--vote-down-color);
    opacity: 1;
    transform: scale(1.05);
}

.queue-remove-btn-placeholder {
    display: inline-block;
    width: 18px;
    height: 18px;
    visibility: hidden;
}

/* --- START: FIX FOR HISTORY LIST --- */
/* This conflicting block was removed. The .history-item-content will now correctly inherit */
/* the `display: grid` property from the shared `.history-header, .history-item-content` rule. */
/*

.history-item-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 6px 8px;
}

.history-item-name {
    flex-grow: 0.5;
    min-width: 0;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-last-played {
    width: 70px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.785rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.history-item-plays {
    width: 50px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.857rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.history-item-rating {
    width: 35px;
    text-align: right;
    font-weight: 600;
    font-size: 0.857rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.history-item-rating.voted-up {
    color: var(--vote-up-color);
}

.history-item-rating.voted-down {
    color: var(--vote-down-color);
}
*/
/* --- END: FIX FOR HISTORY LIST --- */


#info-history-content #playedSongsHistoryUL .item {
    border-bottom: none;
    background: transparent;
    padding: 6px 0;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-out;
}

#info-history-content #playedSongsHistoryUL .item:hover {
    background-color: var(--bg-tertiary);
    transform: translateX(3px);
}

/* History row: current track on air */
#info-history-content #playedSongsHistoryUL .history-item--now-playing {
    border-left: 3px solid var(--color-accent);
    background-color: var(--bg-tertiary);
    padding-left: calc(8px - 3px);
}

#info-history-content #playedSongsHistoryUL .history-item--now-playing .history-now-playing-label {
    display: inline-block;
    margin-left: var(--space-1);
    padding: var(--space-0-5) var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 18%, transparent);
    border-radius: var(--radius-sm);
    vertical-align: middle;
}

.queue-message {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.928rem;
    /* Approx 13px */
}

#chat-column {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background-color: var(--bg-primary);
    overflow: hidden;
    position: relative;
    width: 100%;
    transition: background-color 0.3s ease-out;
}

#chat-column #info-tabs-card-container {
    padding: 10px 15px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease-out;
}

#chat-column #info-tabs-container {
    width: 100%;
    border-spacing: 4px;
    table-layout: fixed;
    flex-shrink: 0;
    border-bottom: none;
    transition: background-color 0.3s ease-out;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
}

#chat-column #info-tabs-container .tab {
    background: transparent;
    text-align: center;
    border-bottom: none;
    padding: 8px 0;
    border-right: none;
    cursor: pointer;
    font-size: 0.857rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-right: 0;
    color: var(--text-secondary) !important;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        transform 0.15s ease-out;
    border-radius: var(--radius-md);
}

#chat-column #info-tabs-container .tab:last-child {
    margin-right: 0;
}

#chat-column #info-tabs-container .tab:hover:not(.active) {
    background-color: var(--bg-secondary);
    color: var(--text-primary) !important;
    transform: translateY(-1px);
}

#chat-column #info-tabs-container .tab:active {
    transform: translateY(0px) scale(0.98);
    filter: brightness(0.95);
}

#chat-column #info-tabs-container .tab.active {
    font-weight: 600;
    background-color: var(--bg-tertiary);
    color: var(--text-primary) !important;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Tab labels are `<a>`; override global `a:hover { text-decoration: underline }` */
#chat-column #info-tabs-container .tab a,
#chat-column #info-tabs-container .tab a:hover,
#chat-column #info-tabs-container .tab a:focus,
#chat-column #info-tabs-container .tab a:focus-visible {
    text-decoration: none;
    color: inherit;
}

#chat-column>.info-content-panel,
#chat-column>#chat-main-wrapper {
    flex-grow: 1;
    overflow: hidden;
    display: none;
    transition: background-color 0.3s ease-out;
}

#chat-column>.info-content-panel.active,
#chat-column>#chat-main-wrapper.active {
    display: flex;
    flex-direction: column;
}

#chat-main-wrapper {
    position: relative;
    background-color: var(--bg-tertiary);
}

@media (min-width: 768px) {
    #chat-column>#chat-main-wrapper.active {
        flex-direction: row;
    }
}

#chat-content-area {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

#chat-column #chat-input-area {
    order: -1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    /* Increased padding */
    gap: 10px;
    /* Increased gap */
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--soft-border-color);
    flex-shrink: 0;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

.chat-rich-text-buttons {
    display: flex;
    gap: 5px;
    /* Increased gap */
    flex-wrap: wrap;
}

.chat-rich-text-buttons button.chat-format-btn {
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    border: 1px solid var(--medium-border-color);
    padding: 8px 10px;
    /* Adjusted padding */
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: bold;
    font-size: 0;
    min-width: 38px;
    /* Slightly larger tap target */
    min-height: 38px;
    text-align: center;
    transition:
        background-color var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease),
        border-color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.chat-rich-text-buttons button.chat-format-btn svg.feather {
    width: 18px;
    /* Slightly larger icons */
    height: 18px;
    stroke: currentColor;
}

.chat-rich-text-buttons button.chat-format-btn:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
    border-color: var(--accent-dark);
    transform: translateY(-1px);
}

.chat-rich-text-buttons button.chat-format-btn:active {
    transform: translateY(0) scale(0.95);
    filter: brightness(0.9);
}

.chat-input-send-container {
    display: flex;
    gap: 10px;
    /* Increased gap */
    align-items: center;
}

#message-input {
    flex-grow: 1;
    padding: 10px 12px;
    /* Increased padding */
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--input-text);
    border-radius: var(--radius-md);
    font-size: 1rem;
    /* 14px */
    line-height: 1.4;
    resize: none;
    min-height: 38px;
    /* Adjusted to match button height */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
        background-color 0.3s ease-out, color 0.3s ease-out;
}

#send-message-btn,
#queue-empty-upload-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
    /* UPDATED: Consistent padding with modal buttons */
    padding: 10px 18px;
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-family-ui);
    font-weight: 600;
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    text-shadow: none;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.15s ease-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    flex-shrink: 0;
    /* REMOVED: Explicit height and line-height; now derived from padding & content */
    /* height: 38px; */
    /* line-height: 36px; */
    box-sizing: border-box;
    /* Ensure padding and border are included in width/height */
    box-shadow: var(--shadow-sm);
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#send-message-btn:hover,
#queue-empty-upload-btn:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

#send-message-btn:active,
#queue-empty-upload-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-xs);
    filter: brightness(0.95);
}

#chat-column #chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    justify-content: flex-end;
    flex-direction: column-reverse;
    position: relative;
}

#chat-column #chat-log .nano-content {
    display: flex;
    flex-direction: column-reverse;
    /* RESTORED this to fix message order */
    width: 100%;
    gap: 0.5rem;
}

.chat-message {
    display: flex;
    /* Make the container a flexbox */
    max-width: 100%;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInSlideUp 0.3s ease-out forwards;
    animation-delay: 0.05s;
}

.chat-message-bubble {
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-quaternary);
    max-width: 85%;
    /* Bubbles don't take full width */
    width: fit-content;
    /* Shrink to content size */
    box-shadow: var(--shadow-sm);
    line-height: 1.45;
}

.chat-message.message-from-self {
    justify-content: flex-end;
    /* Align the entire flex item to the right */
}

.chat-message.message-from-self .chat-message-bubble {
    background-color: var(--chat-bubble-self-bg);
    /* Example distinct color */
    color: var(--text-primary);
}

.chat-message.message-from-self .chat-message-bubble .username {
    color: var(--text-primary);
    font-weight: 700;
}

.chat-message.message-from-self .chat-message-bubble .message-content,
.chat-message.message-from-self .chat-message-bubble .timestamp,
.chat-message.message-from-self .chat-message-bubble a,
.chat-message.message-from-self .chat-message-bubble .image-hidden-placeholder {
    color: var(--text-primary);
}

.chat-message.message-from-self .chat-message-bubble code {
    background-color: color-mix(in srgb, var(--accent-dark), black 15%);
}

.chat-message.message-from-self .chat-message-bubble pre {
    background-color: color-mix(in srgb, var(--accent-dark), black 20%);
    border-color: color-mix(in srgb, var(--accent-dark), black 30%);
}

.chat-message.new-item-animation {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInSlideUp 0.4s ease-out forwards;
}

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

#chat-column #chat-log .nano-content>.chat-message:last-child {
    margin-top: 0;
}

.chat-message .username {
    font-weight: 500;
    /* Rubik Medium */
    color: var(--accent-color);
    margin-right: 4px;
    cursor: pointer;
    font-size: 1rem;
    /* 14px */
    transition: color 0.2s ease-in-out;
}

.chat-message .username:hover {
    color: var(--accent-hover);
}

.chat-message .timestamp {
    font-size: 0.785rem;
    /* Approx 11px */
    color: var(--text-muted);
    margin-left: 6px;
    white-space: nowrap;
}

.chat-message .message-content {
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 1rem;
    /* Or 0.928rem (13px) if username is 1rem */
    font-weight: 400;
    /* Rubik Regular */
}

/* --- Day mode readability tweaks for accent-colored text --- */

body.day-mode .chat-message .username {
    /* Use darker text on light chat background */
    color: var(--text-primary);
}

body.day-mode .chat-message .username:hover {
    color: var(--accent-color);
}

body.day-mode #playlist .current .uploader-line #current-track-uploader-name a,
body.day-mode #playlist .current .full .sender a {
    /* Avoid bright yellow on pale playlist cards */
    color: var(--text-secondary);
}

body.day-mode #playlist .current .uploader-line #current-track-uploader-name a:hover,
body.day-mode #playlist .current .full .sender a:hover {
    color: var(--text-primary);
}

/* Day mode: ensure logo and top auth/profile text are readable */

body.day-mode #main-header .listener-stats,
body.day-mode #main-header .listener-stats span,
body.day-mode #main-header .auth-links-container a,
body.day-mode #main-header #console-user-info-placeholder span,
body.day-mode #main-header #console-user-info-placeholder a {
    color: var(--text-primary);
}

/* Day mode: stronger tab label contrast (Chat/History/Profile/Settings) */

body.day-mode #chat-column #info-tabs-container .tab a {
    color: var(--text-secondary);
}

body.day-mode #chat-column #info-tabs-container .tab.active a,
body.day-mode #chat-column #info-tabs-container .tab:hover:not(.active) a {
    color: var(--text-primary);
}

/* Day mode: user list nicknames (including AVA) use dark text, not yellow */

body.day-mode #chat-column #user-list .user-item .username-text {
    color: var(--text-primary);
}

/* Day mode structural contrast for chat / playlist column */

body.day-mode #chat-column {
    background-color: var(--bg-primary);
}

body.day-mode #chat-main-wrapper,
body.day-mode #chat-content-area {
    background-color: var(--bg-tertiary);
}

body.day-mode #playlist .current {
    background-color: var(--bg-secondary);
}

.chat-message .message-content b,
.chat-message .message-content strong {
    font-weight: 600;
    /* Rubik SemiBold */
}

.chat-message .message-content i,
.chat-message .message-content em {
    font-style: italic;
}

.chat-message .message-content u {
    text-decoration: underline;
}

.chat-message .message-content s,
.chat-message .message-content del {
    text-decoration: line-through;
    color: var(--text-muted);
}

.chat-message .message-content code {
    background-color: var(--bg-quaternary);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family-mono);
    /* Keep monospace for code */
    font-size: 0.9em;
}

.chat-message .message-content pre {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-family-mono);
    /* Keep monospace for code blocks */
    font-size: 0.85em;
    max-height: 200px;
    margin-top: 5px;
    white-space: pre;
}

.chat-message .message-content .chat-spoiler {
    background-color: color-mix(in srgb, var(--text-primary), transparent 84%);
    color: transparent;
    border-radius: var(--radius-sm);
    padding: 0 0.24em;
    cursor: pointer;
    user-select: none;
    transition: color var(--motion-fast) var(--motion-ease);
}

.chat-message .message-content .chat-spoiler:hover,
.chat-message .message-content .chat-spoiler:active {
    color: inherit;
}

.chat-message.action .message-content {
    font-style: italic;
    color: var(--text-secondary);
}

.chat-message.private-to-me .chat-message-bubble {
    background-color: color-mix(in srgb,
            var(--accent-color) 10%,
            var(--bg-secondary));
    border-left: 3px solid var(--accent-color);
}

.chat-message.private-from-me .chat-message-bubble {
    background-color: var(--chat-bubble-self-bg);
    border-right: 3px solid var(--accent-color);
}

.chat-message.quoted-mention {
    font-weight: bold;
    color: var(--accent-hover);
}

.chat-message .info-icon {
    margin-left: 5px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9em;
    transition: color 0.2s ease-in-out, transform 0.15s ease-out;
}

.chat-message .info-icon:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.chat-message .info-icon:active {
    transform: scale(0.95);
}

.chat-message img {
    max-width: 100%;
    /* Changed to 100% to fit bubble */
    max-height: 220px;
    /* Limit height of embedded images */
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 5px;
    display: block;
}

.chat-message a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
}

.chat-message a:hover {
    color: var(--accent-hover);
}

.chat-message .image-hidden-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-decoration: none;
    display: inline-block;
    padding: 0 2px;
    border: 1px dashed var(--text-muted);
    border-radius: var(--radius-sm);
}

.track-embed-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--soft-border-color);
    border-radius: var(--radius-md);
    padding: 0;
    margin-top: 5px;
    display: inline-flex;
    /* changed */
    align-items: center;
    /* new */
    gap: 8px;
    /* new */
    max-width: 95%;
    box-shadow: var(--shadow-sm);
    line-height: 1.4;
    transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out,
        background-color 0.3s ease-out;
}

.track-embed-card img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    flex-shrink: 0;
    margin: 0;
    border: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.track-embed-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
}

.chat-message-embeds {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
    min-width: 11rem;
}

.post-embed-card {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 8px 6px 10px;
    box-sizing: border-box;
    background-color: color-mix(in srgb, var(--accent-color, #ffcd00) 7%, transparent);
    border: none;
    border-left: 2px solid var(--accent-color, #ffcd00);
    border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
    box-shadow: none;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
}

.post-embed-card:hover {
    background-color: color-mix(in srgb, var(--accent-color, #ffcd00) 14%, transparent);
    border-left-color: var(--accent-hover, #e0b800);
    box-shadow: none;
    text-decoration: none;
}

.post-embed-label {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.post-embed-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.post-embed-chevron {
    flex-shrink: 0;
    color: var(--accent-color, #ffcd00);
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.85;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.post-embed-card:hover .post-embed-chevron {
    transform: translateX(2px);
    opacity: 1;
}

.chat-message.message-from-self .post-embed-title {
    color: var(--text-primary);
}

.track-embed-card a {
    color: var(--accent-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    transition: color 0.2s ease-in-out;
    padding: 8px 10px 8px 0;
    display: block;
    font-size: 0.9rem;
}

.track-embed-card a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

#chat-column #user-list-container {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-quaternary);
    padding: 8px;
    border-top: 1px solid var(--border-color);
    /* Kept for user list base */
    max-height: 150px;
    overflow-y: auto;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

#chat-column .user-list-header {
    padding-bottom: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: bold;
    flex-shrink: 0;
}

#chat-column #user-list {
    flex-grow: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

#chat-column #user-list .user-item {
    padding: 5px 3px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Increased gap */
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    /* Approx 12.6px */
    font-weight: 400;
    /* Rubik Regular */
    transition: color 0.2s ease-in-out, transform 0.15s ease-out,
        background-color 0.2s ease-in-out;
}

#user-list-bot-status {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--soft-border-color);
    cursor: pointer;
    /* Make it clickable */
    transition: background-color 0.2s ease-in-out;
}

#user-list-bot-status:hover {
    background-color: var(--bg-tertiary);
    /* Add a subtle hover effect */
}

.bot-status-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    font-style: italic;
    color: hsl(48.15deg 98.41% 49.41%);
    cursor: default;
    /* Not clickable */
}

.bot-status-entry .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    opacity: 0.8;
}

.bot-status-entry .username-text {
    font-weight: 500;
}

#chat-column #user-list .user-item .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
    position: relative;
    /* For status dot */
}

#chat-column #user-list .user-item .username-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


#chat-column #user-list .user-item:hover {
    color: var(--accent-color);
    transform: translateX(3px);
    background-color: var(--bg-tertiary);
}

#chat-column #user-list .user-item.muted {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
}

#chat-column #user-list .user-item.active-user .user-avatar-container::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: var(--color-success-strong);
    /* Green status dot */
    border-radius: 50%;
    border: 1px solid var(--bg-quaternary);
}

/* When live-uploader, show only the pulsing dot (hide static active-user dot if both apply) */
#chat-column #user-list .user-item.live-uploader.active-user .user-avatar-container::after {
    display: none;
}

/* Live uploader: green indicator dot next to avatar pulses (not the whole avatar) */
#chat-column #user-list .user-item.live-uploader .user-avatar-container::before {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: var(--color-success-strong-alt);
    border-radius: 50%;
    border: 2px solid var(--bg-quaternary);
    box-shadow: var(--shadow-glow-success);
    animation: live-uploader-dot-pulse 1s ease-in-out infinite;
}

@keyframes live-uploader-dot-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7), var(--shadow-glow-success);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
        box-shadow: 0 0 0 10px rgba(0, 230, 118, 0), 0 0 16px 4px rgba(0, 230, 118, 0.5);
    }
}

.user-avatar-container {
    position: relative;
    flex-shrink: 0;
}

#chat-column #user-list .user-item .info-icon {
    margin-left: auto;
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
}

#chat-column #user-list .user-item:hover .info-icon {
    opacity: 1;
    color: var(--accent-color);
}

.chat-loading-history {
    text-align: center;
    padding: 10px 0;
    color: var(--text-muted);
    font-style: italic;
    display: none;
    width: 100%;
    font-size: 0.928rem;
    /* Approx 13px */
}

.chat-loading-history p::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

#chat-column #chat-locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--bg-primary) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    z-index: 100;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

#chat-column #chat-locked-overlay p {
    font-size: 1.2rem;
    /* Approx 16.8px */
    font-weight: bold;
    margin: 0;
    color: var(--text-primary);
}

#chat-column #chat-locked-overlay button {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    /* Approx 15.4px */
    font-weight: bold;
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
        transform 0.15s ease-out;
    box-shadow: var(--shadow-sm);
}

#chat-column #chat-locked-overlay button:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

#chat-column #chat-locked-overlay button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-xs);
}

.info-content-panel {
    overflow-y: auto;
    background-color: var(--bg-secondary);
    transition: background-color 0.3s ease-out;
}

#info-history-content {
    padding: 0;
    display: flex;
    flex-direction: column;
}

#info-history-content #hpanel {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 8px;
    font-size: 0.785rem;
    /* Approx 11px */
    border-bottom: 1px solid var(--light-border-color);
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

#info-history-content #hpanel label {
    margin-right: 0;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: 500;
    /* Rubik Medium */
    transition: color 0.2s ease-in-out;
}

#info-history-content #hpanel label:hover {
    color: var(--text-primary);
}

#info-history-content #hpanel input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 5px;
    cursor: pointer;
}

#info-history-content #hpanel .finput {
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    padding: 4px 6px;
    font-size: 1em;
    /* Relative to parent's 0.785rem */
    margin-left: 0;
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
        background-color 0.3s ease-out, color 0.3s ease-out;
    flex-grow: 1;
    min-width: 150px;
}

#info-history-content #hpanel a {
    color: var(--accent-color);
    margin-left: 0;
    text-decoration: none;
    transition: transform 0.15s ease-out, color 0.2s ease-in-out;
    flex-shrink: 0;
}

#info-history-content #hpanel a:hover {
    text-decoration: underline;
    transform: translateY(-1px);
    color: var(--accent-hover);
}

#info-history-content #hpanel a:active {
    transform: translateY(0) scale(0.98);
}

#info-history-content #history-list-container.inner.nano {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

#info-history-content #playedSongsHistoryUL {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-message {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.928rem;
}

.history-pagination {
    padding: 8px;
    text-align: center;
    border-top: 1px solid var(--soft-border-color);
    background-color: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

.history-pagination .pagination {
    display: inline-flex;
    gap: 4px;
}

.history-pagination .page-btn {
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    border: 1px solid var(--medium-border-color);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.857rem;
    /* Approx 12px */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, transform 0.15s ease-out;
}

.history-pagination .page-btn:hover:not(:disabled) {
    background-color: var(--accent-color);
    color: var(--button-text);
    border-color: var(--accent-dark);
    transform: translateY(-1px);
}

.history-pagination .page-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

.history-pagination .page-btn.active {
    background-color: var(--accent-color);
    color: var(--button-text);
    border-color: var(--accent-dark);
    font-weight: bold;
    cursor: default;
    transform: none;
}

.history-pagination .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.history-pagination .page-ellipsis {
    padding: 5px;
    color: var(--text-muted);
    align-self: center;
}

.history-pagination .pagination-info {
    font-size: 0.785rem;
    /* Approx 11px */
    color: var(--text-muted);
}

#info-constitution-content {
    line-height: 1.7;
    font-size: 0.928rem;
    color: var(--text-primary);
}

#info-constitution-content > div {
    padding: 20px;
    max-width: 700px;
    margin: 0 auto;
}

#info-constitution-content h1 {
    color: var(--accent-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

/* Major parts - same language as Settings section titles */
#info-constitution-content h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    line-height: 1.3;
    margin-top: 1.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--soft-border-color);
}

#info-constitution-content h2:first-of-type {
    margin-top: 1.25rem;
}

/* Subsections / articles - accent so they scan like site highlights */
#info-constitution-content h3 {
    color: var(--accent-color);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;
    margin-top: 1.35rem;
    margin-bottom: 0.5rem;
}

#info-constitution-content p {
    margin-top: 0;
    margin-bottom: 0.9rem;
    color: var(--text-primary);
}

#info-constitution-content p + p {
    margin-top: 0.15rem;
}

#info-constitution-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

#info-constitution-content a {
    color: var(--accent-color);
    text-decoration: none;
}

#info-constitution-content a:hover,
#info-constitution-content a:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Slash commands / inline code - match chat chips */
#info-constitution-content code {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family-mono);
    font-size: 0.9em;
    border: 1px solid var(--soft-border-color);
}

#info-constitution-content ul,
#info-constitution-content ol {
    margin: 0.5rem 0 1rem;
    padding-left: 1.35rem;
    color: var(--text-primary);
}

#info-constitution-content ul {
    list-style-type: disc;
}

#info-constitution-content ol {
    list-style-type: decimal;
}

#info-constitution-content li {
    margin-bottom: 0.45rem;
    padding-left: 0.15rem;
    color: var(--text-secondary);
}

#info-constitution-content li::marker {
    color: var(--accent-color);
}

#info-constitution-content li strong {
    color: var(--text-primary);
}

#info-constitution-content li code {
    color: var(--text-primary);
}

/* Closing line */
#info-constitution-content > div > p:last-child {
    text-align: center;
    font-style: italic;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

body.day-mode #info-constitution-content h1,
body.day-mode #info-constitution-content h3,
body.day-mode #info-constitution-content li::marker {
    color: var(--accent-dark);
}

body.day-mode #info-constitution-content a {
    color: var(--accent-dark);
}

body.day-mode #info-constitution-content a:hover,
body.day-mode #info-constitution-content a:focus-visible {
    color: var(--accent-hover);
}

/* --- DEPRECATED PROFILE STYLES (REPLACED BY DJ CARD) --- */
#info-profile-content .profile-main-info {
    display: none;
}

#info-profile-content .profile-description-container {
    display: none;
}

#info-profile-content .profile-stats {
    display: none;
}

/* --- NEW: Redesigned DJ Card Styles --- */
.dj-card-container {
    padding: 1rem;
    max-width: 800px;
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--soft-border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

.dj-card-header {
    display: flex;
    flex-direction: column;
    /* Stack on mobile */
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--soft-border-color);
}

.dj-card-avatar-container {
    flex-shrink: 0;
    position: relative;
}

.dj-card-avatar-container img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-full);
    border: 4px solid var(--bg-tertiary);
    box-shadow: var(--shadow-md);
}

.edit-avatar-overlay {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: color-mix(in srgb, var(--bg-secondary) 70%, transparent);
    backdrop-filter: blur(4px);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.dj-card-avatar-container:hover .edit-avatar-overlay {
    opacity: 1;
    transform: scale(1.1);
}

.dj-card-identity {
    flex-grow: 1;
    min-width: 0;
}

.dj-card-identity h3 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.dj-card-identity .description-wrapper {
    margin: 0;
}

#profile-panel-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    min-height: 20px;
    padding: 0;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, box-shadow 0.2s;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}

#profile-panel-description[contenteditable="true"] {
    background-color: var(--bg-quaternary);
    outline: 1px dashed var(--accent-color);
    cursor: text;
    padding: 8px 12px;
}

#profile-panel-description[contenteditable="true"]:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 40%, transparent);
}

#dj-card-description-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    gap: 1rem;
}

#description-char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#description-char-counter.limit-exceeded {
    color: var(--vote-down-color);
    font-weight: bold;
}

.save-profile-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 6px 14px;
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}


.dj-card-stats-minor {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    /* row-gap, column-gap */
    justify-content: center;
}

/* Re-using the .detail-section for consistency */
.dj-card-section {
    background-color: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-inner);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.dj-card-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

/* Admin profile controls inside the DJ card (index.html) */
.admin-info {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.admin-permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.admin-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: end;
}

/* Generic button helper for premium interactions */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--button-border, transparent);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-normal) var(--motion-ease);
}

.most-upvoted-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: transparent;
    padding: 0;
    box-shadow: none;
}

.most-upvoted-track img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--artwork-border);
}

.most-upvoted-track-info .track-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

.most-upvoted-track-info .track-rating {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.recent-uploads-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-uploads-list .recent-upload-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-bottom: none;
}

.recent-uploads-list .recent-upload-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}

.recent-uploads-list .recent-upload-rating {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.taste-profile .taste-summary {
    font-style: italic;
    color: var(--text-muted);
}

.profile-options-placeholder {
    margin-top: 0;
    /* No extra margin */
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-inner);
}

#info-settings-content {
    font-size: 0.928rem;
    /* Approx 13px base for settings items */
    padding: 20px;
}

#info-settings-content h3 {
    margin-top: 12px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1.25rem;
    /* Approx 17.5px */
    font-weight: 600;
    /* Rubik SemiBold */
    letter-spacing: 0.015em;
    border-bottom: 1px solid var(--soft-border-color);
    padding-bottom: 6px;
}

#info-settings-content .settings-group {
    margin-bottom: 20px;
}

#info-settings-content .setting-item {
    margin-bottom: 10px;
    /* font-size is inherited from #info-settings-content */
    color: var(--text-secondary);
}

#info-settings-content .setting-item label:hover {
    color: var(--text-primary);
}

#info-settings-content .settings-group a {
    color: var(--accent-color);
    padding-left: 5px;
    display: block;
    margin-bottom: 8px;
    text-decoration: none;
    font-size: 1em;
    /* Relative to panel base (0.928rem) */
    transition: transform 0.15s ease-out, color 0.2s ease-in-out;
}

#info-settings-content .settings-group a:hover {
    text-decoration: underline;
    transform: translateY(-1px);
    color: var(--accent-hover);
}

#info-settings-content .settings-group a:active {
    transform: translateY(0) scale(0.98);
}

/* Ko-fi button in About / Links — sit with text links, skip accent underline styles */
#info-settings-content .settings-group a.settings-kofi-link {
    display: inline-block;
    padding-left: 0;
    margin-top: 4px;
    margin-bottom: 4px;
    line-height: 0;
    color: inherit;
}

#info-settings-content .settings-group a.settings-kofi-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-1px);
    opacity: 0.92;
}

#info-settings-content .settings-group a.settings-kofi-link:active {
    transform: translateY(0) scale(0.98);
    opacity: 1;
}

#info-settings-content .settings-group a.settings-kofi-link:focus-visible {
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

#info-settings-content .settings-group a.settings-kofi-link img {
    display: block;
    height: 36px;
    width: auto;
    max-width: 100%;
    border: 0;
}

/* --- LEADERBOARD STYLES (COMPACT) --- */
.leaderboard-container {
    padding: 10px 15px;
    background-color: var(--bg-quaternary);
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#top-djs-list-content {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.leaderboard-rank {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
    text-align: center;
}

.leaderboard-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.leaderboard-username {
    font-weight: 500;
    color: var(--text-primary);
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-username:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.leaderboard-avg-rating {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.leaderboard-track-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}


/* Phase D (R4/R17/R33): overlay + panel enter/exit via `.is-open` — replaces keyframe fadeIn/slideInFromTop */
.modal,
.auth-modal {
    display: none;
    position: fixed;
    z-index: 50000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: color-mix(in srgb, var(--bg-primary) 70%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    transition: opacity var(--motion-slow) var(--motion-ease);
}

.modal.is-open,
.auth-modal.is-open {
    opacity: 1;
}

.modal {
    padding-top: 5vh;
}

.auth-modal {
    padding-top: 15vh;
}

.modal-content,
.auth-modal-content {
    background-color: var(--bg-primary);
    margin: auto;
    padding: 25px;
    border: none;
    /* REMOVED BORDER */
    width: 90%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    /* Rely on shadow */
    position: relative;
    font-family: var(--font-family-ui);
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(-20px);
    transition: transform var(--motion-slow) var(--motion-ease), opacity var(--motion-slow) var(--motion-ease), background-color 0.3s ease-out, border-color 0.3s ease-out;
}

.modal.is-open .modal-content,
.auth-modal.is-open .auth-modal-content {
    opacity: 1;
    transform: translateY(0);
}

.modal-content {
    max-width: 500px;
    text-align: left;
}

.auth-modal-content {
    max-width: 380px;
    text-align: left;
}

.modal-content h2,
.auth-modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.3rem;
    /* Approx 18.2px relative to modal base */
    letter-spacing: 0.015em;
    font-weight: 600;
    /* Rubik SemiBold */
    padding: 0;
    text-align: center;
}

.auth-modal-content h2 {
    text-align: center;
}

.modal-content p {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 1em;
    /* Relative to modal base */
}

/* --- Upload modal + file review (theme tokens) --- */
#uploadModal .modal-content {
    max-width: 560px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.upload-modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.upload-modal-header-row h2 {
    margin: 0;
    text-align: left;
    flex: 1;
    min-width: 0;
}

.upload-modal-header-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

.upload-modal-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: color var(--motion-fast) var(--motion-ease), background-color var(--motion-fast) var(--motion-ease);
}

.upload-modal-icon-btn:hover,
.upload-modal-icon-btn:focus-visible {
    color: var(--accent-color);
    background-color: color-mix(in srgb, var(--accent-color) 12%, transparent);
}

.upload-modal-header-actions .close-button {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border-radius: var(--radius-md);
}

.upload-modal-header-actions .close-button:hover,
.upload-modal-header-actions .close-button:focus-visible {
    transform: none;
    background-color: color-mix(in srgb, var(--accent-color) 12%, transparent);
}

#uploadModal .upload-modal-hint {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 0;
    margin-bottom: var(--space-4);
}

.modal-content button#browseFilesBtn {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 8px 15px;
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.928rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: var(--space-3);
    margin-top: 0;
    transition: all 0.2s ease-out;
}

.modal-content button#browseFilesBtn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

#file-review-list {
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-height: min(46vh, 420px);
    overflow-y: auto;
    padding-right: 2px;
}

.file-review-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3) var(--space-4);
    align-items: start;
    padding: var(--space-3);
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    box-shadow: var(--shadow-xs);
}

.file-review-item .file-info {
    grid-column: 1 / 2;
    min-width: 0;
}

.file-review-item .filename {
    margin: 0 0 var(--space-3);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-review-item .file-meta-fields {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.file-review-item .file-meta-field {
    flex: 1 1 140px;
    min-width: 0;
}

.file-review-item .file-meta-field-comment {
    flex: 1 1 100%;
}

.file-review-item label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 4px;
    color: var(--accent-color);
    font-weight: 500;
}

.file-review-item .remove-file-btn {
    grid-column: 2 / 3;
    align-self: start;
    margin-top: 0;
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    line-height: 0;
    box-shadow: none;
    transition: all 0.2s ease-out;
}

.file-review-item .remove-file-btn:hover {
    background-color: var(--vote-down-color);
    color: var(--notification-text-color);
    border-color: transparent;
    transform: scale(1.08);
    box-shadow: none;
}

.file-review-item .remove-file-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.modal-buttons {
    text-align: right;
    margin-top: var(--space-4);
}

.modal-buttons button {
    margin-left: 8px;
}

#uploadModal #cancelUpload {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: none;
}

#uploadModal #cancelUpload:hover {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    box-shadow: var(--shadow-sm);
}

#uploadProgress {
    width: 100%;
    margin: var(--space-4) 0 var(--space-3) 0;
    display: none;
    appearance: none;
    height: 10px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-quaternary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#uploadProgress::-webkit-progress-bar {
    background-color: var(--bg-quaternary);
    border-radius: var(--radius-sm);
}

#uploadProgress::-webkit-progress-value {
    background-color: var(--accent-color);
    border-radius: var(--radius-sm);
    transition: width 0.1s linear;
}

#uploadProgress::-moz-progress-bar {
    background-color: var(--accent-color);
    border-radius: var(--radius-sm);
    transition: width 0.1s linear;
}

#uploadStatus {
    margin-top: var(--space-3);
    font-size: 0.95em;
    color: var(--text-secondary);
    min-height: 1.5em;
    text-align: center;
    line-height: 1.4;
}

/* H6 R18–R20 — upload bubble */
.upload-bubble {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: 1200;
}

#uploadBubble.upload-bubble {
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity var(--motion-normal) var(--motion-ease),
        transform var(--motion-normal) var(--motion-ease);
}

#uploadBubble.upload-bubble.upload-bubble--visible {
    opacity: 1;
    transform: translateY(0);
}

.upload-bubble-inner {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-3) var(--space-4);
    min-width: 240px;
    max-width: min(360px, calc(100vw - 32px));
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-family-ui);
}

#uploadBubble.upload-bubble.upload-bubble--complete .upload-bubble-inner {
    box-shadow: var(--shadow-glow-success), var(--shadow-xl);
    border-color: color-mix(in srgb, var(--color-success-strong) 45%, var(--border-color));
    transition: box-shadow var(--motion-normal) var(--motion-ease), border-color var(--motion-normal) var(--motion-ease);
}

.upload-bubble-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.upload-bubble-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

#uploadBubbleProgress {
    width: 100%;
    height: 8px;
    appearance: none;
    border: none;
    border-radius: var(--radius-sm);
    background-color: var(--bg-quaternary);
    overflow: hidden;
}

#uploadBubbleProgress::-webkit-progress-bar {
    background-color: var(--bg-quaternary);
    border-radius: var(--radius-sm);
}

#uploadBubbleProgress::-webkit-progress-value {
    background-color: var(--accent-color);
    border-radius: var(--radius-sm);
    transition: width 0.1s linear;
}

#uploadBubbleProgress::-moz-progress-bar {
    background-color: var(--accent-color);
    border-radius: var(--radius-sm);
    transition: width 0.1s linear;
}

#uploadBubbleStatus {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.35;
    word-break: break-word;
}

.upload-bubble-details-btn {
    margin-top: 2px;
    align-self: flex-start;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-family-ui);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}

.upload-bubble-details-btn:hover {
    background: color-mix(in srgb, var(--accent-color) 18%, var(--bg-tertiary));
    border-color: var(--accent-dark);
    color: var(--text-primary);
}

@media (max-width: 520px) {
    .file-review-item .file-meta-fields {
        flex-direction: column;
        gap: var(--space-2);
    }
}

@media (prefers-reduced-motion: reduce) {
    #uploadBubble.upload-bubble {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.auth-modal-content label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 1em;
    /* Relative to modal base */
    color: var(--accent-color);
    font-weight: 500;
    /* Rubik Medium */
}

.auth-modal-content input[type="text"],
.auth-modal-content input[type="password"],
.auth-modal-content input[type="email"],
.file-review-item input[type="text"],
.file-review-item textarea.comment-input {
    /* ADDED: Style review inputs */
    width: 100%;
    /* Changed to 100% to fill container */
    padding: 8px 10px;
    /* Adjusted padding */
    margin-bottom: 0;
    /* Margin handled by parent */
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--input-text);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 1rem;
    /* 14px for consistency with other inputs */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-out,
        background-color 0.3s ease-out, color 0.3s ease-out;
}

.file-review-item textarea.comment-input {
    resize: vertical;
    min-height: 2.5em;
    font-family: inherit;
    line-height: 1.35;
}

.auth-modal-content input[type="text"]:focus,
.auth-modal-content input[type="password"]:focus,
.auth-status {
    color: var(--vote-down-color);
    font-size: 1em;
    /* Relative to modal base */
    min-height: 1.5em;
    text-align: center;
    margin-top: 15px;
}

.field-error {
    color: var(--vote-down-color);
    font-size: 0.9rem;
    margin-top: 4px;
    min-height: 1.1em;
}

.field-error[hidden] {
    display: none;
}

#profile-info-modal-content strong {
    color: var(--text-primary);
    display: inline-block;
    min-width: 120px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 60000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    bottom: unset;
    left: unset;
    transform: none;
    align-items: flex-end;
}

.toast-notification {
    background-color: var(--notification-bg-info);
    color: var(--notification-text-color);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    font-size: 0.928rem;
    /* Approx 13px */
    opacity: 0;
    transform: translateY(-12px);
    transition:
        opacity var(--motion-normal) var(--motion-ease),
        transform var(--motion-normal) var(--motion-ease),
        background-color var(--motion-fast) var(--motion-ease);
    pointer-events: auto;
    cursor: pointer;
}

/* Phase C / R5: added in JS after append (see notifications.js) */
.toast-notification.toast-notification--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification:hover {
    filter: brightness(1.1);
}

.toast-notification.error {
    background-color: var(--notification-bg-error);
}

.toast-notification.success {
    background-color: var(--notification-bg-success);
}

.toast-notification.critical {
    background-color: var(--notification-bg-critical);
    font-weight: bold;
    border: 1px solid var(--notification-text-color);
}

.toast-notification.hide {
    opacity: 0;
    transform: translateY(-20px);
}

.auth-modal-content button[type="submit"],
.modal-content button:not(.remove-file-btn),
#info-profile-content .profile-options-placeholder button,
#send-message-btn,
/* Included already in main.js changes */
#chat-column #chat-locked-overlay button {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 10px 18px;
    /* Increased padding */
    min-height: 40px;
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 10px;
    font-family: var(--font-family-ui);
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    font-weight: 600;
    text-shadow: none;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, box-shadow 0.25s ease-in-out,
        transform 0.15s ease-out;
    box-shadow: var(--shadow-sm);
}

.auth-modal-content button[type="submit"]:hover,
.modal-content button:not(.remove-file-btn):hover,
#info-profile-content .profile-options-placeholder button:hover,
#send-message-btn:hover,
#chat-column #chat-locked-overlay button:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.auth-modal-content button[type="submit"]:active,
.modal-content button:not(.remove-file-btn):active,
#info-profile-content .profile-options-placeholder button:active,
#send-message-btn:active,
#chat-column #chat-locked-overlay button:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: var(--shadow-xs);
    filter: brightness(0.95);
}

.auth-modal-content button[type="submit"]:disabled,
.modal-content button:not(.remove-file-btn):disabled {
    background-color: var(--input-bg);
    cursor: not-allowed;
    opacity: 0.6;
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
}

/* General focus style for keyboard navigators */
a:focus-visible,
button:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
input[type="file"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
div[role="button"]:focus-visible,
span[role="button"]:focus-visible,
.console-submit-box:focus-visible,
.slider:focus-visible,
td.tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-color-primary);
}

/* Specific focus for text-based inputs */
#message-input:focus-visible,
.auth-modal-content input[type="text"]:focus-visible,
.auth-modal-content input[type="password"]:focus-visible,
.auth-modal-content input[type="email"]:focus-visible,
.file-review-item input[type="text"]:focus-visible,
.file-review-item textarea.comment-input:focus-visible,
#info-history-content #hpanel .finput:focus-visible,
#info-profile-content .profile-description[contenteditable="true"]:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-color-primary);
    outline: none;
}

/* Fallback for :focus if :focus-visible is not supported or for mouse focus on inputs */
#message-input:focus,
.auth-modal-content input[type="text"]:focus,
.auth-modal-content input[type="password"]:focus,
.auth-modal-content input[type="email"]:focus,
.file-review-item input[type="text"]:focus,
.file-review-item textarea.comment-input:focus,
#info-history-content #hpanel .finput:focus,
#info-profile-content .profile-description[contenteditable="true"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-color-primary);
    outline: none;
}

/* Remove default outline for elements that will get :focus-visible styles */
a:focus,
button:focus,
input[type="checkbox"]:focus,
input[type="radio"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus,
div[role="button"]:focus,
span[role="button"]:focus,
.console-submit-box:focus,
.slider:focus,
td.tab:focus {
    outline: none;
}

/* --- NEW STYLES FOR INVITE SECTION --- */
#invite-generation-area #generate-invite-btn {
    /* Inherit modal button styles for consistency */
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 8px 15px;
    /* Slightly smaller than modal main buttons */
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 0;
    font-family: var(--font-family-ui);
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    font-weight: 600;
    transition: all 0.2s ease-out;
    box-shadow: var(--shadow-sm);
}

#invite-generation-area #generate-invite-btn:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

#invite-generation-area #generate-invite-btn:disabled {
    background-color: var(--input-bg);
    cursor: not-allowed;
    opacity: 0.6;
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
}

#invite-link-container {
    display: flex;
    align-items: center;
    overflow: hidden;
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    transition:
        opacity var(--motion-normal) var(--motion-ease),
        max-height var(--motion-slow) var(--motion-ease),
        margin-top var(--motion-normal) var(--motion-ease);
}

#invite-link-container.invite-link-reveal {
    max-height: 6rem;
    margin-top: 15px;
    opacity: 1;
}

#invite-link-display {
    flex-grow: 1;
    background-color: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid var(--input-border);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

/* --- NEW STYLES FOR ADMIN UI AND BUG FIXES --- */

/* Base class for Pin and Remove buttons */
.queue-action-btn {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    transition:
        background-color var(--motion-normal) var(--motion-ease),
        color var(--motion-normal) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-normal) var(--motion-ease),
        opacity var(--motion-fast) var(--motion-ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    min-width: 18px;
    min-height: 18px;
}

.queue-action-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.queue-action-btn:active {
    transform: translateY(0) scale(0.96);
    box-shadow: var(--shadow-xs);
}

.queue-action-btn-placeholder {
    display: inline-block;
    width: 20px;
    /* Match button size */
    height: 20px;
    visibility: hidden;
}

/* Specific hover for remove button */
.queue-remove-btn:hover {
    border-color: var(--vote-down-color);
    color: var(--vote-down-color);
}

.queue-remove-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
}

/* Specific styling for pin button */
.queue-pin-btn {
    font-size: 15px;
    /* Make the pin emoji visible */
}

.queue-pin-btn:hover {
    color: var(--accent-color);
}

/* Admin modal for user actions */
#admin-user-actions-modal .modal-content {
    padding: 20px;
}

#admin-actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.admin-action-link {
    display: block;
    padding: 10px 15px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.admin-action-link:hover {
    background-color: var(--accent-color);
    color: var(--button-text);
    transform: translateX(5px);
}

/* Styles for Admin Message Deletion (Bug #4) */
.admin-delete-msg {
    margin-left: 8px;
    cursor: pointer;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s ease-in-out, transform 0.15s ease-out;
    display: inline-block;
}

.chat-message-bubble:hover .admin-delete-msg {
    opacity: 0.6;
    /* Visible on hover of the message bubble */
}

.admin-delete-msg:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Animation for the message being deleted (Bug #4) */
.chat-message.deleting {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out, max-height 0.4s ease-out, padding 0.4s, margin 0.4s;
    opacity: 0 !important;
    transform: translateX(30px) !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden;
}

/* Style for admin visibility of private messages (UI Polish) */
.chat-message.private-visible-to-admin .chat-message-bubble {
    background-color: color-mix(in srgb, var(--bg-secondary) 85%, var(--accent-dark) 15%);
    border-left: 2px solid var(--accent-dark);
}

.chat-message.private-visible-to-admin .username::after {
    content: '[private]';
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 5px;
    font-weight: normal;
}

/* High-priority admin broadcasts sent via the admin panel */
.chat-message.admin-broadcast .chat-message-bubble {
    background-color: color-mix(in srgb, var(--accent-color) 18%, var(--bg-secondary));
    border-left: 3px solid var(--accent-color);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-md);
}

.chat-message.admin-broadcast .message-content {
    font-weight: 600;
}

/* NEW: Forgot Password Link */
.forgot-password-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.forgot-password-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}


/* --- Media Queries --- */
@media (min-width: 768px) {
    #main-header {
        flex-wrap: nowrap;
        padding: 10px 20px;
        box-shadow: var(--shadow-lg);
        /* Stronger shadow for lifted header */
    }

    #header-player-slot {
        order: 0;
        margin: 0 15px;
        min-height: var(--player-element-height);
    }

    .header-section {
        flex-basis: auto;
        padding: 0;
        margin-bottom: 0;
    }

    .logo-section {
        flex-grow: 0;
        justify-content: flex-start;
    }

    .auth-upload-section {
        order: 3;
        justify-content: flex-end;
        flex-grow: 0;
        margin-top: 0;
    }

    .desktop-only {
        display: flex;
    }

    #mobile-nav-toggle,
    .mobile-nav-overlay,
    .mobile-nav-menu {
        display: none;
    }

    #main-content {
        flex-direction: row;
    }

    #playlist {
        width: 35%;
        flex-basis: 35%;
        flex-shrink: 0;
        border-right: 1px solid var(--border-color);
        /* Kept for desktop layout division */
        border-bottom: none;
        box-shadow: var(--shadow-md);
        /* Removed explicit right-side line from shadow */
    }

    #chat-column {
        width: 65%;
        flex-basis: 65%;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        border-left: none;
        box-shadow: none;
        /* Rely on playlist's right border/shadow */
    }

    #chat-column>#chat-main-wrapper.active {
        flex-direction: row;
        overflow: hidden;
    }

    #chat-main-wrapper.active>#chat-content-area {
        flex-grow: 1;
        min-width: 0;
    }

    #chat-main-wrapper.active>#user-list-container {
        width: 200px;
        flex-shrink: 0;
        border-top: none;
        border-left: 1px solid var(--border-color);
        /* Keep for desktop user list separation */
        max-height: none;
    }

    .notification-container {
        top: 20px;
        right: 20px;
        bottom: unset;
        left: unset;
        transform: none;
        align-items: flex-end;
    }

    .toast-notification {
        max-width: 300px;
        width: auto;
        text-align: left;
    }

    .toast-notification.hide {
        transform: translateY(-20px);
    }
}

@media (min-width: 1200px) {
    #main-header {
        padding: 15px 30px;
    }

    .logo-section .logo-link img {
        max-height: 38px;
    }

    .listener-stats {
        font-size: 1rem;
        /* 14px */
    }

    #chat-main-wrapper.active>#user-list-container {
        width: 240px;
    }
}

@media (max-width: 992px) {
    #main-header {
        flex-wrap: wrap;
        min-height: auto;
    }

    #header-player-slot {
        order: 1;
        width: 65%;
        margin: 5px 0;
        min-height: var(--player-element-height);
    }

    #playlist .current .full .expanded-details-container {
        grid-template-columns: 1fr;
        /* Stack columns on smaller screens */
    }
}

@media (min-width: 600px) {
    .dj-card-container {
        padding: 2rem;
        margin: 2rem auto;
    }

    .dj-card-header {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
    }

    .dj-card-identity h3 {
        font-size: 2.25rem;
    }

    #profile-panel-description {
        margin-left: 0;
        margin-right: 0;
    }

    #dj-card-description-controls {
        justify-content: flex-start;
    }

    .dj-card-stats-minor {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {

    /* Revert player to a simpler flex layout for mobile */
    #audio-player #player-bar-info-and-main-controls {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
    }

    .player-info-stack {
        order: 1;
        align-items: center;
        text-align: center;
    }

    .player-control-cluster {
        order: 2;
        flex-direction: column;
        /* Stack controls vertically on mobile */
    }

    #audio-player #player-bar-tags-container,
    #audio-player #player-bar-uploader-container {
        display: none;
        /* Hide tags and uploader only on the smallest screens */
    }

    #main-header #audio-player,
    #header-player-slot {
        --player-bar-cover-size: var(--mobile-player-bar-cover-size);
        --player-bar-padding: var(--mobile-player-bar-padding);
        --player-bar-content-height-mobile: calc(var(--mobile-player-bar-cover-size) + (2 * var(--mobile-player-bar-padding)));
        --player-element-height-mobile: calc(var(--player-bar-content-height-mobile) + var(--player-bar-progress-height));
        height: var(--player-element-height-mobile) !important;
        min-height: var(--player-element-height-mobile);
    }

    #audio-player #player-bar-cover-art-container {
        width: var(--mobile-player-bar-cover-size);
        height: var(--mobile-player-bar-cover-size);
    }

    #audio-player .player-bar-content-wrapper {
        padding: var(--mobile-player-bar-padding);
        gap: var(--mobile-player-bar-padding);
        height: var(--player-bar-content-height-mobile);
    }

    #audio-player #player-bar-artist-title-display .title-name {
        font-size: 1.15em;
        line-height: 1.3;
    }

    #audio-player .player-bar-vote-btn {
        --player-bar-vote-button-icon-size-mobile: 20px;
        min-width: calc(var(--player-bar-vote-button-icon-size-mobile) + 6px);
        min-height: calc(var(--player-bar-vote-button-icon-size-mobile) + 6px);
    }

    #audio-player .player-bar-vote-btn svg {
        width: var(--player-bar-vote-button-icon-size-mobile);
        height: var(--player-bar-vote-button-icon-size-mobile);
    }

    #audio-player #player-bar-play-controls {
        gap: 15px;
    }

    #main-header {
        min-height: auto;
        padding: 10px;
    }

    .logo-section,
    .auth-upload-section {
        flex-basis: 50%;
    }

    #main-content {
        flex-direction: column;
    }

    #playlist {
        width: 100%;
        flex-basis: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        /* Softer border for mobile */
    }

    #chat-column {
        width: 100%;
        flex-basis: auto;
        flex-grow: 1;
        box-shadow: none;
    }

    #chat-column #chat-main-wrapper.active {
        flex-direction: column;
    }

    #chat-main-wrapper.active>#chat-content-area {
        flex-grow: 1;
        min-height: 0;
    }

    #chat-main-wrapper.active>#user-list-container {
        width: 100%;
        max-height: 150px;
        border-left: none;
        border-top: 1px solid var(--border-color);
        /* Softer border */
        flex-shrink: 0;
    }

    #mobile-nav-toggle {
        display: block;
    }

    .notification-container {
        top: 10px;
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        align-items: center;
    }

    .toast-notification.hide {
        transform: translateY(20px);
    }
}

@media (max-width: 480px) {
    #audio-player #player-bar-artist-title-display .title-name {
        font-size: 1.1rem;
    }

    #audio-player #player-bar-artist-title-display .artist-name {
        font-size: 0.9rem;
    }

    #audio-player #player-bar-info-and-main-controls {
        gap: 3px;
    }

    #audio-player #player-bar-volume-container {
        gap: 5px;
    }

    #audio-player #player-bar-volume-container #volume {
        width: 80px;
        /* Smaller slider for very small screens */
    }

    #audio-player #player-bar-volume-display {
        display: none !important;
    }
}

@media (max-width: 360px) {
    #audio-player #player-bar-artist-title-display .title-name {
        font-size: 0.9rem;
        /* Approx 12.6px */
    }

    #audio-player #player-bar-artist-title-display .artist-name {
        font-size: 0.8rem;
    }

    #audio-player #player-bar-play-controls {
        gap: 10px;
    }

    #audio-player .player-bar-vote-btn {
        --player-bar-vote-button-icon-size-tiny: 18px;
        min-width: calc(var(--player-bar-vote-button-icon-size-tiny) + 4px);
        min-height: calc(var(--player-bar-vote-button-icon-size-tiny) + 4px);
        padding: 2px;
    }

    #audio-player .player-bar-vote-btn svg {
        width: var(--player-bar-vote-button-icon-size-tiny);
        height: var(--player-bar-vote-button-icon-size-tiny);
    }

    #audio-player #player-bar-volume-container #volume {
        width: 60px;
        /* Even smaller slider */
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.chat-message.system {
    font-style: italic;
    color: var(--text-muted);
    background-color: var(--bg-quaternary);
    /* A slightly different background */
    padding: 6px 10px;
    border-left: 3px solid var(--accent-color);
}

.chat-message.system .username {
    color: var(--accent-hover);
    /* Make the "System" username a different color */
    font-weight: 500;
}

/* Visually Hidden Class (from index.html) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Compact Wave status pill under logo/listeners block */
.wave-status-panel {
    display: none;
    align-items: center;
    justify-content: flex-start;
    margin-top: 4px;
}

.wave-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: var(--panel-bg, rgba(0, 0, 0, 0.4));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
    line-height: 1.3;
    white-space: nowrap;
}

.wave-status-pill--inactive {
    background-color: transparent;
    box-shadow: none;
    color: var(--text-muted);
}

.wave-status-icon {
    font-size: 1.05rem;
}

.wave-status-main {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wave-status-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.85;
}

.wave-status-tags {
    font-weight: 500;
}

.wave-status-tags--inactive {
    font-weight: 400;
    opacity: 0.7;
}

.wave-status-started-by {
    font-size: 0.78rem;
    opacity: 0.8;
}

.wave-status-strength {
    margin-left: 10px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.wave-status-strength-text {
    font-size: 0.785rem;
    color: var(--text-muted);
    text-align: right;
    margin-bottom: 2px;
    white-space: nowrap;
}

.wave-status-strength-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
    opacity: 0.8;
    white-space: nowrap;
}

.wave-status-pill--low .wave-status-strength-sub {
    color: rgba(255, 150, 130, 0.85);
    opacity: 1;
}

.wave-status-strength-bar {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
}

.wave-status-strength-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(
        90deg,
        var(--accent-color) 0%,
        rgba(120, 200, 255, 0.55) 60%,
        rgba(255, 255, 255, 0.0) 100%
    );
    transform-origin: left center;
    transform: scaleX(0.04);
    transition: transform 0.45s ease-out, background 0.3s ease-out;
    opacity: 0.95;
}

.wave-status-strength--low .wave-status-strength-fill {
    background: linear-gradient(
        90deg,
        rgba(255, 110, 90, 0.95) 0%,
        rgba(255, 180, 90, 0.5) 60%,
        rgba(255, 255, 255, 0.0) 100%
    );
}

.wave-status-pill--low .wave-status-strength-text {
    color: rgba(255, 150, 130, 0.9);
    font-weight: 600;
}

.wave-status-pill--low {
    box-shadow: 0 0 0 1px rgba(255, 110, 90, 0.35);
}

/* --- Waves (Pillar 1) --- */

.wave-indicator-line {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 1.4em;
}

.wave-indicator-line .wave-icon {
    font-size: 1rem;
}

.wave-indicator-line .wave-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.upcoming-track-item.queue-item-wave {
    border-left: 3px solid var(--accent-color);
    background: linear-gradient(to right, rgba(255, 205, 0, 0.08), transparent);
}

.queue-wave-indicator {
    margin-left: 6px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

/* =============================================================================
   Phase B (FRONTEND_UX_EXECUTION_PLAN.md): interactive polish — CSS only, no JS
   R3, R21, R36 — focus parity + motion tokens (see also Phase A reduced-motion)
   ============================================================================= */

/* Player play/stop: keyboard focus matches hover lift (focus ring from global button/div rules) */
#audio-player #player-bar-play-controls .play-container:focus-visible,
#audio-player #player-bar-play-controls .stop-container:focus-visible {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

/* Chat formatting toolbar: clearer focused chip */
.chat-rich-text-buttons button.chat-format-btn:focus-visible {
    border-color: var(--accent-color);
}

/* Info panel tabs: keyboard focus mirrors inactive hover */
#chat-column #info-tabs-container .tab:focus-visible {
    outline-offset: 3px;
}

#chat-column #info-tabs-container .tab:focus-visible:not(.active) {
    background-color: var(--bg-secondary);
    color: var(--text-primary) !important;
}

/* Settings “About” links: ring sits comfortably on block links */
#info-settings-content .settings-group a:focus-visible {
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* =============================================================================
   Phase H (FRONTEND_UX_EXECUTION_PLAN.md): tabs, queue/history, badges, theme,
   expand/collapse, upload bubble, admin — motion tokens; reduced motion via Phase A
   ============================================================================= */

@keyframes tfmNumTickPulse {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.06);
        color: var(--accent-color);
    }

    100% {
        transform: scale(1);
    }
}

.tfm-num-tick {
    display: inline-block;
    animation: tfmNumTickPulse var(--motion-normal) var(--motion-ease) 1;
}

@media (prefers-reduced-motion: reduce) {
    .tfm-num-tick {
        animation: none;
    }
}

@keyframes infoPanelSwitchIn {
    from {
        opacity: 0.88;
    }

    to {
        opacity: 1;
    }
}

#chat-column>.info-content-panel.info-panel-switch-in,
#chat-column>#chat-main-wrapper.info-panel-switch-in {
    animation: infoPanelSwitchIn var(--motion-fast) var(--motion-ease) forwards;
}

@media (prefers-reduced-motion: reduce) {

    #chat-column>.info-content-panel.info-panel-switch-in,
    #chat-column>#chat-main-wrapper.info-panel-switch-in {
        animation: none;
    }
}

/* H1 R27 — mobile drawer tab shortcuts mirror desktop active */
#mobileNavMenu .mobile-tab-link.mobile-tab-link--active {
    color: var(--accent-color);
    font-weight: 600;
}

/* H2 R8/R28/R29 — queue + history row hover (defer “updated row” flash per plan §7) */
#playlist #upcomingQueue .item.upcoming-track-item {
    transition:
        background-color var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-fast) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease);
}

#playlist #upcomingQueue .item.upcoming-track-item:hover {
    background-color: rgba(255, 205, 0, 0.06);
}

#playedSongsHistoryUL .history-item-content {
    transition:
        background-color var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-fast) var(--motion-ease);
}

#playedSongsHistoryUL .item.history-item:hover .history-item-content {
    background-color: rgba(255, 255, 255, 0.04);
}

@keyframes historyListFadeIn {
    from {
        opacity: 0.65;
    }

    to {
        opacity: 1;
    }
}

#playedSongsHistoryUL.history-swap-fade {
    animation: historyListFadeIn var(--motion-fast) var(--motion-ease) 1;
}

@media (prefers-reduced-motion: reduce) {
    #playedSongsHistoryUL.history-swap-fade {
        animation: none;
    }
}

#hpanel label {
    transition: color var(--motion-fast) var(--motion-ease), opacity var(--motion-fast) var(--motion-ease);
}

#hpanel input[type="checkbox"]:checked+span {
    color: var(--accent-color);
}

/* H4 R10/R34 — theme + settings lang buttons (storage unchanged; theme.js untouched) */
#theme-toggle-button .theme-icon-desktop-sun,
#theme-toggle-button .theme-icon-desktop-moon,
#mobile-theme-toggle-button .theme-icon-mobile-sun,
#mobile-theme-toggle-button .theme-icon-mobile-moon {
    transition: opacity var(--motion-normal) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}

#mobile-lang-switcher-console button:active,
#lang-switcher-console button:active {
    transform: translateY(1px) scale(0.97);
}

/* H5 R12 — current track expand uses grid 0fr/1fr (existing); token-align transition */
#playlist .current .full {
    transition:
        grid-template-rows var(--motion-slow) var(--motion-ease),
        opacity var(--motion-normal) var(--motion-ease);
}

/* ========== Community Blog (WP6) ========== */
#info-blog-content {
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.blog-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    width: 100%;
}

.blog-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--medium-border-color);
    background: var(--bg-primary);
}

.blog-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.blog-toolbar-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.blog-toolbar-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

.blog-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.blog-karma-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 180px;
    text-align: right;
}

.blog-view-root {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 24px;
    min-height: 0;
}

.blog-anim-enter {
    animation: blogPanelIn 0.22s var(--motion-ease, ease-out);
}

@keyframes blogPanelIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.blog-loading,
.blog-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.blog-empty .blog-btn {
    margin-top: 12px;
}

.blog-feed-list {
    display: flex;
    flex-direction: column;
}

.blog-feed-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 14px 14px;
    border-bottom: 1px solid var(--medium-border-color);
}

.blog-feed-main {
    min-width: 0;
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
    padding: 2px 4px 4px 0;
    transition: background-color 0.15s ease-out;
}

.blog-feed-main:hover,
.blog-feed-main:focus-visible {
    background-color: color-mix(in srgb, var(--accent-color, #ffcd00) 8%, transparent);
}

.blog-feed-main:focus-visible {
    outline: none;
    box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color-primary, var(--accent-color));
}

.blog-feed-row.blog-row-highlight,
.blog-detail.blog-row-highlight {
    animation: blogHighlight 1.4s ease-out;
}

@keyframes blogHighlight {
    0% { background-color: color-mix(in srgb, var(--accent-color, #ffcd00) 22%, transparent); }
    100% { background-color: transparent; }
}

.blog-vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 2px;
}

.blog-vote-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 14px;
}

.blog-vote-col .queue-vote-btn,
.blog-vote-row .queue-vote-btn {
    min-width: 40px;
    min-height: 40px;
}

.blog-feed-title {
    display: block;
    width: 100%;
    text-align: left;
    margin: 0 0 4px;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--text-primary);
    line-height: 1.3;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent-color, #ffcd00) 45%, transparent);
    text-underline-offset: 3px;
    transition: color 0.15s ease-out, text-decoration-color 0.15s ease-out;
}

.blog-feed-main:hover .blog-feed-title,
.blog-feed-main:focus-visible .blog-feed-title {
    color: var(--accent-color, #ffcd00);
    text-decoration-color: var(--accent-color, #ffcd00);
}

.blog-feed-open-hint {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-color, #ffcd00);
    opacity: 0.75;
    transition: opacity 0.15s ease-out;
}

.blog-feed-main:hover .blog-feed-open-hint,
.blog-feed-main:focus-visible .blog-feed-open-hint {
    opacity: 1;
}

.blog-feed-meta,
.blog-detail-meta,
.blog-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.blog-meta-sep {
    opacity: 0.5;
}

.blog-author-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--text-secondary);
    cursor: pointer;
}

.blog-author-link:hover {
    color: var(--accent-color, #ffcd00);
    text-decoration: underline;
}

.blog-feed-preview {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-load-more-sentinel {
    padding: 16px;
    text-align: center;
}

.blog-detail,
.blog-compose {
    padding: 12px 14px 28px;
    max-width: 720px;
}

.blog-back-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 14px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.blog-back-btn:hover {
    color: var(--accent-color, #ffcd00);
}

.blog-detail-title,
.blog-compose-heading {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 650;
    color: var(--text-primary);
    line-height: 1.25;
}

.blog-body {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
    word-break: break-word;
    /* Same as chat .message-content — MessageParser does not insert <br> */
    white-space: pre-wrap;
}

.blog-body img {
    /* Cap both axes; keep aspect ratio — large originals stay thumbnail-sized in-flow */
    max-width: min(100%, 400px);
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 10px 0;
    cursor: zoom-in;
    border-radius: var(--radius-md, 6px);
    border: 1px solid var(--border-color, var(--medium-border-color));
    background-color: var(--bg-secondary);
    box-sizing: border-box;
}

/* MessageParser wraps remote/local images in <a><img></a> — don't let the link stretch */
.blog-body a:has(> img) {
    display: block;
    width: fit-content;
    max-width: min(100%, 400px);
    margin: 10px 0;
    line-height: 0;
}

.blog-body a:has(> img) > img {
    margin: 0;
}

/* Comments: slightly tighter */
.blog-comment-body img,
.blog-comment-body a:has(> img) {
    max-width: min(100%, 280px);
    max-height: 200px;
}

.blog-comment-body a:has(> img) {
    max-width: min(100%, 280px);
}

.blog-detail-actions {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.blog-comments {
    margin-top: 22px;
    border-top: 1px solid var(--medium-border-color);
    padding-top: 14px;
}

.blog-comments-heading {
    margin: 0 0 12px;
    font-size: 1rem;
}

.blog-comment {
    padding: 10px 0;
    border-bottom: 1px solid var(--medium-border-color);
}

.blog-comment-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
}

.blog-comment-form,
.blog-compose-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.blog-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.blog-field input,
.blog-field textarea,
.blog-comment-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--medium-border-color);
    border-radius: var(--radius-md, 6px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
}

.blog-format-toolbar {
    margin: 6px 0 8px;
    padding: 0;
    background: transparent;
    border: none;
}

.blog-compose-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

/* Match #send-message-btn / modal upload CTAs (tokens + hover lift / press) */
.blog-btn,
#blog-new-post-btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 18px;
    min-height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-family-ui);
    font-size: calc(0.928rem * var(--font-size-ui-scale));
    font-weight: 600;
    text-shadow: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: none;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        border-color 0.2s ease-in-out, box-shadow 0.25s ease-in-out,
        transform 0.15s ease-out, filter 0.15s ease-out;
}

.blog-btn:hover,
#blog-new-post-btn:hover {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
    border-color: var(--medium-border-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.blog-btn:active,
#blog-new-post-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-xs);
    filter: brightness(0.95);
}

.blog-btn:disabled,
#blog-new-post-btn:disabled {
    background-color: var(--input-bg);
    cursor: not-allowed;
    opacity: 0.6;
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
    filter: none;
}

.blog-btn-primary,
#blog-new-post-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--button-border);
    box-shadow: var(--shadow-sm);
}

.blog-btn-primary:hover,
#blog-new-post-btn:hover {
    background-color: var(--accent-hover);
    color: var(--button-text);
    border-color: var(--button-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.blog-btn-primary:active,
#blog-new-post-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-xs);
    filter: brightness(0.95);
}

.blog-btn-ghost {
    background-color: transparent;
    box-shadow: none;
}

.blog-btn-ghost:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--medium-border-color);
    box-shadow: var(--shadow-sm);
}

.blog-btn-danger {
    color: var(--vote-down-color, #e57373);
    border-color: color-mix(in srgb, var(--vote-down-color, #e57373) 40%, var(--medium-border-color));
    background-color: transparent;
    box-shadow: none;
}

.blog-btn-danger:hover {
    background-color: color-mix(in srgb, var(--vote-down-color, #e57373) 12%, var(--bg-secondary));
    border-color: var(--vote-down-color, #e57373);
    color: var(--vote-down-color, #e57373);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

/* Six tabs: slightly tighter labels */
#chat-column #info-tabs-container .tab {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    padding: 8px 2px;
}

#chat-column #info-tabs-container .tab a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

@media (max-width: 720px) {
    .blog-feed-row {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 12px 10px;
    }
    .blog-karma-hint {
        max-width: 120px;
        font-size: 0.72rem;
    }
}

#info-blog-content .queue-vote-btn.active-up {
    border-color: var(--vote-up-color);
    color: var(--vote-up-color);
    opacity: 1;
}

#info-blog-content .queue-vote-btn.active-down {
    border-color: var(--vote-down-color);
    color: var(--vote-down-color);
    opacity: 1;
}
