/* ============================================================================
 *  ФормулаЦТ — экраны
 * ==========================================================================*/

/* ----------------------------- ПРИВЕТСТВИЕ -------------------------------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #e8f7d4 0%, #d3f0b0 100%);
  color: #2e4d0a;
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
  border: 2px solid #c7e89a;
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(88,204,2,.12);
}
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.hero::after  { width: 130px; height: 130px; left: -50px; bottom: -60px; }
.hero__inner { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: var(--sp-4); }
.hero__hi { font-size: 14px; opacity: .8; font-weight: 800; }
.hero__name { font-size: 27px; font-weight: 900; letter-spacing: -.4px; }
.hero__sub { font-size: 14px; opacity: .85; margin-top: 4px; font-weight: 700; }
.hero__stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-top: var(--sp-5); }
.hero__stat { background: rgba(255,255,255,.7); border-radius: var(--r); padding: var(--sp-3); text-align: center; }
.hero__stat b { display: block; font-size: 20px; font-weight: 900; color: #2e4d0a; }
.hero__stat span { font-size: 11px; opacity: .8; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }

/* ----------------------------- ОНБОРДИНГ --------------------------------- */
.onb { min-height: 100vh; display: flex; flex-direction: column; padding: calc(var(--sp-6) + var(--safe-top)) var(--sp-5) calc(var(--sp-6) + var(--safe-bot)); }
.onb__top { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.onb__step { flex: 1; display: flex; gap: 6px; }
.onb__step i { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); transition: background var(--t); }
.onb__step i.on { background: var(--brand); }
.onb__body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--sp-5); max-width: 560px; width: 100%; margin: 0 auto; }
.onb__foot { max-width: 560px; width: 100%; margin: var(--sp-5) auto 0; display: grid; gap: var(--sp-3); }

.pick {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  text-align: left; width: 100%;
}
.pick:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
.pick.is-on { box-shadow: inset 0 0 0 2px var(--brand), 0 4px 0 var(--brand-600); background: var(--brand-100); }
.pick__ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--surface-3); flex: none; color: var(--brand-600); }
.pick.is-on .pick__ico { background: var(--brand); color: #fff; }
.pick__ico svg { width: 26px; height: 26px; }
.pick__t { font-weight: 800; font-size: 16px; }
.pick__d { font-size: 13px; color: var(--fg-2); }
.pick__check { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); display: grid; place-items: center; color: transparent; flex: none; font-weight: 900; }
.pick.is-on .pick__check { background: var(--brand); box-shadow: none; color: #fff; }

.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 800; color: var(--fg-2); }
.field input, .field select {
  width: 100%; padding: 14px var(--sp-4); border-radius: var(--r);
  box-shadow: inset 0 0 0 2px var(--line); border: 0; background: var(--surface); outline: 0;
  font-size: 16px; font-weight: 700;
}
.field input:focus, .field select:focus { box-shadow: inset 0 0 0 2px var(--brand); }

/* ------------------------------- ГЛАВНАЯ -------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-3); }
.section-head h2 { font-size: 18px; font-weight: 900; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.quick__card {
  border-radius: var(--r-lg); padding: var(--sp-4); color: #fff;
  display: flex; flex-direction: column; gap: 6px; min-height: 108px;
  position: relative; overflow: hidden; text-align: left;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.quick__card:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.quick__card::after { content: ''; position: absolute; right: -24px; bottom: -24px; width: 92px; height: 92px; border-radius: 50%; background: rgba(255,255,255,.14); }
.quick__card b { font-size: 16px; font-weight: 900; }
.quick__card span { font-size: 12.5px; opacity: .95; font-weight: 700; }
.quick__ico { font-size: 24px; margin-bottom: auto; color: #fff; }
.quick__ico svg { width: 26px; height: 26px; }
.quick--train { background: #ff9600; }
.quick--ai { background: #1cb0f6; }
.quick--review { background: #58cc02; }
.quick--exam { background: #ce82ff; }

/* -------------------------------- УРОК ----------------------------------- */
.lesson { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 200px; }
.lesson__head { padding: calc(var(--sp-4) + var(--safe-top)) var(--sp-4) var(--sp-3); position: sticky; top: 0; z-index: 30; background: var(--bg); }
.lesson__body { flex: 1; width: 100%; max-width: 700px; margin: 0 auto; padding: var(--sp-4); }
.lesson__prompt { font-size: 21px; font-weight: 900; line-height: 1.35; margin-bottom: var(--sp-5); letter-spacing: -.2px; }
.lesson__hint { font-size: 13.5px; color: var(--fg-3); margin-top: var(--sp-3); display: flex; gap: 6px; align-items: flex-start; }

