/* [agukat'] — neumorphism (soft UI): один материал, свет — только тенями.
   Все ресурсы локальные, шрифты системные (ui-rounded → SF Pro Rounded на macOS/iOS). */

:root {
  /* единый материал: фон, карточки и кнопки — один и тот же hex */
  --bg:        #E4EBF1;
  --surface:   #E4EBF1;
  --highlight: #FFFFFF; /* свет сверху-слева */
  --shadow:    #A3B1C6; /* тень снизу-справа */

  --ink:    #31456A;
  --muted:  #7A8AA8;
  --accent: #34B579;  /* единственный насыщенный акцент — зелёный тумблер со скрина */
  --danger: #C0616B;

  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-body: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif;

  --radius-sm: 12px;
  --radius-card: 20px;
  --radius-pill: 9999px;

  /* двойные мягкие тени — вся суть стиля */
  --shadow-raised: 8px 8px 16px var(--shadow), -8px -8px 16px var(--highlight);
  --shadow-raised-sm: 4px 4px 8px var(--shadow), -4px -4px 8px var(--highlight);
  --shadow-inset: inset 6px 6px 12px var(--shadow), inset -6px -6px 12px var(--highlight);
  --shadow-inset-sm: inset 3px 3px 6px var(--shadow), inset -3px -3px 6px var(--highlight);
  /* алиасы для прежних имён (используются в разметке) */
  --shadow-soft: var(--shadow-raised);
  --shadow-rest: var(--shadow-raised-sm);
  --text-engraved: 1px 1px 1px var(--highlight), -1px -1px 1px rgba(163, 177, 198, .55);

  --space-1: 8px; --space-2: 16px; --space-3: 24px;
  --space-4: 40px; --space-5: 64px;
  --measure: 680px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.4rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

a { color: var(--accent); }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
  text-shadow: var(--text-engraved);
}

/* прежний «волнистый» класс — теперь тихий заголовок без декора */
.squiggle { padding-bottom: 4px; }

/* ---------- каркас ---------- */

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--surface);
  box-shadow: 0 6px 14px -8px var(--shadow);
  position: sticky; top: 0; z-index: 10;
}

.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand b { color: var(--accent); }

.nav { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px;
  padding: 8px 18px; border-radius: var(--radius-pill);
  transition: box-shadow .15s ease, color .15s ease;
}
.nav a.active {
  color: var(--accent);
  box-shadow: var(--shadow-inset-sm); /* активная вкладка «вдавлена» */
}
.nav a:not(.active):hover { box-shadow: var(--shadow-raised-sm); color: var(--ink); }

main {
  width: 100%; max-width: 960px; margin: 0 auto;
  padding: var(--space-4) clamp(16px, 4vw, 40px) var(--space-5);
  flex: 1;
}

/* ---------- элементы ---------- */

.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
  padding: var(--space-3);
}

.btn {
  display: inline-block; text-decoration: none; text-align: center;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  border: none; cursor: pointer;
  border-radius: var(--radius-pill);
  padding: 12px 26px;
  background: var(--accent); color: #F4FBF7;
  box-shadow: 6px 6px 12px var(--shadow), -6px -6px 12px var(--highlight);
  transition: box-shadow 140ms ease-out, transform 140ms ease-out, opacity .15s;
}
.btn:hover { opacity: .93; }
.btn:active { transform: scale(.98); box-shadow: var(--shadow-inset-sm); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary, .btn.ghost {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-raised-sm);
}
.btn.secondary { color: var(--accent); }
.btn.secondary:active, .btn.ghost:active { box-shadow: var(--shadow-inset-sm); }
.btn.small { font-size: 13px; padding: 8px 18px; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 700;
  border-radius: var(--radius-pill); padding: 3px 12px;
  background: var(--surface); color: var(--muted);
  box-shadow: var(--shadow-inset-sm);
}
.chip.sage { color: var(--accent); }
.chip.ochre { color: var(--ink); }
.chip.terra { background: var(--accent); color: #F4FBF7; box-shadow: var(--shadow-raised-sm); }

.meter {
  height: 14px; background: var(--surface); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-inset-sm); /* вогнутый жёлоб */
  overflow: hidden; padding: 3px;
}
.meter > i {
  display: block; height: 100%;
  background: var(--accent); border-radius: var(--radius-pill);
  transition: width .5s ease;
}
.meter.xp > i { background: linear-gradient(90deg, var(--accent), #57C994); }

.note { color: var(--muted); font-size: 14px; }

input[type=text], input[type=email], input[type=password] {
  width: 100%; font-family: var(--font-body); font-size: 16px;
  padding: 12px 18px; border-radius: var(--radius-pill);
  border: none; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-inset); /* поля «вдавлены» в поверхность */
}
input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-weight: 700; font-size: 13px; margin: 14px 0 6px; color: var(--muted); }

