@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== VARIABLES ===== */
:root {
  --red:       #C0392B;
  --red-light: #E74C3C;
  --red-bg:    #FDF2F2;
  --gold:      #F39C12;
  --gold-light:#F8C471;
  --gold-bg:   #FEFBF0;
  --green:     #27AE60;
  --green-bg:  #F0FBF4;
  --blue:      #2980B9;
  --blue-bg:   #EBF5FB;
  --dark:      #1A1A2E;
  --gray:      #6C757D;
  --gray-light:#E9ECEF;
  --white:     #FFFFFF;
  --bg:        #F8F9FA;
  --shadow:    0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius:    14px;
  --radius-sm: 8px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== CHINESE FONT ===== */
.zh, [lang="zh"] {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--red);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo .zh-logo {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.5rem;
  opacity: 0.9;
}
.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.2s;
}
.header-nav a:hover { background: rgba(255,255,255,0.15); color: var(--white); }
.header-nav a.active { background: rgba(255,255,255,0.2); color: var(--white); font-weight: 600; }

/* ===== PROGRESS BAR (global) ===== */
.global-progress {
  background: rgba(255,255,255,0.25);
  height: 4px;
  width: 100%;
}
.global-progress-fill {
  height: 4px;
  background: var(--gold);
  transition: width 0.5s ease;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--red) 0%, #8B0000 100%);
  color: var(--white);
  padding: 60px 24px 48px;
  text-align: center;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}
.hero .zh-big {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  opacity: 0.25;
  display: block;
  margin-bottom: 16px;
  letter-spacing: 8px;
}
.hero p { font-size: 1.1rem; opacity: 0.85; max-width: 560px; margin: 0 auto 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.btn:active { transform: translateY(0); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-white { background: var(--white); color: var(--red); }
.btn-red { background: var(--red); color: var(--white); }
.btn-outline { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,0.6); }
.btn-sm { padding: 8px 18px; font-size: 0.88rem; }
.btn-lg { padding: 16px 36px; font-size: 1.1rem; }

/* ===== MODULES GRID ===== */
.modules-section { padding: 48px 0; }
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dark);
}
.section-sub { color: var(--gray); margin-bottom: 32px; font-size: 0.95rem; }

.module-group { margin-bottom: 40px; }
.module-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 14px;
  padding-left: 4px;
}

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

.lesson-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--dark);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lesson-card.completed { border-color: var(--green); }
.lesson-card.active { border-color: var(--gold); }
.lesson-card.locked { opacity: 0.55; pointer-events: none; filter: grayscale(0.5); }

