/* 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-hover: #e0b800;
    --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-content-height: calc(var(--player-bar-cover-size) + (2 * var(--player-bar-padding)));
    --player-element-height: var(--player-bar-content-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: 56px;
    --mobile-player-bar-padding: 6px;

    /* --- 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;
    /* Phase D2: clip at document root instead of body overflow-x:hidden masking bugs.
       Phase A layout should not produce horizontal overflow; this is a last-resort guard. */
    overflow-x: clip;
}

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-hover: #e0b800;
    --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 {
    /*
     * Day roles (night gold does not transfer 1:1):
     * - Surfaces: cool slate field + true-white reading panels
     * - --accent-* : interactive INK (links, icons, borders, focus, progress)
     *   Bright #ffcd00 fails ~1.5:1 on white — use deep bronze instead
     * - --button-* : brand gold only as SOLID CTA fills (Send, Upload, submit)
     *   Gold chip + dark label is fine; gold as text/icon is not
     */

    /* Surfaces */
    --bg-primary: #e6e8ee;
    /* Field behind columns */
    --bg-secondary: #ffffff;
    /* Reading / cards — true white */
    --bg-tertiary: #f2f3f7;
    /* Chat shelf / nested panels */
    --bg-quaternary: #d5d8e0;
    /* Rails, chips base */

    /* Text on light panels */
    --text-primary: #141820;
    --text-secondary: #3f4756;
    --text-muted: #6a7280;
    --text-dark-contrast: #0c0e12;

    /* Interactive ink — gold family, WCAG-safe on white (~4.6:1+) */
    --accent-color: #8a6200;
    --accent-dark: #6b4c00;
    --accent-hover: #a37400;

    /* Borders */
    --border-color: #c7cbd4;
    --light-border-color: #e6e8ee;
    --medium-border-color: #949aa8;
    --soft-border-color: #eef0f4;

    /* Primary CTA chips — brand gold as fill only */
    --button-bg: #ffcd00;
    --button-hover: #f0c000;
    --button-text: #141820;
    --button-border: #c9a000;

    /* Inputs — white fields on slate chrome */
    --input-bg: #ffffff;
    --input-border: #c7cbd4;
    --input-text: var(--text-primary);

    /* Votes as icon/border color on white panels */
    --vote-up-color: #a65f00;
    --vote-down-color: #c62828;

    /* Tags */
    --tag-bg: #e6e8ee;
    --tag-text: #1a1f2a;

    /* Artwork */
    --artwork-border: var(--border-color);
    --artwork-bg: #f4f5f8;

    /* Semantic 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, 160, 90, 0.96);
    --color-success-strong: #1a8f4a;
    --color-success-strong-alt: #22a85a;
    --color-bg-header-day: #f4f5f8;

    /* Notifications */
    --notification-bg-info: rgba(59, 130, 246, 0.96);
    --notification-bg-error: rgba(198, 40, 40, 0.96);
    --notification-bg-success: rgba(34, 160, 90, 0.96);
    --notification-bg-critical: rgba(180, 35, 35, 0.98);
    --notification-text-color: white;

    /* Own messages — warm paper, not highlighter yellow */
    --chat-bubble-self-bg: #f3ecdf;

    /* Depth on light UI */
    --shadow-color: rgba(20, 24, 32, 0.08);
    --shadow-xs: 0 1px 2px 0 rgba(20, 24, 32, 0.05);
    --shadow-sm: 0 2px 4px 0 rgba(20, 24, 32, 0.06);
    --shadow-md: 0 10px 24px rgba(20, 24, 32, 0.08);
    --shadow-lg: 0 18px 36px rgba(20, 24, 32, 0.1);
}

@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;
    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;
}

/* Distinct header bar in day mode — uses header token */
body.day-mode #main-header {
    background-color: var(--color-bg-header-day);
}

#header-player-slot {
    flex-grow: 1;
    flex-shrink: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    /* Phase A1: never force 450px on phones/tablets (caused h-scroll + overlaps) */
    min-width: 0;
    width: 100%;
    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-3);
    /* Space between play controls and volume/time */
    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;
    /* Phase A2: allow flex/grid shrink so ellipsis works; text never paints over controls */
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* 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;
    min-width: 0;
    max-width: 100%;
}

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


#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-and-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#audio-player #player-bar-track-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
    min-height: 1.2em;
}

#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);
}

.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;
    flex-shrink: 0;
    /* Queue must not flex-crush expanded details (links/actions) */
    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: 1 1 0;
    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 {
    /* Phase B1: allow tags to wrap instead of collapsing to junk ellipsis */
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.857rem;
    /* Approx 12px */
    line-height: 1.35;
    max-width: 100%;
}

#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;
    /* overflow:hidden required for 0fr collapse; scroll only when expanded */
    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 .expanded-details-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#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;
    min-width: 0;
}

.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 */
}

/* Tags are injected into #details-upvoted-by / #details-downvoted-by;
   without this the span is one flex item and grows past the card. */
.song-stats-grid .stat-voters > span {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-width: 0;
    flex: 1 1 0%;
}

.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;
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Shared fixed tracks so header + every row stay column-aligned
   (separate grids with `auto` sized differently per content).
   Plays col sized for RU "ПРОСЛУШИВАНИЙ" (uppercase + letter-spacing). */
.history-header,
.history-item-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 8rem 11rem 5rem;
    column-gap: 12px;
    align-items: center;
    padding: 8px 12px;
    box-sizing: border-box;
}

/* Стилизация самого заголовка */
.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.04em;
    /* Same gutter as the scrollable list so right columns stay aligned */
    overflow-y: auto;
    scrollbar-gutter: stable;
}

/* Data cells may truncate; headers must show full labels */
.history-item-name,
.history-item-last-played,
.history-item-plays,
.history-item-rating {
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-header-name,
.history-header-last-played,
.history-header-plays,
.history-header-rating {
    white-space: nowrap;
    min-width: 0;
    overflow: visible;
}

/* 1. Колонка с названием трека */
.history-item-name {
    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;
}

/* 4. Колонка рейтинга */
.history-item-rating {
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.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 .innerl.queue-drop-target {
    min-height: 0;
}

#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);
    background: var(--bg-secondary);
    cursor: default;
    padding: 0;
    transition: background-color 0.2s ease-in-out;
}

.queue-drop-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.queue-drop-zone {
    flex-shrink: 0;
    border-top: 2px dashed var(--border-color);
    padding: var(--space-3) var(--space-4);
    text-align: center;
    background: color-mix(in srgb, var(--accent-color) 5%, var(--bg-secondary));
    cursor: copy;
    transition: border-color var(--motion-fast) var(--motion-ease),
        background-color var(--motion-fast) var(--motion-ease);
}

.queue-drop-zone[hidden] {
    display: none !important;
}

.queue-drop-zone-hint {
    margin: 0;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-muted);
}

.queue-drop-zone--active {
    border-top-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 12%, var(--bg-secondary));
}

.queue-drop-zone--active .queue-drop-zone-hint {
    color: var(--accent-color);
}

.queue-drop-target {
    position: relative;
}

.queue-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    background: color-mix(in srgb, var(--accent-color) 10%, var(--bg-secondary));
    pointer-events: none;
    text-align: center;
    transition: border-color var(--motion-fast) var(--motion-ease),
        background-color var(--motion-fast) var(--motion-ease);
}

.queue-drop-overlay[hidden] {
    display: none !important;
}

.queue-drop-overlay--active {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 18%, var(--bg-secondary));
}

.queue-drop-overlay-hint,
.queue-drop-overlay-active-text {
    margin: 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-primary, inherit);
}

.queue-drop-overlay-active-text {
    color: var(--accent-color);
}

#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;
    /* Phase B1: long titles wrap inside the fluid column, never shove votes */
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

#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 {
    /* Phase B1: wrap tags up to 2 lines */
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.25;
    max-width: 100%;
}

.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;
    white-space: nowrap;
}

