:root {
  --bg: #ffffff;
  --ink: #101010;
  --lav: #e9e9f7;
  --lav-2: #f2f2fb;
  --purple: #332d5f;
  --purple-soft: #4a4385;
  --pink: #f6c7dd;
  --green: #d7ecb5;
  --green-2: #c9e7a2;
  --muted: #8a8a99;
  --border: #e4e4ec;
}

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

html, body { background: #f0f0f4; }

body {
  font-family: 'Manrope', 'Noto Sans SC', system-ui, sans-serif;
  color: var(--ink);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 18px 18px 96px;
}

.hanzi, .word-hanzi, .reveal-hanzi, .results-hanzi, .btn-jia, .muted-hanzi, .logo {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.logo { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; }
.logo span { font-weight: 800; font-family: 'Manrope', sans-serif; }
.btn-plus {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* Screens */
.screen { display: flex; flex-direction: column; }
.hidden { display: none !important; }

.hero { margin: 8px 0 26px; }
.hero h1 { font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -0.5px; }
.hero-hanzi { margin-top: 10px; font-size: 15px; color: var(--ink); }

.row-between { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; }
.row-between h2 { font-size: 17px; font-weight: 700; }
.muted-hanzi { color: var(--muted); font-size: 13px; }

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--lav-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform .06s ease, background .15s ease;
}
.card:active { transform: scale(0.985); }
.card:hover { background: var(--lav); }
.card .t { font-size: 19px; font-weight: 700; }
.card .s { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card .n { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; }
.card .n b { color: var(--ink); font-weight: 700; }

/* Level hero panel */
.panel.level-hero {
  background: var(--lav);
  border-radius: 14px;
  padding: 16px 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.level-title { font-size: 22px; font-weight: 800; }
.level-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.level-count { font-size: 12px; color: var(--muted); margin-top: 7px; }

.btn-dark {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-dark:active { transform: scale(0.97); }
.btn-light {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.crumbs { display: flex; gap: 14px; margin: 2px 0 14px; font-size: 14.5px; }
.crumbs a { color: var(--ink); text-decoration: none; cursor: pointer; }
.crumbs a.cur { text-decoration: underline; text-underline-offset: 4px; font-weight: 600; }
.crumbs a.dim { color: var(--ink); }

.progress-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink); margin: 0 0 8px; }
#streakText { color: var(--muted); }

/* Exercise */
.card-word {
  background: var(--lav);
  border-radius: 14px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 16px;
  margin-bottom: 20px;
}
.word-hanzi { font-size: 74px; line-height: 1; font-weight: 500; }
.word-ru { font-size: 32px; font-weight: 700; }
.word-meta { margin-top: 10px; font-size: 13px; color: var(--muted); font-family: 'Manrope', sans-serif; }

.section { margin-bottom: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.section-head > span:first-child { font-size: 16.5px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 16px;
  cursor: pointer;
  font-family: 'Noto Sans SC', 'Manrope', sans-serif;
  transition: background .12s ease;
}
.chip:hover { background: var(--lav-2); }
.chip.sel { background: var(--pink); border-color: var(--pink); }
.chip.ok { background: var(--green); border-color: var(--green-2); }
.chip.off { pointer-events: none; opacity: 0.95; }

/* mode 3 */
.input-row { display: flex; gap: 10px; }
.input-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 17px;
  font-family: inherit;
  outline: none;
}
.input-row input:focus { border-color: var(--purple-soft); }
.input-row input.err { border-color: #e084b4; background: #fdeef6; }
.input-row input.good { border-color: #9dc46f; background: #f2f9e4; }

.feedback { margin-top: 10px; font-size: 14px; }
.feedback.bad { color: #b2457c; }
.feedback.good { color: #4f7a1e; }

.reveal { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.reveal-hanzi { font-size: 56px; line-height: 1; }
.reveal-pinyin { font-size: 17px; color: var(--muted); }

/* results */
.results { display: flex; flex-direction: column; align-items: center; padding: 30px 10px; }
.results-head { font-size: 15px; color: var(--muted); }
.results-hanzi { font-size: 84px; margin: 16px 0 4px; }
.results-score { font-size: 26px; font-weight: 800; }
.results-note { margin-top: 8px; font-size: 13.5px; color: var(--muted); text-align: center; }
.results-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }

/* bottom bar */
.bottombar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.btn-jia {
  pointer-events: auto;
  width: calc(100% - 36px);
  max-width: 394px;
  height: 52px;
  border: none;
  border-radius: 12px;
  background: var(--purple);
  color: #eae8f2;
  font-size: 24px;
  cursor: pointer;
}