.lesson-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray);
}
.lesson-icon { font-size: 2rem; }
.lesson-title { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.lesson-sub { font-size: 0.8rem; color: var(--gray); }
.lesson-status {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 1rem;
}
.stars { color: var(--gold); font-size: 0.8rem; letter-spacing: 1px; }

/* ===== LESSON PAGE ===== */
.lesson-header {
  background: linear-gradient(135deg, var(--red) 0%, #8B0000 100%);
  color: var(--white);
  padding: 40px 24px 32px;
}
.lesson-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.lesson-header .back-link:hover { color: var(--white); }
.lesson-header h1 { font-size: 1.9rem; font-weight: 700; margin-bottom: 8px; }
.lesson-header p { opacity: 0.8; font-size: 1rem; }
.lesson-meta {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.lesson-meta span {
  font-size: 0.82rem;
  background: rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 20px;
}

.lesson-body { padding: 40px 24px; max-width: 760px; margin: 0 auto; }

/* ===== SECTIONS in lesson ===== */
.section { margin-bottom: 40px; }
.section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section h3 { font-size: 1.05rem; font-weight: 600; margin: 20px 0 10px; color: var(--dark); }
.section p { margin-bottom: 12px; color: #333; line-height: 1.7; }
.section ul, .section ol { padding-left: 22px; margin-bottom: 12px; }
.section li { margin-bottom: 6px; line-height: 1.6; }

/* ===== TONE CARDS ===== */
.tone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.tone-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid transparent;
  transition: transform 0.15s;
}
.tone-card:hover { transform: translateY(-3px); }
.tone-card.t1 { border-color: #E74C3C; }
.tone-card.t2 { border-color: #F39C12; }
.tone-card.t3 { border-color: #27AE60; }
.tone-card.t4 { border-color: #2980B9; }
.tone-card.t0 { border-color: #9B59B6; }
.tone-char {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}
.tone-pinyin { font-size: 1.2rem; color: var(--gray); margin-bottom: 4px; }
.tone-meaning { font-size: 0.82rem; color: var(--gray); }
.tone-num {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 28px;
  margin-bottom: 12px;
  color: var(--white);
}
.t1 .tone-num { background: #E74C3C; }
.t2 .tone-num { background: #F39C12; }
.t3 .tone-num { background: #27AE60; }
.t4 .tone-num { background: #2980B9; }
.t0 .tone-num { background: #9B59B6; }

/* ===== SVG TONE DIAGRAM ===== */
.tone-diagram {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin: 20px 0;
}
.tone-diagram h3 { margin-bottom: 16px; }
.tones-svg-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  text-align: center;
}
.tone-svg-item svg { width: 100%; max-width: 90px; height: 80px; }
.tone-svg-item .label { font-size: 0.78rem; color: var(--gray); margin-top: 6px; }

/* ===== WORD CARDS ===== */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.word-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}
.word-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.word-card .wc-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.word-card .wc-py { font-size: 0.85rem; color: var(--red); margin-bottom: 4px; }
.word-card .wc-ru { font-size: 0.82rem; color: var(--gray); }

/* flip card */
.flip-card { perspective: 800px; }
.flip-inner {
  position: relative;
  width: 100%;
  height: 110px;
  transform-style: preserve-3d;
  transition: transform 0.5s;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.flip-front { background: var(--white); }
.flip-back { background: var(--red-bg); transform: rotateY(180deg); }
.flip-back .wc-ru { font-size: 1rem; color: var(--dark); font-weight: 600; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius-sm); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th {
  background: var(--red);
  color: var(--white);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-light);
  font-size: 0.92rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.td-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.td-py { color: var(--red); font-weight: 500; }

/* ===== INFO BOXES ===== */
.info-box {
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  border-left: 4px solid;
  font-size: 0.93rem;
}
.info-box.tip { background: var(--gold-bg); border-color: var(--gold); }
.info-box.note { background: var(--blue-bg); border-color: var(--blue); }
.info-box.warning { background: var(--red-bg); border-color: var(--red); }
.info-box.success { background: var(--green-bg); border-color: var(--green); }
.info-box .box-title { font-weight: 700; margin-bottom: 6px; }

/* ===== QUIZ SECTION ===== */
.quiz-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin: 40px 0;
}
.quiz-section h2 { border-bottom: 2px solid var(--gray-light); margin-bottom: 24px; }
.quiz-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-light);
  border-radius: 4px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.4s ease;
  border-radius: 4px;
}
.quiz-progress-text { font-size: 0.82rem; color: var(--gray); white-space: nowrap; }

.question-block { display: none; }
.question-block.active { display: block; }
.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.4;
}
.question-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  display: block;
  margin: 16px 0;
  color: var(--dark);
}
.question-py {
  text-align: center;
  color: var(--gray);
  font-size: 1rem;
  margin-bottom: 20px;
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-btn {
  background: var(--bg);
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.4;
}
.option-btn:hover:not(:disabled) { border-color: var(--red); background: var(--red-bg); }
.option-btn.correct { border-color: var(--green); background: var(--green-bg); color: var(--green); font-weight: 600; }
.option-btn.wrong { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.option-btn:disabled { cursor: default; }
.option-btn .opt-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.5rem;
  display: block;
  margin-bottom: 2px;
}

.quiz-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  display: none;
  font-size: 0.93rem;
  line-height: 1.5;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: var(--green-bg); color: #1a6b3c; border-left: 4px solid var(--green); }
.quiz-feedback.wrong-fb { background: var(--red-bg); color: #8B0000; border-left: 4px solid var(--red); }

.quiz-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ===== SCORE PANEL ===== */
.score-panel {
  display: none;
  text-align: center;
  padding: 32px 16px;
}
.score-panel.show { display: block; }
.score-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 8px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  background: var(--gold-bg);
}
.score-stars { font-size: 2rem; margin-bottom: 12px; }
.score-msg { font-size: 1.1rem; color: var(--gray); margin-bottom: 24px; }
.score-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== DIALOG BOX ===== */
.dialog-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 20px 0;
}
.dialog-line {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.dialog-line.right { flex-direction: row-reverse; }
.dialog-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  background: var(--gray-light);
}
.dialog-bubble {
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 16px;
  max-width: 80%;
  font-size: 0.95rem;
}
.dialog-line.right .dialog-bubble { background: var(--red-bg); }
.dialog-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.dialog-py { font-size: 0.8rem; color: var(--red); margin-bottom: 2px; }
.dialog-ru { font-size: 0.8rem; color: var(--gray); }

/* ===== STROKE ORDER ===== */
.stroke-demo {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.stroke-char {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stroke-char .sc-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}
.stroke-char .sc-info { font-size: 0.78rem; color: var(--gray); }

/* ===== RADICAL CARDS ===== */
.radical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.radical-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.radical-card:hover { transform: translateY(-2px); }
.radical-card .rc-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  color: var(--red);
}
.radical-card .rc-name { font-size: 0.72rem; color: var(--gray); }
.radical-card .rc-meaning { font-size: 0.78rem; font-weight: 600; }

/* ===== PINYIN TABLE ===== */
.pinyin-table td { font-size: 0.82rem; padding: 7px 9px; text-align: center; }
.pinyin-table th { text-align: center; font-size: 0.78rem; padding: 7px; }
.pinyin-table td:first-child { font-weight: 700; background: var(--bg); color: var(--dark); }
.pinyin-table td:not(:first-child) { color: var(--red); }
.pinyin-table td:not(:first-child):hover { background: var(--red-bg); cursor: pointer; }

/* ===== PROGRESS STATS ===== */
.stats-bar {
  display: flex;
  gap: 20px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 80px;
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--red); }
.stat-label { font-size: 0.78rem; color: var(--gray); text-align: center; }

/* ===== CERTIFICATE ===== */
.certificate {
  background: linear-gradient(135deg, #FFF9E6 0%, #FFF 100%);
  border: 3px solid var(--gold);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.certificate::before {
  content: '中';
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 20rem;
  position: absolute;
  top: -40px; right: -20px;
  opacity: 0.04;
  color: var(--red);
  font-weight: 700;
  pointer-events: none;
}
.cert-title { font-size: 0.85rem; letter-spacing: 3px; text-transform: uppercase; color: var(--gray); margin-bottom: 16px; }
.cert-name { font-size: 2rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.cert-desc { color: var(--gray); margin-bottom: 20px; }
.cert-seal {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 2.5rem;
  color: var(--red);
  margin-bottom: 8px;
}

/* ===== LESSON NAVIGATION ===== */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 40px;
  gap: 12px;
  flex-wrap: wrap;
}
.lesson-nav .btn { min-width: 160px; justify-content: center; }

/* ===== MATCHING GAME ===== */
.matching-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  background: var(--bg);
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.95rem;
  text-align: center;
}
.match-item.selected { border-color: var(--gold); background: var(--gold-bg); }
.match-item.matched { border-color: var(--green); background: var(--green-bg); color: var(--green); font-weight: 600; pointer-events: none; }
.match-item.wrong { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.match-item .zh { font-family: 'Noto Sans SC', sans-serif; font-size: 1.5rem; }

/* ===== FILL IN ===== */
.fill-input {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  width: 100%;
  max-width: 300px;
  outline: none;
  transition: border-color 0.15s;
}
.fill-input:focus { border-color: var(--red); }
.fill-input.correct-input { border-color: var(--green); background: var(--green-bg); }
.fill-input.wrong-input { border-color: var(--red); background: var(--red-bg); }

/* ===== TONE PICKER ===== */
.tone-picker { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.tone-btn {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
  color: var(--white);
}
.tone-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.tone-btn.t1 { background: #E74C3C; }
.tone-btn.t2 { background: #F39C12; }
.tone-btn.t3 { background: #27AE60; }
.tone-btn.t4 { background: #2980B9; }
.tone-btn.t0 { background: #9B59B6; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .hero .zh-big { font-size: 2.5rem; }
  .options { grid-template-columns: 1fr; }
  .tones-svg-grid { grid-template-columns: repeat(3, 1fr); }
  .lesson-body { padding: 24px 16px; }
  .quiz-section { padding: 20px 16px; }
  .stats-bar { gap: 12px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes pop { 0% { transform:scale(1); } 50% { transform:scale(1.2); } 100% { transform:scale(1); } }
@keyframes shake { 0%,100% { transform:translateX(0); } 20%,60% { transform:translateX(-6px); } 40%,80% { transform:translateX(6px); } }

.fade-in { animation: fadeIn 0.35s ease forwards; }
.pop { animation: pop 0.3s ease; }
.shake { animation: shake 0.4s ease; }

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-gray { color: var(--gray); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display:flex; align-items:center; justify-content:center; }
.flex-wrap { flex-wrap: wrap; }
.bold { font-weight: 700; }
.hidden { display: none !important; }

/* ===== AUDIO / TTS ===== */
.tts-ready .td-zh, .tts-ready .wc-zh, .tts-ready .question-zh,
.tts-ready .dialog-zh, .tts-ready .tc-zh, .tts-ready .rc-zh,
.tts-ready .sc-zh, .tts-ready .zh-say, .tts-ready .compare-example,
.tts-ready .zh-big { cursor: pointer; }
.tts-ready .td-zh:hover, .tts-ready .wc-zh:hover, .tts-ready .dialog-zh:hover,
.tts-ready .tc-zh:hover, .tts-ready .rc-zh:hover, .tts-ready .sc-zh:hover,
.tts-ready .zh-say:hover { color: var(--red-light); }
.tts-ready .question-zh:hover { color: var(--red); }

.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-bg);
  color: var(--red);
  border: 1.5px solid var(--red-light);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.speak-btn:hover { background: var(--red); color: var(--white); }
.speak-btn:active { transform: scale(0.96); }
.speak-btn.gold { background: var(--gold-bg); color: #B9770E; border-color: var(--gold); }
.speak-btn.gold:hover { background: var(--gold); color: var(--white); }

.audio-hint {
  background: var(--blue-bg);
  border: 1px dashed var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #1a5276;
  margin: 12px 0;
}

/* ===== MISTAKES REVIEW ===== */
.mistakes-review {
  text-align: left;
  margin-top: 24px;
  border-top: 2px solid var(--gray-light);
  padding-top: 20px;
}
.mistakes-review h3 { font-size: 1rem; margin-bottom: 14px; }
.mistake-item {
  background: var(--bg);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.mistake-q { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.mistake-a { color: var(--green); font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.mistake-ex { font-size: 0.83rem; color: var(--gray); line-height: 1.5; }

/* ===== LESSON STEPS (пошаговая подача) ===== */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sound-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  margin: 8px 0;
  flex-wrap: wrap;
}
.sound-py {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--red);
  min-width: 46px;
}
.sound-desc { flex: 1; font-size: 0.9rem; min-width: 200px; }
.sound-desc small { color: var(--gray); }

/* ===== FLASHCARD TRAINER ===== */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.deck-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}
.deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.deck-card .deck-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.deck-card .deck-name { font-weight: 700; margin-bottom: 4px; }
.deck-card .deck-count { font-size: 0.8rem; color: var(--gray); }
.deck-card .deck-learned { font-size: 0.78rem; color: var(--green); font-weight: 600; margin-top: 6px; }

.tcard-stage { max-width: 480px; margin: 0 auto; }
.tcard {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 48px 24px 36px;
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.tcard .tcard-zh {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
}
.tcard .tcard-zh:hover { color: var(--red); }
.tcard .tcard-py { font-size: 1.4rem; color: var(--red); font-weight: 600; }
.tcard .tcard-ru { font-size: 1.1rem; color: var(--dark); }
.tcard .tcard-hint { font-size: 0.8rem; color: var(--gray); }
.tcard-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.tcard-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px auto;
  max-width: 480px;
}
.tcard-progress .bar { flex: 1; height: 8px; background: var(--gray-light); border-radius: 4px; overflow: hidden; }
.tcard-progress .bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); border-radius: 4px; transition: width 0.3s; }
.tcard-progress .label { font-size: 0.82rem; color: var(--gray); white-space: nowrap; }

.btn-green { background: var(--green); color: var(--white); }
.btn-gray { background: var(--gray-light); color: var(--dark); }