#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 (box-shadow keeps column alignment) */
#info-history-content #playedSongsHistoryUL .history-item--now-playing {
    box-shadow: inset 3px 0 0 var(--color-accent);
    background-color: var(--bg-tertiary);
}

#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);
}

/* Canonical desk breakpoint: min-width 901px (see docs/RESPONSIVE_LAYOUT_IMPROVEMENT_PLAN.md) */
@media (min-width: 901px) {
    #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-composer-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.chat-format-toggle {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid var(--medium-border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-quaternary);
    color: var(--text-secondary);
    font-family: var(--font-family-ui);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition:
        background-color var(--motion-fast) var(--motion-ease),
        color var(--motion-fast) var(--motion-ease),
        border-color var(--motion-fast) var(--motion-ease);
}

.chat-format-toggle:hover,
#chat-input-area.chat-format-open .chat-format-toggle {
    background-color: var(--accent-color);
    color: var(--button-text);
    border-color: var(--accent-dark);
}

.chat-format-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.chat-rich-text-buttons {
    display: flex;
    gap: 5px;
    /* Increased gap */
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.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(--button-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%;
    min-width: 0;
    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: min(85%, 100%);
    /* Bubbles don't take full width */
    width: fit-content;
    /* Shrink to content size */
    min-width: 0;
    box-shadow: var(--shadow-sm);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.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;
    /* Phase B3: long names wrap — never force 1-char-wide message columns */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.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;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    font-size: 1rem;
    /* Or 0.928rem (13px) if username is 1rem */
    font-weight: 400;
    /* Rubik Regular */
    min-width: 0;
}

/* --- 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;
}

/* Phase C: presence toggle — hidden on desk; shown on compact */
.user-list-toggle {
    display: none;
    align-items: center;
    align-self: flex-end;
    gap: 6px;
    margin: 8px 12px 0;
    padding: 6px 12px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 2;
    transition:
        color var(--motion-normal) var(--motion-ease),
        border-color var(--motion-normal) var(--motion-ease),
        background-color var(--motion-normal) var(--motion-ease);
}

.user-list-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.user-list-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.user-list-toggle[aria-expanded="true"] {
    color: var(--text-primary);
    border-color: var(--accent-color);
    background-color: var(--bg-tertiary);
}

.user-list-toggle-count {
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}

.user-list-sheet-backdrop {
    display: none;
}

#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(--button-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;
    scrollbar-gutter: stable;
}

#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 {
    position: relative;
    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-container.is-loading > :not(.dj-card-loading) {
    visibility: hidden;
    pointer-events: none;
}

.dj-card-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 2.5rem 1rem 2rem;
    background-color: var(--bg-secondary);
    border-radius: inherit;
    text-align: center;
}

.dj-card-loading[hidden] {
    display: none !important;
}

.dj-card-loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.dj-card-loading-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.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-meta {
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.dj-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 0.85rem;
    row-gap: 0.75rem;
    width: 100%;
    max-width: 28rem;
}

.dj-card-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
    min-width: 0;
}

.dj-card-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.2;
    text-align: center;
}

.dj-card-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    word-break: break-word;
    text-align: center;
}

.dj-card-contributed {
    margin: 0;
    max-width: 36rem;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-secondary);
    text-align: center;
}

.dj-card-contributed:empty {
    display: none;
}

.dj-card-email-self-only {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem 0.55rem;
    width: 100%;
    max-width: 36rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--soft-border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dj-card-email-label {
    font-weight: 700;
    color: var(--text-primary);
}

.dj-card-email-value {
    word-break: break-all;
}

.dj-card-email-edit {
    padding: 4px 8px;
    min-width: 2rem;
    line-height: 1;
}

/* 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;
}

.dj-card-invitees-details {
    padding-top: 0.25rem;
}

.dj-card-invitees-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}

.dj-card-invitees-summary::-webkit-details-marker {
    display: none;
}

.dj-card-invitees-summary::before {
    content: "▸";
    display: inline-block;
    transition: transform 0.15s ease;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.dj-card-invitees-details[open] > .dj-card-invitees-summary::before {
    transform: rotate(90deg);
}

.dj-card-invitees-count {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.dj-card-invitees-details > .recent-uploads-list {
    margin-top: 0.75rem;
}

.profile-upvoted-pagination {
    margin-top: 0.75rem;
}

/* 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-genres-title {
    margin: 0.75rem 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.taste-genre-bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.taste-genre-row {
    display: grid;
    grid-template-columns: minmax(0, 7.5rem) 1fr 1.75rem;
    align-items: center;
    gap: 0.45rem;
    min-height: 1.1rem;
}

.taste-genre-name {
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taste-genre-track {
    display: block;
    height: 0.35rem;
    background-color: color-mix(in srgb, var(--text-muted) 22%, transparent);
    border-radius: 999px;
    overflow: hidden;
}

.taste-genre-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
}

/* Rotating palette (preview-style category colors) */
.taste-genre-fill.taste-genre-c0 { background-color: #7BAFE9; }
.taste-genre-fill.taste-genre-c1 { background-color: #9386F2; }
.taste-genre-fill.taste-genre-c2 { background-color: #3FA266; }
.taste-genre-fill.taste-genre-c3 { background-color: #F1B467; }
.taste-genre-fill.taste-genre-c4 { background-color: #81A1C1; }
.taste-genre-fill.taste-genre-c5 { background-color: #B48EAD; }
.taste-genre-fill.taste-genre-c6 { background-color: #DD7F76; }
.taste-genre-fill.taste-genre-c7 { background-color: #FC6B83; }

body.day-mode .taste-genre-fill.taste-genre-c0 { background-color: #3685BF; }
body.day-mode .taste-genre-fill.taste-genre-c1 { background-color: #7754D9; }
body.day-mode .taste-genre-fill.taste-genre-c2 { background-color: #1F8A65; }
body.day-mode .taste-genre-fill.taste-genre-c3 { background-color: #C08532; }
body.day-mode .taste-genre-fill.taste-genre-c4 { background-color: #4C7F8C; }
body.day-mode .taste-genre-fill.taste-genre-c5 { background-color: #B8448B; }
body.day-mode .taste-genre-fill.taste-genre-c6 { background-color: #D75C4E; }
body.day-mode .taste-genre-fill.taste-genre-c7 { background-color: #CF2D56; }

.taste-genre-count {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    text-align: right;
}

.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;
}

.modal-player-strip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50001;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-4);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 24px color-mix(in srgb, var(--bg-primary) 40%, transparent);
    /* Match header play/stop icon ratio (65×50) scaled to fit the strip */
    --modal-strip-icon-h: 44px;
    --modal-strip-icon-w: calc(var(--modal-strip-icon-h) * 65 / var(--player-bar-play-button-size));
}

.modal-player-strip[hidden] {
    display: none !important;
}

.modal-player-strip-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

.modal-player-strip .play-container,
.modal-player-strip .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;
    position: relative;
}

.modal-player-strip .play-container:hover,
.modal-player-strip .stop-container:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

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

.modal-player-strip .play-container img,
.modal-player-strip .stop-container img {
    width: var(--modal-strip-icon-w);
    height: var(--modal-strip-icon-h);
    display: block;
    object-fit: contain;
}

.modal-player-strip .play-container.is-loading {
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    width: var(--modal-strip-icon-w);
    height: var(--modal-strip-icon-h);
    overflow: hidden;
}

.modal-player-strip .play-container.is-loading img {
    display: none;
}

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

.modal-player-strip .play-container:focus-visible,
.modal-player-strip .stop-container:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.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);
}

.upload-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.upload-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: -1px;
    padding: var(--space-2) var(--space-3);
    transition: color var(--motion-fast) var(--motion-ease),
        border-color var(--motion-fast) var(--motion-ease);
}

.upload-tab:hover,
.upload-tab:focus-visible {
    color: var(--accent-color);
}

.upload-tab.upload-tab--active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
}

.upload-tab-panel[hidden] {
    display: none !important;
}

.upload-wizard-steps {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    margin: 0 0 var(--space-3);
    padding: 0;
}

.upload-wizard-step {
    flex: 0 0 auto;
    padding: 0;
    border: none;
    border-radius: 0;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    transition: color var(--motion-fast) var(--motion-ease);
}

.upload-wizard-step:not(:last-child)::after {
    content: '→';
    display: inline-block;
    margin-left: var(--space-2);
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.6;
}

.upload-wizard-step--active {
    color: var(--accent-color);
}

.upload-wizard-step--done {
    color: var(--text-primary, inherit);
}

.upload-wizard-panel[hidden] {
    display: none !important;
}

.upload-file-picker-list {
    list-style: none;
    margin: 0 0 var(--space-3);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.upload-file-picker-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary, transparent);
}

.upload-file-picker-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9em;
}

.upload-file-picker-size {
    font-size: 0.85em;
    color: var(--text-muted);
    white-space: nowrap;
}

.upload-file-picker-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 var(--space-1);
    border-radius: var(--radius-md);
}

.upload-file-picker-remove:hover,
.upload-file-picker-remove:focus-visible {
    color: #e55;
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.upload-wizard-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-4) 0 var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.upload-wizard-footer-actions {
    display: flex;
    flex: 1 1 12rem;
    min-width: min(100%, 12rem);
    justify-content: stretch;
}

.upload-wizard-btn {
    appearance: none;
    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;
    line-height: 1.2;
    margin-top: 0;
    padding: 0.55rem 1.1rem;
    text-shadow: none;
    transition: background-color var(--motion-fast) var(--motion-ease),
        border-color var(--motion-fast) var(--motion-ease),
        color var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-fast) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        opacity var(--motion-fast) var(--motion-ease);
}

.upload-wizard-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
    box-shadow: none;
}

.upload-wizard-btn--primary {
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--button-bg) 38%, transparent);
    color: var(--button-text);
    flex: 1 1 auto;
    font-size: calc(1.02rem * var(--font-size-ui-scale));
    font-weight: 700;
    min-height: 48px;
    padding: 0.8rem 1.5rem;
    width: 100%;
}

.upload-wizard-btn--primary:hover:not(:disabled),
.upload-wizard-btn--primary:focus-visible:not(:disabled) {
    background-color: var(--button-hover);
    border-color: var(--button-border);
    color: var(--button-text);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--button-bg) 45%, transparent);
    transform: translateY(-1px);
}

