/* ==========================================================================
   Design tokens — warm paper & ink, one accent. Dark theme follows the OS.
   ========================================================================== */
:root {
    color-scheme: light dark;

    --bg:        hsl(40, 28%, 96%);
    --surface:   hsl(40, 30%, 99%);
    --sidebar:   hsl(40, 22%, 93%);
    --viewer:    hsl(38, 12%, 87%);
    --line:      hsl(35, 16%, 83%);
    --hover:     hsla(35, 30%, 40%, 0.09);

    --ink:       hsl(222, 24%, 14%);
    --ink-2:     hsl(222, 12%, 36%);
    --ink-3:     hsl(222, 9%, 44%);

    --accent:      hsl(168, 62%, 25%);
    --accent-soft: hsl(168, 38%, 89%);
    --on-accent:   hsl(0, 0%, 100%);

    --shadow-sm: 0 1px 2px hsla(30, 30%, 10%, 0.08);
    --shadow-md: 0 8px 28px hsla(30, 30%, 10%, 0.16);
    --scrim:     hsla(30, 20%, 8%, 0.45);

    --font-display: 'Noto Serif SC', 'Songti SC', 'Source Han Serif SC', 'STSong', 'SimSun', serif;
    --font-body: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;

    --radius: 8px;
    --transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s, transform .15s;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        hsl(30, 8%, 9%);
        --surface:   hsl(30, 8%, 13%);
        --sidebar:   hsl(30, 8%, 11%);
        --viewer:    hsl(30, 8%, 7%);
        --line:      hsl(30, 6%, 22%);
        --hover:     hsla(40, 20%, 80%, 0.08);

        --ink:       hsl(40, 15%, 92%);
        --ink-2:     hsl(40, 8%, 72%);
        --ink-3:     hsl(40, 6%, 58%);

        --accent:      hsl(165, 48%, 56%);
        --accent-soft: hsl(165, 28%, 19%);
        --on-accent:   hsl(30, 8%, 9%);

        --shadow-sm: 0 1px 2px hsla(0, 0%, 0%, 0.4);
        --shadow-md: 0 8px 28px hsla(0, 0%, 0%, 0.55);
        --scrim:     hsla(0, 0%, 0%, 0.6);
    }
}

/* In the base layer so the reader's Tailwind utilities (reader/pep-reader.css) can still set padding/margin */
@layer base {
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        scrollbar-width: thin;
        scrollbar-color: var(--line) transparent;
    }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* Shared: single-line ellipsis */
.tree-book-name, .tree-chapter-title, .tree-audio span, .words-info span,
.audio-track-item .track-title, .audio-info .track-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Shared: small section label */
.tree-nav h3, .words-panel h3, .settings-panel h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

/* ==========================================================================
   App layout
   ========================================================================== */
.app-container {
    display: grid;
    grid-template-columns: 292px 1fr;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    transition: grid-template-columns .25s ease;
}

.app-container.sidebar-collapsed { grid-template-columns: 0px 1fr; }
.app-container.sidebar-collapsed .sidebar { border-right-color: transparent; }

.sidebar-backdrop { display: none; }
.mobile-only { display: none; }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
    background-color: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    z-index: 10;
}

.sidebar-header {
    padding: 22px 20px 18px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.logo-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 15px;
}

.sidebar-header .subtitle {
    font-size: 12px;
    color: var(--ink-2);
    margin: 8px 0 0 42px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tree-nav { flex: 0 0 auto; padding: 8px 12px 10px; }
.tree-nav h3 { padding: 0 8px; }

.tree-root {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Book node */
.tree-book-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    user-select: none;
}

.tree-book-header:hover { background-color: var(--hover); color: var(--ink); }

.tree-book.active > .tree-book-header {
    background-color: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.tree-book-name { flex: 1; }

.tree-arrow {
    font-size: 9px;
    flex-shrink: 0;
    color: var(--ink-3);
    transition: transform .2s ease;
}

.tree-book.open > .tree-book-header .tree-arrow,
.tree-chapter.open > .tree-chapter-header .tree-arrow { transform: rotate(90deg); }

/* Collapsible lists */
.tree-chapters, .tree-audios {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.tree-chapters { margin-left: 18px; border-left: 1px solid var(--line); padding-left: 6px; }
.tree-book.open > .tree-chapters { max-height: 2000px; padding-top: 2px; padding-bottom: 4px; }

.tree-chapter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    cursor: pointer;
    border-radius: 6px;
    color: var(--ink-2);
    font-size: 13px;
    transition: var(--transition);
    user-select: none;
}

.tree-chapter-header:hover { background-color: var(--hover); color: var(--ink); }
.tree-chapter.active > .tree-chapter-header { color: var(--accent); font-weight: 600; }

.tree-chapter-title { flex: 1; }

.tree-chapter-page, .words-page, .time-label {
    font-size: 11px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tree-chapter.active > .tree-chapter-header .tree-chapter-page { color: var(--accent); }

.tree-audios { display: flex; flex-direction: column; gap: 1px; padding-left: 14px; }
.tree-chapter.open > .tree-audios { max-height: 1000px; padding-top: 2px; padding-bottom: 6px; }

.tree-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ink-2);
    font-size: 12.5px;
    transition: var(--transition);
}

.tree-audio:hover { background-color: var(--hover); color: var(--ink); }
.tree-audio.playing { background-color: var(--accent-soft); color: var(--accent); font-weight: 500; }

.tree-play-icon { font-size: 9px; flex-shrink: 0; width: 12px; text-align: center; }

/* Vocabulary panel */
.words-panel { flex: 0 0 auto; padding: 14px 12px; border-top: 1px solid var(--line); }
.words-panel h3 { padding: 0 8px; }

.words-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }

