:root {
    --primary: #c41e3a;
    --primary-dark: #a01830;
    --secondary: #d4a017;
    --success: #27ae60;
    --bg: #fdf8f5;
    --card: #ffffff;
    --text: #2d3436;
    --text-muted: #636e72;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(196, 30, 58, 0.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-main {
    padding-bottom: 48px;
}

.site-header {
    background: linear-gradient(135deg, var(--primary), #8b0000);
    color: white;
    padding: 12px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 0;
    flex: 1;
}

.logo-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    flex-shrink: 0;
}

.nav-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: white;
    border-radius: 2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.15);
}

.nav-portal {
    opacity: 0.9;
    font-size: 0.9rem;
}

.hero {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px;
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.hero h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.hero-phases {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.phase-tag {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.phase-pinyin { background: #e8f4fd; color: #1565c0; }
.phase-daily { background: #e8f5e9; color: #2e7d32; }
.phase-real { background: #fff3e0; color: #e65100; }

.pinyin-roadmap {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.pinyin-roadmap h2 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.roadmap-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.roadmap-step {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    border-radius: var(--radius);
    text-align: center;
    border: 2px solid transparent;
}

.roadmap-step strong {
    display: block;
    font-size: 1rem;
}

.roadmap-cn {
    display: block;
    font-size: 1.1rem;
    font-family: 'SimSun', serif;
    margin: 4px 0;
}

.roadmap-days {
    font-size: 0.8rem;
    opacity: 0.85;
}

.roadmap-num {
    font-size: 1.2rem;
}

.roadmap-arrow {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 700;
}

.step-shengmu { background: #e3f2fd; border-color: #64b5f6; }
.step-yunmu { background: #f3e5f5; border-color: #ba68c8; }
.step-shengdiao { background: #fff8e1; border-color: #ffb74d; }
.step-review { background: #e8f5e9; border-color: #81c784; }

.roadmap-formula {
    font-size: 0.95rem;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px dashed #ddd;
}

.day-step {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.day-card.step-shengmu { border-color: #64b5f6; }
.day-card.step-yunmu { border-color: #ba68c8; }
.day-card.step-shengdiao { border-color: #ffb74d; }
.day-card.step-review { border-color: #81c784; }
.day-card.phase-intro { border-color: #78909c; }

.pinyin-step-badge.step-intro { background: #eceff1; color: #455a64; }

.pinyin-step-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    margin-left: 8px;
}

.pinyin-step-badge.step-shengmu { background: #e3f2fd; color: #1565c0; }
.pinyin-step-badge.step-yunmu { background: #f3e5f5; color: #7b1fa2; }
.pinyin-step-badge.step-shengdiao { background: #fff8e1; color: #e65100; }
.pinyin-step-badge.step-review { background: #e8f5e9; color: #2e7d32; }

.guide-box,
.schedule-section,
.resources {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.guide-box h2,
.schedule-section h2,
.resources h2 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.guide-steps {
    padding-left: 24px;
    margin-bottom: 12px;
}

.guide-steps li {
    margin-bottom: 8px;
}

.guide-note {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.day-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
    background: #fafafa;
}

.day-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.phase-pinyin.day-card { border-color: #90caf9; }
.phase-talk.day-card { border-color: #ce93d8; }
.phase-daily.day-card { border-color: #a5d6a7; }
.phase-real.day-card { border-color: #ffcc80; }
.phase-review.day-card { border-color: var(--secondary); }

.day-num {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.day-phase {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.day-title {
    font-size: 0.95rem;
    line-height: 1.35;
}

.day-focus {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.resources ul {
    padding-left: 20px;
}

.resources li {
    margin-bottom: 8px;
}

.lesson-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin: 12px 0 16px;
    padding: 10px 14px;
    background: var(--card);
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.lesson-nav--btns {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    margin: 0 0 12px;
}

.lesson-nav--btns .lesson-nav-spacer {
    flex: 1;
}

.lesson-nav--btns .lesson-nav-next {
    margin-left: auto;
}

.lesson-nav--btns .lesson-nav-back:only-child,
.lesson-nav--btns .lesson-nav-next:only-child {
    margin-left: auto;
}

.lesson-nav > span:empty {
    display: none;
}

.lesson-nav .nav-prev {
    justify-self: start;
}

.lesson-nav .nav-home {
    justify-self: center;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.lesson-nav .nav-next {
    justify-self: end;
}

.lesson-nav a:not(.btn) {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}

.lesson-nav-bottom {
    margin-top: 32px;
}

.lesson-minimal {
    padding-top: 24px;
}

.lesson-minimal .lesson-block:first-child h2 {
    margin-top: 0;
}

.lesson {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
}

.lesson.phase-pinyin { border-top-color: #1565c0; }
.lesson.phase-intro { border-top-color: #546e7a; }
.lesson.phase-talk { border-top-color: #7b1fa2; }
.lesson.phase-daily { border-top-color: #2e7d32; }
.lesson.phase-real { border-top-color: #e65100; }
.lesson.phase-review { border-top-color: var(--secondary); }

.lesson-header {
    margin-bottom: 24px;
}

.lesson-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.lesson-phase {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.lesson-header h1 {
    font-size: 1.5rem;
}

.lesson-block {
    margin-bottom: 28px;
}

.lesson-block h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.drill-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.pinyin-drill-block .drill-head {
    justify-content: center;
    margin-top: 30px;
}

.drill-head h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.pinyin-drill-block .drill-head + .table-wrap {
    margin-top: 4px;
}

.table-compact .phonetic-to {
    font-size: 1.05rem;
}

/* Bảng thanh mẫu kiểu bài giảng (lưới 3×4) */
.shengmu-grid-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.shengmu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #333;
}

.shengmu-grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    min-height: 0;
    padding: 0;
    background: #fffde7;
    border: none;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    cursor: pointer;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: #111;
    font-family: Arial, 'Segoe UI', sans-serif;
    transition: background 0.15s ease;
}

.shengmu-grid-cell:nth-child(4n) {
    border-right: none;
}

.shengmu-grid-cell:nth-last-child(-n + 4) {
    border-bottom: none;
}

.shengmu-grid-cell:hover {
    background: #fff9c4;
}

.shengmu-grid-cell.speak-row-active {
    background: #ffeb3b;
    box-shadow: inset 0 0 0 3px var(--primary);
}

.shengmu-grid-cell--empty {
    background: #fffde7;
    cursor: default;
    pointer-events: none;
}

.pinyin-drill-block .drill-head + .shengmu-grid-wrap {
    margin-top: 8px;
}

/* Phiên âm tiếng Việt — danh sách thanh mẫu */
.phonetic-list-block {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px dashed #e0e0e0;
}

.phonetic-list-block h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.phonetic-list-tag {
    font-weight: 600;
    color: #666;
    font-size: 0.95em;
}

.phonetic-list-hint {
    margin-bottom: 14px;
}

.phonetic-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.phonetic-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fafafa;
}

.phonetic-list-pinyin {
    min-width: 1.8em;
    font-size: 1.35rem;
    font-weight: 700;
    color: #c62828;
    text-align: center;
}

.phonetic-list-sep {
    color: #bbb;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.phonetic-list-vi {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1565c0;
}

tr.speak-row-active {
    background: #fff8e1;
    box-shadow: inset 4px 0 0 #1565c0;
}

tr.speak-row-active .pinyin {
    color: #c62828;
    font-weight: 700;
}

tr.speak-row-active .btn-audio {
    background: #e65100;
    border-color: #e65100;
    transform: scale(1.08);
}

.btn-speak-all.is-playing {
    opacity: 0.85;
    cursor: wait;
}

.goal-list {
    padding-left: 20px;
}

.goal-list li {
    margin-bottom: 6px;
}

.table-wrap {
    overflow-x: auto;
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.vocab-table th,
.vocab-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.vocab-table th {
    background: #fafafa;
    font-weight: 600;
}

.hanzi {
    font-size: 1.35rem;
    font-family: 'SimSun', 'STSong', serif;
}

.pinyin {
    color: var(--primary);
    font-weight: 500;
}

.table-compact {
    max-width: 420px;
}

.table-compact .phonetic {
    font-size: 1rem;
    white-space: nowrap;
}

.phonetic-guide {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: #37474f;
}

.phonetic-to {
    font-weight: 500;
    color: #1565c0;
}

.table-compact .pinyin-large {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.table-compact .col-audio {
    width: 72px;
    text-align: center;
}

.listen-block-minimal .listen-actions {
    margin-bottom: 0;
}

.listen-block-minimal + .lesson-block {
    margin-top: 0.5rem;
}

.char-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.char-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    font-size: 2rem;
    font-family: 'SimSun', 'STSong', serif;
    background: #fff8e1;
    border: 2px solid var(--secondary);
    border-radius: 8px;
}

.block-hint {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.grammar-block p {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
}

.sentence-list {
    list-style: none;
}

.sentence-list li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.sentence-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.listen-block {
    background: linear-gradient(135deg, #fff5f5, #fffde7);
    border: 2px solid #ffcdd2;
    border-radius: var(--radius);
    padding: 20px !important;
}

.listen-intro {
    margin-bottom: 14px;
    color: var(--text);
}

.listen-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-listen {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-listen:hover {
    background: var(--primary-dark);
}

.listen-videos {
    margin-bottom: 16px;
}

.listen-video-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

.video-embed-wrap {
    position: relative;
    width: 100%;
    max-width: 640px;
    padding-bottom: 56.25%;
    height: 0;
    margin-bottom: 8px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.listen-video-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.listen-video-link:hover {
    text-decoration: underline;
}

.video-embed-wrap--wide {
    max-width: 800px;
}

.video-segment-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.video-intro-block {
    max-width: none;
    margin: 0 auto;
}

.lesson-video-day {
    --lesson-pad-x: 32px;
}

.lesson-video-day .video-intro-block {
    margin-left: calc(-1 * var(--lesson-pad-x));
    margin-right: calc(-1 * var(--lesson-pad-x));
    width: calc(100% + 2 * var(--lesson-pad-x));
}

.lesson-video-day .video-intro-header,
.lesson-video-day .video-intro-actions-row,
.lesson-video-day .video-intro-done {
    padding-left: var(--lesson-pad-x);
    padding-right: var(--lesson-pad-x);
}

.lesson-video-day .video-embed-wrap,
.lesson-video-day .video-embed-wrap--wide {
    max-width: none;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.video-embed-wrap--intro {
    background: #0f0f0f;
}

.video-embed-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-embed-target iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-intro-header {
    text-align: center;
    margin-bottom: 24px;
}

.video-intro-header h1 {
    font-size: 1.75rem;
    margin: 8px 0 6px;
    color: var(--text);
}

.video-intro-range {
    color: var(--text-muted);
    font-size: 1rem;
}

.video-intro-form {
    margin: 0;
}

.video-intro-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}

.btn-video-replay,
.btn-video-next {
    font-size: 1.05rem;
    padding: 12px 24px;
    min-width: 148px;
}

.btn-video-replay {
    border-width: 2px;
}

.btn-video-replay:disabled {
    opacity: 0.55;
    cursor: wait;
}

.video-intro-done {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    text-align: center;
}

.chart-embed-wrap {
    position: relative;
    width: 100%;
    max-width: 960px;
    padding-bottom: 75%;
    height: 0;
    margin-bottom: 10px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 2px solid #ffcdd2;
}

.chart-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.chart-extra-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-extra-links a {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.chart-extra-links a:hover {
    text-decoration: underline;
}

.pinyin-chart-embed {
    margin-bottom: 16px;
}

.btn-audio-native[data-audio-url],
.btn-audio-native[data-audio-urls] {
    border-color: #2e7d32;
    background: #e8f5e9;
}

.video-fallback-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-left: 3px solid var(--secondary);
}
    font-size: 0.88rem;
    color: var(--text-muted);
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-left: 3px solid var(--secondary);
}

.col-audio {
    width: 56px;
    text-align: center;
}

.btn-audio {
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: transform 0.15s, background 0.15s;
}

.btn-audio:hover {
    background: #fff5f5;
    transform: scale(1.08);
}

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

.sentence-list .vi {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.task-checklist {
    list-style: none;
}

.task-checklist li {
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

.task-checklist label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.task-checklist input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.tip-box {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn:hover {
    opacity: 0.9;
}

/* Admin */
.admin-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.admin-login {
    max-width: 420px;
    margin: 40px auto;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-toolbar-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.admin-toolbar-links a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.admin-reset-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.admin-input-sm {
    max-width: 140px;
    padding: 6px 8px;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.admin-temp-pass {
    border: 2px solid #81c784;
}

.admin-users-table .admin-input {
    max-width: none;
}

.admin-toolbar h1 {
    margin: 0;
    font-size: 1.35rem;
}

.admin-logout {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.admin-hint {
    color: #666;
    margin-bottom: 16px;
}

.admin-hint.small {
    font-size: 0.85rem;
    margin-top: 16px;
    margin-bottom: 0;
}

.admin-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.admin-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.admin-form label {
    display: block;
    margin-bottom: 16px;
    font-weight: 600;
}

.admin-form input[type="password"],
.admin-input {
    display: block;
    width: 100%;
    max-width: 280px;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.admin-phonetic-table .admin-input {
    max-width: none;
}

.admin-day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.admin-day-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-day-tab.active {
    background: var(--primary);
    color: white;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.admin-practice-table .admin-input-sm {
    width: 5rem;
}

.admin-practice-icon {
    margin-right: 6px;
}

.admin-practice-extra {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
    max-width: 240px;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.admin-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

/* Bài 0 — cấu trúc tiếng */
.intro-day-section {
    margin-bottom: 24px;
}

.intro-day-card {
    display: block;
    background: linear-gradient(135deg, #eceff1 0%, #fff 100%);
    border: 2px solid #78909c;
    border-radius: var(--radius);
    padding: 24px 28px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.intro-day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.intro-day-badge {
    display: inline-block;
    background: #546e7a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.intro-day-title {
    display: block;
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 6px;
}

.intro-day-desc {
    color: #666;
    font-size: 0.95rem;
}

.part-shengmu { color: #1565c0; }
.part-yunmu { color: #7b1fa2; }
.part-shengdiao { color: #e65100; }

.syllable-parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.syllable-part-card {
    border-radius: 12px;
    padding: 18px;
    border: 2px solid transparent;
}

.part-shengmu-card {
    background: #e3f2fd;
    border-color: #90caf9;
}

.part-yunmu-card {
    background: #f3e5f5;
    border-color: #ce93d8;
}

.part-shengdiao-card {
    background: #fff3e0;
    border-color: #ffcc80;
}

.part-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.part-cn {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

.syllable-part-card p {
    margin: 0 0 10px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.part-samples {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}

.part-shengmu-card .part-samples { color: #1565c0; }
.part-yunmu-card .part-samples { color: #7b1fa2; }
.part-shengdiao-card .part-samples { color: #e65100; }

.viet-compare-box {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 8px;
}

.viet-compare-box h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.viet-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.viet-compare-table th,
.viet-compare-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.syllable-demos {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.syllable-demo-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid #eee;
}

.syllable-builder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.syllable-piece {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 1.35rem;
    font-weight: 700;
}

.piece-shengmu {
    background: #e3f2fd;
    color: #1565c0;
    border: 2px solid #64b5f6;
}

.piece-yunmu {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 2px solid #ba68c8;
}

.piece-shengdiao {
    background: #fff3e0;
    color: #e65100;
    border: 2px solid #ffb74d;
}

.syllable-op {
    color: #90a4ae;
    font-weight: 600;
    font-size: 1.1rem;
}

.syllable-result {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    margin-left: 4px;
}

.syllable-result .pinyin {
    font-size: 1.5rem;
    font-weight: 700;
}

.syllable-result .hanzi {
    font-size: 1.75rem;
    font-family: 'SimSun', 'STSong', serif;
}

.syllable-demo-vi {
    margin: 10px 0 0;
    color: #666;
    font-size: 0.95rem;
}

.aspirate-examples {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.aspirate-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 10px;
}

.aspirate-plain,
.aspirate-marked {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
}

.aspirate-plain {
    background: #e3f2fd;
    color: #1565c0;
}

.aspirate-marked {
    background: #fff3e0;
    color: #e65100;
}

.aspirate-arrow {
    color: #90a4ae;
}

.aspirate-note {
    color: #666;
    font-size: 0.9rem;
    flex: 1 1 180px;
}

.site-footer {
    background: #2d3436;
    color: rgba(255, 255, 255, 0.75);
    padding: 20px 0;
    margin-top: 40px;
    font-size: 0.9rem;
    text-align: center;
}

.error-msg {
    padding: 40px;
    text-align: center;
}

/* Auth */
.auth-card {
    max-width: 400px;
    margin: 40px auto;
    background: var(--card);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 1.4rem;
}

.auth-lead {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.auth-form label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 0.9rem;
}

.auth-form input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.auth-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.auth-temp-password {
    font-size: 1.2rem;
    text-align: center;
    margin: 16px 0;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
}

.auth-temp-password code {
    font-size: 1.35rem;
    color: var(--primary);
}

.auth-hint {
    font-size: 0.88rem;
    color: #666;
    margin-top: 12px;
    line-height: 1.45;
}

.field-hint {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.auth-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    border: none;
    cursor: pointer;
    text-align: center;
}

.nav-user {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 8px 12px;
}

.nav-login {
    font-weight: 700;
}

/* Khóa bài */
.day-card--locked {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.3);
}

.day-card--passed .day-num {
    color: #2e7d32;
}

.intro-day-card--passed {
    border-color: #81c784;
}

.intro-day-card--locked {
    opacity: 0.7;
    pointer-events: none;
}

.lock-notice {
    padding: 32px;
    text-align: center;
}

.lock-notice h1 {
    margin-bottom: 12px;
}

.nav-exam {
    color: #e65100 !important;
}

@media (max-width: 600px) {
    .container {
        padding: 0 12px;
    }

    .page-main {
        padding-bottom: 32px;
    }

    .hero,
    .lesson {
        padding: 16px 14px;
        margin-top: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .lesson-minimal {
        padding: 14px 12px;
    }

    .lesson-video-day {
        --lesson-pad-x: 12px;
    }

    .lesson-nav {
        margin: 8px 0 12px;
        padding: 8px 10px;
    }

    .drill-head {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .pinyin-drill-block .drill-head {
        align-items: center;
    }

    .drill-head h2 {
        font-size: 1.05rem;
    }

    .drill-head .btn-listen {
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    .table-compact {
        max-width: none;
    }

    .vocab-table th,
    .vocab-table td {
        padding: 10px 8px;
    }

    .table-compact .pinyin-large {
        font-size: 1.25rem;
    }

    .table-compact .phonetic-to {
        font-size: 0.95rem;
    }

    .col-audio {
        width: 52px;
        text-align: center;
    }

    .btn-audio {
        width: 40px;
        height: 40px;
    }

    .day-grid {
        grid-template-columns: 1fr;
    }

    .intro-day-card {
        padding: 18px 16px;
    }

    .syllable-parts-grid {
        grid-template-columns: 1fr;
    }

    .aspirate-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        background: #8b0000;
        border-radius: 12px;
        padding: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        padding: 12px 14px;
        font-size: 1rem;
    }

    .nav-portal {
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: 4px;
        padding-top: 12px !important;
    }

    body.nav-menu-open {
        overflow: hidden;
    }
}

@media (min-width: 769px) {
    .header-inner {
        gap: 20px;
    }

    .logo {
        flex: 0 1 auto;
    }

    .nav {
        flex: 1;
        justify-content: flex-end;
    }

    .nav-portal {
        margin-left: 4px;
    }
}