.upload-wizard-btn--primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--button-bg) 30%, transparent);
}

.upload-wizard-btn--link {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--accent-color);
    font-size: calc(0.875rem * var(--font-size-ui-scale));
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.upload-wizard-btn--link:hover:not(:disabled),
.upload-wizard-btn--link:focus-visible:not(:disabled) {
    color: var(--accent-hover);
    transform: none;
}

.upload-wizard-btn--ghost {
    align-self: center;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-muted);
    flex: 0 0 auto;
    font-size: calc(0.875rem * var(--font-size-ui-scale));
    font-weight: 500;
    min-height: auto;
    padding: 0.35rem 0.75rem 0.35rem 0;
    width: auto;
}

.upload-wizard-btn--ghost:hover:not(:disabled),
.upload-wizard-btn--ghost:focus-visible:not(:disabled) {
    background: transparent;
    box-shadow: none;
    color: var(--accent-color);
    transform: none;
}

.upload-wizard-back[hidden] + .upload-wizard-footer-actions {
    margin-left: 0;
    width: 100%;
}

.upload-wizard-footer[hidden] {
    display: none !important;
}

.upload-wizard-steps[hidden] {
    display: none !important;
}

/* Legacy confirm step styles removed — upload ends on Details step */

.spotyflac-upload-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.spotyflac-upload-field label {
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 600;
}

.spotyflac-url-input,
.spotyflac-artist-input,
.spotyflac-title-input,
.spotyflac-comment-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.spotyflac-comment-input {
    resize: vertical;
    min-height: 2.5em;
    font-family: inherit;
    line-height: 1.35;
}

.spotyflac-metadata-panel {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
}

.spotyflac-preview-meta {
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 0 0 var(--space-3);
}

.youtube-music-hint {
    margin: 0 0 var(--space-3);
    font-size: 0.9em;
    color: var(--text-muted);
}

.youtube-music-hint.youtube-music-hint--likely {
    color: var(--text-primary, inherit);
}

.youtube-music-hint.youtube-music-hint--weak {
    color: var(--warning, #b45309);
}

.youtube-song-confirm {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
    color: var(--text-primary);
    font-size: 0.95em;
    cursor: pointer;
}

.youtube-song-confirm input {
    margin-top: 0.2em;
}

.upload-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-5) var(--space-4);
    margin-bottom: var(--space-3);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--motion-fast) var(--motion-ease),
        background-color var(--motion-fast) var(--motion-ease);
}

.upload-drop-zone:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.upload-drop-zone--active {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, transparent);
}

.upload-drop-zone--invalid {
    border-color: #e55;
    background: color-mix(in srgb, #e55 6%, transparent);
}

.upload-drop-zone-title {
    margin: 0 0 var(--space-2);
    font-weight: 600;
    color: var(--text-primary, inherit);
}

.upload-drop-zone-hint {
    margin: 0 0 var(--space-3);
    color: var(--text-muted);
    font-size: 0.9em;
}

.upload-drop-zone-active-text {
    margin: 0 0 var(--space-3);
    color: var(--accent-color);
    font-size: 0.9em;
    font-weight: 600;
}

.upload-file-count {
    margin: 0 0 var(--space-2);
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 600;
}

.upload-modal-close-hint {
    margin: 0 0 var(--space-2);
    font-size: 0.85em;
    color: var(--text-muted);
}

.upload-add-more-btn {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    margin-top: var(--space-2);
    margin-left: var(--space-2);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color var(--motion-fast) var(--motion-ease),
        border-color var(--motion-fast) var(--motion-ease);
}

.upload-add-more-btn:hover,
.upload-add-more-btn:focus-visible {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, transparent);
}

#upload-drop-zone .upload-wizard-btn--link {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--accent-color);
    cursor: pointer;
    display: inline-block;
    font-size: calc(0.875rem * var(--font-size-ui-scale));
    font-weight: 600;
    margin-bottom: 0;
    margin-top: var(--space-2);
    padding: 0.35rem 0.65rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#upload-drop-zone .upload-wizard-btn--link:hover,
#upload-drop-zone .upload-wizard-btn--link:focus-visible {
    color: var(--accent-hover);
    transform: none;
}

#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--metadata-loading .artist-input,
.file-review-item--metadata-loading .title-input {
    /* Keep full opacity — dimmed fields looked "locked" while tags were reading. */
    opacity: 1;
}

.file-metadata-status {
    margin: var(--space-1) 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text-secondary);
}

.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: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-muted);
    font-size: calc(0.85rem * var(--font-size-ui-scale));
    font-weight: 500;
    min-height: auto;
    padding: 0.35rem 0.5rem;
}

#uploadModal #cancelUpload:hover {
    background-color: transparent;
    color: var(--accent-color);
    transform: none;
}

/* Compact band (<900): upload as bottom sheet */
@media (max-width: 900px) {
    #uploadModal.modal.is-open {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-end;
        padding-top: 0;
    }

    #uploadModal .modal-content {
        width: 100%;
        max-width: none;
        max-height: 85vh;
        margin-top: auto;
        margin-bottom: 0;
        overflow-y: auto;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .modal-player-strip {
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: calc(56px + env(safe-area-inset-bottom, 0));
    }
}

#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;
}

.password-field {
    position: relative;
    display: block;
    width: 100%;
}

.password-field input[type="password"],
.password-field input[type="text"] {
    width: 100%;
    padding-right: 2.5rem;
    box-sizing: border-box;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-md, 6px);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 0;
}

.password-toggle:hover {
    color: var(--accent-color);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.auth-modal-content .password-toggle {
    /* Auth submit buttons use full-width styles; keep the eye control compact. */
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-secondary);
}

.auth-modal-content .password-toggle:hover {
    background: transparent;
    color: var(--accent-color);
}

