/* Оформление «iOS»: как приложения iPhone. Системный шрифт, цвета iOS, большой заголовок, который при прокрутке
   превращается в компактную полупрозрачную панель, сгруппированные списки, переключатели и сегменты iOS,
   плавающая панель вкладок из «стекла». Светлое или тёмное — как в системе. На iPhone включается само.
   <html data-theme="ios">; на компьютере вкладки остаются в колонке слева. */

:root[data-theme="ios"] {
  color-scheme: light dark;
  --bg: #f2f2f7; --surface: #ffffff; --surface2: #f2f2f7; --surface3: #e5e5ea;
  --fill: rgba(118, 118, 128, .12); --line: rgba(60, 60, 67, .18);
  --text: #000000; --muted: #8a8a8e;
  --accent: #007aff; --on-accent: #ffffff; --accent-soft: rgba(0, 122, 255, .12);
  --ok: #34c759; --on-ok: #ffffff; --warn: #ff9500; --danger: #ff3b30; --stop: #ff3b30; --listen: #af52de;
  --glass: rgba(249, 249, 251, .78); --glass-line: rgba(255, 255, 255, .7); --glass-shadow: 0 8px 32px rgba(0, 0, 0, .12);
  --switch-off: #e9e9eb; --seg-on: #ffffff;
  --nav-h: 76px; --stop-h: 78px;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="ios"] {
    --bg: #000000; --surface: #1c1c1e; --surface2: #2c2c2e; --surface3: #3a3a3c;
    --fill: rgba(118, 118, 128, .24); --line: rgba(84, 84, 88, .6);
    --text: #ffffff; --muted: #8d8d93;
    --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, .2);
    --ok: #30d158; --warn: #ff9f0a; --danger: #ff453a; --stop: #ff453a; --listen: #bf5af2;
    --glass: rgba(30, 30, 32, .72); --glass-line: rgba(255, 255, 255, .1); --glass-shadow: 0 8px 32px rgba(0, 0, 0, .5);
    --switch-off: #39393d; --seg-on: #636366;
  }
}

[data-theme="ios"] body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
[data-theme="ios"] .hint { font-size: 13px; line-height: 1.35; }

/* нажатие — как в iOS: элемент на миг становится прозрачнее (вместо «капли») */
[data-theme="ios"] :is(.btn, .icon-btn, .chip-btn, .sheet-item, .navbar button, .resume, .plan .phead, .fx-btn, .subject-btn, details.mini summary) {
  transition: opacity .3s, transform .3s;
}
[data-theme="ios"] :is(.btn, .icon-btn, .chip-btn, .sheet-item, .resume, .plan .phead, .fx-btn, .subject-btn, details.mini summary):active {
  opacity: .5; filter: none; transition: none;
}
[data-theme="ios"] #rippleRow { display: none; }