.words-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.words-item:hover { background-color: var(--hover); color: var(--ink); }
.words-item.active { background-color: var(--accent-soft); color: var(--accent); font-weight: 600; }
.words-item.active .words-page { color: var(--accent); }

.words-info { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }

.words-actions, .track-actions, .card-actions { display: flex; align-items: center; gap: 10px; }

.play-icon-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    font-size: 12px;
    color: var(--ink-3);
}
.words-item.active .play-icon-mini, .audio-track-item.playing .play-icon-mini { color: var(--accent); }

/* Download buttons (words / panel / cards) */
.btn-words-download, .btn-track-download, .card-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}
.btn-words-download:hover, .btn-track-download:hover, .card-download-btn:hover { color: var(--accent); }

/* Settings */
.settings-panel { padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.setting-item { display: flex; flex-direction: column; gap: 8px; }

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--ink-2);
}

.setting-tip { font-size: 11px; color: var(--ink-3); }

.badge {
    background-color: var(--accent-soft);
    color: var(--accent);
    padding: 1px 7px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
}

/* ==========================================================================
   Main area & toolbar
   ========================================================================== */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.toolbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 20px;
    z-index: 5;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }

.btn {
    background-color: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    height: 34px;
    padding: 0 12px;
    transition: var(--transition);
}

.btn-secondary:hover { background-color: var(--hover); border-color: var(--ink-3); color: var(--ink); }

.toolbar .btn { min-width: 34px; padding: 0 10px; }

.page-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 4px;
    font-size: 14px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.page-indicator input {
    background-color: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    width: 52px;
    height: 30px;
    outline: none;
    transition: var(--transition);
}

.page-indicator input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.page-indicator .separator { color: var(--ink-3); }

.toolbar-right .badge { min-width: 46px; text-align: center; }

.book-title-display {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    color: var(--ink);
}

/* ==========================================================================
   Page viewer — the 3D book (reader/pep-reader.js) sits on a plain "desk"
   ========================================================================== */
.viewer-area {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--viewer);
}

.viewer-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
    position: relative;
}

/* The book fits this box; zoom grows the box and the viewer scrolls */
.reader-stage {
    position: relative;
    width: 100%;
    height: calc(100% * var(--reader-zoom, 1));
    min-height: 320px;
    color: var(--ink-2);
}

/* Floating "this page's audio" panel */
.floating-audio-panel {
    position: absolute;
    z-index: 30; /* above the reader's own overlays (hint pill is z-20) */
    top: 16px;
    right: 20px;
    width: 264px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow-md);
    transition: opacity .2s ease, transform .2s ease;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.floating-audio-panel.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 8px;
    padding: 0 4px 8px;
    border-bottom: 1px solid var(--line);
}

.page-audio-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 250px;
    overflow-y: auto;
}