.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):not(.upload-wizard-btn):not(.upload-add-more-btn):not(.upload-file-picker-remove):not(.upload-tab),
#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):not(.upload-wizard-btn):not(.upload-add-more-btn):not(.upload-file-picker-remove):not(.upload-tab):hover,
#info-profile-content .profile-options-placeholder button:hover,
#send-message-btn:hover,
#chat-column #chat-locked-overlay button:hover {
    background-color: var(--button-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.auth-modal-content button[type="submit"]:active,
.modal-content button:not(.remove-file-btn):not(.upload-wizard-btn):not(.upload-add-more-btn):not(.upload-file-picker-remove):not(.upload-tab):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):not(.upload-wizard-btn):not(.upload-add-more-btn):not(.upload-file-picker-remove):not(.upload-tab):disabled {
    background-color: var(--input-bg);
    cursor: not-allowed;
    opacity: 0.6;
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
}

/* Upload wizard CTAs — must follow generic .modal-content button rules above */
#uploadModal .upload-wizard-btn--primary {
    background-color: var(--button-bg);
    border-color: var(--button-border);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--button-bg) 38%, transparent);
    color: var(--button-text);
}

#uploadModal .upload-wizard-btn--primary:hover:not(:disabled),
#uploadModal .upload-wizard-btn--primary:focus-visible:not(:disabled) {
    background-color: var(--button-hover);
    border-color: var(--button-border);
    color: var(--button-text);
}

#uploadModal .upload-wizard-btn--ghost,
#uploadModal .upload-wizard-btn--link {
    background-color: transparent;
    border: none;
    box-shadow: none;
    margin-top: 0;
}

/* 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(--button-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 ---
   Canonical breakpoints (RESPONSIVE_LAYOUT_IMPROVEMENT_PLAN Phase D1):
   - Compact: max-width 900px
   - Desk:    min-width 901px
   - Wide:    min-width 1200px
   - Ultrawide chat measure: min-width 1600px
   Phone density: 480 / 360
*/
@media (min-width: 901px) {
    #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);
        /* Soft floor only on true desk — never on compact */
        min-width: min(450px, 100%);
        width: auto;
        flex: 1 1 auto;
    }

    .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;
    }

    /* Phase A4 / C3: fixed user rail only from desk breakpoint up */
    #chat-main-wrapper.active>#user-list-container {
        display: flex;
        width: 200px;
        flex-shrink: 0;
        border-top: none;
        border-left: 1px solid var(--border-color);
        /* Keep for desktop user list separation */
        max-height: none;
        position: static;
        border-radius: 0;
        box-shadow: none;
        padding: 8px;
    }

    .user-list-toggle,
    #user-list-sheet-backdrop {
        display: none !important;
    }

    .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;
    }
}

/* Desk only: allow header wrap on narrow laptops without affecting compact */
@media (min-width: 901px) and (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-meta {
        align-items: flex-start;
    }

    .dj-card-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 32rem;
        column-gap: 1.5rem;
    }

    .dj-card-stat {
        align-items: flex-start;
    }

    .dj-card-stat-label,
    .dj-card-stat-value,
    .dj-card-contributed {
        text-align: left;
    }

    .dj-card-email-self-only {
        justify-content: flex-start;
    }
}

/* Phase A3–A5: entire compact band (<=900) — stack desk + compact header player */
@media (max-width: 900px) {
    /* Compact header player: title above controls; never overlap votes/Wave */
    #audio-player #player-bar-info-and-main-controls {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: stretch;
        gap: 4px;
        min-width: 0;
    }

    .player-info-stack {
        order: 1;
        align-items: flex-start;
        text-align: left;
        min-width: 0;
        width: 100%;
        height: auto;
    }

    .player-control-cluster {
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        height: auto;
        width: 100%;
        gap: var(--space-2);
    }

    #audio-player #player-bar-tags-container,
    #audio-player #player-bar-uploader-container {
        display: none;
        /* Tags/uploader remain on left Now Playing / queue cards */
    }

    #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: auto;
        height: auto !important;
        min-height: var(--player-bar-content-height-mobile);
        min-width: 0;
        width: 100%;
        order: 1;
        margin: var(--space-1) 0;
    }

    #audio-player #player-bar-cover-art-container {
        width: var(--mobile-player-bar-cover-size);
        height: var(--mobile-player-bar-cover-size);
        flex: 0 0 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: auto;
        min-height: var(--player-bar-content-height-mobile);
        align-items: flex-start;
    }

    #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;
        flex-wrap: wrap;
    }

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

    #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 */
    }

    #playlist .current .full .expanded-details-container {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }

    /* Compact: stats/links before long bio so “Find Online / Actions” isn’t
       clipped under the queue when the expand panel hits its max-height. */
    #playlist .current .full .expanded-details-container .details-col-side {
        order: -1;
    }

    /* Leave room for chat composer; details scroll inside */
    #playlist .current .full.expanded {
        max-height: min(42vh, 360px);
    }

    #playlist .current .full .detail-section {
        padding: 0.85rem;
    }

    #playlist .current .full .detail-section-title {
        font-size: 0.9rem;
        margin-bottom: 0.55rem;
    }

    #playlist .current .full .track-external-links #current-track-links {
        gap: 6px;
    }

    #playlist .current .full .track-external-links .service-icon-link {
        width: 36px;
        height: 36px;
    }

    #playlist .current .full .track-external-links .service-icon-link img,
    #playlist .current .full .track-external-links .service-icon-link svg {
        width: 22px;
        height: 22px;
    }

    /* Phase B1: smaller Now Playing cover on compact so title/tags keep room */
    #playlist .current .cover {
        width: 72px;
        height: 72px;
    }

    #playlist .current .base {
        min-height: 96px;
        padding: 10px;
    }

    #playlist .current .rating {
        min-width: 72px;
    }

    /* Compact chat composer: Aa toggle + denser input/send */
    #chat-column #info-tabs-card-container {
        padding: 6px 10px;
    }

    #chat-column #chat-input-area {
        padding: 8px 10px;
        gap: 6px;
    }

    #chat-column .chat-format-toggle {
        display: inline-flex;
    }

    /* Format strip collapsed by default on compact — open via Aa */
    #chat-column .chat-rich-text-buttons {
        display: none;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 2px;
    }

    #chat-column #chat-input-area.chat-format-open .chat-rich-text-buttons {
        display: flex;
    }

    #chat-column .chat-rich-text-buttons button.chat-format-btn {
        min-width: 34px;
        min-height: 34px;
        width: 34px;
        height: 34px;
        padding: 0;
        box-sizing: border-box;
    }

    #chat-column .chat-rich-text-buttons button.chat-format-btn svg.feather {
        width: 15px;
        height: 15px;
    }

    #chat-column .chat-input-send-container {
        gap: 8px;
        min-width: 0;
    }

    #chat-column #message-input {
        min-width: 0;
        padding: 8px 10px;
        min-height: 36px;
        font-size: 1rem;
    }

    #chat-column #send-message-btn {
        padding: 8px 12px;
        min-height: 36px;
        font-size: calc(0.85rem * var(--font-size-ui-scale));
        white-space: nowrap;
    }

    #chat-column .user-list-toggle {
        margin: 4px 10px 0;
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    /*
     * Keyboard / compose mode: reclaim vertical space so the input + a few
     * chat lines remain usable above the OS keyboard.
     */
    body.chat-composing #playlist {
        display: none;
    }

    body.chat-composing #main-header {
        padding: 4px 8px;
        gap: 0;
    }

    body.chat-composing #main-header .logo-section,
    body.chat-composing #main-header .auth-upload-section,
    body.chat-composing #main-header #mobile-nav-toggle,
    body.chat-composing #wave-status-panel,
    body.chat-composing #chat-column #info-tabs-card-container,
    body.chat-composing #chat-column .user-list-toggle {
        display: none !important;
    }

    body.chat-composing #main-header #header-player-slot,
    body.chat-composing #main-header #audio-player {
        --mobile-player-bar-cover-size: 40px;
        --mobile-player-bar-padding: 4px;
        --player-bar-cover-size: 40px;
        --player-bar-padding: 4px;
        margin: 0;
        min-height: 0;
        width: 100%;
        order: 0;
    }

    body.chat-composing #audio-player .player-bar-content-wrapper {
        min-height: 0;
        align-items: center;
        padding: 4px;
        gap: 8px;
    }

    body.chat-composing #audio-player #player-bar-cover-art-container {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }

    body.chat-composing #audio-player #player-bar-info-and-main-controls {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    body.chat-composing #audio-player .player-info-stack {
        flex: 1 1 auto;
        min-width: 0;
        order: 0;
    }

    body.chat-composing #audio-player #player-bar-artist-title-display .title-name {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.chat-composing #audio-player #player-bar-artist-title-display .artist-name,
    body.chat-composing #audio-player #player-bar-artist-title-display br {
        display: none;
    }

    body.chat-composing #audio-player .player-control-cluster {
        order: 0;
        flex: 0 0 auto;
        width: auto;
        gap: 4px;
    }

    body.chat-composing #audio-player .player-bar-vote-btn,
    body.chat-composing #audio-player .player-bar-volume-and-time {
        display: none !important;
    }

    body.chat-composing #audio-player #player-bar-play-controls {
        gap: 4px;
    }

    body.chat-composing #audio-player #player-bar-play-controls .play-container,
    body.chat-composing #audio-player #player-bar-play-controls .stop-container {
        transform: scale(0.85);
    }

    body.chat-composing #chat-column #chat-input-area {
        padding: 6px 8px;
        gap: 4px;
    }

    body.chat-composing #chat-column #chat-input-area:not(.chat-format-open) .chat-composer-toolbar {
        display: none;
    }

    body.chat-composing #chat-column #chat-log {
        padding: 6px 8px;
    }

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

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

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

    /* Phase C: compact — toggle + bottom sheet (not a permanent under-chat rail) */
    .user-list-toggle {
        display: inline-flex;
    }

    #chat-column #user-list-container,
    #chat-main-wrapper.active>#user-list-container {
        display: none;
        width: 100%;
        max-height: none;
        border-left: none;
        border-top: none;
        flex-shrink: 0;
    }

    #chat-column #user-list-container.user-list-sheet-open,
    #chat-main-wrapper.active>#user-list-container.user-list-sheet-open {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        width: 100%;
        max-height: min(45vh, 280px);
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0));
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-xl);
        background-color: var(--bg-quaternary);
        overflow-y: auto;
    }

    .user-list-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1190;
        margin: 0;
        padding: 0;
        border: none;
        background: color-mix(in srgb, var(--bg-primary) 55%, transparent);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        cursor: pointer;
    }

    .user-list-sheet-backdrop[hidden] {
        display: none !important;
    }

    #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) {
    .dj-card-stats {
        grid-template-columns: 1fr;
        max-width: 16rem;
        row-gap: 0.55rem;
    }

    .dj-card-stat {
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.75rem;
        padding-bottom: 0.45rem;
        border-bottom: 1px solid var(--soft-border-color);
    }

    .dj-card-stat:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .dj-card-stat-label {
        text-align: left;
        text-transform: none;
        letter-spacing: 0;
        font-size: 0.85rem;
    }

    .dj-card-stat-value {
        text-align: right;
        font-size: 1rem;
    }

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

    #playlist .current .cover {
        width: 56px;
        height: 56px;
    }

    #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;
}

