/* ─────────────────────────────────────────────
   reading.css — PhonicsPro Reading Module
   Includes: Unit list cards + LingQ-style reader
   ───────────────────────────────────────────── */

/* ╔══════════════════════════════════════════╗
   ║   SHARED CONTAINER                       ║
   ╚══════════════════════════════════════════╝ */
.reading-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ╔══════════════════════════════════════════╗
   ║   READING LIST — Page Header             ║
   ╚══════════════════════════════════════════╝ */
.reading-list-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reading-page-header {
    text-align: center;
    padding: 0.5rem 0 1.5rem;
}

.reading-page-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    background: var(--grad-premium);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.reading-page-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ╔══════════════════════════════════════════╗
   ║   UNIT CARD                              ║
   ╚══════════════════════════════════════════╝ */
.reading-unit-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem 2rem 1.5rem;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.reading-unit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grad-premium);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-unit-card:hover {
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.reading-unit-card:hover::before {
    opacity: 1;
}

/* Unit Header */
.unit-card-header {
    margin-bottom: 1.75rem;
}

.unit-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

[data-theme="light"] .unit-label {
    color: #f97316; /* Orange in light mode — faithful to reference */
}

.unit-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.unit-subtitle-inline {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

/* ╔══════════════════════════════════════════╗
   ║   UNIT TOPICS — Timeline                 ║
   ╚══════════════════════════════════════════╝ */
.unit-topics-list {
    display: flex;
    flex-direction: column;
    padding-left: 0.25rem;
}

.unit-topic-item {
    display: flex;
    gap: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem 0.25rem 0;
    border-radius: 10px;
    transition: background 0.2s ease;
    position: relative;
}

.unit-topic-item:hover {
    background: rgba(139, 92, 246, 0.06);
}

[data-theme="light"] .unit-topic-item:hover {
    background: rgba(249, 115, 22, 0.05);
}

/* Bullet + line column */
.unit-topic-bullet {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding-top: 0.35rem;
    width: 24px;
}

.bullet-outer {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, transform 0.2s;
    z-index: 1;
}

[data-theme="light"] .bullet-outer {
    border-color: #1e3a5f; /* Navy blue as in the reference */
}

.bullet-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    transition: background 0.2s;
}

[data-theme="light"] .bullet-inner {
    background: #1e3a5f;
}

.unit-topic-item:hover .bullet-outer {
    transform: scale(1.1);
    border-color: var(--accent-primary);
}

.unit-topic-item:hover .bullet-inner {
    background: var(--accent-primary);
}

/* Vertical connector line */
.bullet-line {
    width: 2px;
    flex: 1;
    min-height: 24px;
    background: var(--accent-color);
    opacity: 0.35;
    margin-top: 3px;
}

[data-theme="light"] .bullet-line {
    background: #1e3a5f;
    opacity: 0.25;
}

/* Topic content */
.unit-topic-content {
    flex: 1;
    padding-bottom: 1.75rem;
}

.unit-topic-item.last .unit-topic-content {
    padding-bottom: 0.5rem;
}

.unit-topic-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.2rem;
}

.unit-topic-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-secondary);
    margin: 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

[data-theme="light"] .unit-topic-title {
    color: #1e3a5f; /* Navy blue — faithful to reference */
}

.unit-topic-item:hover .unit-topic-title {
    color: var(--accent-primary);
}

[data-theme="light"] .unit-topic-item:hover .unit-topic-title {
    color: #3b82f6;
}

.topic-number {
    font-weight: 800;
    opacity: 0.85;
}

.topic-progress-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--grad-premium);
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
}

.unit-topic-subtitle {
    font-size: 0.82rem;
    color: var(--accent-secondary);
    opacity: 0.75;
    margin: 0 0 0.4rem;
    font-style: italic;
}

[data-theme="light"] .unit-topic-subtitle {
    color: #3b82f6;
}

.unit-topic-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 0.5rem;
}

.unit-topic-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.topic-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ╔══════════════════════════════════════════╗
   ║   UNIT CARD — Footer / Unit Test Btn     ║
   ╚══════════════════════════════════════════╝ */
.unit-card-footer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--card-border);
}

.unit-test-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f97316; /* Orange — faithful to video reference */
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px -2px rgba(249, 115, 22, 0.45);
}

.unit-test-btn:hover {
    background: #ea6b0a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(249, 115, 22, 0.55);
}

.unit-test-btn:active {
    transform: translateY(0);
}

/* ╔══════════════════════════════════════════╗
   ║   READER — Detail Layout                 ║
   ╚══════════════════════════════════════════╝ */
.reading-detail-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Main text area — scrollable */
.reading-main-content {
    flex: 1;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2.5rem 3rem 2.5rem;
    overflow-y: auto;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
    min-height: 0;
    /* Add bottom padding so last sentence isn't hidden by pill */
    padding-bottom: 7rem;
}