.error-box {
  background: var(--surface); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 16px; margin-top: 14px;
  font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-inset-sm);
}

/* ---------- экран входа ---------- */

.auth-wrap {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-4);
  align-items: center; min-height: 70vh;
}
@media (max-width: 800px) { .auth-wrap { grid-template-columns: 1fr; } }

.auth-story { position: relative; }
/* декоративные «блобы» стали строгими выпуклыми дисками из того же материала */
.auth-story .blob-bg {
  position: absolute; inset: -40px -20px auto auto;
  width: 220px; height: 220px; z-index: -1;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-raised);
}

.slogan { color: var(--accent); }

/* ---------- дом: персонаж ---------- */

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 800px) { .home-grid { grid-template-columns: 1fr; } }

.char-card {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 220px 1fr; gap: var(--space-3);
  align-items: center; position: relative; overflow: hidden;
}
@media (max-width: 640px) { .char-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.char-stage-wrap { position: relative; width: 200px; height: 200px; }
/* персонаж лежит в круглой вогнутой лунке */
.char-stage-wrap .blob-bg {
  position: absolute; inset: 2px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-inset);
}
.char-svg { position: relative; width: 100%; height: 100%; }
.char-svg svg { width: 100%; height: 100%; }

.breathe { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.zzz {
  position: absolute; top: 0; right: 8px;
  font-family: var(--font-display); font-weight: 700;
  color: var(--muted); font-size: 20px;
  text-shadow: var(--text-engraved);
  animation: zfloat 2.6s ease-in-out infinite;
}
@keyframes zfloat { 0% { transform: translateY(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-18px); opacity: 0; } }

.stat-row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: 10px 0; }
.stat {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13px; color: var(--muted);
  box-shadow: var(--shadow-inset-sm);
}
.stat b { font-size: 18px; display: block; line-height: 1.2; color: var(--ink); }

.care-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: var(--space-2); }
.care-btn {
  border: none; background: var(--surface);
  border-radius: var(--radius-pill); cursor: pointer;
  padding: 10px 18px; font-family: var(--font-body); font-size: 14px; font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-raised-sm);
  transition: box-shadow 140ms ease-out, transform 140ms ease-out;
}
.care-btn:hover { color: var(--accent); }
.care-btn:active { transform: scale(.97); box-shadow: var(--shadow-inset-sm); }
.care-btn:disabled { opacity: .4; cursor: default; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface); color: var(--accent);
  padding: 12px 24px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-raised); font-weight: 700; font-size: 14px;
  z-index: 50; animation: toast-in .3s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- путь ---------- */

.stage-list { display: flex; flex-direction: column; gap: var(--space-4); }

.stage-card { position: relative; }
.stage-card.locked { opacity: .6; }
.stage-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stage-emoji { font-size: 32px; }

.lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-top: 12px;
  background: var(--surface); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-inset-sm); /* уроки лежат в вогнутых ячейках подноса */
}
.lesson-row .grow { flex: 1; min-width: 0; }
.lesson-title { font-weight: 700; }
.done-mark { color: var(--accent); font-weight: 700; }

/* ---------- урок ---------- */

.task-progress { display: flex; gap: 8px; margin-bottom: var(--space-3); }
.task-progress i {
  flex: 1; height: 8px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--shadow-inset-sm);
}
.task-progress i.on { background: var(--accent); box-shadow: none; }

