/* Оформление RusWeo: цвета, радиусы, тени, шапка и карточки-строки взяты с rusweo.com (web/shared/app.css), только нужное.
   Тёмная тема — для Telegram в тёмном режиме (на rusweo.com её нет, палитра та же, затемнённая). */
:root {
  --bg: #f4f7fb; --bg2: #ffffff; --card: #ffffff; --text: #10233f; --hint: #69788f; --line: #e5e9ef; --line2: #dce5ee;
  --link: #145f9f; --soft: #f3f7fc; --soft-h: #e8f0fa; --top: rgba(255,255,255,.96); --top-line: #edf0f5; --shadow: 0 7px 22px rgba(34,57,90,.06);
  --grad: linear-gradient(105deg, #1595ed, #684cec 58%, #e7188a); --icon1: #eef6ff; --icon2: #fff0f8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1322; --bg2: #0e182a; --card: #14223a; --text: #e8eef8; --hint: #9aa9c0; --line: #243650; --line2: #2c4160;
    --link: #7fc0ff; --soft: #1a2c47; --soft-h: #223858; --top: rgba(14,24,42,.96); --top-line: #1d2d47; --shadow: 0 7px 22px rgba(0,0,0,.28); --icon1: #1b3050; --icon2: #3a2442;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1322; --bg2: #0e182a; --card: #14223a; --text: #e8eef8; --hint: #9aa9c0; --line: #243650; --line2: #2c4160;
  --link: #7fc0ff; --soft: #1a2c47; --soft-h: #223858; --top: rgba(14,24,42,.96); --top-line: #1d2d47; --shadow: 0 7px 22px rgba(0,0,0,.28); --icon1: #1b3050; --icon2: #3a2442;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
body { margin: 0; min-height: 100dvh; background: linear-gradient(180deg, var(--bg2) 0, var(--bg) 52%, var(--bg) 100%); font-size: 16px; line-height: 1.4; overscroll-behavior-y: contain; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

/* шапка — как .topbar на rusweo.com */
.topbar { position: sticky; top: 0; z-index: 20; min-height: 64px; background: var(--top); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; border-bottom: 1px solid var(--top-line); }
.topbar .logo { height: 34px; width: 34px; border-radius: 9px; }
.topbar .mid { flex: 1; min-width: 0; }
.topbar .title { font-size: 18px; font-weight: 900; line-height: 1.15; }
.topbar .prog { color: var(--hint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.back { width: 40px; height: 40px; flex: none; border: 0; background: var(--card); border-radius: 13px; font-size: 24px; line-height: 1; color: var(--text); box-shadow: 0 2px 8px rgba(30,54,88,.08); }
.back:active { background: var(--soft-h); }
#bar { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 30; background: var(--grad); transform-origin: left; animation: bar 1.2s ease-in-out infinite; }
@keyframes bar { 0% { transform: scaleX(.05); } 60% { transform: scaleX(.8); } 100% { transform: scaleX(1); opacity: .3; } }

.page { width: min(100%, 760px); margin: 0 auto; flex: 1; }
.shell { padding: 14px 14px calc(26px + env(safe-area-inset-bottom)); }
.hub-page .shell { padding: calc(14px + env(safe-area-inset-top)) 14px 24px; }
.hub-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hub-brand img { height: 42px; width: 42px; border-radius: 11px; }
.hub-title { font-size: 31px; line-height: 1.05; margin: 10px 0 3px; font-weight: 950; }
.hub-sub { font-size: 14px; color: var(--hint); margin-bottom: 17px; }

/* карточки-строки — как .service-row на rusweo.com: значок, текст, картинка, стрелка */
.service-list { display: flex; flex-direction: column; gap: 12px; }
.service-row { position: relative; width: 100%; min-height: 88px; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: var(--card); display: grid; grid-template-columns: 48px 1fr 102px 22px; align-items: center; overflow: hidden; box-shadow: var(--shadow); }
.service-row:active { transform: scale(.995); }
.service-row:disabled { opacity: .55; }
.service-row img { width: 102px; height: 88px; object-fit: cover; display: block; }
.service-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-left: 12px; font-size: 22px; background: var(--icon1); }
.row-exam .service-icon { background: var(--icon2); }
.service-copy { padding: 11px 8px; }
.service-copy strong { display: block; font-size: 16px; line-height: 1.15; }
.service-copy small { display: block; margin-top: 4px; color: var(--hint); font-size: 11.5px; line-height: 1.25; }
.chev { color: var(--hint); font-size: 22px; text-align: center; }
.badge { position: absolute; top: 8px; right: 30px; padding: 1px 8px; border-radius: 99px; background: var(--grad); color: #fff; font-size: 10.5px; font-style: normal; font-weight: 800; }
@media (max-width: 560px) {
  .hub-title { font-size: 28px; }
  .service-row { grid-template-columns: 44px 1fr 90px 18px; min-height: 80px; }
  .service-row img { width: 90px; height: 80px; }
  .service-copy strong { font-size: 14px; }
  .service-copy small { font-size: 10.5px; }
}
#notice { margin-top: 18px; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
#notice b { color: #d1235a; }
.llc { margin-top: 22px; text-align: center; font-size: 10px; color: var(--hint); }

/* карточка урока / вопроса: .card и кнопка .secondary с rusweo.com */
.card { scroll-margin-top: 80px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin: 0 0 13px; box-shadow: var(--shadow); }
.card.off { opacity: .88; }
.card img.pic { display: block; width: 112px; height: 112px; object-fit: contain; margin: 0 auto 12px; background: #fff; border-radius: 14px; padding: 4px; border: 1px solid var(--line); }
.html { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.html code { font: .92em ui-monospace, Menlo, Consolas, monospace; background: var(--soft); padding: 1px 5px; border-radius: 6px; }
.html a { color: var(--link); }
.kb { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.row { display: flex; gap: 9px; }
.btn { flex: 1; min-height: 48px; padding: 11px 16px; border: 1px solid var(--line2); border-radius: 14px; background: var(--soft); color: var(--link); text-align: left; font-size: 16.5px; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; display: flex; align-items: center; }
.btn:active { background: var(--soft-h); }
.row.short .btn { flex: 1 1 auto; justify-content: center; text-align: center; padding: 11px 10px; }
.row.letters .btn { flex: 1 1 0; font-size: 21px; font-weight: 900; }
a.btn { text-decoration: none; }
.btn.pick { border-color: transparent; background: var(--grad); color: #fff; }
body.busy .btn, body.busy .service-row, body.busy .back { pointer-events: none; opacity: .6; }

#composer { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 9px; width: min(100%, 760px); margin: 0 auto; padding: 9px 14px calc(9px + env(safe-area-inset-bottom)); background: var(--top); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--top-line); }
#inp { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-size: 16px; }
#inp:focus { outline: 2px solid #1595ed; outline-offset: -1px; }
#send { width: 52px; height: 48px; border: 0; border-radius: 14px; background: var(--grad); color: #fff; font-size: 24px; font-weight: 800; box-shadow: 0 5px 14px rgba(75,72,220,.2); }
#send:disabled { opacity: .45; }
#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; max-width: 92vw; padding: 10px 16px; border-radius: 14px; background: #10233f; color: #fff; font-size: 14.5px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.28); }
#empty { padding: 40px 0; text-align: center; color: var(--hint); }
