/* Платформа «НенормальнаЯ» — кабинет участницы. Оформление по макетам проекта. */
:root {
  --bg: #f8eee4;   /* совпадает с верхом фоновой картинки — статус-бар не выделяется */
  --card: #fffdfb;
  --line: #eee5da;
  --line-soft: #f4ece2;
  --txt: #2f2a25;
  --dim: #6f6660;
  --mute: #a2988d;

  --acc: #c4715a;          /* терракота: кнопки, ссылки, активная вкладка */
  --acc-deep: #b3644e;
  --acc-soft: #f8e5dd;     /* пудровая заливка */
  --rose: #c8977f;
  --sage: #7f9a78;         /* выполнено */
  --sage-soft: #e7efe4;
  --ochre: #c1913f;        /* сдано после срока */
  --lock: #e9e3da;
  --dot: #5b3f31;

  --radius: 22px;
  --shadow: 0 14px 34px rgba(120, 95, 70, 0.09);
  --font: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { background: var(--bg); }  /* этим цветом iOS красит полосу статус-бара в установленном приложении */
body {
  margin: 0; color: var(--txt); font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background: transparent; /* важно: заливка body перекрывала бы слой с фоновой картинкой */
}
/* фон — отдельным слоем на весь экран: всегда заполняет его целиком, на любом устройстве */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg) url("../img/bg-mobile.webp") center center / cover no-repeat;
}
@media (min-width: 760px) {
  body::before { background-image: url("../img/bg-desktop.webp"); }
}
a { color: var(--acc); text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }

