/* Цвета взяты с фото доктора: малиновый фон и лаймовое кольцо. */
:root {
  --pink: #FC2F84;
  --pink-hi: #FF6FAE;
  --pink-lo: #E0106B;
  --lime: #C2FB30;
  --lime-hi: #DCFF73;
  --lime-lo: #9FDB0E;
  --violet: #8B5CF6;

  --bg: #F6F1F5;
  --card: #FFFFFF;
  --card-2: #FBF8FA;
  --text: #17121A;
  --muted: #8A8190;
  --hairline: rgba(23, 18, 26, .08);
  --shadow: 0 1px 2px rgba(60, 20, 45, .04), 0 8px 24px rgba(120, 30, 80, .08);
  --shadow-pink: 0 10px 28px rgba(252, 47, 132, .38);
  --glass: rgba(255, 255, 255, .72);

  --grad-pink: linear-gradient(135deg, var(--pink-hi) 0%, var(--pink) 48%, var(--pink-lo) 100%);
  --grad-lime: linear-gradient(135deg, var(--lime-hi) 0%, var(--lime) 55%, var(--lime-lo) 100%);
  --grad-hero: linear-gradient(150deg, #FF4F98 0%, #FC2F84 40%, #D40F68 100%);

  --r-lg: 26px;
  --r-md: 20px;
  --r-sm: 14px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --safe-top: max(var(--tg-content-safe-area-inset-top, 0px), 0px);
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0F0B11;
  --card: #1C171F;
  --card-2: #241E28;
  --text: #F6F1F7;
  --muted: #9D93A3;
  --hairline: rgba(255, 255, 255, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  --glass: rgba(28, 23, 31, .72);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; text-align: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.caption { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ── фон ─────────────────────────────────────────────────────── */
.bg-blobs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-blobs i {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35;
  animation: float 18s ease-in-out infinite alternate;
}
.bg-blobs i:nth-child(1) { width: 320px; height: 320px; background: var(--pink); top: -140px; right: -120px; }
.bg-blobs i:nth-child(2) { width: 260px; height: 260px; background: var(--lime); top: 38%; left: -150px; opacity: .25; animation-duration: 22s; }
.bg-blobs i:nth-child(3) { width: 220px; height: 220px; background: var(--violet); bottom: -120px; right: -60px; opacity: .14; animation-duration: 26s; }
:root[data-theme="dark"] .bg-blobs i { opacity: .2; }
@keyframes float {
  to { transform: translate3d(30px, 40px, 0) scale(1.12); }
}

/* ── экраны ──────────────────────────────────────────────────── */
.screens { position: relative; z-index: 1; height: 100%; max-width: 560px; margin: 0 auto; }
.screen {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + var(--safe-top)) 16px calc(112px + var(--safe-bottom));
  opacity: 0; visibility: hidden;
  transform: translateX(24px);
  transition: opacity .35s var(--ease), transform .45s var(--ease), visibility 0s .45s;
}
.screen.is-left { transform: translateX(-24px); }
.screen.is-active {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .35s var(--ease), transform .45s var(--ease), visibility 0s;
}

.reveal { opacity: 0; transform: translateY(16px) scale(.985); }
.screen.is-active .reveal {
  animation: reveal .6s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes reveal { to { opacity: 1; transform: none; } }

.large-title { padding: 6px 4px 14px; }
.large-title h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.eyebrow { color: var(--muted); font-size: 15px; font-weight: 500; margin-bottom: 2px; }

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* ── нажатие: пружина как в iOS ──────────────────────────────── */
.pressable { transition: transform .45s var(--spring), filter .2s; will-change: transform; }
.pressable.is-pressed { transform: scale(.96); transition: transform .12s ease-out; filter: brightness(.97); }

/* ── герой ───────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  padding: 18px;
  color: #fff;
  background: var(--grad-hero);
  box-shadow: var(--shadow-pink);
}
.hero-glow {
  position: absolute; width: 240px; height: 240px; right: -70px; top: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(194, 251, 48, .55), transparent 65%);
  animation: float 9s ease-in-out infinite alternate;
}
.hero-row { position: relative; display: flex; align-items: center; gap: 14px; }
.avatar-ring {
  flex: none; width: 76px; height: 76px; border-radius: 50%; padding: 4px;
  background: conic-gradient(from 210deg, var(--lime-hi), var(--lime), var(--lime-lo), var(--lime-hi));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  animation: breathe 4s ease-in-out infinite;
}
.avatar-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
@keyframes breathe { 50% { transform: scale(1.04); } }
.hero-text h2 { font-size: 20px; font-weight: 750; letter-spacing: -.01em; line-height: 1.15; }
.hero-text p { opacity: .85; font-size: 14px; margin-top: 4px; }
.chips { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip {
  font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.chip-lime { background: var(--lime); color: #1d2a00; }

/* ── подарок ─────────────────────────────────────────────────── */
.gift { margin-top: 14px; padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.gift-badge {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: var(--grad-lime);
  box-shadow: 0 6px 16px rgba(159, 219, 14, .35);
  animation: wiggle 5s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 86%, 100% { transform: rotate(0); }
  89% { transform: rotate(-10deg) scale(1.06); }
  92% { transform: rotate(9deg) scale(1.06); }
  95% { transform: rotate(-5deg); }
}
.gift .caption { color: var(--pink); }
.gift h3 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; }
.gift .muted { font-size: 14px; margin-top: 4px; }
.gift .btn { grid-column: 1 / -1; margin-top: 14px; }

/* ── кнопки ──────────────────────────────────────────────────── */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 16px;
  font-weight: 650; font-size: 16px; letter-spacing: -.005em;
  transition: transform .45s var(--spring), box-shadow .3s, opacity .2s;
}
.btn-block { width: 100%; }
.btn-primary { color: #fff; background: var(--grad-pink); box-shadow: var(--shadow-pink); }
.btn-lime { color: #1d2a00; background: var(--grad-lime); box-shadow: 0 10px 24px rgba(159, 219, 14, .35); }
.btn-ghost { color: var(--pink); background: rgba(252, 47, 132, .1); }
.btn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-shine {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label, .btn.is-loading .ico { opacity: 0; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.is-done { background: var(--grad-lime); color: #1d2a00; box-shadow: 0 10px 24px rgba(159, 219, 14, .35); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── темы ────────────────────────────────────────────────────── */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 4px 12px; }
.section-head h2 { font-size: 22px; font-weight: 750; letter-spacing: -.015em; }
.section-head .muted { font-size: 14px; }
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.topic {
  position: relative; overflow: hidden;
  min-height: 132px; padding: 14px; border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between;
}
.topic.wide { grid-column: 1 / -1; min-height: 96px; flex-direction: row; align-items: center; gap: 14px; justify-content: flex-start; }
.topic-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px;
  background: var(--tint, rgba(252, 47, 132, .12));
}
.topic > * { position: relative; z-index: 1; }
.topic b { display: block; font-size: 15px; font-weight: 650; line-height: 1.2; letter-spacing: -.005em; }
.topic small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.topic::after {
  content: ""; position: absolute; width: 90px; height: 90px; right: -30px; bottom: -30px; border-radius: 50%;
  background: var(--tint, rgba(252, 47, 132, .12)); filter: blur(4px);
}

/* ── строки и группы ─────────────────────────────────────────── */
.row-card, .group-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.row-card { padding: 14px; }
.row-text { flex: 1; min-width: 0; }
.row-text b { display: block; font-weight: 600; font-size: 16px; }
.row-text small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.tile {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
}
.tile-pink { background: rgba(252, 47, 132, .13); }
.tile-lime { background: rgba(194, 251, 48, .32); }
.tile-violet { background: rgba(139, 92, 246, .14); }
.tile-gray { background: rgba(138, 129, 144, .14); }
.chev { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
.group { margin-top: 14px; overflow: hidden; }
.group-row { padding: 12px 14px; position: relative; }
.group-row + .group-row::before {
  content: ""; position: absolute; top: 0; left: 66px; right: 0; height: 1px; background: var(--hairline);
}
.group-row.pressable.is-pressed { transform: none; background: var(--card-2); }

/* ── кабинет ─────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: 12px; padding: 14px; }
.me-avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; font-weight: 700; color: #fff; background: var(--grad-pink); overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 13px; }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring-bg { stroke: var(--hairline); }
.ring-fg {
  stroke: var(--pink); stroke-dasharray: 113.1;
  stroke-dashoffset: calc(113.1 - 113.1 * var(--p));
  transition: stroke-dashoffset 1.1s var(--ease);
}
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

.segmented {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 16px 0 14px; padding: 3px; border-radius: 12px;
  background: rgba(118, 118, 128, .12);
}
.segmented button { position: relative; z-index: 1; height: 34px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); transition: color .25s; }
.segmented button.is-active { color: var(--text); }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  border-radius: 9px; background: var(--card);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .1), 0 1px 1px rgba(0, 0, 0, .04);
  transition: transform .45s var(--spring);
}

.files { display: grid; gap: 12px; }
.file {
  display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; padding: 14px;
  transition: opacity .3s, transform .45s var(--spring);
}
.file.is-hidden { display: none; }
.file-thumb {
  position: relative; width: 54px; height: 66px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em;
  background: var(--grad-pink);
  box-shadow: 0 6px 14px rgba(252, 47, 132, .3);
}
.file-thumb.lime { background: var(--grad-lime); color: #1d2a00; box-shadow: 0 6px 14px rgba(159, 219, 14, .3); }
.file-thumb.locked { background: linear-gradient(135deg, #CFC8D3, #A79EAD); box-shadow: none; }
.file-thumb::before {
  content: ""; position: absolute; top: 0; right: 0; width: 16px; height: 16px;
  background: linear-gradient(225deg, var(--bg) 50%, rgba(255, 255, 255, .35) 50%);
  border-top-right-radius: 12px;
}
.file-info { min-width: 0; }
.file-info b { display: block; font-size: 16px; font-weight: 650; line-height: 1.25; letter-spacing: -.005em; }
.file-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.file-meta small { color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge-new { color: var(--pink); background: rgba(252, 47, 132, .12); }
.badge-got { color: #3d5700; background: rgba(194, 251, 48, .45); }
.badge-soon { color: var(--muted); background: rgba(138, 129, 144, .14); }
.file .btn { grid-column: 1 / -1; height: 46px; border-radius: 14px; font-size: 15px; }
.file.is-locked { opacity: .78; }

.footnote { text-align: center; color: var(--muted); font-size: 13px; margin: 20px 24px 0; }

/* ── промо ───────────────────────────────────────────────────── */
.promo {
  position: relative; overflow: hidden; padding: 20px; border-radius: var(--r-lg); color: #fff;
  background: linear-gradient(150deg, #2A1530 0%, #3B1640 45%, #A0145E 100%);
  box-shadow: 0 14px 32px rgba(80, 20, 70, .35);
}
.promo-orb {
  position: absolute; width: 200px; height: 200px; right: -60px; top: -70px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--lime-hi), var(--lime) 40%, transparent 70%);
  opacity: .55; filter: blur(6px);
  animation: float 8s ease-in-out infinite alternate;
}
.promo .caption { position: relative; color: var(--lime); }
.promo h3 { position: relative; font-size: 22px; font-weight: 750; line-height: 1.2; letter-spacing: -.015em; margin: 8px 0 6px; max-width: 280px; }
.promo p { position: relative; opacity: .8; font-size: 15px; }
.promo .btn { margin-top: 16px; }

/* ── таб-бар ─────────────────────────────────────────────────── */
.tabbar {
  position: fixed; z-index: 10; left: 16px; right: 16px;
  max-width: 528px; margin: 0 auto;
  bottom: calc(10px + var(--safe-bottom));
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: 64px; padding: 6px; border-radius: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  box-shadow: 0 10px 30px rgba(60, 20, 45, .14), inset 0 0 0 1px var(--hairline);
}
.tabbar button {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; transition: color .3s;
}
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; transition: transform .45s var(--spring); }
.tabbar button.is-active { color: #fff; }
.tabbar button.is-active svg { transform: translateY(-1px) scale(1.06); fill: rgba(255, 255, 255, .25); }
.tab-pill {
  position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 3);
  border-radius: 18px; background: var(--grad-pink); box-shadow: 0 6px 16px rgba(252, 47, 132, .4);
  transition: transform .5s var(--spring);
}

/* ── шторка ──────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(10, 4, 12, .4);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: 88%; overflow-y: auto;
  padding: 8px 18px calc(22px + var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--card);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  transform: translateY(105%);
  transition: transform .5s var(--ease);
}
.sheet.is-open { transform: translateY(var(--drag, 0px)); }
.sheet.is-dragging { transition: none; }
.sheet-grabber { width: 38px; height: 5px; border-radius: 3px; margin: 2px auto 14px; background: var(--hairline); background: rgba(138, 129, 144, .35); }
.sheet-hero { display: flex; align-items: center; gap: 14px; }
.sheet-hero .topic-ico { width: 58px; height: 58px; border-radius: 18px; font-size: 30px; }
.sheet h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sheet-lead { margin: 16px 0 6px; font-size: 16px; line-height: 1.45; }
.sheet-points { margin: 12px 0 4px; padding: 0; list-style: none; display: grid; gap: 8px; }
.sheet-points li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--card-2); font-size: 15px; }
.sheet-points li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--grad-pink); }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { width: 100%; }
.sheet-note { margin-top: 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── тост ────────────────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 40; left: 50%; top: calc(12px + var(--safe-top));
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 10px 10px; border-radius: 999px;
  background: var(--glass); color: var(--text);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16), inset 0 0 0 1px var(--hairline);
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transform: translate(-50%, -140%) scale(.9); opacity: 0;
  transition: transform .55s var(--spring), opacity .3s;
}
.toast.is-shown { transform: translate(-50%, 0) scale(1); opacity: 1; }
.toast-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-lime); color: #1d2a00; font-weight: 900; font-size: 14px; }
.toast.is-error .toast-ico { background: var(--grad-pink); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