.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.vocab-card {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 16px; cursor: pointer; border: none;
  box-shadow: var(--shadow-raised-sm);
  transition: box-shadow 140ms ease-out;
}
.vocab-card:active { box-shadow: var(--shadow-inset-sm); }
.vocab-card .ru { font-weight: 700; font-size: 17px; }
.vocab-card .hint { color: var(--muted); font-size: 14px; min-height: 1.4em; }

.say-btn {
  border: none; background: var(--surface); color: var(--accent);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-raised-sm);
  transition: box-shadow 140ms ease-out, transform 140ms ease-out;
}
.say-btn:active { transform: scale(.94); box-shadow: var(--shadow-inset-sm); }

.phrase-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 17px;
  box-shadow: var(--shadow-inset-sm);
}

.quiz-q { margin-bottom: var(--space-3); }
.quiz-opt {
  display: block; width: 100%; text-align: left; font-family: var(--font-body);
  font-size: 15px; font-weight: 600; padding: 12px 18px; margin: 12px 0;
  border-radius: var(--radius-sm); border: none;
  background: var(--surface); cursor: pointer; color: var(--ink);
  box-shadow: var(--shadow-raised-sm);
  transition: box-shadow 140ms ease-out, color .15s;
}
.quiz-opt:hover { color: var(--accent); }
.quiz-opt.right { color: var(--accent); box-shadow: var(--shadow-inset-sm); }
.quiz-opt.wrong { color: var(--danger); box-shadow: var(--shadow-inset-sm); }

.dialog-line { display: flex; gap: 10px; margin: 12px 0; }
.dialog-line .bubble {
  padding: 10px 18px; border-radius: 18px; max-width: 80%;
  background: var(--surface);
}
.dialog-line.npc .bubble { box-shadow: var(--shadow-inset-sm); border-bottom-left-radius: 6px; }
.dialog-line.you { justify-content: flex-end; }
.dialog-line.you .bubble { box-shadow: var(--shadow-raised-sm); color: var(--accent); font-weight: 600; border-bottom-right-radius: 6px; }

.result-blob {
  width: 140px; height: 140px; margin: 0 auto var(--space-2);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border-radius: 50%; font-size: 56px;
  box-shadow: var(--shadow-inset);
}

/* ---------- echo ---------- */

.echo-hero { position: relative; margin-bottom: var(--space-4); }
.echo-hero .blob-bg {
  position: absolute; inset: -30px auto auto -30px;
  width: 180px; height: 180px; z-index: -1;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-raised);
}

.med-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.med-card { cursor: pointer; transition: box-shadow .2s ease, transform .2s ease; }
.med-card:hover { transform: translateY(-2px); }
.med-card:active { box-shadow: var(--shadow-inset-sm); transform: none; }

.breath-circle {
  width: 130px; height: 130px; margin: var(--space-3) auto;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  animation: breath 8s ease-in-out infinite;
}
@keyframes breath { 0%, 100% { transform: scale(.72); } 50% { transform: scale(1); } }

.med-text {
  max-width: var(--measure); margin: 0 auto;
  font-size: 18px; line-height: 1.9;
}
.med-para { opacity: .38; transition: opacity .6s ease; }
.med-para.now { opacity: 1; }
.med-para .cons { color: var(--accent); font-weight: 700; }

.affirm {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--muted); text-align: center; margin: 1em 0;
  text-shadow: var(--text-engraved);
}

.player-controls {
  display: flex; gap: 16px; justify-content: center;
  margin: var(--space-3) 0; flex-wrap: wrap;
}

.cycle-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: var(--space-2) 0; }
.cycle-step {
  background: var(--surface); border-radius: var(--radius-pill);
  padding: 6px 14px; font-size: 12px; font-weight: 700; color: var(--muted);
  box-shadow: var(--shadow-raised-sm);
}
.cycle-arrow { color: var(--muted); }

footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: var(--space-3);
  text-shadow: var(--text-engraved);
}
