/* css/base.css - основа: переменные, кнопки, карточки, персонаж, первые экраны, занятие, родительский раздел (первая версия).
   Порядок файлов в index.html важен: правила ниже перекрывают правила выше; карта файлов - obsidian/Pally/architecture/code-map.md */
:root {
  --bg: #fbf4e6;
  --paper: #fffdf8;
  --ink: #2e2a25;
  --muted: #7a6f60;
  --line: #eadfca;
  --brand: #d2542f;
  --brand-dark: #a53d1c;
  --brand-soft: #fce3d8;
  --green: #2f6b5a;
  --green-soft: #dcefe4;
  --sun: #f2b950;
  --sun-soft: #fdf0cf;
  --sky-soft: #dcecef;
  --ok: #2c7f5c;
  --ok-soft: #dcefe4;
  --bad: #c2402f;
  --bad-soft: #fbe2dc;
  --radius: 22px;
  --shadow: 0 3px 0 rgba(46, 42, 37, .07);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: 27px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.app {
  max-width: 540px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
}
.brand svg { flex: none; }
.brand.sm { font-size: 17px; color: var(--muted); }
.brand.sm svg { width: 26px; height: 26px; }

.card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brand-dark);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { background: #c74c29; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .chip:focus-visible, .option:focus-visible, .key:focus-visible,
.tab:focus-visible, .icon-btn:focus-visible, .l-link:focus-visible, .link:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.btn.ghost {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
  font-weight: 700;
}
.btn.ghost:hover { background: #fff; border-color: #dccdaf; }
.btn.small-btn { min-height: 46px; font-size: 16px; }
.btn.danger { background: var(--bad); box-shadow: 0 4px 0 #8c2a1d; }
.link {
  background: none;
  border: 0;
  padding: 8px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

/* Персонаж */
.mascot {
  width: 92px; height: 92px; flex: none;
  display: grid; place-items: center;
  background: var(--sun-soft);
  border-radius: 46% 54% 52% 48% / 52% 46% 54% 48%;
}
.mascot-svg { width: 78%; height: 78%; display: block; }

/* Главный экран ребёнка */
.hero-row { display: flex; align-items: center; gap: 14px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--sun-soft);
  font-size: 14px;
  font-weight: 700;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.spacer { flex: 1; }

/* Анкета */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .label { font-weight: 800; }
.field input[type=text] {
  min-height: 52px;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.field input[type=text]:focus { outline: none; border-color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: #dccdaf; }
.chip[aria-pressed=true] {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--green); }
.form-card { gap: 20px; }

/* Занятие */
.topbar { display: flex; align-items: center; gap: 10px; }
.progress {
  flex: 1; height: 12px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .25s; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 18px;
  cursor: pointer;
}
.stage { font-size: 13px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.question { font-size: 20px; font-weight: 700; }
.qrow { display: flex; gap: 10px; align-items: flex-start; }
.qrow .question { flex: 1; }
.big {
  padding: 18px 10px;
  text-align: center;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.big.emoji { font-size: 34px; line-height: 1.5; letter-spacing: .1em; white-space: pre-line; }
.big.picture { font-size: 84px; line-height: 1.2; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.options.one { grid-template-columns: 1fr; }
.option {
  min-height: 64px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.option:hover:not(:disabled) { border-color: var(--sun); }
.option.pic { font-size: 44px; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option:disabled { cursor: default; }

.entry {
  min-height: 64px;
  display: grid; place-items: center;
  border: 2px dashed var(--sun);
  border-radius: 18px;
  background: var(--paper);
  font-size: 34px;
  font-weight: 800;
}
.entry.empty { color: var(--line); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}
.key:active { background: var(--sun-soft); }
.key.ok-key { background: var(--brand); border-color: var(--brand); color: #fff; }
.key.ok-key:disabled { opacity: .45; }

.note {
  padding: 14px 16px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note.hint { background: var(--sun-soft); }
.note.good { background: var(--ok-soft); }
.note.steps { background: var(--sky-soft); }
.note b { display: block; }

.finale { text-align: center; align-items: center; }
.finale .mascot { width: 128px; height: 128px; }
.stars { font-size: 34px; letter-spacing: .1em; color: var(--sun); }

/* Родительский раздел */
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tab {
  min-height: 44px;
  padding: 8px 2px;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
}
.tab[aria-selected=true] { background: var(--green); border-color: var(--green); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg); border-radius: 16px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 24px; font-family: var(--serif); }
.stat span { font-size: 13px; color: var(--muted); line-height: 1.25; display: block; }
.list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

.topic {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg);
}
.topic .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); }
.topic.mastered .dot { background: var(--ok); }
.topic.learning .dot { background: var(--sun); }
.topic.assumed .dot { background: #b5d9c5; }
.topic .t-title { flex: 1; }
.topic .t-state { font-size: 13px; color: var(--muted); text-align: right; }
.grade-label { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

.demo-banner { font-size: 13px; color: var(--muted); text-align: center; }