/* Wave status — live signal strip under logo/listeners */
.wave-status-panel {
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
    margin-top: 8px;
    max-width: min(260px, 46vw);
}

.wave-status {
    --wave-accent: var(--accent-color);
    --wave-accent-soft: color-mix(in srgb, var(--accent-color) 35%, transparent);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: 10px;
    row-gap: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    position: relative;
}

.wave-status-signal {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 18px;
    width: 22px;
    margin-top: 3px;
    flex-shrink: 0;
}

.wave-bar {
    display: block;
    width: 2px;
    height: 28%;
    border-radius: 1px;
    background: var(--wave-accent);
    transform-origin: bottom center;
    opacity: 0.85;
    animation: wave-bar-bounce 1.05s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * -0.12s);
}

.wave-bar:nth-child(1) { height: 35%; }
.wave-bar:nth-child(2) { height: 58%; }
.wave-bar:nth-child(3) { height: 90%; }
.wave-bar:nth-child(4) { height: 72%; }
.wave-bar:nth-child(5) { height: 100%; }
.wave-bar:nth-child(6) { height: 48%; }
.wave-bar:nth-child(7) { height: 30%; }

@keyframes wave-bar-bounce {
    0%,
    100% {
        transform: scaleY(0.35);
        opacity: 0.55;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.wave-status--inactive {
    --wave-accent: color-mix(in srgb, var(--text-muted) 70%, transparent);
    color: var(--text-muted);
}

.wave-status--inactive .wave-bar {
    animation: none;
    transform: scaleY(0.28);
    opacity: 0.4;
    height: 40%;
}

.wave-status--support {
    --wave-accent: rgba(255, 140, 110, 0.95);
    --wave-accent-soft: rgba(255, 120, 100, 0.35);
}

.wave-status--support .wave-bar {
    animation-duration: 1.9s;
}

.wave-status--ending {
    --wave-accent: rgba(255, 110, 95, 0.95);
    --wave-accent-soft: rgba(255, 100, 90, 0.3);
}

.wave-status--ending .wave-bar {
    animation-duration: 2.6s;
    opacity: 0.55;
}

.wave-status--ending .wave-bar:nth-child(odd) {
    animation: none;
    transform: scaleY(0.22);
    opacity: 0.35;
}

.wave-status-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wave-status-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.wave-status-live {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--wave-accent);
    box-shadow: 0 0 0 0 var(--wave-accent-soft);
    flex-shrink: 0;
    animation: wave-live-pulse 1.8s ease-out infinite;
}

.wave-status--inactive .wave-status-live {
    display: none;
}

@keyframes wave-live-pulse {
    0% {
        box-shadow: 0 0 0 0 var(--wave-accent-soft);
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 6px transparent;
        opacity: 0.85;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
        opacity: 1;
    }
}

.wave-status-label {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    font-size: 0.66rem;
    color: var(--text-muted);
}

.wave-status-tags {
    font-weight: 600;
    color: var(--wave-accent);
    letter-spacing: 0.03em;
    word-break: break-word;
    position: relative;
}

.wave-status:not(.wave-status--inactive):not(.wave-status--low) .wave-status-tags {
    animation: wave-tag-sheen 3.6s ease-in-out infinite;
}

@keyframes wave-tag-sheen {
    0%,
    100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.18);
    }
}

.wave-status-tags--inactive {
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.85;
    animation: none !important;
    filter: none !important;
}

.wave-status-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 0.74rem;
    color: var(--text-muted);
    min-width: 0;
}

.wave-status-fit {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.9;
    line-height: 1.3;
    word-break: break-word;
}

.wave-status--opening .wave-status-live {
    opacity: 0.65;
}

.wave-status-sep {
    opacity: 0.55;
}

.wave-status-started-by {
    font-size: inherit;
    opacity: 0.9;
}

.wave-status-strength-text {
    font-size: inherit;
    color: var(--text-muted);
    font-weight: 600;
}

.wave-status-strength-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.85;
    white-space: normal;
    line-height: 1.3;
    word-break: break-word;
}

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

.wave-status--low .wave-status-strength-text {
    color: rgba(255, 150, 130, 0.98);
}

.wave-status--ending .wave-status-strength-text {
    color: rgba(255, 120, 110, 1);
}

.wave-status--ending .wave-status-live {
    animation-duration: 0.9s;
    background: rgba(255, 110, 95, 0.95);
}

body.day-mode .wave-status {
    /* Live strip uses ink bronze; brighter gold only on CTA chips */
    --wave-accent: var(--accent-color);
    --wave-accent-soft: color-mix(in srgb, var(--accent-color) 22%, transparent);
}

