/* Білім үйі — спокойная тёплая палитра. Никакого чистого белого и чистого чёрного:
   тёплый фон и тёмно-серый текст меньше утомляют глаза на долгих занятиях. */
:root {
  --bg: #F6F4EE;
  --surface: #FFFDF8;
  --surface-2: #EFEBE1;
  --line: #E2DCCD;
  --text: #34322D;
  --muted: #7A756A;
  --accent: #5B7C99;
  --ok: #4E8B63;
  --ok-bg: #E4F0E6;
  --bad: #B8584A;
  --bad-bg: #F6E3DE;
  --warn-bg: #F7EDD2;
  --rus: #5B7C99;   --rus-bg: #E3EBF2;
  --kaz: #3F8A87;   --kaz-bg: #DDEEEC;
  --eng: #B98A3E;   --eng-bg: #F4EAD6;
  --math: #6E8B5C;  --math-bg: #E5EDDF;
  --log: #8A6FA8;   --log-bg: #ECE5F2;
  --zhanel: #8A6FA8; --zhanel-bg: #ECE5F2;
  --adina: #C77A6B;  --adina-bg: #F5E4DF;
  --shadow: 0 1px 2px rgba(60, 50, 30, .06), 0 4px 16px rgba(60, 50, 30, .06);
  --radius: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #22221F;
  --surface: #2C2B27;
  --surface-2: #35342F;
  --line: #44423B;
  --text: #E8E4DA;
  --muted: #A9A396;
  --accent: #8FB0CC;
  --ok: #86BD95;  --ok-bg: #2F3F33;
  --bad: #E0907F; --bad-bg: #4A322C;
  --warn-bg: #4A4230;
  --rus: #8FB0CC;  --rus-bg: #2F3A44;
  --kaz: #7BC0BC;  --kaz-bg: #2A3F3D;
  --eng: #D9B06C;  --eng-bg: #463B28;
  --math: #A2BF8E; --math-bg: #34402D;
  --log: #B9A0D4;  --log-bg: #3D3447;
  --zhanel: #B9A0D4; --zhanel-bg: #3D3447;
  --adina: #E4A497;  --adina-bg: #4A3531;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 64px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.btn {
  border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 700;
  background: var(--surface-2); color: var(--text); min-height: 48px;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.big { font-size: 20px; padding: 16px 28px; min-height: 60px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  width: 44px; height: 44px; display: inline-grid; place-items: center; font-size: 20px;
}

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 640px; text-align: center; }
.logo { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.logo span { color: var(--kaz); }
.avatars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 28px 0 16px; }
.avatar {
  border: 2px solid transparent; border-radius: 24px; padding: 22px 12px; background: var(--surface);
  box-shadow: var(--shadow); display: grid; gap: 8px; justify-items: center;
}
.avatar .face { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; font-size: 60px; }
.avatar.zhanel .face { background: var(--zhanel-bg); }
.avatar.adina .face { background: var(--adina-bg); }
.avatar .nm { font-size: 24px; font-weight: 800; }
.avatar.sel.zhanel { border-color: var(--zhanel); }
.avatar.sel.adina { border-color: var(--adina); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.keypad button {
  height: 64px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  font-size: 26px; font-weight: 700; box-shadow: var(--shadow);
}
.err { color: var(--bad); font-weight: 700; min-height: 26px; margin-top: 10px; }
.field { display: grid; gap: 6px; text-align: left; margin-bottom: 12px; }
.field input {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  min-height: 48px;
}

/* ---------- шапка ---------- */
.top { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; background: var(--surface-2); padding: 5px; border-radius: 16px; }
.tab { border: 0; background: transparent; padding: 10px 18px; border-radius: 12px; font-weight: 800; min-height: 44px; }
.tab.on.zhanel { background: var(--zhanel-bg); color: var(--zhanel); }
.tab.on.adina { background: var(--adina-bg); color: var(--adina); }
.tab.on.parent { background: var(--surface); }
.tab .lock { font-size: 13px; opacity: .6; }

.hello { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.hello .face { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; flex: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 26px; font-weight: 800; }
.stat span { font-size: 13px; color: var(--muted); }

/* ---------- неделя ---------- */
.weekbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.day {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px 4px;
  text-align: center; min-height: 72px;
}
.day .wd { font-size: 13px; color: var(--muted); font-weight: 700; }
.day .dn { font-size: 20px; font-weight: 800; }
.day .dots { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.day .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.day .dots i.done { background: var(--ok); }
.day.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.day.today .dn { color: var(--accent); }
.day.off { background: transparent; }

.lessons { display: grid; gap: 12px; }
.lesson-card {
  display: flex; gap: 14px; align-items: center; border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--line); background: var(--surface); text-align: left; width: 100%;
  box-shadow: var(--shadow);
}
.lesson-card .ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex: none; }
.s-rus .ic { color: var(--rus); } .s-kaz .ic { color: var(--kaz); } .s-eng .ic { color: var(--eng); } .s-math .ic { color: var(--math); }
.s-log .ic { font-size: 28px; }
.lesson-card .t { font-weight: 800; font-size: 18px; }
.lesson-card .st { font-size: 14px; color: var(--muted); }
.lesson-card .badge { font-weight: 800; font-size: 15px; white-space: nowrap; }
.lesson-card.locked { opacity: .55; }
.s-rus .ic { background: var(--rus-bg); } .s-rus .t { color: var(--rus); }
.s-kaz .ic { background: var(--kaz-bg); } .s-kaz .t { color: var(--kaz); }
.s-eng .ic { background: var(--eng-bg); } .s-eng .t { color: var(--eng); }
.s-math .ic { background: var(--math-bg); } .s-math .t { color: var(--math); }
.s-log .ic { background: var(--log-bg); } .s-log .t { color: var(--log); }

.sunday { text-align: center; padding: 28px 16px; }
.sunday .big { font-size: 56px; }
.game-banner { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.game-banner .ic { font-size: 40px; }

/* ---------- урок ---------- */
.lesson-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.timer { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.timer .bar { flex: 1; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--eng); }
.stepnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 16px; }
.stepnav button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 700; }
.stepnav button.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.stepnav button.ok { background: var(--ok-bg); color: var(--ok); }
.stepnav button.bad { background: var(--bad-bg); color: var(--bad); }
.stepnav button.seen { background: var(--surface-2); }

