* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

body.dark {
    --light-bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
    background: var(--light-bg);
    color: var(--text-main);
    font-size: 18px;
    line-height: 1.7;
    transition: background 0.3s, color 0.2s;
}

/* progress bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: transparent;
    z-index: 2000;
}
.progress-bar {
    height: 5px;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    width: 0%;
    transition: width 0.1s;
}

/* header */
.header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(16px);
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}
body.dark .header { background: rgba(15,23,42,0.95); }
.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.9rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    cursor: pointer;
}
.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}
.nav-menu a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.nav-menu a:hover { color: var(--primary); }
.dark-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hamburger {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
}

/* main container - BIGGER & COMFORTABLE */
.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* article card */
.article-detail {
    background: var(--card-bg);
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 20px 35px -12px rgba(0,0,0,0.15);
    margin-bottom: 2.5rem;
    transition: 0.2s;
}

.article-header {
    border-bottom: 2px solid var(--border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.article-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.level-badge {
    padding: 0.3rem 1rem;
    border-radius: 40px;
    font-weight: 700;
}
.level-1-badge { background: #dcfce7; color: #166534; }
.level-2-badge { background: #fed7aa; color: #9a3412; }
.level-3-badge { background: #fee2e2; color: #b91c1c; }

/* featured image */
.featured-img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

/* toolbar */
.article-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
    margin: 1rem 0 2rem 0;
}
.control-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--light-bg);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 44px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.95rem;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.like-btn.active { background: #dcfce7; color: #166534; border-color: #166534; }
.dislike-btn.active { background: #fee2e2; color: #b91c1c; border-color: #b91c1c; }
.bookmark-btn.active { background: #fef08a; color: #854d0e; }
.tts-active { background: var(--success); color: white; animation: pulse 1s infinite; }

/* article content -> bigger text */
.article-content {
    font-size: 1.2rem;
    line-height: 1.8;
    margin: 2rem 0;
}
.article-content p {
    margin-bottom: 1.5rem;
}



/* vocabulary */
.vocabulary-section {
    background: var(--light-bg);
    border-radius: 1.2rem;
    padding: 1.6rem;
    margin: 2rem 0;
}
.vocab-word {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    margin: 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}
.vocab-word:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* comments */
.comments-section {
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
}
.comment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.comment-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--light-bg);
    font-family: inherit;
}
.comment-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 2rem;
    padding: 0 1.8rem;
    cursor: pointer;
    font-weight: 600;
}
.comment {
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 0;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.comment-author { font-weight: bold; color: var(--primary); }
.comment-text { margin: 0.5rem 0; line-height: 1.5; }
.comment-actions { display: flex; gap: 1rem; }
.comment-like, .comment-dislike {
    cursor: pointer;
    font-size: 0.85rem;
}

/* toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 60px;
    z-index: 2000;
    animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@media (max-width: 768px) {
    .container { padding: 0 1.2rem; }
    .article-detail { padding: 1.5rem; }
    .article-content { font-size: 1rem; }
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 75px;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .nav-menu.active { display: flex; }
    .hamburger { display: block; }
}

/* Responsive footer */
footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    font-size: clamp(0.75rem, 3vw, 0.9rem);
}

/* Table Styles */
.vocabulary-table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.vocabulary-table {
    width: 100%;
    background-color: var(--bg-primary);
    border-collapse: separate;
    border-spacing: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    color: var(--text-primary);
}

.vocabulary-table thead tr {
    background-color: var(--header-bg);
}

.vocabulary-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.vocabulary-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.vocabulary-table tbody tr:hover {
    background-color: var(--hover-bg);
    transition: background-color 0.2s ease;
}
/* Premium Modern Audio Player Styles - Full Width Responsive */

.audio-player-wrapper {
    width: 100%;
    flex: 1 1 100%;
    margin-bottom: 0.75rem;
}

.modern-audio-player {
    width: 100%;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--light-bg) 100%);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.modern-audio-player:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.player-waveform {
    margin-bottom: 1rem;
    width: 100%;
}

.waveform-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin-bottom: 12px;
    width: 100%;
}

.waveform-bar {
    flex: 1;
    max-width: 4px;
    min-width: 2px;
    height: 12px;
    background: linear-gradient(180deg, var(--primary) 0%, #a855f7 100%);
    border-radius: 3px;
    transition: height 0.2s ease;
}

@keyframes waveformPulse {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 28px;
    }
}

.player-progress-container {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.player-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 4px;
    width: 0%;
    pointer-events: none;
    transition: width 0.1s linear;
}

.player-progress-slider {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.player-progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-progress-container:hover .player-progress-slider::-webkit-slider-thumb {
    opacity: 1;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
}

.player-controls-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.player-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.player-play-pause {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.player-play-pause:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.player-play-pause:active {
    transform: scale(0.95);
}

.player-play-pause svg {
    color: white;
}

.player-time {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.85rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.player-current-time {
    color: var(--primary);
    font-weight: 600;
}

.player-time-separator {
    margin: 0 2px;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.player-volume-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--light-bg);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.player-volume-btn:hover {
    background: var(--border);
    transform: scale(1.05);
}

.volume-slider-container {
    width: 80px;
    flex-shrink: 0;
}

.player-volume-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.player-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.player-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.player-speed {
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--light-bg);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.player-speed:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.player-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 12px;
    color: var(--danger);
    font-size: 0.9rem;
    width: 100%;
}

.player-error-toast {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .audio-player-wrapper {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .modern-audio-player {
        padding: 0.85rem;
    }

    .waveform-bars {
        gap: 2px;
        height: 32px;
    }

    .waveform-bar {
        min-width: 1.5px;
    }

    .player-controls {
        gap: 0.65rem;
    }

    .player-controls-group {
        gap: 0.65rem;
    }

    .player-play-pause {
        width: 40px;
        height: 40px;
    }

    .player-time {
        font-size: 0.75rem;
    }

    .volume-slider-container {
        width: 70px;
    }

    .player-speed {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 650px) {
    .player-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .player-controls-group {
        justify-content: space-between;
        width: 100%;
    }

    .player-controls-group:first-child {
        margin-bottom: 0.5rem;
    }

    .player-volume {
        justify-content: flex-end;
    }

    .volume-slider-container {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .modern-audio-player {
        padding: 0.75rem;
    }

    .waveform-bars {
        gap: 1.5px;
    }

    .waveform-bar {
        min-width: 1px;
    }

    .player-play-pause {
        width: 36px;
        height: 36px;
    }

    .player-time {
        font-size: 0.7rem;
    }

    .player-controls-group {
        gap: 0.5rem;
    }

    .volume-slider-container {
        width: 80px;
    }

    .player-volume-btn {
        width: 28px;
        height: 28px;
    }

    .player-speed {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

@media (max-width: 380px) {
    .player-controls-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .player-time {
        order: 1;
    }

    .player-volume {
        order: 2;
    }

    .player-speed {
        order: 3;
    }
}

/* Dark mode specific adjustments */
body.dark .modern-audio-player {
    background: linear-gradient(135deg, var(--card-bg) 0%, #1a1a2e 100%);
    border-color: var(--border);
}

body.dark .player-speed {
    background: rgba(255, 255, 255, 0.1);
}

body.dark .player-speed:hover {
    background: var(--primary);
}

body.dark .player-volume-btn {
    background: rgba(255, 255, 255, 0.1);
}

body.dark .player-volume-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Ripple effect for buttons */
.player-btn {
    position: relative;
    overflow: hidden;
}

.player-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.player-btn:active::after {
    width: 100%;
    height: 100%;
}

/* Loading animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.modern-audio-player.loading {
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--border) 50%, var(--card-bg) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}


/* Additional styles for Post Navigation Cards */
.post-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0 1rem;
    justify-content: space-between;
}

.nav-card {
    flex: 1;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: 1.5rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-card:hover:not(.disabled) {
    transform: translateY(-6px);
    box-shadow: 0 16px 28px -8px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.nav-card.disabled {
    opacity: 0.55;
    cursor: default;
    filter: grayscale(0.1);
}

.nav-card-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--primary);
}

.nav-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nav-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.prev-card .nav-card-inner {
    align-items: flex-start;
    text-align: left;
}

.next-card .nav-card-inner {
    align-items: flex-end;
    text-align: right;
}

@media (max-width: 680px) {
    .post-navigation {
        flex-direction: column;
    }
    .prev-card .nav-card-inner,
    .next-card .nav-card-inner {
        align-items: flex-start;
        text-align: left;
    }
    .nav-card-inner {
        padding: 1.2rem;
    }
    .nav-title {
        font-size: 1rem;
    }
}



.post-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0 1rem;
    justify-content: space-between;
}

.nav-card {
    flex: 1;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: 1.5rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-card:hover:not(.disabled) {
    transform: translateY(-6px);
    box-shadow: 0 16px 28px -8px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.nav-card.disabled {
    opacity: 0.55;
    cursor: default;
    filter: grayscale(0.1);
}

.nav-card-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--primary);
}

.nav-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nav-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.prev-card .nav-card-inner {
    align-items: flex-start;
    text-align: left;
}

.next-card .nav-card-inner {
    align-items: flex-end;
    text-align: right;
}

@media (max-width: 680px) {
    .post-navigation {
        flex-direction: column;
    }
    .prev-card .nav-card-inner,
    .next-card .nav-card-inner {
        align-items: flex-start;
        text-align: left;
    }
    .nav-card-inner {
        padding: 1.2rem;
    }
    .nav-title {
        font-size: 1rem;
    }
}