body.day-mode .wave-status--support,
body.day-mode .wave-status--ending {
    --wave-accent: #d97757;
    --wave-accent-soft: rgba(217, 119, 87, 0.3);
}

.queue-wave-indicator--filler {
    opacity: 0.55;
    font-size: 0.85em;
}

.queue-wave-indicator--assist {
    opacity: 0.85;
    font-size: 0.9em;
    color: var(--accent-color, #ffcd00);
}

/* --- 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%;
    /* Reading measure only — chrome + rows own the full pane (no wall strip + void) */
    --blog-read-max: 65ch;
    --blog-compose-max: min(100%, 52rem);
    /* Reading scale: feed titles quiet; detail one step up; body calm */
    --blog-title-feed: 1.1rem;
    --blog-title-detail: 1.32rem;
    --blog-title-compose: 1.22rem;
    --blog-body-size: 1.02rem;
    --blog-body-lh: 1.65;
    --blog-meta-size: 0.78rem;
    --blog-preview-size: 0.95rem;
}

.blog-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 20px;
    border-bottom: 1px solid var(--medium-border-color);
    background: var(--bg-primary);
}

/* Blog activity pip — accent signal for new posts / thread replies (CSS ::after
   so language swaps via textContent cannot wipe the indicator). */
.blog-activity-host {
    position: relative;
}

.blog-activity-host[data-blog-activity]::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 0.28em;
    border-radius: 50%;
    vertical-align: super;
    flex-shrink: 0;
    background: var(--accent-color);
    pointer-events: none;
}

/* Hollow ring: replies-only */
.blog-activity-host[data-blog-activity="replies"]::after {
    background: transparent;
    border: 1.5px solid var(--accent-color);
    width: 5px;
    height: 5px;
    vertical-align: middle;
}

.blog-activity-host[data-blog-activity="both"]::after {
    background: var(--accent-color);
    box-shadow: none;
}

.blog-feed-row--activity {
    border-left-color: var(--accent-color, #ffcd00);
}

#chat-column #info-tabs-container .tab.blog-activity-host[data-blog-activity]::after,
#mobileNavMenu .mobile-tab-link.blog-activity-host[data-blog-activity]::after {
    margin-left: 0.18em;
}

#chat-column #info-tabs-container .tab a.blog-activity-host {
    display: inline-block;
    max-width: 100%;
}

body.day-mode .blog-activity-host[data-blog-activity="both"]::after {
    box-shadow: none;
}

.blog-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.blog-sort[hidden] {
    display: none;
}

.blog-toolbar-back {
    appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    padding: 4px 0 6px;
    margin: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 0 0 auto;
}

.blog-toolbar-back[hidden] {
    display: none;
}

.blog-toolbar-back:hover,
.blog-toolbar-back:focus-visible {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent-color, #ffcd00);
    text-underline-offset: 0.18em;
}

.blog-sort-tab {
    appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    padding: 4px 0 6px;
    margin: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.blog-sort-tab:hover {
    color: var(--text-primary);
}

.blog-sort-tab.is-active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--accent-color, #ffcd00);
}

.blog-sort-tab:focus-visible {
    outline: 2px solid var(--accent-color, #ffcd00);
    outline-offset: 3px;
}

.blog-activity-jump {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--medium-border-color);
    background: var(--bg-primary);
}

.blog-activity-jump[hidden] {
    display: none;
}

.blog-activity-jump-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin: 0;
    padding: 8px 20px;
    border: none;
    border-radius: 0;
    background: none;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}

.blog-activity-jump-toggle::before {
    content: "";
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--accent-color);
    background: transparent;
}

.blog-activity-jump-toggle:hover {
    color: var(--text-primary);
}