/* ------------------------------------------------------------ типографика */
h1 {
  font-family: var(--serif); font-size: clamp(30px, 8.6vw, 38px); font-weight: 600;
  margin: 26px 0 8px; line-height: 1.15; letter-spacing: 0.2px;
}
h2 { font-family: var(--serif); font-size: 23px; font-weight: 600; margin: 0 0 10px; }
h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 12px; letter-spacing: 0.2px; }
.lead { color: var(--dim); margin: 0 0 20px; font-size: 14.5px; line-height: 1.6; }
.muted { color: var(--mute); font-size: 13px; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.spacer { margin-left: auto; }

/* ---------------------------------------------------------------- каркас */
.wrap { max-width: 560px; margin: 0 auto; padding: 8px 18px calc(112px + env(safe-area-inset-bottom)); }
.top { display: none; } /* заголовок страницы живёт в контенте, как в макетах */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 253, 251, 0.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-soft); border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 28px rgba(120, 95, 70, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in { max-width: 560px; margin: 0 auto; display: flex; padding: 9px 10px 7px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 3px 0 5px; color: #8a8079; font-size: 12px; font-weight: 500;
}
.tabbar .ico { display: grid; place-items: center; width: 62px; height: 34px; border-radius: 18px; transition: 0.18s; }
.tabbar a.active { color: var(--acc); }
.tabbar a.active .ico { background: var(--acc-soft); }
.tabbar a:active .ico { transform: scale(0.94); }

/* -------------------------------------------------------------- элементы */
.card {
  background: var(--card); border: 1px solid rgba(238, 229, 218, 0.7); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 22px;
  border-radius: 14px; background: var(--acc); color: #fff; border: none; cursor: pointer;
  font-weight: 500; font-size: 15px; transition: 0.16s;
}
.btn:hover { background: var(--acc-deep); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: #fff; color: var(--acc); border: 1px solid var(--acc-soft); }
.btn.ghost:hover { background: var(--acc-soft); }
.btn.sm { padding: 9px 15px; font-size: 13.5px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.plain { background: none; color: var(--acc); padding: 8px 0; }
.btn.plain:hover { background: none; text-decoration: underline; }

.inp, textarea.inp, select.inp {
  width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 15px; outline: none; transition: 0.15s;
}
.inp:focus { border-color: var(--rose); box-shadow: 0 0 0 3px var(--acc-soft); }
textarea.inp { resize: vertical; min-height: 96px; line-height: 1.6; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 7px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 20px;
  font-size: 12.5px; background: var(--acc-soft); color: var(--acc);
}
.pill.ok { background: var(--sage); color: #fff; }
.pill.lock { background: var(--lock); color: #8c8579; }
.pill.late { background: var(--ochre); color: #fff; }

.ava {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--acc-soft);
  display: grid; place-items: center; color: var(--acc); font-weight: 600; flex: none;
}
.ava.sm { width: 36px; height: 36px; font-size: 14px; }

.empty { text-align: center; color: var(--mute); padding: 38px 16px; }
.empty svg { width: 34px; height: 34px; opacity: 0.4; margin-bottom: 10px; }
.loader {
  width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--acc);
  border-radius: 50%; animation: spin 0.7s linear infinite; margin: 36px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice { background: var(--acc-soft); border-radius: 14px; padding: 13px 15px; font-size: 13.5px; color: #8a5340; line-height: 1.55; }
.num-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--acc); color: var(--acc);
  display: grid; place-items: center; font-size: 13px; font-weight: 500; flex: none;
}

/* ------------------------------------------------------------- программа */
.day-badge {
  display: inline-flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--acc); color: var(--acc); border-radius: 30px; padding: 9px 18px; font-size: 14px;
}
.day-badge b { font-weight: 600; }

.practice {
  display: flex; gap: 16px; align-items: flex-start; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid rgba(238, 229, 218, 0.7); border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); transition: 0.16s; font-family: inherit;
}
.practice:hover { transform: translateY(-1px); }
.practice.locked { background: rgba(252, 249, 245, 0.72); box-shadow: none; opacity: 0.85; cursor: not-allowed; }
.practice.locked:hover { transform: none; }
.practice .n {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--acc); color: var(--acc); font-size: 19px; font-weight: 500; flex: none;
  font-family: var(--serif);
}
.practice.done .n { background: var(--sage); border-color: var(--sage); color: #fff; }
.practice.locked .n { border-color: #d9d2c8; color: #a9a196; }
.practice .body { flex: 1; min-width: 0; padding-top: 2px; }
.practice .body b { display: block; font-weight: 500; font-size: 15.5px; margin-bottom: 3px; line-height: 1.35; }
.practice .body > span:not(.marks) { font-size: 13.5px; color: var(--mute); display: block; }
.practice .marks .pill { font-size: 12.5px; }
.practice .marks { margin-top: 10px; display: flex; gap: 7px; flex-wrap: wrap; }

/* -------------------------------------------------------------- практика */
.back-link { display: inline-flex; align-items: center; gap: 9px; color: var(--acc); font-size: 14.5px; margin-top: 18px; }
.content { line-height: 1.7; color: var(--dim); }
.content p { margin: 0 0 14px; }
.content p:last-child { margin-bottom: 0; }
.content .prayer { font-style: italic; color: var(--txt); line-height: 1.8; }
.content figure.mat { margin: 0 0 16px; }
.content figure.mat img { width: 100%; border-radius: 14px; display: block; }
.content figure.mat figcaption { font-size: 12.5px; color: var(--mute); margin-top: 7px; text-align: center; }
.mat-audio {
  background: var(--acc-soft); border-radius: 14px; padding: 14px 16px; margin: 16px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.mat-audio b { font-size: 14px; color: var(--acc); font-weight: 600; }
.mat-audio audio { width: 100%; }
.materials { display: flex; flex-direction: column; gap: 9px; }
.materials a {
  display: flex; align-items: center; gap: 11px; padding: 13px 16px; background: var(--acc-soft);
  border-radius: 13px; color: var(--acc); font-size: 14px;
}
.materials svg { width: 17px; height: 17px; flex: none; }
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cards-grid img { border-radius: 13px; border: 1px solid var(--line); cursor: zoom-in; width: 100%; }
@media (max-width: 520px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }

.qa { margin-bottom: 18px; }
.qa label { display: block; font-size: 14.5px; margin-bottom: 9px; color: var(--txt); font-weight: 500; line-height: 1.45; }
.qa .num { color: var(--acc); margin-right: 6px; }

.attach-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.attach-row > .btn.ghost.sm, .attach-row > label.btn { flex: 1; min-width: 120px; justify-content: center; padding: 12px 10px; font-size: 13px; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--acc-soft); color: var(--acc);
  border-radius: 20px; padding: 7px 13px; font-size: 12.5px;
}
.chip button { background: none; border: none; color: inherit; cursor: pointer; padding: 0; line-height: 1; opacity: 0.7; }
.rec.on { color: var(--acc-deep); }

/* ----------------------------------------------------------------- лента */
.post {
  display: flex; gap: 13px; background: rgba(252, 249, 245, 0.85); border-radius: 16px;
  padding: 15px; margin-bottom: 11px;
}
.post:last-child { margin-bottom: 0; }
.post.expert { background: var(--acc-soft); }
.post .who { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; flex-wrap: wrap; }
.post .who b { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.post .who .when { font-size: 12.5px; color: var(--mute); }
.post .who .who-src { font-size: 12.5px; color: var(--mute); }
.post .txt { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.post .answers { margin-top: 8px; }
.post .answers div { margin-bottom: 10px; }
.post .answers i { display: block; font-style: normal; color: var(--mute); font-size: 12.5px; margin-bottom: 2px; }
.post .reply-to {
  font-size: 13.5px; color: var(--dim); background: rgba(255, 255, 255, 0.75);
  border-left: 3px solid var(--rose); padding: 9px 13px; border-radius: 0 10px 10px 0; margin-bottom: 8px;
}
.post audio { width: 100%; max-width: 330px; margin-top: 9px; }
.post .shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.post .shots img { width: 118px; height: 118px; object-fit: cover; border-radius: 13px; cursor: zoom-in; }
.post-actions { margin-top: 9px; display: flex; gap: 16px; font-size: 13px; }
.post-actions button {
  background: none; border: none; color: var(--acc); cursor: pointer; padding: 0;
  border-bottom: 1px solid var(--acc-soft);
}
.post-actions button:hover { border-bottom-color: var(--acc); }
.pill.expert-tag { background: rgba(255, 255, 255, 0.8); color: var(--acc); padding: 4px 11px; font-size: 12px; }

.chat-scroll { max-height: 62vh; overflow-y: auto; margin: -4px -4px 0; padding: 4px; }
.composer { position: sticky; bottom: 0; background: var(--card); padding-top: 12px; }

/* ------------------------------------------------------ переключатели */
.switch-row { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.switch-text { flex: 1; min-width: 0; }
.switch-text b { display: block; font-weight: 500; font-size: 15px; }
.switch-text span { display: block; font-size: 13px; color: var(--mute); }
.field label.switch, label.switch { display: inline-flex !important; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 0; }
.switch input { display: none; }
.switch i {
  width: 52px; height: 30px; border-radius: 16px; background: #e2dacf; position: relative;
  transition: 0.2s; flex: none;
}
.switch i::after {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: 0.2s; box-shadow: 0 1px 4px rgba(60, 40, 20, 0.25);
}
.switch input:checked + i { background: var(--sage); }
.switch input:checked + i::after { left: 25px; }
.switch em { font-style: normal; font-size: 13.5px; color: var(--mute); min-width: 34px; }
.switch input:checked ~ em { color: var(--sage); font-weight: 600; }

.time-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 14px; color: var(--dim); }
.time-row input { width: 128px; text-align: center; }
.hint-line { font-size: 12.5px; color: var(--mute); margin-top: 8px; line-height: 1.5; }

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

.auth {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  max-width: 440px; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.auth-hero { text-align: center; }
.auth-hero .mark { width: min(240px, 62vw); height: auto; display: block; margin: 0 auto; }
.auth-title { font-family: var(--serif); font-size: clamp(32px, 9.5vw, 42px); font-weight: 600; color: #3b322b; margin: 2px 0 0; }
.auth-tagline { font-family: var(--serif); font-size: clamp(17px, 4.8vw, 20px); color: var(--rose); margin: 4px 0 0; }
.orn { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 20px; }
.orn i { display: block; width: 64px; height: 1px; background: linear-gradient(90deg, transparent, #dfd0bf); }
.orn i:last-child { background: linear-gradient(270deg, transparent, #dfd0bf); }

.auth-card {
  background: rgba(255, 253, 251, 0.95); backdrop-filter: blur(6px);
  border-radius: 26px; padding: 24px 22px; box-shadow: 0 20px 60px rgba(122, 96, 70, 0.14);
}
.ac-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ac-head h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; color: #3b322b; }
.ac-ico { width: 46px; height: 46px; border-radius: 50%; background: #f1eae1; color: #8b8177; display: grid; place-items: center; flex: none; }
.ac-text { color: var(--mute); font-size: 14.5px; line-height: 1.65; margin: 0 0 18px; }
.ac-div { height: 1px; background: var(--line-soft); margin: 18px 0; }
.ac-err { color: #c15f5f; font-size: 13.5px; margin: 14px 0 0; }

.ac-btn {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 16px; margin-bottom: 12px;
  border: none; border-radius: 16px; cursor: pointer; text-align: left; font-size: 15.5px; color: #3b322b;
  transition: 0.16s; font-family: inherit;
}
.ac-btn .cap { flex: 1; }
.ac-btn .badge { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); display: grid; place-items: center; flex: none; }
.ac-btn .chev { color: #a2988d; flex: none; }
.ac-btn.tg { background: #ccd5c6; }
.ac-btn.tg .badge { color: #64735a; }
.ac-btn.mail { background: var(--acc-soft); }
.ac-btn.mail .badge { color: var(--acc); }
.ac-btn.tg:hover, .ac-btn.mail:hover { transform: translateY(-1px); }
.ac-btn.soon { background: transparent; border: 1px solid var(--line); color: var(--mute); cursor: default; margin-bottom: 0; }
.ac-btn.soon .badge { background: #f7f2ec; color: #b6aa9c; }
.soon-tag { font-size: 12px; color: #b6aa9c; background: #f7f2ec; border-radius: 20px; padding: 3px 10px; }

.ac-back { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; color: var(--acc); font-size: 14.5px; padding: 0 0 16px; font-family: inherit; }
.ac-wait { text-align: center; color: var(--mute); font-size: 14px; line-height: 1.6; padding: 6px 0 4px; }
.ac-wait .loader { margin: 6px auto 14px; }
.code-input { letter-spacing: 10px; font-size: 22px; text-align: center; font-weight: 600; }
.auth-foot { text-align: center; margin-top: 26px; color: var(--mute); font-size: 13.5px; line-height: 1.7; }
.auth-foot p { margin: 8px 0 0; }
.auth-foot .heart { color: var(--rose); display: inline-flex; }

.seg { display: flex; gap: 6px; background: #f3ece4; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px;
  border: none; background: transparent; border-radius: 9px; color: var(--dim); font-size: 13.5px; cursor: pointer;
}
.seg-btn.active { background: var(--card); color: var(--txt); font-weight: 600; box-shadow: 0 2px 8px rgba(120, 95, 70, 0.08); }

@media (max-height: 880px) {
  .auth { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .auth-hero .mark { width: min(190px, 50vw); }
  .auth-title { font-size: clamp(29px, 8.4vw, 36px); }
  .auth-tagline { font-size: 16px; }
  .orn { margin: 8px 0 14px; }
  .auth-card { padding: 18px 17px; border-radius: 22px; }
  .ac-head { margin-bottom: 10px; }
  .ac-head h2 { font-size: 20px; }
  .ac-ico { width: 40px; height: 40px; }
  .ac-text { margin-bottom: 12px; font-size: 13.5px; }
  .ac-div { margin: 12px 0; }
  .ac-btn { padding: 11px 14px; margin-bottom: 9px; font-size: 15px; }
  .ac-btn .badge { width: 38px; height: 38px; }
  .auth-foot { margin-top: 14px; font-size: 12.5px; }
}

/* ------------------------------------------------ установка приложения */
.install-bar {
  position: fixed; left: 12px; right: 12px; z-index: 40; display: flex; align-items: center; gap: 12px;
  bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 34px rgba(120, 95, 70, 0.18);
  animation: rise 0.25s ease;
}
.install-bar img { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.install-bar b { display: block; font-size: 14px; }
.install-bar span { display: block; font-size: 12px; color: var(--dim); }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@media (min-width: 760px) { .install-bar { left: auto; right: 20px; max-width: 420px; } }

/* --------------------------------------------------------- служебное */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 108px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 420px; }
.toast { background: #3b3129; color: #fff; border-radius: 13px; padding: 13px 16px; font-size: 14px; box-shadow: var(--shadow); }
.toast.bad { background: #b8574f; }
.toast.ok { background: var(--sage); }

.overlay { position: fixed; inset: 0; background: rgba(48, 38, 30, 0.72); display: grid; place-items: center; z-index: 80; padding: 20px; }
.overlay img { max-height: 88vh; border-radius: 14px; }
.overlay .card { max-width: 430px; }
.ask-ico {
  width: 62px; height: 62px; border-radius: 50%; background: var(--acc-soft); color: var(--acc);
  display: grid; place-items: center; margin: 0 auto;
}

@media (display-mode: standalone) {
  .wrap { padding-top: calc(8px + env(safe-area-inset-top)); }
}

/* ------------------------------------------------------------ свой плеер */
.aplayer {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; margin: 12px 0;
  box-shadow: 0 4px 14px rgba(120, 95, 70, 0.05);
}
.mat-audio .aplayer { margin: 0; background: #fff; border-color: #f0dfd6; }
.aplayer.playing { border-color: var(--acc-soft); box-shadow: 0 6px 18px rgba(196, 113, 90, 0.13); }
.ap-play {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}
.ap-play:hover { background: var(--acc-deep); }
.ap-play:active { transform: scale(0.94); }
.ap-play svg { width: 20px; height: 20px; }
.ap-main { flex: 1; min-width: 0; }
.ap-bar { position: relative; height: 6px; border-radius: 4px; background: var(--line); }
.ap-buf { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--line-soft); }
.ap-done {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--rose), var(--acc));
}
.ap-knob {
  position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: #fff; border: 2px solid var(--acc); pointer-events: none;
  box-shadow: 0 1px 4px rgba(120, 95, 70, 0.28);
}
.ap-seek {
  position: absolute; inset: -10px 0; width: 100%; height: 26px; margin: 0;
  opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: none;
}
.ap-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; }
.ap-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums;
}
.ap-state { color: var(--acc); font-size: 11.5px; }
.ap-side { flex: none; display: flex; align-items: center; gap: 2px; }
.ap-mini, .ap-rate {
  border: 0; background: none; cursor: pointer; color: var(--dim);
  display: flex; align-items: center; justify-content: center; border-radius: 10px;
}
.ap-mini { position: relative; width: 34px; height: 34px; }
.ap-mini svg { width: 17px; height: 17px; }
.ap-mini i {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-style: normal; padding-top: 2px; letter-spacing: -0.3px;
}
.ap-rate { min-width: 36px; height: 34px; font-size: 12.5px; font-weight: 600; color: var(--acc); }
.ap-mini:hover, .ap-rate:hover { background: var(--acc-soft); color: var(--acc); }
.aplayer.mini { padding: 9px 11px; gap: 10px; margin: 9px 0 0; max-width: 340px; }
.aplayer.mini .ap-play { width: 36px; height: 36px; }
.aplayer.mini .ap-play svg { width: 16px; height: 16px; }

/* --------------------------------------------- переход к соседним практикам */
.pnav { display: flex; gap: 10px; margin-top: 14px; }
.pnav a, .pnav span {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 14px; color: var(--txt); box-shadow: var(--shadow);
}
.pnav .to-next { flex-direction: row-reverse; text-align: right; }
.pnav span { opacity: 0.45; box-shadow: none; }
.pnav svg { flex: none; width: 18px; height: 18px; color: var(--acc); }
.pnav b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.pnav u { display: block; font-size: 11.5px; color: var(--mute); text-decoration: none; margin-bottom: 2px; }
.pnav .txt { min-width: 0; flex: 1; }
.pnav .txt b { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 420px) { .pnav { flex-direction: column; } .pnav .to-next { flex-direction: row; text-align: left; } }

/* стрелки перехода в шапке практики */
.prow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pjump { display: flex; align-items: center; gap: 4px; margin-top: 18px; }
.pjump a, .pjump .off {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--acc);
  box-shadow: 0 3px 10px rgba(120, 95, 70, 0.06);
}
.pjump a:hover { background: var(--acc-soft); }
.pjump a:active { transform: scale(0.93); }
.pjump .off { color: var(--mute); opacity: 0.4; box-shadow: none; }
.pcount { font-size: 12.5px; color: var(--mute); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }

/* ====================================================== чат как мессенджер */
/* Экран занимает ровно высоту окна: список сообщений прокручивается сам,
   строка ввода всегда внизу, а при открытой клавиатуре поднимается над ней. */
body.chat-mode { overflow: hidden; }
/* Экран чата держится за видимую часть окна, а не за страницу: когда iOS поднимает
   страницу под клавиатуру, мы возвращаем экран на место сами (--vvtop) и подрезаем
   высоту (--vvh). Иначе нижняя панель уезжала на середину экрана. */
.wrap.chat-page {
  position: fixed; top: 0; left: 0; right: 0; margin: 0 auto;
  display: flex; flex-direction: column;
  height: var(--vvh, 100dvh);
  transform: translateY(var(--vvtop, 0px));
  padding: 0 12px; overflow: hidden;
}
.chat-head { padding: 16px 6px 8px; flex: none; }
.chat-head b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.chat-head span { font-size: 12.5px; color: var(--mute); }

.chat-list {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 2px 12px; display: flex; flex-direction: column;
}
.chat-empty { margin: auto; }

.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.msg.grouped { margin-top: 3px; }
.msg.mine { flex-direction: row-reverse; }
.ava-gap { width: 36px; flex: none; }
.msg .ava { flex: none; }
.bub {
  max-width: 78%; background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 18px 18px 18px 7px; padding: 9px 13px 6px;
  box-shadow: 0 2px 9px rgba(120, 95, 70, 0.05);
}
.msg.mine .bub { background: var(--acc-soft); border-color: transparent; border-radius: 18px 18px 7px 18px; }
.msg.expert .bub { background: var(--sage-soft); border-color: transparent; }
.bub .nm { display: block; font-size: 12.5px; font-weight: 600; color: var(--acc); margin-bottom: 3px; }
.msg.expert .bub .nm { color: var(--sage); }
.bub .txt { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.45; }
.bub .tm { display: block; text-align: right; font-size: 10.5px; color: var(--mute); margin-top: 3px; }
.bub .shots img { width: 150px; height: 150px; }
.bub .aplayer { max-width: 260px; margin: 8px 0 2px; }
.msg-reply {
  flex: none; border: 0; background: none; padding: 4px; color: var(--mute);
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.msg:hover .msg-reply { opacity: 1; }
@media (hover: none) { .msg-reply { opacity: 0.4; } }

.daysep { text-align: center; margin: 16px 0 4px; }
.daysep span {
  font-size: 11.5px; color: var(--dim); background: rgba(255, 255, 255, 0.75);
  padding: 4px 13px; border-radius: 20px;
}

/* ---- строка ввода */
.composer-wrap {
  flex: none; padding: 6px 0 10px;
  /* высоту таббара меряем вживую (--tabh): на iPhone к ней добавляется полоска «домой» */
  margin-bottom: var(--tabh, calc(74px + env(safe-area-inset-bottom)));
}
.composer-wrap .reply-to {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim);
  background: rgba(255, 255, 255, 0.8); border-left: 3px solid var(--rose);
  padding: 8px 12px; border-radius: 0 10px 10px 0; margin-bottom: 8px;
}
.composer-wrap .reply-to svg { width: 14px; height: 14px; color: var(--acc); }
.cprev { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cprev:empty { display: none; }
.composer {
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 26px;
  padding: 5px 6px; box-shadow: 0 6px 22px rgba(120, 95, 70, 0.1);
}
.composer textarea {
  flex: 1; min-width: 0; border: 0; background: none; resize: none; outline: none;
  padding: 11px 4px 10px; max-height: 130px; font-size: 15px; line-height: 1.35;
}
.cbtn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: var(--acc); display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.cbtn:active { transform: scale(0.92); }
.cbtn.send { background: var(--acc); color: #fff; }
.cbtn.mic.on { background: #c9564a; color: #fff; }
.cbtn.busy { opacity: 0.45; pointer-events: none; }
.stop-sq { width: 13px; height: 13px; border-radius: 3px; background: currentColor; }

.recbar {
  display: flex; align-items: center; gap: 9px; margin-bottom: 8px;
  background: var(--card); border-radius: 18px; padding: 10px 14px; font-size: 13px;
  box-shadow: 0 4px 14px rgba(120, 95, 70, 0.08);
}
.recbar .dot { width: 9px; height: 9px; border-radius: 50%; background: #c9564a; animation: recpulse 1s infinite; }
.recbar b { font-variant-numeric: tabular-nums; min-width: 34px; }
.recbar .hint { flex: 1; color: var(--mute); font-size: 12px; }
.recbar button { border: 0; background: none; color: var(--acc); cursor: pointer; font-size: 13px; }
@keyframes recpulse { 50% { opacity: 0.2; } }

/* Клавиатура открыта — нижняя панель уезжает вниз, строка ввода прижимается к клавиатуре.
   Убираем именно через bottom: на панели стоит backdrop-filter, а с ним transform не срабатывает. */
.tabbar { transition: bottom 0.22s ease; }
body.kb-open .tabbar { bottom: -160px; pointer-events: none; }
body.kb-open .composer-wrap { margin-bottom: 0; padding-bottom: 6px; }
body.chat-mode.recording .chat-list { opacity: 0.55; transition: opacity 0.2s; }

/* ---------------------------- масштаб экрана двумя пальцами всегда выключен */
html, body { touch-action: pan-x pan-y; }

/* «потянуть вниз, чтобы обновить» */
.ptr {
  position: fixed; top: 6px; left: 50%; z-index: 60;
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--acc); border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(120, 95, 70, 0.14);
  transform: translate(-50%, 0); opacity: 0; pointer-events: none;
}
.ptr.ready { color: #fff; background: var(--acc); border-color: var(--acc); }
.ptr.spin svg { animation: ptrspin 0.9s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

/* практика: вертикальная прокрутка — браузеру, горизонтальный жест — наш */
.wrap.practice-page { touch-action: pan-y; will-change: transform; }

/* ------------------------------------------------------- видео в практике */
.vid {
  position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 16px;
  border-radius: 14px; overflow: hidden; background: #efe3d8;
}
.vid iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ----------------------------------------- юридические документы под входом */
.auth-docs {
  margin: 14px auto 0; max-width: 420px; text-align: center;
  font-size: 11.5px; line-height: 1.9; color: var(--mute);
}
.auth-docs a { color: var(--mute); text-decoration: underline; text-underline-offset: 2px; }
.auth-docs a:hover { color: var(--acc); }
.auth-docs .sep { margin: 0 7px; opacity: 0.6; }

/* ------------------------------------------- «в ответ на» — цитата над текстом */
.quote {
  display: flex; align-items: flex-start; gap: 7px; width: 100%; text-align: left;
  border: 0; border-left: 3px solid var(--rose); background: rgba(255, 255, 255, 0.72);
  border-radius: 0 10px 10px 0; padding: 7px 11px; margin: 0 0 8px; cursor: pointer;
  font: inherit; color: var(--dim);
}
.quote:hover { background: #fff; }
.quote.expert { border-left-color: var(--sage); }
.quote svg { flex: none; width: 13px; height: 13px; margin-top: 3px; color: var(--acc); }
.quote .qt { min-width: 0; font-size: 12.5px; line-height: 1.4; }
.quote .qt i {
  display: block; font-style: normal; font-weight: 600; color: var(--acc); margin-bottom: 1px;
}
.quote.expert .qt i { color: var(--sage); }
.quote .qt { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.msg.mine .quote { background: rgba(255, 255, 255, 0.55); }

/* подсветка сообщения, к которому перешли по цитате */
@keyframes flashmsg {
  0% { box-shadow: 0 0 0 3px var(--acc); }
  100% { box-shadow: 0 0 0 3px rgba(196, 113, 90, 0); }
}
.post.flash, .msg.flash .bub { border-radius: 16px; animation: flashmsg 1.8s ease-out; }

/* ------------------------------------------- команда проекта: админ и модератор */
:root { --admin: #b8342a; --moder: #b07d1c; }
.role-tag {
  display: inline-block; margin-left: 7px; padding: 1px 8px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; color: #fff; vertical-align: middle;
}
.role-tag.admin { background: var(--admin); }
.role-tag.moderator { background: var(--moder); }

/* имя автора красим по роли — и в чате, и в ленте практики */
.msg.admin .bub .nm, .post.admin .who b { color: var(--admin); }
.msg.moderator .bub .nm, .post.moderator .who b { color: var(--moder); }
.msg.admin .bub { border-color: rgba(184, 52, 42, 0.35); }
.msg.moderator .bub { border-color: rgba(176, 125, 28, 0.35); }
.post.admin { background: rgba(184, 52, 42, 0.06); }
.post.moderator { background: rgba(176, 125, 28, 0.07); }
.quote.admin { border-left-color: var(--admin); }
.quote.admin .qt i { color: var(--admin); }
.quote.moderator { border-left-color: var(--moder); }
.quote.moderator .qt i { color: var(--moder); }

/* --------------------------------- голосование за дату выпускного эфира */
.poll-card { margin-bottom: 16px; }
.poll-card.done .poll-final {
  font-family: var(--serif); font-size: 22px; margin: 0 0 6px; color: var(--acc);
}
.poll-card.done .poll-final span { font-family: var(--font); font-size: 12.5px; color: var(--mute); }
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; cursor: pointer; overflow: hidden;
}
.poll-opt.on { border-color: var(--acc); background: var(--acc-soft); }
.poll-opt input { position: absolute; opacity: 0; pointer-events: none; }
.poll-opt .tick {
  flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line);
  display: grid; place-items: center; color: transparent; background: #fff;
}
.poll-opt.on .tick { background: var(--acc); border-color: var(--acc); color: #fff; }
.poll-opt .txt { flex: 1; min-width: 0; }
.poll-opt .txt b { display: block; font-size: 14.5px; font-weight: 500; }
.poll-opt .txt i { display: block; font-style: normal; font-size: 12.5px; color: var(--mute); }
.poll-opt .cnt {
  flex: none; min-width: 26px; text-align: center; font-size: 13px; font-weight: 600; color: var(--acc);
  font-variant-numeric: tabular-nums;
}
.poll-opt .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line-soft); }
.poll-opt .bar i { display: block; height: 100%; background: var(--rose); }
