/* --- Global Styles & Variables --- */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --highlight-bg: #e9f4ff; /* Paragraph highlight */
    --border-color: #dee2e6;
    --card-bg: #ffffff;
}

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

body {
    font-family: 'Noto Sans', 'Noto Sans SC', sans-serif;
    line-height: 1.8;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* --- Header & Controls Styling (unchanged from previous version) --- */
.preview-title { font-size: 1.5rem; color: var(--primary-color); font-weight: bold; margin-bottom: 1rem; }
.subtitle { font-size: 1.2rem; color: var(--text-color); font-weight: bold; margin-bottom: 0.25rem; }
.source { font-size: 0.9rem; color: #888; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 2rem; }
.main-actions button { padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: bold; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; margin-right: 0.5rem; background-color: #f0f0f0; }
#play-all-btn { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
#stop-btn { background-color: #dc3545; color: white; border-color: #dc3545; }
#reset-btn { background-color: var(--secondary-color); color: white; border-color: var(--secondary-color); }
.toggles { display: flex; align-items: center; gap: 1rem; }
.toggles label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; user-select: none;}
.toggles input[type="checkbox"] { width: 16px; height: 16px; }

/* --- Article Content --- */
#article-content { display: flex; flex-direction: column; gap: 1rem; }
.paragraph-container { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; border-radius: 8px; border-left: 4px solid #e9ecef; transition: all 0.3s ease; }
.paragraph-container.highlight { background-color: var(--highlight-bg); border-left-color: var(--primary-color); }
.paragraph-controls { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--secondary-color); padding-top: 4px; }
.play-paragraph-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-color); background-color: white; font-size: 1rem; color: var(--primary-color); cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; display:flex; align-items: center; justify-content: center; }
.text-block { flex-grow: 1; }

/* Word and line styles */
.text-block p { margin: 0; overflow-wrap: break-word; word-break: break-word; }
.text-block .chinese-line { font-size: 1.2rem; line-height: 1.7; }
.text-block .pinyin-line { display: none; font-size: 0.9rem; color: var(--secondary-color); line-height: 1.6; margin-bottom: 1em; }

/* Styles for word spans */
.chinese-line span, .pinyin-line span {
    transition: background-color 0.1s, color 0.1s; /* Smooth transition */
}
.chinese-line span.word-highlight,
.pinyin-line span.pinyin-highlight {
    background-color: var(--primary-color);
    color: white;
    border-radius: 3px;
    padding: 0 2px;
}

/* Toggling visibility */
body.pinyin-visible .pinyin-line { display: block; }
.text-block .translation { display: none; font-size: 0.95rem; color: var(--secondary-color); font-style: italic; border-left: 3px solid var(--border-color); padding-left: 1rem; margin-top: 1rem; }
body.translation-visible .translation { display: block; }