.blog-activity-jump-toggle:focus-visible {
    outline: 2px solid var(--accent-color, #ffcd00);
    outline-offset: 2px;
}

.blog-activity-jump.is-open .blog-activity-jump-toggle {
    color: var(--text-primary);
}

.blog-activity-jump-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-activity-jump-menu {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    top: 100%;
    display: flex;
    flex-direction: column;
    max-height: 11rem;
    overflow-y: auto;
    border-bottom: 1px solid var(--medium-border-color);
    background: var(--bg-primary);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.blog-activity-jump-menu[hidden] {
    display: none;
}

.blog-activity-jump-row {
    appearance: none;
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 14px 10px 12px;
    text-align: left;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--text-primary);
    background: none;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--medium-border-color);
    box-shadow: inset 2px 0 0 var(--accent-color);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-activity-jump-row:first-child {
    border-top: none;
}

.blog-activity-jump-row:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.blog-activity-jump-row:focus-visible {
    outline: 2px solid var(--accent-color, #ffcd00);
    outline-offset: -2px;
}

.blog-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-inline-start: auto;
}

.blog-karma-hint {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-karma-hint[hidden] {
    display: none;
}

.blog-view-root {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 24px;
    min-height: 0;
    container-name: blog-wall;
    container-type: inline-size;
}

.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: 2.5rem 14px 2rem;
    text-align: start;
    color: var(--text-secondary);
}

.blog-empty p {
    margin: 0;
    max-width: 36ch;
    color: var(--text-primary);
    line-height: 1.5;
}

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

.blog-empty-gate {
    margin: 12px 0 0;
    max-width: 36ch;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Shells are full-bleed; prose uses --blog-read-max (see titles/body below) */
.blog-measure {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    box-sizing: border-box;
}

.blog-feed-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
    max-width: none;
    padding: 0.55rem 0.7rem 1.1rem;
    box-sizing: border-box;
}

.blog-feed-row {
    display: grid;
    /* Full pane width: preview fills to right-edge thumb; no mid-cluster + dead right */
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "main"
        "footer";
    justify-content: stretch;
    gap: 8px 18px;
    width: 100%;
    max-width: none;
    padding: 1.15rem 1rem 1.25rem;
    border: none;
    border-left: 2px solid transparent;
    background: color-mix(in srgb, var(--bg-tertiary) 58%, transparent);
    align-items: start;
    box-sizing: border-box;
    transition: background-color 0.14s ease-out, border-color 0.14s ease-out;
}

.blog-feed-row:hover {
    background: color-mix(in srgb, var(--bg-tertiary) 88%, transparent);
    border-left-color: color-mix(in srgb, var(--accent-color, #ffcd00) 50%, transparent);
}

.blog-feed-row:has(.blog-feed-thumb) {
    grid-template-columns:
        minmax(0, 1fr)
        minmax(12.5rem, 16.5rem);
    grid-template-areas:
        "main thumb"
        "footer .";
}

.blog-feed-row:not(:has(.blog-feed-thumb)) .blog-feed-main {
    min-height: 3.25rem;
}

.blog-vote-col {
    grid-area: vote;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding-top: 2px;
    width: 2.75rem;
}

.blog-feed-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    width: 100%;
    max-width: none;
    cursor: pointer;
    border-radius: 0;
    padding: 2px 0 0;
}

.blog-feed-footer,
.blog-detail-footer {
    grid-area: footer;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    width: 100%;
    min-width: 0;
    margin-top: 2px;
}

/* Feed only: meta as a quiet sign-off before the next post */
.blog-feed-footer {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
}

.blog-feed-footer .blog-feed-meta,
.blog-detail-footer .blog-detail-meta {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    max-width: none;
}

.blog-feed-headline,
.blog-detail-headline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2em 0.55em;
    width: 100%;
    min-width: 0;
}

/* Title + votes stay adjacent — do not flex-grow the title across the row */
.blog-feed-headline .blog-feed-title,
.blog-detail-headline .blog-detail-title {
    flex: 0 1 auto;
    width: auto;
    max-width: calc(100% - 4.5em);
}

.blog-feed-headline .blog-vote-row,
.blog-detail-headline .blog-vote-row {
    flex: 0 0 auto;
    margin: 0;
}

.blog-feed-thumb {
    grid-area: thumb;
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: 8.75rem;
    margin: 0;
    line-height: 0;
    border-radius: var(--radius-md, 6px);
    border: 1px solid var(--border-color, var(--medium-border-color));
    background-color: var(--bg-secondary);
    overflow: hidden;
    cursor: pointer;
    justify-self: stretch;
    align-self: start;
}

.blog-feed-thumb img {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-feed-main:hover,
.blog-feed-main:focus-visible {
    background-color: 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-score {
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--text-primary);
    line-height: 1.2;
    min-width: 2rem;
    text-align: center;
}

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

.blog-vote-col .queue-vote-btn,
.blog-vote-row .queue-vote-btn {
    min-width: 32px;
    min-height: 32px;
    opacity: 1;
    color: var(--text-secondary);
    border-color: var(--medium-border-color);
    transition: border-color 0.15s ease-in-out, color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.blog-vote-col .queue-vote-btn:disabled,
.blog-vote-row .queue-vote-btn:disabled {
    opacity: 0.4;
}

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

/* Compact votes sit in the headline — type-scale, not queue chrome.
   Base .queue-vote-btn sets font-size: 0 (icon buttons); override or em SVG collapses. */
.blog-vote-row--compact {
    gap: 0.12em;
    font-size: inherit;
    line-height: 1.2;
    opacity: 1;
}

.blog-feed-headline .blog-vote-row--compact {
    font-size: var(--blog-title-feed);
}

.blog-detail-headline .blog-vote-row--compact {
    font-size: var(--blog-title-detail);
}

.blog-vote-row--compact .blog-vote-score {
    min-width: 1em;
    padding: 0 0.12em;
    font-size: 1em;
    font-weight: 650;
    line-height: 1.2;
    color: var(--text-secondary);
}

.blog-vote-row--compact .queue-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    min-width: 1.1em;
    min-height: 1.1em;
    width: auto;
    height: auto;
    padding: 0.15em;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted, var(--text-secondary));
    box-shadow: none;
    font-size: 1em;
    line-height: 1;
    opacity: 1;
    transform: none;
}

.blog-vote-row--compact .queue-vote-btn svg {
    width: 0.78em;
    height: 0.78em;
    stroke: currentColor;
    stroke-width: 2.75;
    fill: none;
    flex-shrink: 0;
}

.blog-vote-row--compact .queue-vote-btn:hover:not(:disabled),
.blog-vote-row--compact .queue-vote-btn:focus-visible:not(:disabled) {
    border: none;
    background: transparent;
    color: var(--text-primary);
    opacity: 1;
    transform: none;
}

.blog-vote-row--compact .queue-vote-btn:active:not(:disabled) {
    transform: none;
}

.blog-vote-row--compact .queue-vote-btn.active-up,
.blog-vote-row--compact .queue-vote-btn.active-down {
    border: none;
    background: transparent;
    opacity: 1;
}

.blog-vote-row--compact .queue-vote-btn.active-up {
    color: var(--vote-up-color, var(--accent-color, #ffcd00));
}

.blog-vote-row--compact .queue-vote-btn.active-down {
    color: var(--vote-down-color, #e07070);
}

.blog-vote-row--compact:has(.queue-vote-btn.active-up) .blog-vote-score {
    color: var(--vote-up-color, var(--accent-color, #ffcd00));
}

.blog-vote-row--compact:has(.queue-vote-btn.active-down) .blog-vote-score {
    color: var(--vote-down-color, #e07070);
}

@media (pointer: coarse) {
    .blog-vote-row--compact .queue-vote-btn {
        min-width: 1.6em;
        min-height: 1.6em;
        padding: 0.28em;
    }
}

@media (pointer: coarse) {
    .blog-vote-col .queue-vote-btn,
    .blog-vote-row:not(.blog-vote-row--compact) .queue-vote-btn {
        min-width: 40px;
        min-height: 40px;
    }
}

.blog-feed-title {
    display: -webkit-box;
    width: auto;
    max-width: 100%;
    text-align: left;
    margin: 0;
    font: inherit;
    font-size: var(--blog-title-feed);
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    line-height: 1.3;
    text-decoration: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

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

.blog-feed-meta,
.blog-detail-meta,
.blog-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    font-size: var(--blog-meta-size);
    color: var(--text-muted);
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.blog-feed-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.blog-feed-meta-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.55;
}

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

.blog-author,
.blog-author-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.blog-author-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.blog-author-link:hover .blog-author-name {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.blog-feed-preview {
    min-width: 0;
    width: 100%;
    max-width: min(100%, var(--blog-read-max));
    margin: 2px 0 0;
    font-size: var(--blog-preview-size);
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
    /* API already truncates (~500 chars); don't clip shorter in CSS */
    overflow: hidden;
}

.blog-feed-preview b,
.blog-feed-preview strong {
    color: var(--text-primary);
    font-weight: 650;
}

.blog-feed-preview .post-embed-card {
    display: flex;
    width: fit-content;
    max-width: 100%;
    margin: 0.35em 0;
}

.blog-feed-preview .blog-feed-track-embed {
    color: var(--accent-color, #ffcd00);
    text-decoration: none;
    font-weight: 600;
}

.blog-feed-preview .blog-feed-track-embed:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.blog-feed-preview .blog-feed-ext-link {
    color: var(--accent-color, #ffcd00);
    word-break: break-all;
}

/* Narrow info pane: thumb under copy; footer always last. */
@container blog-wall (max-width: 640px) {
    .blog-feed-list {
        gap: 0.55rem;
        padding: 0.4rem 0.45rem 0.9rem;
    }

    .blog-feed-row,
    .blog-feed-row:has(.blog-feed-thumb) {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "thumb"
            "footer";
        padding: 0.95rem 0.75rem 1.05rem;
        gap: 10px 12px;
    }

    .blog-feed-row:not(:has(.blog-feed-thumb)) .blog-feed-main {
        min-height: 0;
    }

    .blog-feed-title {
        font-size: 1.05rem;
    }

    .blog-feed-thumb {
        aspect-ratio: 16 / 10;
        height: auto;
        max-height: 6.25rem;
        margin-top: 2px;
    }
}

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

/* Thin IO target when the Load more button is SR / no-JS fallback only */
.blog-load-more-sentinel--auto,
.blog-comments-sentinel.blog-load-more-sentinel--auto {
    padding: 0;
    height: 1px;
    overflow: hidden;
    text-align: start;
}

.blog-detail,
.blog-compose {
    padding: 12px 20px 28px;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Prose measure only — back/chrome stay full pane so detail isn’t a postcard void */
.blog-detail > .blog-detail-headline,
.blog-detail > .blog-body,
.blog-detail > .blog-detail-footer,
.blog-detail > .blog-detail-actions,
.blog-detail > .blog-comments {
    max-width: min(100%, var(--blog-read-max));
}

.blog-compose > .blog-compose-heading,
.blog-compose-form {
    max-width: var(--blog-compose-max);
}

.blog-detail-title {
    margin: 0;
    font-size: var(--blog-title-detail);
    font-weight: 650;
    letter-spacing: -0.018em;
    color: var(--text-primary);
    line-height: 1.25;
}

.blog-detail-headline {
    margin: 0 0 12px;
}

.blog-detail-footer {
    margin: 18px 0 10px;
}

.blog-compose-heading {
    margin: 0 0 14px;
    font-size: var(--blog-title-compose);
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    line-height: 1.25;
}

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

.blog-comment-body {
    font-size: 0.92rem;
    line-height: 1.55;
}

.blog-body img {
    max-width: 100%;
    max-height: 52vh;
    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: 100%;
    margin: 10px 0;
    line-height: 0;
    cursor: zoom-in;
}

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

/* In-page image zoom (click again / Esc to close) */
.blog-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 55000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.86);
    cursor: zoom-out;
    animation: blogLightboxIn 0.16s ease-out;
}

.blog-image-lightbox img {
    max-width: min(96vw, 1400px);
    max-height: 94vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md, 6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    cursor: zoom-out;
}

@keyframes blogLightboxIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 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-comments-empty {
    margin: 0 0 14px;
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.45;
}

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

.blog-comment-meta {
    gap: 6px 8px;
    margin: 0 0 6px;
    position: relative;
}

.blog-comment-when {
    font-variant-numeric: tabular-nums;
}

.blog-comment-menu {
    margin-left: auto;
    position: relative;
}

.blog-comment-menu-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1;
    letter-spacing: 0.08em;
    user-select: none;
}

.blog-comment-menu-toggle::-webkit-details-marker {
    display: none;
}

.blog-comment-menu-toggle:hover,
.blog-comment-menu[open] > .blog-comment-menu-toggle {
    color: var(--text-primary);
}

.blog-comment-menu-toggle:focus-visible {
    outline: 2px solid var(--accent-color, #ffcd00);
    outline-offset: 2px;
}

.blog-comment-actions {
    position: absolute;
    right: 0;
    top: calc(100% + 2px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 7.5rem;
    padding: 4px 0;
    border: 1px solid var(--medium-border-color);
    background: var(--bg-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.blog-comment-edit,
.blog-comment-delete {
    appearance: none;
    background: none;
    border: none;
    margin: 0;
    padding: 10px 12px;
    text-align: left;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    min-height: 36px;
}

.blog-comment-edit:hover,
.blog-comment-delete:hover {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.blog-comments-sentinel {
    padding: 10px 0 4px;
}

.blog-comment-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 4px;
}

.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,
.blog-comment-edit-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-format-toolbar--compact {
    flex-wrap: wrap;
    gap: 2px 4px;
}

.blog-format-toolbar--compact .chat-format-btn {
    opacity: 0.85;
}

.blog-format-more-btn {
    appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    margin: 0 0 0 2px;
    padding: 4px 6px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    cursor: pointer;
    align-self: center;
}

.blog-format-more-btn:hover,
.blog-format-toolbar.is-more-open .blog-format-more-btn {
    color: var(--text-primary);
}

.blog-format-more-btn:focus-visible {
    outline: 2px solid var(--accent-color, #ffcd00);
    outline-offset: 2px;
}

.blog-format-more-tools {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

.blog-format-more-tools[hidden] {
    display: none;
}

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

.blog-compose-form > .blog-compose-tools {
    margin-top: 4px;
}

.blog-field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.blog-char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.blog-rate-hint {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    opacity: 0.9;
    text-align: end;
}

body.day-mode .blog-rate-hint {
    opacity: 1;
    color: var(--text-secondary);
}

.blog-mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.blog-mode-btn {
    background: none;
    border: none;
    border-radius: 0;
    padding: 2px 0 4px;
    margin: 0;
    font: inherit;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.blog-mode-btn:hover {
    color: var(--text-primary);
}

.blog-mode-btn.is-active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--accent-color, #ffcd00);
}

.blog-preview {
    min-height: 4.5rem;
    padding: 10px 0 4px;
}

/* Preview reuses .blog-body type; keep empty state quieter than body copy */
.blog-preview.blog-body {
    font-size: var(--blog-body-size);
    line-height: var(--blog-body-lh);
}

.blog-preview-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: normal;
}

/* Compose preview: single cut mark where the feed teaser ends */
.blog-feed-cut-marker {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.85rem 0;
}

.blog-feed-cut-marker-line {
    flex: 1 1 auto;
    height: 1px;
    background: color-mix(in srgb, var(--accent-color, #ffcd00) 45%, var(--medium-border-color));
}

.blog-feed-cut-marker-label {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-color, #ffcd00);
    white-space: nowrap;
}

.blog-full-preview-beyond {
    opacity: 0.45;
}

.blog-edit-pane {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blog-edit-pane > .blog-char-count {
    align-self: flex-end;
}

/* Gold fill = New post / Post / Comment. Ghost and danger do not lift. */
.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: none;
    transform: none;
}

.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(--button-hover);
    color: var(--button-text);
    border-color: var(--button-border);
    box-shadow: var(--shadow-sm);
    transform: none;
}

.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: none;
    transform: none;
}

.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: none;
    transform: none;
}

.blog-btn-ghost:active,
.blog-btn-danger:active {
    transform: none;
    box-shadow: none;
    filter: none;
}

/* Six tabs: slightly tighter labels on desk; compact uses scroll (see Phase B2 below) */
#chat-column #info-tabs-container .tab {
    font-size: 0.88rem;
    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;
}

/* Phase B2: compact — horizontal scroll tabs, no equal-width squeeze */
@media (max-width: 900px) {
    #chat-column #info-tabs-card-container {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #chat-column #info-tabs-container {
        table-layout: auto;
        width: max-content;
        min-width: 100%;
        border-spacing: 4px;
    }

    #chat-column #info-tabs-container .tab {
        padding: 8px 10px;
        white-space: nowrap;
    }

    #chat-column #info-tabs-container .tab a {
        overflow: visible;
        text-overflow: unset;
        white-space: nowrap;
        padding: 0 4px;
    }
}

/* Phase B1: mid desk — shrink cover so title/tags keep room in 35% playlist */
@media (min-width: 901px) and (max-width: 1199px) {
    #playlist .current .cover {
        width: 72px;
        height: 72px;
    }

    #playlist .current .base {
        min-height: 100px;
    }

    #playlist .current .rating {
        min-width: 72px;
        gap: 4px;
    }

    #playlist .current .rating .curnum {
        font-size: 1.35rem;
        min-width: 20px;
    }
}

/* Phase B4: ultrawide — ink stays full-bleed; cap chat bubble measure */
@media (min-width: 1600px) {
    .chat-message-bubble {
        max-width: min(85%, 72ch);
    }
}

/* Phase B5: history — name + rating only on narrow; meta stacks as secondary line */
@media (max-width: 720px) {
    .history-header,
    .history-item-content,
    #playedSongsHistoryUL .history-item-content {
        grid-template-columns: minmax(0, 1fr) 4.5rem;
        column-gap: 8px;
    }

    .history-header-last-played,
    .history-header-plays,
    .history-item-last-played,
    .history-item-plays {
        display: none;
    }

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

@media (max-width: 720px) {
    .blog-feed-row,
    .blog-feed-row:has(.blog-feed-thumb) {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "thumb"
            "footer";
        padding: 16px 12px 18px;
    }
    .blog-karma-hint {
        font-size: 0.72rem;
    }
}

#info-blog-content .queue-vote-btn:hover:not(:disabled),
#info-blog-content .queue-vote-btn:focus-visible:not(:disabled) {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    background-color: color-mix(in srgb, var(--text-primary) 6%, transparent);
    opacity: 1;
    transform: none;
}

#info-blog-content .blog-vote-row--compact .queue-vote-btn:hover:not(:disabled),
#info-blog-content .blog-vote-row--compact .queue-vote-btn:focus-visible:not(:disabled) {
    border: none;
    background: transparent;
    color: var(--text-primary);
}

#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;
}

#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-up,
#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-down {
    border: none;
    background: transparent;
}

#info-blog-content .queue-vote-btn.active-up:hover:not(:disabled),
#info-blog-content .queue-vote-btn.active-up:focus-visible:not(:disabled) {
    border-color: var(--vote-up-color);
    color: var(--vote-up-color);
    background-color: color-mix(in srgb, var(--vote-up-color) 10%, transparent);
}

#info-blog-content .queue-vote-btn.active-down:hover:not(:disabled),
#info-blog-content .queue-vote-btn.active-down:focus-visible:not(:disabled) {
    border-color: var(--vote-down-color);
    color: var(--vote-down-color);
    background-color: color-mix(in srgb, var(--vote-down-color) 10%, transparent);
}

#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-up:hover:not(:disabled),
#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-up:focus-visible:not(:disabled),
#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-down:hover:not(:disabled),
#info-blog-content .blog-vote-row--compact .queue-vote-btn.active-down:focus-visible:not(:disabled) {
    border: none;
    background: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .blog-anim-enter,
    .blog-feed-row.blog-row-highlight,
    .blog-detail.blog-row-highlight {
        animation: none;
    }

    .blog-feed-row {
        transition: none;
    }
}
