/* Ni Hao World - brand identity from ni-hao-world.com (original site):
   teal/blue chrome + "ni-hao-world" lowercase wordmark + tagline.
   Purple kept ONLY for the target-word highlight (video continuity). */
:root {
  /* colors sampled from the official logo gradient (blue -> green) */
  --bg: #F6FBFE;
  --card: #E9F5FC;
  --border: #A8D6EE;
  --accent: #4A97D3;
  --accent2: #6FBE8F;
  --grad: linear-gradient(135deg, #4A97D3, #6FBE8F);
  --accent-dark: #2F7AB8;
  --text: #1D3E6E;
  --text2: #4A7FA8;
  --inactive: #DCEEF8;
  --white: #FFFFFF;
  --green: #52C08E;
  --amber: #F4A200;
  --red: #F0574A;
  --hl: #7F77DD;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(74, 151, 211, 0.15);
}

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

body {
  font-family: "Segoe UI", "Noto Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

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

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 247, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--inactive);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-globe { width: 44px; height: 44px; display: block; }
.brand-wordmark { height: 34px; display: block; }
@media (max-width: 560px) { .brand-wordmark { height: 27px; } .brand-globe { width: 36px; height: 36px; } }
.streak-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--card); border: 1.5px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 15px;
}
.streak-chip .flame { font-size: 18px; }
.streak-chip.zero { opacity: 0.55; }

