:root {
    --wine: #522f24;
    --wine-dark: #342019;
    --orange: #e17b3b;
    --orange-soft: #f0c29f;
    --paper: #f4eedf;
    --paper-up: #fffaf0;
    --ink: #25241f;
    --soft: #6a6357;
    --line: #d2c5ad;
    --green: #315f55;
    --blue: #327387;
    --serif: "STKaiti", "KaiTi", "Songti SC", serif;
    --sans: "LXGW WenKai", "Microsoft YaHei UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; color: var(--ink); font-family: var(--sans);
    background:
        linear-gradient(rgba(82,47,36,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(82,47,36,.028) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 15px; top: -50px; z-index: 20; padding: 10px 14px; background: var(--wine); color: white; }
.skip-link:focus { top: 10px; }
.english-global {
    position: sticky; top: 0; z-index: 12; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    height: 76px; padding: 0 28px; border-bottom: 1px solid rgba(82,47,36,.22); background: rgba(244,238,223,.94); backdrop-filter: blur(12px);
}
.english-brand { display: flex; align-items: center; gap: 12px; width: fit-content; color: inherit; text-decoration: none; }
.brand-glyph { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--wine); border-radius: 50%; color: var(--wine); font-family: Georgia, serif; font-size: 17px; font-style: italic; }
.english-brand strong { display: block; font-family: var(--serif); font-size: 18px; letter-spacing: .08em; }
.english-brand small { display: block; margin-top: 2px; color: var(--soft); font-size: 8px; letter-spacing: .13em; }
.english-global nav { display: flex; gap: 18px; }
.english-global nav a { color: var(--soft); font-size: 11px; font-weight: 750; text-decoration: none; }
.english-global nav a:hover { color: var(--wine); }
#mobileNavButton { display: none; justify-self: end; padding: 7px 11px; border: 1px solid var(--line); background: transparent; }
.english-shell { display: grid; grid-template-columns: 294px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.english-sidebar {
    position: sticky; top: 76px; align-self: start; height: calc(100vh - 76px); padding: 25px 20px 40px;
    overflow-y: auto; border-right: 1px solid rgba(82,47,36,.18); background: #efe5d2;
}
.sidebar-close { display: none; }
.english-progress { padding: 18px; background: var(--wine); color: white; }
.english-progress > div { display: flex; align-items: baseline; justify-content: space-between; }
.english-progress span { color: #d8c4b8; font-size: 10px; }
.english-progress strong { color: #f0a66f; font-family: Georgia, serif; font-size: 21px; }
.english-progress p { height: 3px; margin: 15px 0 9px; background: rgba(255,255,255,.14); }
.english-progress i { display: block; width: 0; height: 100%; background: #f08e52; transition: width .5s ease; }
.english-progress small { color: #cdbbb0; font-size: 9px; }
.daily-streak { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 14px 0 20px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.daily-streak span { color: var(--soft); font-size: 9px; }
.daily-streak strong { color: var(--wine); font-family: var(--serif); font-size: 15px; }
.daily-streak small { grid-column: 1 / -1; color: var(--soft); font-size: 9px; }
.lesson-search { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--line); background: rgba(255,255,255,.33); }
.lesson-search span { color: var(--soft); }
.lesson-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.lesson-nav { margin-top: 23px; }
.track-block { margin-bottom: 22px; }
.track-title { display: flex; align-items: center; gap: 8px; margin: 0 0 7px; color: var(--soft); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.track-title::before { width: 12px; height: 3px; background: var(--track); content: ""; }
.lesson-link {
    position: relative; display: grid; grid-template-columns: 22px 1fr 15px; gap: 5px; align-items: start;
    width: 100%; padding: 8px 5px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.lesson-link:hover { background: rgba(82,47,36,.06); }
.lesson-link.active { background: rgba(82,47,36,.1); color: var(--wine); }
.lesson-link > span:first-child { color: var(--soft); font-family: Georgia, serif; font-size: 9px; }
.lesson-link b { font-size: 11px; font-weight: 650; line-height: 1.45; }
.lesson-link i { width: 12px; height: 12px; margin-top: 2px; border: 1px solid #aa9c83; border-radius: 50%; }
.lesson-link.completed i { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px #efe5d2; }
.sidebar-source-note { margin-top: 28px; color: #877e70; font-size: 9px; line-height: 1.7; }
.english-main { min-width: 0; }
.training-toolbar {
    position: sticky; top: 76px; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 20px;
    min-height: 61px; padding: 9px clamp(20px, 5vw, 75px); border-bottom: 1px solid rgba(82,47,36,.14); background: rgba(244,238,223,.94); backdrop-filter: blur(10px);
}
.mode-tabs { display: flex; gap: 4px; }
.mode-tabs button { padding: 9px 13px; border: 0; background: transparent; color: var(--soft); cursor: pointer; font-size: 11px; font-weight: 750; }
.mode-tabs button.active { background: var(--wine); color: white; }
.mode-tabs span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 4px; border-radius: 50%; background: var(--orange); color: white; font-size: 8px; }
.voice-controls { display: flex; align-items: center; gap: 14px; color: var(--soft); font-size: 9px; }
.voice-controls label { display: flex; align-items: center; gap: 6px; }
.voice-controls input { width: 80px; accent-color: var(--wine); }
.voice-controls button { padding: 6px 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 9px; }
.mode-view { max-width: 940px; margin: 0 auto; padding: 57px clamp(20px, 6vw, 80px) 90px; }
.lesson-hero { margin-bottom: 46px; padding-bottom: 31px; border-bottom: 1px solid var(--line); }
.lesson-meta { display: flex; align-items: center; gap: 10px; color: var(--soft); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.lesson-meta span:first-child { padding: 5px 8px; background: var(--track-color); color: white; }
.lesson-hero h1 { margin: 17px 0 14px; font-family: var(--serif); font-size: clamp(36px, 5vw, 59px); font-weight: 500; line-height: 1.1; }
.lesson-summary { color: var(--soft); font-family: var(--serif); font-size: 17px; line-height: 1.8; }
.lesson-objectives { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 25px; margin: 23px 0 0; padding: 18px 22px; border-left: 4px solid var(--track-color); background: var(--paper-up); }
.lesson-objectives b { grid-column: 1 / -1; color: var(--wine); font-size: 10px; }
.lesson-objectives span { color: var(--soft); font-size: 11px; }
.lesson-objectives span::before { margin-right: 6px; color: var(--orange); content: "✓"; }
.lesson-body > h2 { margin: 53px 0 17px; font-family: var(--serif); font-size: 29px; font-weight: 600; }
.lesson-body > p, .lesson-body li { color: #4f4c43; font-size: 15px; line-height: 2; }
.lesson-body ol, .lesson-body ul { padding-left: 23px; }
.sentence-example { position: relative; margin: 22px 0; padding: 24px 130px 22px 25px; border: 1px solid var(--line); background: var(--paper-up); }
.english-line { margin: 0 0 7px; color: var(--wine-dark); font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.55; }
.zh-line { margin: 0 0 10px; color: var(--ink); font-family: var(--serif); font-size: 15px; }
.sentence-example > span { display: block; color: var(--soft); font-size: 11px; line-height: 1.6; }
.speak-button { position: absolute; right: 18px; top: 20px; padding: 7px 9px; border: 1px solid var(--orange-soft); background: #fff4e9; color: var(--wine); cursor: pointer; font-size: 9px; font-weight: 800; }
.english-note, .english-practice { margin: 27px 0; padding: 23px 26px; }
.english-note { border-left: 5px solid var(--blue); background: #e8f0ee; }
.english-note b { color: var(--blue); font-family: var(--serif); font-size: 17px; }
.english-note p { margin: 8px 0 0; color: #4d625f; font-size: 12px; line-height: 1.8; }
.english-practice { border: 1px solid #cfaa83; background: #fff3e2; }
.english-practice > span { color: var(--orange); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.english-practice h3 { margin: 8px 0; font-family: var(--serif); font-size: 22px; }
.english-practice p { margin: 0; color: var(--soft); font-size: 12px; line-height: 1.8; }
.english-table { margin: 24px 0; overflow-x: auto; border: 1px solid var(--line); }
.english-table table { width: 100%; border-collapse: collapse; background: var(--paper-up); font-size: 12px; }
.english-table th, .english-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; line-height: 1.65; }
.english-table th { background: #e7dcc8; color: var(--wine); font-size: 10px; }
.lesson-sources { margin-top: 53px; padding: 23px; background: var(--wine-dark); color: white; }
.lesson-sources h2 { margin: 0 0 13px; font-family: var(--serif); font-size: 19px; }
.lesson-sources a { display: block; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.14); color: #e4d6cd; font-size: 11px; text-decoration: none; }
.lesson-notes { margin: 42px 0 20px; padding: 21px; border: 1px solid var(--line); background: rgba(255,255,255,.35); }
.lesson-notes > div { display: flex; justify-content: space-between; margin-bottom: 10px; }
.lesson-notes b { color: var(--wine); font-family: var(--serif); }
.lesson-notes span { color: var(--soft); font-size: 9px; }
.lesson-notes textarea { width: 100%; padding: 12px; resize: vertical; border: 1px dashed var(--line); background: rgba(255,255,255,.4); color: var(--ink); line-height: 1.7; }
.lesson-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; }
.lesson-controls button { min-height: 62px; padding: 9px 13px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.lesson-controls button:last-child { text-align: right; }
.lesson-controls small, .lesson-controls b { display: block; font-size: 9px; }
.lesson-controls b { margin-top: 4px; font-size: 11px; }
.lesson-controls .complete-lesson { padding: 0 20px; border-color: var(--wine); background: var(--wine); color: white; font-size: 11px; font-weight: 800; }
.lesson-controls .complete-lesson.completed { border-color: var(--green); background: var(--green); }
.training-intro { margin-bottom: 40px; }
.eyebrow { margin: 0 0 14px; color: var(--orange); font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.training-intro h1 { margin: 0; font-family: var(--serif); font-size: clamp(41px, 6vw, 67px); font-weight: 500; line-height: 1.08; }
.training-intro > p:last-child { max-width: 650px; color: var(--soft); line-height: 1.8; }
.word-dashboard { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; margin-bottom: 22px; }
.word-dashboard > div, .word-dashboard label { min-height: 77px; padding: 14px 17px; border: 1px solid var(--line); background: rgba(255,255,255,.36); }
.word-dashboard span, .word-dashboard label { color: var(--soft); font-size: 9px; }
.word-dashboard strong { display: block; margin-top: 5px; color: var(--wine); font-family: Georgia, serif; font-size: 24px; }
.word-dashboard select { display: block; width: 100%; margin-top: 9px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.flashcard { min-height: 330px; padding: 46px; border: 1px solid #c9ae91; background: var(--paper-up); box-shadow: 13px 13px 0 #e5d3ba; outline: 0; }
.card-front > span { color: var(--orange); font-size: 9px; font-weight: 850; }
.card-front h2 { margin: 28px 0 5px; font-family: Georgia, serif; font-size: clamp(47px, 7vw, 72px); font-weight: 500; }
.card-front p { margin: 0 0 25px; color: var(--soft); font-family: Georgia, serif; font-size: 18px; }
.card-front button, .card-back button { padding: 8px 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 10px; }
.card-front small { display: block; margin-top: 35px; color: #938879; }
.card-back { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.card-back h3 { margin: 0 0 10px; color: var(--wine); font-family: var(--serif); font-size: 28px; }
.card-back p { color: var(--ink); font-family: Georgia, serif; font-size: 17px; line-height: 1.7; }
.reveal-card { width: 100%; margin-top: 25px; padding: 14px; border: 0; background: var(--wine); color: white; cursor: pointer; font-weight: 800; }
.word-ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 13px; }
.word-ratings button { padding: 12px 7px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.word-ratings b, .word-ratings small { display: block; }
.word-ratings b { font-size: 11px; }
.word-ratings small { margin-top: 4px; color: var(--soft); font-size: 8px; }
.training-feedback { min-height: 24px; color: var(--green); font-size: 11px; }
.dictation-panel { padding: clamp(25px, 5vw, 50px); border: 1px solid var(--line); background: var(--paper-up); }
.dictation-head { display: flex; align-items: center; justify-content: space-between; color: var(--soft); font-size: 10px; }
.dictation-head select { margin-left: 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.listen-pulse { display: grid; place-items: center; width: 150px; height: 150px; margin: 38px auto; border: 1px solid #d7ad89; border-radius: 50%; background: #fff3e8; cursor: pointer; }
.listen-pulse i { display: grid; place-items: center; width: 47px; height: 47px; border-radius: 50%; background: var(--orange); color: white; font-style: normal; }
.listen-pulse span { color: var(--wine); font-size: 10px; }
.listen-pulse.playing { animation: pulse 1.2s ease infinite; }
.dictation-input { display: block; color: var(--soft); font-size: 10px; }
.dictation-input textarea { width: 100%; margin-top: 9px; padding: 14px; border: 1px solid var(--line); background: #faf5ea; color: var(--ink); font-family: Georgia, serif; font-size: 16px; line-height: 1.6; }
.dictation-actions { display: flex; gap: 8px; margin-top: 12px; }
.dictation-actions button { flex: 1; padding: 12px; border: 1px solid var(--wine); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.dictation-actions button:first-child { background: var(--wine); color: white; }
.dictation-result { margin-top: 18px; padding: 17px; background: #e9f0e9; font-size: 12px; line-height: 1.8; }
.dictation-result strong { display: block; color: var(--green); font-family: Georgia, serif; font-size: 17px; }
.dictation-result .miss { color: #b3402f; text-decoration: underline wavy; }
.error-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.error-legend b, .error-legend span { padding: 7px 9px; border: 1px solid var(--line); font-size: 9px; }
.error-legend b { border-color: var(--wine); background: var(--wine); color: white; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 14; background: rgba(26,24,20,.42); }
@keyframes pulse { 50% { box-shadow: 0 0 0 16px rgba(225,123,59,.1); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; } }
@media (max-width: 900px) {
    .english-global { grid-template-columns: 1fr auto; padding: 0 16px; }
    .english-global nav { display: none; }
    #mobileNavButton { display: block; }
    .english-shell { grid-template-columns: 1fr; }
    .english-sidebar { position: fixed; z-index: 16; left: 0; top: 0; width: min(86vw, 320px); height: 100vh; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 12px 0 35px rgba(0,0,0,.2); }
    .english-sidebar.open { transform: none; }
    .sidebar-close { display: block; position: absolute; right: 13px; top: 8px; border: 0; background: transparent; font-size: 24px; }
    .training-toolbar { top: 76px; }
}
@media (max-width: 620px) {
    .english-brand small { display: none; }
    .training-toolbar { align-items: stretch; flex-direction: column; padding: 8px 10px; }
    .mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
    .mode-tabs button { padding: 8px 5px; }
    .voice-controls { justify-content: end; }
    .mode-view { padding: 38px 15px 70px; }
    .lesson-objectives { grid-template-columns: 1fr; }
    .sentence-example { padding: 22px 18px 65px; }
    .speak-button { top: auto; right: 17px; bottom: 16px; }
    .lesson-controls { grid-template-columns: 1fr 1fr; }
    .lesson-controls .complete-lesson { grid-column: 1 / -1; grid-row: 1; }
    .word-dashboard { grid-template-columns: 1fr 1fr; }
    .word-dashboard label { grid-column: 1 / -1; }
    .flashcard { padding: 29px 23px; box-shadow: 7px 7px 0 #e5d3ba; }
    .word-ratings { grid-template-columns: 1fr 1fr; }
}