.audio-track-item {
    border-radius: 6px;
    color: var(--ink-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    font-size: 13px;
    transition: var(--transition);
}

.audio-track-item:hover { background-color: var(--hover); color: var(--ink); }
.audio-track-item.playing { background-color: var(--accent-soft); color: var(--accent); font-weight: 600; }
.audio-track-item .track-title { margin-right: 10px; flex: 1; }

/* ==========================================================================
   Player bar
   ========================================================================== */
.audio-player-bar {
    background-color: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    padding: 0 28px;
    z-index: 5;
}

.player-left { width: 28%; min-width: 0; }
.audio-info { display: flex; flex-direction: column; gap: 2px; }

.audio-info .track-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.audio-info .book-name { font-size: 12px; color: var(--ink-3); }

.player-center {
    width: 44%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.player-controls { display: flex; align-items: center; gap: 18px; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover { background-color: var(--hover); color: var(--ink); }

.btn-play, .btn-play:hover {
    background-color: var(--accent);
    color: var(--on-accent);
    font-size: 15px;
    width: 42px;
    height: 42px;
    box-shadow: var(--shadow-sm);
}
.btn-play:hover { filter: brightness(1.1); }

.progress-container { display: flex; align-items: center; gap: 10px; width: 100%; }

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

/* Taller invisible hit area for easier seeking */
.progress-bar-wrapper::after { content: ''; position: absolute; inset: -8px 0; }

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: var(--accent);
}

.progress-knob {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}

.progress-bar-wrapper:hover .progress-knob { opacity: 1; }

.player-right {
    width: 28%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Playback speed */
.speed-control { position: relative; }

.speed-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    padding: 4px;
    list-style: none;
    width: 128px;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}

.speed-menu.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.speed-menu li {
    color: var(--ink-2);
    cursor: pointer;
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 6px;
    transition: var(--transition);
}

.speed-menu li:hover { background-color: var(--hover); color: var(--ink); }
.speed-menu li.active { background-color: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Playing indicator: only visible while audio plays */
.wave-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
    width: 23px;
    opacity: 0;
    transition: opacity .2s;
}

.wave-visualizer.playing { opacity: 1; }

.wave-visualizer span {
    background: var(--accent);
    border-radius: 1px;
    width: 3px;
    height: 100%;
    transform: scaleY(0.2);
    transform-origin: bottom;
}

.wave-visualizer.playing span { animation: wave-bounce 0.9s ease-in-out infinite alternate; }
.wave-visualizer.playing span:nth-child(1) { animation-delay: 0.1s; }
.wave-visualizer.playing span:nth-child(2) { animation-delay: 0.35s; }
.wave-visualizer.playing span:nth-child(3) { animation-delay: 0.55s; }
.wave-visualizer.playing span:nth-child(4) { animation-delay: 0.2s; }
.wave-visualizer.playing span:nth-child(5) { animation-delay: 0.45s; }

@keyframes wave-bounce {
    from { transform: scaleY(0.2); }
    to   { transform: scaleY(1); }
}

/* ==========================================================================
   Audio-only view (gaokao resources)
   ========================================================================== */
.audio-only-view {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.audio-only-header { text-align: center; margin-bottom: 28px; }

.audio-only-header .header-icon { font-size: 36px; color: var(--accent); margin-bottom: 12px; }

.audio-only-header h2 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
}

.audio-only-header p { font-size: 14px; color: var(--ink-2); }

.audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    width: 100%;
    padding-bottom: 40px;
}

.audio-card {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 132px;
    cursor: pointer;
    transition: var(--transition);
}

.audio-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.audio-card.playing { background-color: var(--accent-soft); border-color: var(--accent); }

.audio-card .card-top { display: flex; align-items: flex-start; justify-content: space-between; }

.audio-card .audio-icon-wrapper {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background-color: var(--sidebar);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
    font-size: 15px;
    transition: var(--transition);
}

.audio-card.playing .audio-icon-wrapper { background-color: var(--accent); color: var(--on-accent); }

.audio-card .play-btn-wrapper { font-size: 20px; color: var(--ink-3); transition: var(--transition); }
.audio-card:hover .play-btn-wrapper, .audio-card.playing .play-btn-wrapper { color: var(--accent); }

.audio-card .card-bottom { display: flex; flex-direction: column; gap: 4px; }

.audio-card .card-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.audio-card .card-subtitle { font-size: 12px; color: var(--ink-3); }

/* ==========================================================================
   Tablet & mobile (≤ 900px): sidebar becomes a drawer
   ========================================================================== */
@media (max-width: 900px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: var(--scrim);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

    .app-container,
    .app-container.sidebar-collapsed { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 300px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-md);
    }
    .sidebar.mobile-open { transform: translateX(0); }

    .mobile-only { display: flex; }
    #toggle-sidebar { display: none; }

    .toolbar { padding: 0 12px; height: 52px; }
    .toolbar-center .book-title-display {
        font-size: 13px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Player: stacked rows */
    .audio-player-bar { height: auto; padding: 10px 16px; flex-direction: column; gap: 6px; }
    .player-left, .player-center, .player-right { width: 100%; }
    .player-right { justify-content: space-between; }
    .wave-visualizer { display: none; }

    /* Page audio: sheet pinned to the bottom of the viewer (never covers the player) */
    .floating-audio-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-width: 1px 0 0;
        border-radius: 14px 14px 0 0;
        padding: 8px 10px 10px;
        max-height: 30vh;
        overflow-y: auto;
        transform: none;
    }
    .floating-audio-panel:not(.visible) { display: none; }
    .floating-audio-panel .panel-header { margin-bottom: 4px; padding-bottom: 6px; }
    .floating-audio-panel .audio-track-item { padding: 6px 8px; }
    .page-audio-list { max-height: none; }
}

@media (max-width: 600px) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .toolbar { height: 48px; padding: 0 10px; }
    #zoom-percent { display: none; }
    .toolbar-center { display: none; }

    .audio-player-bar { padding: 10px 12px 12px; }
    .audio-info .track-name { font-size: 13px; }
    .btn-icon { width: 38px; height: 38px; }
    .btn-play, .btn-play:hover { width: 46px; height: 46px; }

    .audio-grid { grid-template-columns: 1fr; }
    .audio-card { height: auto; min-height: 112px; gap: 12px; }
    .audio-only-header h2 { font-size: 21px; }

    .speed-menu { bottom: auto; top: calc(100% + 8px); right: 0; }
    .settings-panel { display: none; }
    .sidebar { width: 88vw; max-width: 320px; }
}

/* Touch screens: no hover lift, bigger tap targets */
@media (hover: none) and (pointer: coarse) {
    .audio-card:hover { transform: none; box-shadow: none; }
    .btn { min-height: 40px; min-width: 40px; }
    .audio-track-item { padding: 12px 8px; }
    .progress-knob { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