.solution { display: grid; gap: var(--sp-3); }
.solution__step { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 15px; color: var(--fg-2); }
.solution__n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.solution__note { background: var(--surface-2); border-radius: var(--r); padding: var(--sp-3); font-size: 14px; color: var(--fg-2); }

/* Сопоставление */
.match { display: grid; gap: var(--sp-3); }
.match__cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.match__col { display: grid; gap: var(--sp-2); }
.match__item {
  padding: 13px var(--sp-3); border-radius: var(--r-sm); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); font-weight: 700; font-size: 14.5px;
  transition: all var(--t-fast); text-align: left;
}
.match__item.is-sel { box-shadow: inset 0 0 0 2px var(--brand), 0 3px 0 var(--brand-600); background: var(--brand-100); }
.match__item.is-done { box-shadow: inset 0 0 0 2px var(--ok), 0 3px 0 var(--ok-600); background: var(--ok-soft); color: var(--ok-600); opacity: .8; }
.match__item.is-bad { box-shadow: inset 0 0 0 2px var(--err), 0 3px 0 var(--err-600); background: var(--err-soft); animation: shake .3s; }

/* Упорядочивание */
.orderlist { display: grid; gap: var(--sp-2); }
.orderlist__item {
  display: flex; align-items: center; gap: var(--sp-3); padding: 13px var(--sp-3);
  border-radius: var(--r-sm); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line);
  font-weight: 700; font-size: 14.5px; text-align: left; width: 100%;
}
.orderlist__item.is-on { box-shadow: inset 0 0 0 2px var(--brand), 0 3px 0 var(--brand-600); background: var(--brand-100); }
.orderlist__n { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 900; flex: none; }

/* Симуляции */
.sim { display: grid; gap: var(--sp-3); }
.sim__canvas { width: 100%; border-radius: var(--r); background: var(--surface-2); border: 2px solid var(--line); touch-action: none; }
.sim__controls { display: grid; gap: var(--sp-3); }
.sim__ctl { display: grid; gap: 4px; }
.sim__ctl-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; color: var(--fg-2); }
.sim__ctl input[type="range"] { width: 100%; accent-color: var(--brand); height: 26px; }