/* ---------- большой заголовок и компактная панель ---------- */
[data-theme="ios"] .appbar {
  position: static; height: auto; align-items: flex-end;
  padding: calc(env(safe-area-inset-top) + 10px) 20px 6px; background: none;
}
[data-theme="ios"] .appbar h1 { font-size: 34px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; }
[data-theme="ios"] .subject-btn { font-size: 15px; margin-top: 2px; }
[data-theme="ios"] .mic { margin-bottom: 4px; }
[data-theme="ios"] .mic.on { background: rgba(52, 199, 89, .15); }
.ios-bar { display: none; }
[data-theme="ios"] .ios-bar {
  display: flex; align-items: center; justify-content: center;
  position: fixed; top: 0; left: 0; right: 0; z-index: 15;
  height: calc(44px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-bottom: .5px solid var(--line);
  font-size: 17px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s;
}
[data-theme="ios"] body.scrolled .ios-bar { opacity: 1; }
[data-theme="ios"] main { padding: 6px 16px 0; }

/* ---------- сгруппированные списки ---------- */
[data-theme="ios"] .card { border-radius: 22px; padding: 14px 16px; margin-bottom: 20px; }
[data-theme="ios"] .card-title {
  font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: 10px;
}
[data-theme="ios"] .card-title.mt { margin-top: 22px; }
[data-theme="ios"] .switch { min-height: 50px; border-top: .5px solid var(--line); }
[data-theme="ios"] .switch small { font-size: 13px; line-height: 1.3; margin-top: 2px; }
[data-theme="ios"] .switch i {
  width: 51px; height: 31px; border-radius: 16px; border: 0; background: var(--switch-off); transition: background .25s;
}
[data-theme="ios"] .switch i::after {
  top: 2px; left: 2px; width: 27px; height: 27px; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .25s;
}
[data-theme="ios"] .switch input:checked + i { background: var(--ok); }
[data-theme="ios"] .switch input:checked + i::after { left: 2px; top: 2px; width: 27px; height: 27px; background: #fff; transform: translateX(20px); }
[data-theme="ios"] .field { font-size: 13px; }
[data-theme="ios"] .field b { font-weight: 400; color: var(--muted); }

/* сегменты */
[data-theme="ios"] .seg { background: var(--fill); border-radius: 100px; padding: 2px; gap: 0; }
[data-theme="ios"] .seg span {
  min-height: 34px; padding: 4px 8px; border-radius: 100px; font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--text);
  transition: background .2s;
}
[data-theme="ios"] .seg.themes, [data-theme="ios"] .seg.themes span { border-radius: 16px; }
[data-theme="ios"] .seg input:checked + span { background: var(--seg-on); color: var(--text); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }

/* поля ввода и списки выбора */
[data-theme="ios"] :is(input[type=text], input[type=password], textarea, select) {
  background: var(--fill); border: 0; border-radius: 12px; min-height: 44px; padding: 10px 12px; font-size: 17px;
}
[data-theme="ios"] select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; color: var(--text);
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='16' viewBox='0 0 12 16'%3E%3Cpath d='M2 6l4-4 4 4M2 10l4 4 4-4' fill='none' stroke='%238a8a8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}
[data-theme="ios"] :is(input, textarea, select):focus { box-shadow: 0 0 0 2px var(--accent-soft); }
[data-theme="ios"] details.mini summary { font-size: 15px; font-weight: 400; }

/* ---------- кнопки ---------- */
[data-theme="ios"] .btn { border-radius: 100px; background: var(--fill); color: var(--accent); font-size: 17px; font-weight: 500; min-height: 44px; }
[data-theme="ios"] .btn.filled { background: var(--accent); color: #fff; font-weight: 600; }
[data-theme="ios"] .btn.tonal { background: var(--accent-soft); color: var(--accent); }
[data-theme="ios"] .btn.ok { background: var(--ok); color: #fff; }
[data-theme="ios"] .btn.text { background: none; font-weight: 400; }
[data-theme="ios"] .btn.danger { color: var(--danger); }
[data-theme="ios"] .btn.wide { min-height: 50px; font-size: 17px; }
[data-theme="ios"] .icon-btn { background: var(--fill); color: var(--accent); }
[data-theme="ios"] .icon-btn.small { background: none; color: var(--muted); }
[data-theme="ios"] .icon-btn.play { border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(0, 122, 255, .3); }
[data-theme="ios"] .icon-btn.more { background: none; }
[data-theme="ios"] .chip-btn { border: 0; background: var(--fill); border-radius: 14px; font-size: 15px; flex-direction: column; gap: 2px; min-height: 64px; }
[data-theme="ios"] .chip-btn svg { width: 24px; height: 24px; }

/* ---------- материал и план ---------- */
[data-theme="ios"] .resume { border-radius: 22px; background: var(--surface); }
[data-theme="ios"] .install { border-radius: 22px; }
[data-theme="ios"] .install img { border-radius: 22%; }
[data-theme="ios"] .sources li { border-bottom: .5px solid var(--line); min-height: 48px; }
[data-theme="ios"] .plan-sum .big { font-size: 28px; font-weight: 700; }
[data-theme="ios"] .plan li { border-radius: 18px; margin-bottom: 10px; }
[data-theme="ios"] .plan .ptitle { font-weight: 600; }
[data-theme="ios"] .plan .pnum { background: var(--fill); font-weight: 600; }
[data-theme="ios"] .plan li.done .pnum { background: rgba(52, 199, 89, .18); }
[data-theme="ios"] .badge { border-radius: 100px; font-weight: 500; }
[data-theme="ios"] .badge.weak { background: rgba(255, 149, 0, .16); }
[data-theme="ios"] .badge.good { background: rgba(52, 199, 89, .16); }
[data-theme="ios"] .dots { color: var(--warn); }

/* ---------- диктовка ---------- */
[data-theme="ios"] .topic h2 { font-size: 22px; font-weight: 700; }
[data-theme="ios"] .chunk { border-radius: 26px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
[data-theme="ios"] .chunk p { font-size: 25px; line-height: 1.38; letter-spacing: -.015em; }
[data-theme="ios"] .chunk .kind { color: var(--accent); font-weight: 600; letter-spacing: .04em; }
[data-theme="ios"] .chunk .gap div { background: var(--accent); }
[data-theme="ios"] .dot.s-speaking { box-shadow: 0 0 0 4px var(--accent-soft); }
[data-theme="ios"] .state { font-weight: 600; }
[data-theme="ios"] .banner { border-radius: 18px; }
[data-theme="ios"] .fx-btn { border-radius: 100px; background: var(--fill); color: var(--accent); }
[data-theme="ios"] .fx-btn.here { background: var(--accent); color: #fff; }
/* вопрос и ответ — как в «Сообщениях»: вопрос справа синим, ответ — серым облачком */
[data-theme="ios"] .qa { border-radius: 22px; }
[data-theme="ios"] .answer { background: var(--surface2); border-radius: 20px 20px 20px 6px; font-size: 17px; line-height: 1.4; }
[data-theme="ios"] .answer .q {
  display: table; margin: -4px -4px 10px auto; max-width: 85%; padding: 7px 12px; border-radius: 18px 18px 6px 18px;
  background: var(--accent); color: #fff; font-size: 15px;
}
[data-theme="ios"] .ask-row textarea { background: none; border: 1px solid var(--line); border-radius: 22px; min-height: 40px; padding: 8px 14px; }
[data-theme="ios"] .ask-row .icon-btn { width: 40px; height: 40px; background: var(--accent); color: #fff; }
[data-theme="ios"] .seek::-webkit-slider-thumb { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); width: 22px; height: 22px; margin-top: -9px; }

/* ---------- СТОП ---------- */
[data-theme="ios"] .stopbar { background: linear-gradient(to top, var(--bg) 60%, transparent); padding: 6px 16px 8px; }
[data-theme="ios"] .stop {
  border-radius: 100px; font-size: 20px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 8px 24px rgba(255, 59, 48, .32); transition: transform .3s;
}
[data-theme="ios"] .stop:active { filter: none; transform: scale(.97); transition: none; }
[data-theme="ios"] .stop.listening { box-shadow: 0 8px 24px rgba(175, 82, 222, .32); }

/* ---------- плавающая панель вкладок из «стекла» ---------- */
@media (max-width: 899px) {
  [data-theme="ios"] .navbar {
    left: 16px; right: 16px; bottom: calc(var(--safe-b) + 6px); height: 64px; padding: 4px;
    max-width: 520px; margin: 0 auto; border-radius: 32px;
    background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
    border: .5px solid var(--glass-line); box-shadow: var(--glass-shadow);
  }
  [data-theme="ios"] .navbar button { gap: 1px; border-radius: 28px; font-size: 10px; font-weight: 500; color: var(--text); }
  [data-theme="ios"] .navbar button.active { color: var(--accent); background: var(--fill); }
  [data-theme="ios"] .navbar .pill, [data-theme="ios"] .navbar button.active .pill { width: auto; height: 30px; background: none; color: inherit; }
  [data-theme="ios"] .navbar svg { width: 26px; height: 26px; }
  [data-theme="ios"] .navbar button:active { transform: scale(.92); }
  [data-theme="ios"] .stopbar { bottom: calc(var(--nav-h) + var(--safe-b)); }
}
@media (min-width: 900px) {
  [data-theme="ios"] .navbar { background: var(--surface); border-right: .5px solid var(--line); }
  [data-theme="ios"] .navbar button.active { color: var(--accent); }
  [data-theme="ios"] .navbar button.active .pill { background: var(--accent-soft); }
  [data-theme="ios"] .ios-bar { left: var(--rail); }
}

/* ---------- нижние меню: плавающая карточка с «ручкой» ---------- */
[data-theme="ios"] .sheet-scrim { background: rgba(0, 0, 0, .25); }
[data-theme="ios"] .sheet-body {
  left: 8px; right: 8px; bottom: calc(var(--safe-b) + 8px); border-radius: 34px; padding: 6px 12px 12px;
  background: var(--surface); box-shadow: 0 12px 48px rgba(0, 0, 0, .2);
  animation: ios-up .35s cubic-bezier(.2, .9, .3, 1.05);
}
@keyframes ios-up { from { transform: translateY(110%); } }
[data-theme="ios"] .sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: var(--surface3); margin: 6px auto 10px; }
[data-theme="ios"] .sheet-title { font-size: 13px; text-transform: uppercase; letter-spacing: .02em; padding: 4px 16px 6px; }
[data-theme="ios"] .sheet-item { min-height: 50px; padding: 0 16px; border-radius: 14px; font-size: 17px; }
[data-theme="ios"] .sheet-item:active { background: var(--fill); }
[data-theme="ios"] .sheet-item.active { background: var(--accent-soft); color: var(--accent); }
[data-theme="ios"] .sheet-sep { background: var(--line); height: .5px; margin: 6px 16px; }
[data-theme="ios"] .fx-item { background: var(--surface2); border-radius: 18px; }
[data-theme="ios"] .fx-f { font-family: ui-serif, 'New York', 'Noto Serif', Georgia, serif; }

/* ---------- уведомление сверху, как баннер iOS ---------- */
[data-theme="ios"] .toast,
[data-theme="ios"] body.has-stop .toast {
  top: calc(env(safe-area-inset-top) + 8px); bottom: auto; transform: translate(-50%, -12px);
  padding: 12px 18px; border-radius: 100px; font-size: 15px; font-weight: 500; text-align: center;
  background: var(--glass); color: var(--text); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: .5px solid var(--glass-line); box-shadow: var(--glass-shadow); transition: opacity .25s, transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
[data-theme="ios"] .toast.show { transform: translate(-50%, 0); }

/* ---------- мастер первого запуска ---------- */
[data-theme="ios"] .ob-step h2 { font-size: 34px; font-weight: 700; line-height: 1.15; }
[data-theme="ios"] .ob-logo { border-radius: 22%; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
[data-theme="ios"] .ob-num { font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .02em; }
[data-theme="ios"] .ob-steps li b { font-weight: 600; }
[data-theme="ios"] .ob-sub { border-radius: 14px; }
[data-theme="ios"] .lecture-text { background: var(--fill); }
[data-theme="ios"] .keys kbd { background: var(--fill); }
[data-theme="ios"] :is(.seg, .hint, .switch) + .card-title { margin-top: 22px; }