.step { display: grid; gap: 16px; }
.q { font-size: 22px; font-weight: 800; }
.q .say { margin-left: 8px; vertical-align: middle; }
.pic { font-size: 44px; line-height: 1.3; letter-spacing: 2px; word-break: break-all; }
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.opt {
  border: 2px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px 16px;
  font-size: 20px; font-weight: 700; min-height: 60px; text-align: left;
}
.opt.sel { border-color: var(--accent); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.num-input {
  font-size: 32px; font-weight: 800; width: 180px; text-align: center; border-radius: 16px;
  border: 2px solid var(--line); background: var(--surface); padding: 10px;
}
.text-input, textarea {
  width: 100%; font-size: 20px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  padding: 12px 14px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.reading { font-size: 20px; line-height: 1.75; white-space: pre-wrap; }
.reading.poem { font-style: italic; }
.reading .w.hl { background: var(--warn-bg); border-radius: 6px; }
.author { color: var(--muted); font-size: 15px; }
.feedback { border-radius: 16px; padding: 14px 16px; font-size: 17px; }
.feedback.ok { background: var(--ok-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback.wait { background: var(--warn-bg); }
.feedback b { display: block; font-size: 19px; margin-bottom: 2px; }
.feedback ul { margin: 6px 0 0; padding-left: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 58px; padding: 8px; border-radius: 16px; border: 2px dashed var(--line); }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 14px;
  font-size: 20px; font-weight: 700; min-height: 48px;
}
.chips.pool { border-style: solid; background: var(--surface-2); }
.order-list { display: grid; gap: 8px; }
.order-item { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; font-size: 18px; }
.order-item .n { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; flex: none; }
.order-item .spacer { flex: 1; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .opt { font-size: 18px; }
.match .opt.paired { opacity: .45; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.flash {
  border-radius: 18px; border: 1px solid var(--line); background: var(--surface); min-height: 150px;
  display: grid; place-items: center; text-align: center; padding: 12px; box-shadow: var(--shadow);
}
.flash .fp { font-size: 46px; }
.flash .ft { font-size: 22px; font-weight: 800; }
.flash .fb { font-size: 16px; color: var(--muted); }
.flash.flipped { background: var(--kaz-bg); }

.nav-bottom { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- итог ---------- */
.result { text-align: center; display: grid; gap: 10px; padding: 24px 16px; }
.result .medal { font-size: 64px; }
.result .pct { font-size: 44px; font-weight: 800; }
.mistake { text-align: left; border-left: 4px solid var(--bad); padding: 10px 14px; background: var(--surface); border-radius: 0 14px 14px 0; margin-top: 10px; }
.mistake .your { color: var(--bad); }
.mistake .right { color: var(--ok); font-weight: 700; }

/* ---------- игра ---------- */
.flag-box { display: grid; place-items: center; margin: 8px 0 16px; }
.flag-box img { width: min(320px, 80vw); aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.fact { background: var(--warn-bg); border-radius: 16px; padding: 14px 16px; }
.collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.collection img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.collection img.no { filter: grayscale(1); opacity: .25; }

/* ---------- родитель ---------- */
/* align-items/align-content: start — иначе карточка короче соседней растягивается и её блоки
   разъезжаются с пустотами (видно на снимке 15.09) */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { align-content: start; }
.bars { display: grid; gap: 10px; }
.barrow { display: grid; grid-template-columns: 190px 1fr 46px; gap: 10px; align-items: center; font-size: 15px; }
.barrow .track { height: 14px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.barrow .track i { display: block; height: 100%; border-radius: 99px; }
.list { display: grid; gap: 8px; }
.li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.li:last-child { border-bottom: 0; }
.review-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.review-item .ans { font-size: 17px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.score-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.score-btns button { min-height: 40px; padding: 6px 12px; }
.section-title { margin: 22px 0 10px; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-weight: 700; z-index: 50; max-width: calc(100% - 32px);
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 24px; }
  .q { font-size: 20px; }
  .days { gap: 4px; }
  .day { padding: 6px 2px; min-height: 64px; }
  .day .dn { font-size: 17px; }
  .stats { gap: 6px; }
  .stat b { font-size: 21px; }
  .avatar .face { width: 84px; height: 84px; font-size: 48px; }
  .barrow { grid-template-columns: 110px 1fr 40px; }
  .match { grid-template-columns: 1fr 1fr; gap: 6px; }
  .match .opt { font-size: 16px; padding: 10px; }
  .keypad { grid-template-columns: repeat(3, 70px); }
  .tab { padding: 10px 10px; font-size: 15px; }
  .top { flex-wrap: nowrap; }
  .top .icon-btn { width: 40px; height: 40px; flex: none; }
  .barrow { grid-template-columns: 130px 1fr 40px; }
}