/* ------------------------------- РЕЗУЛЬТАТ ------------------------------- */
.result { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); padding: calc(var(--sp-6) + var(--safe-top)) var(--sp-5) calc(var(--sp-6) + var(--safe-bot)); text-align: center; }
.result__title { font-size: 27px; font-weight: 900; }
.result__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); width: 100%; max-width: 460px; }
.result__card { border-radius: var(--r); padding: var(--sp-3); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); }
.result__card b { display: block; font-size: 22px; font-weight: 900; }
.result__card span { font-size: 11px; font-weight: 800; color: var(--fg-3); text-transform: uppercase; }
.result__stars { display: flex; gap: 8px; justify-content: center; }
.result__stars svg { width: 34px; height: 34px; }
.result__card--gold { box-shadow: inset 0 0 0 2px var(--gold); background: #fff8e0; }
html[data-theme="dark"] .result__card--gold { background: #3d330d; }

/* ------------------------------- СТАТИСТИКА ------------------------------ */
.stat-hero { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.stat-box { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); }
.stat-box b { display: block; font-size: 25px; font-weight: 900; line-height: 1.1; }
.stat-box span { font-size: 12px; font-weight: 800; color: var(--fg-3); text-transform: uppercase; letter-spacing: .3px; }
.stat-box__ico { font-size: 20px; margin-bottom: var(--sp-2); color: var(--brand-600); }
.stat-box__ico svg { width: 24px; height: 24px; }

.chart { width: 100%; height: 150px; }

/* -------------------------------- ПРЕМИУМ ------------------------------- */
.prem {
  background: linear-gradient(160deg, #ffd94d 0%, #ffc800 55%, #f0a500 100%);
  color: #5a4200; border-radius: var(--r-xl); padding: var(--sp-5); position: relative; overflow: hidden;
}
.prem::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.22); }
.prem__title { font-size: 25px; font-weight: 900; letter-spacing: -.4px; position: relative; }
.prem__sub { font-weight: 700; opacity: .85; position: relative; }
.plan {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line);
  text-align: left; width: 100%;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.plan:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
.plan.is-on { box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 #cc9f00; }
.plan__price { margin-left: auto; text-align: right; flex: none; }
.plan__price b { font-size: 19px; font-weight: 900; display: block; }
.plan__badge { position: absolute; top: -9px; right: 14px; font-size: 10px; font-weight: 900; padding: 3px 9px; border-radius: 99px; background: var(--brand); color: #fff; letter-spacing: .3px; }
.perk { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 14.5px; font-weight: 600; color: var(--fg-2); }
.perk__ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-100); flex: none; font-size: 15px; color: var(--brand-700); }
.perk__ico svg { width: 18px; height: 18px; }
.perk--on .perk__ico { background: var(--ok-soft); color: var(--ok-600); }

/* --------------------------------- ЧАТ ИИ ------------------------------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - var(--safe-top) - var(--tabbar-h) - var(--safe-bot)); }
.chat__log { flex: 1; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 11px var(--sp-4); border-radius: var(--r-lg); font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg--ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg--me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg--sys { align-self: center; background: var(--surface-2); color: var(--fg-3); font-size: 12.5px; font-weight: 700; border-radius: var(--r-pill); padding: 7px 14px; }
.msg--typing { display: flex; gap: 4px; align-items: center; }
.msg--typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); animation: typing 1.1s infinite; }
.msg--typing i:nth-child(2) { animation-delay: .15s; }
.msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .4 } 30% { transform: translateY(-5px); opacity: 1 } }
.chat__chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding: 0 var(--sp-4) var(--sp-2); scrollbar-width: none; }
.chat__chips::-webkit-scrollbar { display: none; }
.chat__chips button {
  flex: none; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line); font-size: 13px; font-weight: 700; color: var(--fg-2); white-space: nowrap;
}
.chat__form { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-bot)); border-top: 2px solid var(--line); background: var(--surface); }
.chat__form input { flex: 1; min-width: 0; padding: 13px var(--sp-4); border-radius: var(--r-pill); box-shadow: inset 0 0 0 2px var(--line); border: 0; background: var(--bg); outline: 0; font-size: 15px; }
.chat__form input:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.chat__send { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 0 var(--brand-700); }
.chat__send:active { transform: translateY(3px); box-shadow: none; }
.chat__send:disabled { opacity: .4; }

/* -------------------------------- ПРОФИЛЬ ------------------------------- */
.prof-head { display: flex; align-items: center; gap: var(--sp-4); }
.prof-ava { width: 66px; height: 66px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-size: 26px; font-weight: 900; flex: none; }
.prof-ava svg { width: 32px; height: 32px; }
.setting { display: flex; align-items: center; gap: var(--sp-3); padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting__ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--fg-2); }
.setting__ico svg { width: 19px; height: 19px; }
.setting__t { font-weight: 700; font-size: 14.5px; }
.setting__d { font-size: 12.5px; color: var(--fg-3); }
.switch { margin-left: auto; width: 48px; height: 28px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background var(--t); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform var(--t-bounce); }
.switch.is-on { background: var(--ok); }
.switch.is-on::after { transform: translateX(20px); }

/* --------------------------- ЗАКРЫТЫЙ КОНТЕНТ --------------------------- */
.locked-card {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: var(--sp-5);
  text-align: center; display: grid; gap: var(--sp-3); justify-items: center; background: var(--surface-2);
}
.locked-card__ico { font-size: 40px; }

/* -------------------------- ПЛАНШЕТ / ДЕСКТОП --------------------------- */
@media (min-width: 900px) {
  .home-cols { display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-6); align-items: start; }
  .home-side { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
  .stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
}