/* Top bar inside reader */
.reading-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.back-to-list-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
    padding: 0;
}

.back-to-list-btn:hover {
    color: var(--text-main);
}

.reading-story-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
}

/* Legend */
.reading-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vocab-dot {
    background: rgba(6, 182, 212, 0.6);
    border: 1.5px solid rgba(6, 182, 212, 0.9);
}

.selected-dot {
    background: var(--accent-primary);
}

/* Story text body */
.story-text-body {
    flex: 1;
    font-size: 1.15rem;
    line-height: 1.95;
    color: var(--text-main);
}

.reading-sentence {
    display: block;
    margin-bottom: 1.2rem;
}

/* Words */
.reading-word {
    cursor: pointer;
    padding: 0 0.15rem;
    border-radius: 4px;
    display: inline;
    transition: background 0.15s ease, color 0.15s ease;
}

.reading-word:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .reading-word:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Words that have vocab data */
.reading-word.has-vocab {
    border-bottom: 1.5px solid rgba(6, 182, 212, 0.5);
}

.reading-word.has-vocab:hover {
    background: rgba(6, 182, 212, 0.12);
}

/* Selected word */
.reading-word.selected {
    background: var(--accent-primary);
    color: #fff;
    border-radius: 4px;
    border-bottom-color: transparent;
    font-weight: 600;
}

/* Active speaking sentence — LingQ-style white underline */
.reading-sentence {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 4px;
    transition: background 0.15s ease;
}

.reading-sentence:hover {
    background: rgba(255,255,255,0.04);
}

[data-theme="light"] .reading-sentence:hover {
    background: rgba(0,0,0,0.03);
}

.reading-sentence.speaking {
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.75);
    text-underline-offset: 5px;
    text-decoration-thickness: 1.5px;
}

[data-theme="light"] .reading-sentence.speaking {
    text-decoration-color: rgba(0, 0, 0, 0.5);
}

/* Speaking legend dot */
.speaking-dot {
    background: rgba(255, 255, 255, 0.7);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .speaking-dot {
    background: rgba(0,0,0,0.4);
    border-color: rgba(0,0,0,0.6);
}

/* ╔══════════════════════════════════════════╗
   ║   LINGQ-STYLE FLOATING PLAYER PILL         ║
   ╚══════════════════════════════════════════╝ */
.story-player-pill {
    position: fixed;
    top: 90px;
    left: 50%;
    width: 440px;
    background: rgba(12, 12, 20, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.85rem 1.25rem 0.85rem 2.2rem; /* extra left padding for handle */
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    
    /* Center it horizontally and offset vertically for entry animation */
    transform: translate(0, -20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.story-player-pill.visible {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    pointer-events: all;
}

/* Drag Handle */
.player-drag-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.25);
    cursor: grab;
    border-radius: 20px 0 0 20px;
    font-size: 1.2rem;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.player-drag-handle:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
}

.player-drag-handle:active {
    cursor: grabbing;
}


/* ─ Timeline row ──────────────────────── */
.player-timeline-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.player-time {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 30px;
}

.player-time:last-child {
    text-align: right;
}

.player-timeline-track {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s ease;
}

.player-timeline-track:hover {
    height: 6px;
}

.player-timeline-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 4px;
    transition: width 0.8s linear;
    pointer-events: none;
}

.player-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: left 0.8s linear;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(34,197,94,0.6);
}

/* ─ Controls row ─────────────────────── */
.player-controls-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.player-ctrl {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.player-ctrl:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.player-ctrl.loop-active {
    color: #22c55e;
    background: rgba(34,197,94,0.12);
}

.player-main-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: none;
    color: #0c0c14;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
    margin: 0 0.25rem;
}

.player-main-btn:hover {
    transform: scale(1.08);
    background: #f0f0f0;
}

.player-main-btn:active {
    transform: scale(0.95);
}

.player-speed-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.75);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 32px;
}

.player-speed-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.player-close-btn {
    margin-left: auto;
}

.player-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ─ Speed popup ─────────────────────── */
.player-speed-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(20, 20, 35, 0.98);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.4rem;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 1rem;
    min-width: 80px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 10000;
}

.story-player-pill {
    position: relative; /* needed for speed menu absolute positioning */
}

.player-speed-menu button {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.65);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.player-speed-menu button:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.player-speed-menu button.speed-active {
    color: #22c55e;
    font-weight: 800;
}

/* Light theme overrides for pill */
[data-theme="light"] .story-player-pill {
    background: rgba(15, 15, 30, 0.96);
    border-color: rgba(255,255,255,0.08);
}


/* ╔══════════════════════════════════════════╗
   ║   READER — Right Sidebar (Vocabulary)    ║
   ╚══════════════════════════════════════════╝ */