/* ---------- hero: bold gradient band like the original ni-hao-world site ---------- */
.hero {
  text-align: center;
  background: linear-gradient(135deg, #3D8FD1 0%, #4AA5B8 55%, #5FB48A 100%);
  border-radius: 28px;
  color: #fff;
  padding: 56px 26px 44px;
  margin-top: 20px;
  box-shadow: 0 14px 40px rgba(61, 143, 209, 0.35);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "你 好";
  position: absolute; right: -20px; top: -30px;
  font-size: 190px; font-weight: 700; color: rgba(255, 255, 255, 0.07);
  line-height: 1; pointer-events: none;
}
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.2; color: #fff; position: relative; }
.hero h1 .accent { color: #FFE49A; }
.hero .cn-sub { color: rgba(255, 255, 255, 0.92); font-size: clamp(16px, 3vw, 22px); margin-top: 8px; position: relative; }
.hero p.tag { margin-top: 14px; color: rgba(255, 255, 255, 0.85); font-size: 15px; position: relative; }

/* ---------- today card ---------- */
.today-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 16px 44px rgba(61, 143, 209, 0.18);
  padding: 30px 26px;
  margin: -34px auto 10px; /* overlaps the hero band like a floating card */
  max-width: 560px;
  text-align: center;
  position: relative;
}
.today-label {
  display: inline-block; background: var(--card); color: var(--text2);
  border-radius: 999px; padding: 5px 16px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.5px;
}
.today-char { font-size: 84px; line-height: 1.15; color: var(--accent); font-weight: 700; }
.today-word { font-size: 26px; font-weight: 700; }
.today-pinyin { color: var(--text2); font-size: 18px; margin-top: 2px; }
.today-type { color: var(--text2); font-size: 14px; margin-top: 6px; }
.btn {
  display: inline-block; border: none; cursor: pointer; text-decoration: none;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 16px;
  padding: 13px 30px; border-radius: 999px; margin-top: 18px;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 14px rgba(127, 119, 221, 0.45);
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(127, 119, 221, 0.5); }
.btn.secondary { background: var(--card); color: var(--text2); box-shadow: none; border: 1.5px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- section titles ---------- */
.section-title { font-size: 22px; font-weight: 800; margin: 44px 0 6px; }
.section-title .cn { color: var(--text2); font-weight: 600; font-size: 17px; margin-inline-start: 8px; }
.section-sub { color: var(--text2); font-size: 14px; margin-bottom: 18px; }

/* ---------- lessons grid ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.day-card {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px 14px; text-align: center; text-decoration: none; color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s; position: relative;
}
.day-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.day-card .day-num { font-size: 12px; font-weight: 700; color: var(--text2); letter-spacing: 0.5px; }
.day-card .char { font-size: 40px; color: var(--accent); font-weight: 700; line-height: 1.3; }
.day-card .word { font-weight: 700; font-size: 15px; }
.day-card.locked { background: var(--bg); border-color: var(--inactive); color: var(--text2); pointer-events: none; }
.day-card.locked .char { color: var(--inactive); }
.day-card.locked::after { content: "🔒"; position: absolute; top: 10px; right: 12px; font-size: 13px; }
.day-card.done::after { content: "✓"; position: absolute; top: 8px; right: 12px; font-weight: 900; color: var(--green); font-size: 16px; }

/* ---------- email ---------- */
.email-box {
  background: linear-gradient(135deg, var(--card), #E4E1FD);
  border: 1.5px solid var(--border); border-radius: 24px;
  padding: 30px 24px; text-align: center; margin: 40px 0;
}
.email-box h3 { font-size: 20px; }
.email-box p { color: var(--text2); font-size: 14px; margin: 6px 0 16px; }
.email-form { display: flex; gap: 10px; max-width: 430px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.email-form input {
  flex: 1; min-width: 220px; padding: 12px 18px; border-radius: 999px;
  border: 1.5px solid var(--border); font-size: 15px; outline: none; color: var(--text);
  font-family: inherit;
}
.email-form input:focus { border-color: var(--accent); }
.email-ok { color: var(--green); font-weight: 700; margin-top: 10px; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--inactive); padding: 26px 0 40px; text-align: center; color: var(--text2); font-size: 14px; margin-top: 30px; }
footer a { color: var(--accent); font-weight: 700; text-decoration: none; }
.socials { display: flex; gap: 14px; justify-content: center; margin-bottom: 10px; }

/* ============ LESSON PAGE ============ */
.lesson-head { text-align: center; padding: 30px 0 6px; }
.lesson-head .day-label {
  display: inline-block; background: var(--card); color: var(--text2); border-radius: 999px;
  padding: 5px 16px; font-size: 13px; font-weight: 700;
}
.lesson-head .char { font-size: 72px; color: var(--accent); font-weight: 700; line-height: 1.2; }
.lesson-head h1 { font-size: 30px; }
.lesson-head .pinyin { color: var(--text2); font-size: 19px; }
.lesson-head .type { color: var(--text2); font-size: 14px; margin-top: 4px; }
.word-audio-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

.progress-dots { display: flex; gap: 7px; justify-content: center; margin: 22px 0 8px; flex-wrap: wrap; }
.progress-dots .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--inactive); transition: background 0.2s; }
.progress-dots .dot.active { background: var(--accent); }

/* sentence cards */
.sentence-card {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin: 14px 0; box-shadow: 0 2px 10px rgba(83, 74, 183, 0.06);
}
.sentence-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.level-badge {
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  background: var(--card); color: var(--text2); border-radius: 999px; padding: 4px 12px;
}
.sentence-num { color: var(--text2); font-size: 12.5px; font-weight: 700; }
.sentence-img {
  width: 100%; max-height: 300px; object-fit: cover; object-position: center;
  border-radius: 14px; border: 1px solid var(--inactive); margin-bottom: 12px; display: block;
}
.sentence-en { font-size: 20px; font-weight: 700; }
.sentence-cn { font-size: 24px; margin-top: 6px; font-weight: 600; }
.hl { color: var(--hl); }
.sentence-py { color: var(--text2); font-size: 15px; margin-top: 4px; display: none; }
.sentence-card.show-py .sentence-py { display: block; }
.sentence-tags { color: var(--text2); font-size: 12.5px; margin-top: 8px; }
.sentence-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip-btn {
  border: 1.5px solid var(--border); background: var(--card); color: var(--text2);
  font-weight: 700; font-size: 13.5px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: background 0.12s; font-family: inherit;
}
.chip-btn:hover { background: var(--inactive); }
.chip-btn.mic { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-btn.mic.listening { background: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.65; } }

.pron-result { margin-top: 12px; border-radius: 16px; padding: 16px 18px; font-size: 14.5px; display: none; }
.pron-result.show { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.pron-result.great { background: #E7F6EC; color: #1E7B3C; }
.pron-result.ok { background: #FFF6E0; color: #8A6400; }
.pron-result.retry { background: #FDECEC; color: #A33; }
.pron-result .heard { opacity: 0.85; font-size: 13px; margin-top: 5px; }
.score-detail { font-size: 13.5px; font-weight: 700; margin-top: 6px; }
.pron-body { flex: 1; min-width: 200px; }
.pron-msg { font-size: 16px; font-weight: 800; }
.score-ring {
  width: 74px; height: 74px; border-radius: 50%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 21px; line-height: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.score-ring small { font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; margin-top: 3px; opacity: 0.9; }
.score-ring.great { background: linear-gradient(135deg, #35A45C, #6FBE8F); }
.score-ring.ok { background: linear-gradient(135deg, #F4A200, #F7C64B); }
.score-ring.retry { background: linear-gradient(135deg, #E2574B, #F08A7F); }

/* quiz */
.quiz-box { background: var(--white); border: 2px solid var(--border); border-radius: 24px; padding: 28px 24px; margin: 34px 0; box-shadow: var(--shadow); }
.quiz-q { font-size: 19px; font-weight: 700; margin-bottom: 16px; }
.quiz-q .cn-big { font-size: 26px; color: var(--accent); }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  text-align: start; border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 14px; padding: 13px 18px; font-size: 16.5px; cursor: pointer; font-weight: 600;
  transition: border 0.1s, background 0.1s; font-family: inherit;
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.correct { background: #E7F6EC; border-color: var(--green); }
.quiz-opt.wrong { background: #FDECEC; border-color: var(--red); }
.quiz-meta { color: var(--text2); font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }

/* completion */
.complete-box { text-align: center; background: linear-gradient(135deg, var(--card), #E4E1FD); border: 2px solid var(--border); border-radius: 24px; padding: 40px 24px; margin: 34px 0; }
.complete-box .big { font-size: 46px; }
.complete-box h2 { font-size: 28px; margin-top: 8px; }
.complete-box .cn { color: var(--text2); font-size: 20px; margin-top: 4px; }
.stats-row { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.stat-box { background: var(--white); border: 1.5px solid var(--border); border-radius: 16px; padding: 14px 22px; min-width: 120px; }
.stat-box .val { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat-box .lbl { font-size: 12.5px; color: var(--text2); font-weight: 700; }

.video-links { margin-top: 16px; font-size: 14px; color: var(--text2); }
.video-links a { color: var(--accent); font-weight: 700; text-decoration: none; margin: 0 6px; }

.back-link { display: inline-block; margin: 18px 0 0; color: var(--text2); text-decoration: none; font-weight: 700; font-size: 14px; }
.back-link:hover { color: var(--accent); }

.hint-bar { background: var(--card); border: 1px dashed var(--border); color: var(--text2); border-radius: 12px; padding: 10px 16px; font-size: 13.5px; margin: 18px 0; }

/* playing state for audio buttons */
.chip-btn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }

/* pronunciation correction: per-character feedback */
.char-check { font-size: 22px; margin-top: 6px; letter-spacing: 2px; }
.char-check .ok { color: #1E7B3C; }
.char-check .miss { color: var(--red); text-decoration: underline wavy; }

/* modal (mic intro + signup) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(29, 62, 110, 0.55); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white); border-radius: 24px; max-width: 470px; width: 100%;
  padding: 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); text-align: center;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 22px; margin-bottom: 4px; }
.modal .cn-sub { color: var(--text2); font-size: 15px; margin-bottom: 16px; }
.modal-steps { text-align: start; margin: 14px 0; }
.modal-steps .step { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.modal-steps .step-icon {
  width: 38px; height: 38px; border-radius: 12px; background: var(--card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.modal-steps .step b { display: block; font-size: 15px; }
.modal-steps .step span { font-size: 13px; color: var(--text2); }
.score-bands { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.score-band { border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 700; }
.score-band.g { background: #E7F6EC; color: #1E7B3C; }
.score-band.y { background: #FFF6E0; color: #8A6400; }
.score-band.r { background: #FDECEC; color: #A33; }
.modal input, .modal select {
  width: 100%; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--border);
  font-size: 15px; margin: 6px 0; outline: none; color: var(--text); font-family: inherit; background: var(--bg);
}
.modal input:focus, .modal select:focus { border-color: var(--accent); }
.modal .close-x {
  position: relative; float: inline-end; border: none; background: none; font-size: 20px;
  color: var(--text2); cursor: pointer; margin: -10px -8px 0 0;
}

@media (max-width: 560px) {
  .today-char { font-size: 64px; }
  .sentence-en { font-size: 18px; }
  .sentence-cn { font-size: 21px; }
}