.reading-sidebar {
    position: fixed;
    top: 100px;
    right: 30px;
    width: 320px;
    height: 500px;
    background: rgba(18, 18, 26, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-drag-handle {
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    cursor: grab;
    user-select: none;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.sidebar-drag-handle:active {
    cursor: grabbing;
}
.sidebar-drag-handle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

#sidebar-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Empty state in sidebar */
.sidebar-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: var(--text-muted);
    gap: 0.75rem;
    padding: 1rem;
}

.sidebar-empty-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.sidebar-empty-state p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.sidebar-hint {
    font-size: 0.78rem !important;
    opacity: 0.7;
}

.vocab-hint-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.8);
    border: 1.5px solid rgba(6, 182, 212, 1);
    vertical-align: middle;
}

/* Word panel */
.sidebar-word-panel {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-word-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.sidebar-word-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.sidebar-audio-btn {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-audio-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: scale(1.1);
}

.pos-badge {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

[data-theme="light"] .pos-badge {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.2);
}

.sidebar-unknown-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.45;
}

/* Sidebar sections */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-section-action {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent-secondary);
    cursor: pointer;
    transition: opacity 0.2s;
}

.sidebar-section-action:hover {
    opacity: 0.7;
}

/* Meaning input */
.meaning-input-wrap {
    display: flex;
    gap: 0.5rem;
}

.meaning-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    width: 100%;
}

.meaning-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.meaning-save-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.meaning-save-btn:hover {
    filter: brightness(1.1);
}

/* Dictionary buttons */
.dict-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dict-btn {
    background: var(--bg-main);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dict-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Popular meanings */
.popular-meanings {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.meaning-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.meaning-item:hover {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.08);
}

[data-theme="light"] .meaning-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .meaning-item:hover {
    background: #f0f4ff;
    border-color: #a5b4fc;
}

.add-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
}

.meaning-item:hover .add-icon {
    color: var(--accent-primary);
}

/* Examples list */
.examples-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.example-item {
    font-size: 0.88rem;
    color: var(--text-muted);
    background: var(--bg-main);
    border-left: 3px solid var(--accent-primary);
    padding: 0.6rem 0.85rem;
    border-radius: 0 8px 8px 0;
    line-height: 1.45;
}

.example-item strong {
    color: var(--text-main);
    font-weight: 700;
}

/* ╔══════════════════════════════════════════╗
   ║   LIGHT THEME OVERRIDES                  ║
   ╚══════════════════════════════════════════╝ */
[data-theme="light"] .reading-unit-card {
    background: #ffffff;
    border-color: #e9ecef;
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .reading-unit-card:hover {
    box-shadow: 0 12px 32px -6px rgba(249, 115, 22, 0.12), 0 0 0 1px rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
}

[data-theme="light"] .unit-title {
    color: #0f172a;
}

[data-theme="light"] .unit-card-footer {
    border-top-color: #e9ecef;
}

[data-theme="light"] .reading-main-content {
    background: #ffffff;
    border-color: #e9ecef;
    box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .reading-sidebar {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sidebar-drag-handle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .sidebar-drag-handle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .reading-top-bar {
    border-bottom-color: #e9ecef;
}

[data-theme="light"] .story-footer {
    border-top-color: #e9ecef;
}

[data-theme="light"] .example-item {
    background: #f8fafc;
}

[data-theme="light"] .meaning-input {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

[data-theme="light"] .sidebar-audio-btn {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .dict-btn {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #4b5563;
}

[data-theme="light"] .reading-word:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ╔══════════════════════════════════════════╗
   ║   RESPONSIVE                             ║
   ╚══════════════════════════════════════════╝ */
@media (max-width: 900px) {
    .reading-container {
        max-width: 100%;
    }

    .reading-detail-layout {
        flex-direction: column;
        height: auto;
    }

    .reading-main-content {
        padding: 1.75rem 1.5rem;
        font-size: 1.05rem;
    }
    
    /* Disable drag on mobile, snap to bottom */
    .reading-sidebar {
        position: fixed;
        top: auto !important;
        left: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 100%;
        height: 350px;
        border-radius: 20px 20px 0 0;
        z-index: 10000;
        transform: none !important;
    }
    
    .sidebar-drag-handle {
        display: none; /* No dragging on mobile */
    }
}

@media (max-width: 600px) {
    .reading-unit-card {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .unit-title {
        font-size: 1.35rem;
    }

    .unit-topic-description {
        font-size: 0.85rem;
    }

    .reading-page-title {
        font-size: 1.6rem;
    }

    .story-player-pill {
        width: calc(100% - 2rem) !important;
        max-width: 440px;
        padding-left: 2rem;
    }
    
    .player-speed-btn {
        padding: 0.25rem 0.35rem;
    }

    .player-main-btn {
        width: 36px;
        height: 36px;
    }
    
    .player-main-btn svg {
        width: 18px;
        height: 18px;
    }
}
