
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #0a0910;
    --bg2: #110f1e;
    --bg3: #1a1730;
    --card: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.08);
    --gold: #c9a96e;
    --gold2: #e8c98a;
    --mist: #8b7fc7;
    --text: #f0ede8;
    --text2: #9b97b0;
    --text3: #5f5c72;
    --teal: #4ecdc4;
    --rose: #e07b8a;
    --r: 16px;
  }

  html, body {
    width: 100%; min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
  }

  /* PHONE FRAME */
  .frame-wrap {
    display: flex; justify-content: center; align-items: flex-start;
    padding: 32px 16px;
    min-height: 100vh;
    background: #06050d;
  }
  .phone {
    width: 390px;
    background: var(--bg);
    border-radius: 44px;
    border: 1.5px solid rgba(255,255,255,0.12);
    box-shadow: 0 0 80px rgba(139,127,199,0.15), 0 40px 80px rgba(0,0,0,0.6);
    overflow: hidden;
    position: relative;
  }
  /* Notch */
  .notch {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 120px; height: 34px;
    background: #06050d;
    border-radius: 0 0 20px 20px;
    z-index: 100;
  }

  /* TG TOP BAR */
  .tg-bar {
    padding: 40px 20px 12px;
    display: flex; align-items: center; gap: 10px;
    background: rgba(17,15,30,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 0.5px solid var(--border);
    position: sticky; top: 0; z-index: 50;
  }
  .tg-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #534AB7, #c9a96e);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .tg-name { font-size: 14px; font-weight: 500; color: var(--text); }
  .tg-status { font-size: 11px; color: var(--teal); }
  .tg-close {
    margin-left: auto; font-size: 20px; color: var(--text2);
    cursor: pointer; padding: 4px;
  }

  /* SCREENS */
  .screen { display: none; flex-direction: column; min-height: calc(100vh - 88px); }
  .screen.active { display: flex; }

  /* ANIMATIONS */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
  }
  @keyframes rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
  @keyframes pulse {
    0%,100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.05); }
  }
  @keyframes starTwinkle {
    0%,100% { opacity: 0.3; }
    50%      { opacity: 1; }
  }
  @keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes typing {
    0%,100% { opacity: 1; }
    50%      { opacity: 0; }
  }

  /* fill-mode: backwards, а НЕ both — и это не придирка.
     Любое значение transform, кроме none, создаёт контекст наложения.
     При `both` браузер держит значение последнего кадра и после конца
     анимации, причём держит его как матрицу — даже если в кадре написано
     `transform: none`, в вычисленном стиле остаётся matrix(1,0,0,1,0,0).
     То есть каждый блок .fade-up навсегда становился непроницаемым для
     z-index изнутри: подсказка с городами (z-index:100) всё равно
     оказывалась ПОД кнопкой «Рассчитать карту» из следующего блока.
     При `backwards` элемент скрыт до старта (ради задержек delay-1…5),
     а по окончании возвращается к обычным стилям — без transform,
     без контекста наложения. */
  .fade-up { animation: fadeUp .55s ease backwards; }
  .delay-1 { animation-delay: .08s; }
  .delay-2 { animation-delay: .16s; }
  .delay-3 { animation-delay: .24s; }
  .delay-4 { animation-delay: .32s; }
  .delay-5 { animation-delay: .40s; }

  /* ─── SCREEN 1: WELCOME ─── */
  #s-welcome {
    justify-content: center; align-items: center;
    padding: 48px 28px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(139,127,199,0.18) 0%, transparent 70%);
    position: relative; overflow: hidden;
  }
  .star-field { position: absolute; inset: 0; pointer-events: none; }
  .star {
    position: absolute; border-radius: 50%;
    background: white;
    animation: starTwinkle linear infinite;
  }
  .orb {
    width: 180px; height: 180px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%, #534AB7 0%, #1a1730 55%, transparent 80%);
    box-shadow: 0 0 60px rgba(83,74,183,0.4), inset 0 0 40px rgba(201,169,110,0.1);
    margin: 0 auto 32px;
    position: relative;
    animation: pulse 4s ease-in-out infinite;
  }
  .orb-ring {
    position: absolute; inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(201,169,110,0.3);
    animation: rotate 18s linear infinite;
  }
  .orb-ring::after {
    content: '✦';
    position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
    color: var(--gold); font-size: 14px;
  }
  .orb-ring2 {
    position: absolute; inset: -28px;
    border-radius: 50%;
    border: 0.5px solid rgba(139,127,199,0.2);
    animation: rotate 30s linear infinite reverse;
  }
  /* Знаки зодиака по внешнему кольцу.
     Раньше внутри шара не было ничего: пустой градиент, а вокруг два голых
     кольца. На главной странице астрологического приложения это выглядело
     недоделанным — картинка ни о чём не говорила. Двенадцать глифов,
     медленно вращающихся вместе с кольцом, сразу задают тему.
     Раскладку по кругу считает скрипт (astro-app-3.js). */
  .orb-zodiac {
    position: absolute; inset: -28px;
    border-radius: 50%;
    animation: rotate 30s linear infinite reverse;
    pointer-events: none;
  }
  .orb-zodiac span {
    position: absolute; top: 50%; left: 50%;
    font-size: 12px; color: rgba(201,169,110,0.55);
    /* переменная --a приходит из скрипта: угол конкретного знака */
    transform: rotate(var(--a)) translateY(-104px) rotate(calc(-1 * var(--a)));
  }
  /* внутри шара — созвездие: несколько звёзд и связывающие их линии */
  .orb-inner {
    position: absolute; inset: 0;
    border-radius: 50%;
    overflow: hidden;
    opacity: .9;
  }
  .welcome-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 38px; font-weight: 300; letter-spacing: .01em;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 8px;
  }
  .welcome-sub { font-size: 14px; color: var(--text2); margin-bottom: 36px; line-height: 1.6; }
  .gold-tag {
    display: inline-block;
    font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold); background: rgba(201,169,110,0.1);
    border: 0.5px solid rgba(201,169,110,0.3);
    padding: 5px 14px; border-radius: 100px;
    margin-bottom: 20px;
  }
  .btn-primary {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, #534AB7 0%, #3d3589 100%);
    color: white; border: none; border-radius: var(--r);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px; font-weight: 500; cursor: pointer;
    box-shadow: 0 8px 32px rgba(83,74,183,0.4);
    transition: all .2s; letter-spacing: .01em;
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 40px rgba(83,74,183,0.5); }
  .btn-primary:active { transform: scale(.98); }
  .btn-ghost {
    width: 100%; padding: 14px;
    background: transparent; color: var(--text2);
    border: 0.5px solid var(--border); border-radius: var(--r);
    font-family: 'DM Sans', sans-serif; font-size: 14px; cursor: pointer;
    margin-top: 10px; transition: all .2s;
  }
  .btn-ghost:hover { border-color: rgba(255,255,255,0.2); color: var(--text); }

  .social-proof {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 28px;
    font-size: 12px; color: var(--text2);
  }
  .avatars { display: flex; }
  .av {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid var(--bg);
    margin-left: -6px;
    font-size: 10px; display: flex; align-items: center; justify-content: center;
  }
  .av:first-child { margin-left: 0; }

  /* ─── SCREEN 2: INPUT ─── */
  #s-input { padding: 28px 24px 32px; gap: 20px; }
  .screen-head { margin-bottom: 4px; }
  .screen-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px; font-weight: 400;
    color: var(--text); margin-bottom: 6px;
  }
  .screen-desc { font-size: 13px; color: var(--text2); }

  .field-group { display: flex; flex-direction: column; gap: 12px; }
  .field-label { font-size: 11px; font-weight: 500; color: var(--text2); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
  .field-input {
    width: 100%; padding: 14px 16px;
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: var(--r); color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 15px;
    outline: none; transition: border-color .2s;
  }
  .field-input:focus { border-color: rgba(139,127,199,0.5); }
  /* Поле города вместе с подсказкой должно лежать выше кнопки внизу экрана
     при любом раскладе — не полагаемся на один лишь порядок в разметке. */
  .field-city { position: relative; z-index: 20; }
  .field-input::placeholder { color: var(--text3); }

  .date-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .date-sel {
    padding: 14px 10px; text-align: center;
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: 12px; color: var(--text3);
    font-size: 14px; cursor: pointer; transition: all .2s;
  }
  .date-sel.picked { color: var(--text); border-color: rgba(139,127,199,0.4); background: rgba(83,74,183,0.12); }

  .city-suggest {
    background: var(--bg2); border: 0.5px solid var(--border);
    border-radius: 12px; overflow: hidden;
    margin-top: -8px;
  }
  .city-item {
    padding: 12px 16px; font-size: 14px; color: var(--text2);
    cursor: pointer; border-bottom: 0.5px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    transition: background .15s;
  }
  .city-item:last-child { border-bottom: none; }
  .city-item:hover { background: rgba(255,255,255,0.04); }
  .city-pin { font-size: 16px; }

  .progress-dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
  .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: all .3s; }
  .dot.active { width: 20px; background: var(--mist); border-radius: 3px; }

  /* ─── SCREEN 3: LOADING ─── */
  #s-loading {
    justify-content: center; align-items: center;
    padding: 48px 28px; text-align: center;
    background: radial-gradient(ellipse at 50% 30%, rgba(83,74,183,0.12) 0%, transparent 70%);
  }
  .zodiac-wheel {
    width: 160px; height: 160px; margin: 0 auto 32px;
    position: relative;
  }
  .wheel-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid rgba(201,169,110,0.25);
    animation: rotate 8s linear infinite;
  }
  .wheel-ring2 {
    position: absolute; inset: 16px; border-radius: 50%;
    border: 0.5px solid rgba(139,127,199,0.25);
    animation: rotate 5s linear infinite reverse;
  }
  .wheel-signs {
    position: absolute; inset: 0;
    animation: rotate 20s linear infinite;
  }
  .wheel-sign {
    position: absolute;
    font-size: 16px;
    top: 50%; left: 50%;
  }
  .wheel-center {
    position: absolute; inset: 32px; border-radius: 50%;
    background: radial-gradient(ellipse, rgba(83,74,183,0.3), transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
  }
  .loading-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px; font-weight: 400;
    color: var(--text); margin-bottom: 10px;
  }
  .loading-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; text-align: left; }
  .load-step {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: var(--card); border-radius: 12px;
    font-size: 13px; color: var(--text2);
    transition: all .4s;
  }
  .load-step.done { color: var(--text); }
  .load-step.done .step-icon { color: var(--teal); }
  .load-step.current { border-left: 2px solid var(--mist); }
  .step-icon { font-size: 16px; width: 24px; flex-shrink: 0; }

  /* ─── SCREEN 4: MINI READING ─── */
  #s-mini { padding: 0 0 32px; }

  .reading-hero {
    position: relative; height: 220px; overflow: hidden;
    background: linear-gradient(to bottom, #1a1030, var(--bg));
  }
  .reading-hero-bg {
    position: absolute; inset: 0;
    background: url('https://images.unsplash.com/photo-1444703686981-a3abbc4d4fe3?w=800&q=80&fm=jpg') center/cover;
    opacity: 0.25;
  }
  .reading-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(10,9,16,0.2), rgba(10,9,16,0.95));
  }
  .reading-hero-content {
    position: relative; z-index: 2;
    padding: 20px 24px 0; height: 100%;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding-bottom: 20px;
  }
  .user-sign {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  }
  .sign-badge {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(201,169,110,0.15);
    border: 1px solid rgba(201,169,110,0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
  }
  .sign-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px; font-weight: 400;
  }
  .sign-dates { font-size: 11px; color: var(--text2); }
  .reading-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 30px; font-weight: 300;
    line-height: 1.15; color: var(--text);
  }

  .reading-body { padding: 20px 24px 0; }

  .planet-row {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
    margin-bottom: 20px; scrollbar-width: none;
  }
  .planet-row::-webkit-scrollbar { display: none; }
  .planet-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: 100px;
    font-size: 12px; color: var(--text2);
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
  }
  .planet-chip.active { background: rgba(83,74,183,0.2); border-color: rgba(139,127,199,0.4); color: var(--mist); }
  .p-icon { font-size: 14px; }

  .text-block {
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: var(--r); padding: 18px 20px;
    margin-bottom: 14px;
    position: relative; overflow: hidden;
  }
  .text-block::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--gold), transparent);
  }
  .block-label {
    font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 8px;
  }
  .block-text { font-size: 14px; color: var(--text2); line-height: 1.7; }
  .block-text em { color: var(--text); font-style: normal; font-weight: 500; }

  .energy-bar-wrap { margin-bottom: 20px; }
  .energy-label { font-size: 12px; color: var(--text2); display: flex; justify-content: space-between; margin-bottom: 6px; }
  .energy-track {
    height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden;
  }
  .energy-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(to right, var(--mist), var(--gold));
    transition: width 1s ease;
  }

  .btn-gold {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, #c9a96e, #a07840);
    color: #1a1000; border: none; border-radius: var(--r);
    font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
    cursor: pointer; letter-spacing: .01em; transition: all .2s;
    box-shadow: 0 8px 24px rgba(201,169,110,0.3);
  }
  .btn-gold:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(201,169,110,0.4); }
  .btn-gold:active { transform: scale(.98); }
  /* NATAL CHART TABLES */
  .nc-section-title { font-size:11px;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--text2);margin:20px 0 10px;padding:0 24px }
  .nc-table { margin:0 24px 4px;border-radius:14px;overflow:hidden;border:0.5px solid var(--border) }
  .nc-table-head { display:grid;background:rgba(139,127,199,.1);padding:9px 14px;font-size:10px;font-weight:500;letter-spacing:.07em;text-transform:uppercase;color:var(--mist);gap:4px }
  #planets-table .nc-table-head { grid-template-columns:1fr 1.4fr .6fr }
  #aspects-table .nc-table-head { grid-template-columns:1fr 1.1fr 1fr .5fr }
  .nc-row { display:grid;padding:10px 14px;border-top:0.5px solid var(--border);font-size:13px;align-items:center;gap:4px;transition:background .15s }
  .nc-row:hover { background:rgba(139,127,199,0.05); }
  .nc-row:hover { background:rgba(255,255,255,.03) }
  #planets-table .nc-row { grid-template-columns:1fr 1.4fr .6fr }
  #aspects-table .nc-row { grid-template-columns:1fr 1.1fr 1fr .5fr }
  .nc-planet { display:flex;align-items:center;gap:7px;font-weight:500 }
  .nc-glyph { font-size:16px;width:20px;text-align:center }
  .nc-sign { color:var(--text2);font-size:12px }
  .nc-deg { font-size:11px;color:var(--mist);font-weight:500 }
  .nc-house { font-size:11px;color:var(--text3);text-align:center }
  .asp-trine { color:var(--teal) }
  .asp-sext  { color:#a0d8a0 }
  .asp-conj  { color:var(--gold) }
  .asp-opp   { color:var(--rose) }
  .asp-sq    { color:#e07b8a }
  .asp-quin  { color:var(--text2) }
  .nc-orb    { font-size:11px;color:var(--text3);text-align:right }

  /* COLLAPSE */
  .nc-collapse-body { overflow:hidden; transition:max-height .35s ease,opacity .25s ease; max-height:3000px; opacity:1; }
  .nc-collapse-body.collapsed { max-height:0; opacity:0; padding:0; margin:0; border:none; }
  .collapse-arrow { display:inline-block; transition:transform .3s; margin-left:6px; font-size:10px; color:var(--text3); }
  .collapse-arrow.up { transform:rotate(180deg); }

  /* FIELD SELECT */
  .field-input select, select.field-input { appearance:none;-webkit-appearance:none;background-image:none }
  select.field-input { cursor:pointer }
  /* Список, который рисует сама операционная система, наши стили формы не
     наследует: на Windows он белый, а цвет текста берётся от select —
     светлый на светлом, читать невозможно. Красим пункты явно. */
  select.field-input option {
    background: #17151f; color: #e8e4f0; font-size: 15px;
  }
  select.field-input option:checked { background: #2a2540; }


  /* TRANSITS */
  .transit-item { display: flex; gap: 14px; padding: 14px 16px; background: var(--card); border: 0.5px solid var(--border); border-radius: 14px; margin-bottom: 10px; align-items: flex-start; }
  .t-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
  .t-good { background: var(--teal); box-shadow: 0 0 8px rgba(78,205,196,.5); }
  .t-warn { background: var(--rose); box-shadow: 0 0 8px rgba(224,123,138,.4); }
  .t-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
  .t-desc { font-size: 12px; color: var(--text2); line-height: 1.6; margin-bottom: 6px; }
  .t-badge { display: inline-block; padding: 2px 9px; border-radius: 100px; font-size: 10px; font-weight: 500; }
  .t-badge-good { background: rgba(78,205,196,.12); color: var(--teal); border: 0.5px solid rgba(78,205,196,.3); }
  .t-badge-hot  { background: rgba(224,123,138,.12); color: var(--rose); border: 0.5px solid rgba(224,123,138,.3); }
  .t-badge-warn { background: rgba(201,169,110,.12); color: var(--gold); border: 0.5px solid rgba(201,169,110,.3); }
  /* WEEK CALENDAR */
  .wday { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 10px; font-size: 10px; color: var(--text3); }
  .wday.today { background: rgba(139,127,199,.18); color: var(--mist); }
  .wday.selected { background: rgba(139,127,199,.22); color: var(--mist); outline: 1.5px solid rgba(139,127,199,.5); }
  .wday.today.selected { background: rgba(139,127,199,.28); outline: 1.5px solid rgba(139,127,199,.7); }
  .wday-num { font-size: 15px; font-weight: 500; }
  .wday-dot { width: 5px; height: 5px; border-radius: 50%; }

  /* ─── SCREEN 5: FULL READING ─── */
  #s-full { padding: 0 0 32px; }

  .full-hero {
    height: 200px; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #0d0b1f, #1a1430);
  }
  .full-hero-img {
    position: absolute; inset: 0;
    background: url('https://images.unsplash.com/photo-1534796636912-3b95b3ab5986?w=800&q=80&fm=jpg') center/cover;
    opacity: 0.2;
  }
  .full-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent, var(--bg) 90%); }
  .full-hero-content {
    position: relative; z-index: 2; height: 100%;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 20px 24px;
  }
  .success-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(78,205,196,0.15); border: 0.5px solid rgba(78,205,196,0.3);
    border-radius: 100px; font-size: 12px; color: var(--teal);
    margin-bottom: 10px;
  }
  .full-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px; font-weight: 400; color: var(--text);
  }

  .full-body { padding: 20px 24px 0; }

  .chapter-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
  .chapter {
    border-radius: 12px;
    cursor: pointer; transition: background .2s;
    overflow: hidden;
    border: 0.5px solid transparent;
  }
  .chapter:hover { background: var(--card); }
  .chapter.expanded { background: var(--card); border-color: var(--border); margin-bottom: 4px; }
  .ch-header {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px;
  }
  .ch-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(139,127,199,0.15); border: 0.5px solid rgba(139,127,199,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 500; color: var(--mist); flex-shrink: 0;
  }
  .ch-title { font-size: 14px; font-weight: 500; flex: 1; color: var(--text); }
  .ch-arrow { font-size: 12px; color: var(--text3); transition: transform .2s; flex-shrink: 0; }
  .chapter.expanded .ch-arrow { transform: rotate(90deg); }
  .ch-content {
    display: none;
    padding: 0 16px 14px 56px;
    font-size: 13px; color: var(--text2); line-height: 1.75;
  }
  .chapter.expanded .ch-content { display: block; }

  .natal-chart-mini {
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: var(--r); padding: 20px;
    margin-bottom: 16px; text-align: center;
  }
  .natal-svg { width: 180px; height: 180px; margin: 0 auto 12px; display: block; }

  .aspects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
  .aspect-item {
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: 12px; padding: 12px 14px;
  }
  .aspect-name { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
  .aspect-val { font-size: 16px; font-weight: 500; }
  .aspect-val.pos { color: var(--teal); }
  .aspect-val.neg { color: var(--rose); }
  .aspect-val.neu { color: var(--gold); }

  /* PROFILE */
  .profile-hero {
    height: 160px; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #0d0b1f, #1a1430);
    display: flex; align-items: flex-end;
  }
  .profile-hero-img {
    position: absolute; inset: 0;
    background: url('https://images.unsplash.com/photo-1534796636912-3b95b3ab5986?w=800&q=80&fm=jpg') center/cover;
    opacity: 0.15;
  }
  .profile-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent, var(--bg) 80%); }
  .profile-hero-content {
    position: relative; z-index: 2;
    padding: 20px 24px; width: 100%;
    display: flex; align-items: center; gap: 14px;
  }
  .profile-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #534AB7, #c9a96e);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
  }
  .profile-name { font-family:'Cormorant Garamond',serif; font-size:24px; font-weight:400; }
  .profile-sub-label {
    font-size:10px; font-weight:500; letter-spacing:.08em; text-transform:uppercase;
    padding:3px 10px; border-radius:100px; margin-left:auto;
    background: rgba(78,205,196,0.12); border: 0.5px solid rgba(78,205,196,.3); color: var(--teal);
  }
  .profile-sub-label.free { background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--text3); }
  .profile-body { padding: 16px 24px 24px; }
  .profile-card {
    background: var(--card); border: 0.5px solid var(--border);
    border-radius: var(--r); padding: 16px 18px;
    margin-bottom: 20px;
  }
  .profile-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 0.5px solid var(--border); font-size: 13px;
  }
  .profile-row:last-child { border-bottom: none; }
  .pr-label { color: var(--text3); }
  .pr-val { color: var(--text); font-weight: 500; }
  .comp-avatar {
    width: 40px; height: 40px; border-radius: 50%; margin: 0 auto;
    background: linear-gradient(135deg, #534AB7, #c9a96e);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
  }
  .comp-score-ring { margin: 0 auto; }

  /* NAV */
  .bottom-nav {
    position: sticky; bottom: 0;
    width: 100%; box-sizing: border-box;
    background: rgba(10,9,16,0.95); backdrop-filter: blur(16px);
    border-top: 0.5px solid var(--border);
    padding: 8px 0 20px;
    display: flex; justify-content: space-around;
    z-index: 50;
  }
  /* Пять пунктов с фиксированными отступами в 16px переставали помещаться
     в узкое окно — «Профиль» уезжал за край и был недоступен. Теперь ширина
     делится поровну, а отступы и подпись ужимаются вместе с окном. */
  .nav-item {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px; cursor: pointer;
    font-size: clamp(9px, 2.4vw, 10px); color: var(--text3);
    letter-spacing: .03em; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color .2s;
  }
  .nav-item.active { color: var(--mist); }
  .nav-icon { font-size: clamp(17px, 4.6vw, 20px); line-height: 1; }

  /* ═══════════════════════════════════════════════════════════════
     РЕЖИМ НАСТОЯЩЕГО ТЕЛЕФОНА

     Страница нарисована как витрина: рамка телефона с чёлкой, скруглениями
     и тенью, а внутри — нарисованная «шапка Telegram». На десктопе это
     красивая презентация, но внутри самого Telegram превращается в мусор:
     вторая шапка поверх настоящей и рамка вокруг рамки.

     Хуже другое. У .phone стоит overflow:hidden, поэтому нижняя панель с
     position:sticky прилипала не к экрану, а к нижнему краю макета — то есть
     показывалась, только если пролистать страницу до самого конца. Здесь она
     становится fixed и видна всегда.

     Включается двумя путями: класс tg-app ставит скрипт, увидев Telegram,
     а media-запрос ниже ловит любой узкий экран (обычный мобильный браузер).
     ═══════════════════════════════════════════════════════════════ */
  body.tg-app .frame-wrap { padding: 0; min-height: 100dvh; background: var(--bg); }
  body.tg-app .phone {
    width: 100%; max-width: 100%;
    border: 0; border-radius: 0; box-shadow: none;
    overflow: visible;
  }
  /* чёлка нужна только витрине на десктопе */
  body.tg-app .notch { display: none; }

  /* Шапка «AstroBot · онлайн» остаётся: она задаёт приложению лицо.
     А вот крестик убираем — Telegram рисует свой «Закрыть» прямо над ней,
     и вторая кнопка с тем же смыслом только сбивает с толку. Верхний отступ
     тоже уменьшаем: 40 пикселей были заложены под нарисованную чёлку. */
  body.tg-app .tg-bar { padding-top: 14px; }
  body.tg-app .tg-close { display: none; }

  body.tg-app .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    /* safe-area — чтобы панель не пряталась под «домашней» полоской iPhone */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 16px));
  }
  /* Запас снизу под закреплённой панелью. Сама панель занимает около 74 px
     плюс safe-area; берём с добавкой, иначе последняя строка таблицы
     оказывается наполовину под панелью и её не дочитать. */
  /* #s-welcome задаёт свой padding через селектор по id, а он «сильнее»
     правила по классу — без явного упоминания экран приветствия оставался
     с прежним отступом в 48px и упирался в панель. */
  /* Распорка в конце экрана. На десктопной витрине панель не закреплена
     и место занимать незачем, поэтому там высота нулевая. */
  .nav-spacer { flex: 0 0 auto; height: 0; }
  body.tg-app .nav-spacer { height: calc(var(--nav-h, 74px) + 28px); }

  body.tg-app .screen,
  body.tg-app #s-welcome {
    /* --nav-h ставит скрипт, измерив панель. 74px — запасное значение на
       случай, если скрипт не отработал; 28px сверху — воздух, чтобы
       последняя строка не липла к панели вплотную. */
    padding-bottom: calc(var(--nav-h, 74px) + 28px);
    min-height: 100dvh;
  }

  @media (max-width: 460px) {
    .frame-wrap { padding: 0; min-height: 100dvh; background: var(--bg); }
    .phone {
      width: 100%; max-width: 100%;
      border: 0; border-radius: 0; box-shadow: none;
      overflow: visible;
    }
    .notch { display: none; }
    .bottom-nav {
      position: fixed; left: 0; right: 0; bottom: 0;
      padding-bottom: calc(10px + env(safe-area-inset-bottom, 16px));
    }
    .tg-bar { padding-top: 14px; }
    .tg-close { display: none; }
    .nav-spacer { height: calc(var(--nav-h, 74px) + 28px); }
    .screen,
    #s-welcome {
      padding-bottom: calc(var(--nav-h, 74px) + 28px);
      min-height: 100dvh;
    }
  }


  /* ═══════════════════════════════════════════════════════════════
     ЧАТ: поле ввода закреплено и не прячется под клавиатурой

     Раньше поле ввода стояло в обычном потоке, внизу колонки сообщений.
     Пока клавиатуры нет — выглядит правильно. Стоит ей появиться, и она
     занимает нижнюю половину экрана: поле оказывается под ней, человек
     печатает вслепую и не видит, что набрал.
     Само по себе это не чинится — браузер не знает, что поле важное.

     Здесь поле закреплено у нижнего края и поднимается ровно на высоту
     клавиатуры. Высоту меряет скрипт в index.html через visualViewport
     и кладёт в переменную --kb; он же ставит классу body метку kb-open.

     Нижняя панель при открытой клавиатуре прячется: места и так мало,
     а нажать по ней всё равно нельзя — она под клавиатурой.
     ═══════════════════════════════════════════════════════════════ */
  /* Экран чата занимает РОВНО видимую полосу между шапкой и полем ввода.
     Раньше он наследовал min-height:100dvh от общего правила и начинался
     под шапкой — значит его низ уходил за край экрана. Лента прокручивалась
     «до конца» в невидимую область, и последнее сообщение оставалось за
     кадром. Увеличение отступа это маскировало, но не лечило: сколько ни
     добавляй, низ всё равно был ниже экрана.
     Отсюда фиксированные границы: сверху шапка, снизу поле ввода. */
  body.tg-app #s-chat,
  body.narrow  #s-chat {
    position: fixed;
    top: var(--tgbar-h, 0px);
    left: 0; right: 0;
    bottom: calc(var(--kb, 0px) + var(--nav-h, 74px) + var(--chat-input-h, 68px));
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  /* клавиатура открыта — панели навигации нет, её высоту не вычитаем */
  body.kb-open #s-chat {
    bottom: calc(var(--kb, 0px) + var(--chat-input-h, 68px));
  }

  /* распорка под панель тут не нужна: поле ввода само занимает низ */
  body.tg-app #s-chat .nav-spacer,
  body.narrow  #s-chat .nav-spacer { display: none; }

  body.tg-app .chat-wrap,
  body.narrow  .chat-wrap { padding-bottom: 0; }

  /* запас снизу, чтобы последнее сообщение не пряталось за полем ввода */
  body.tg-app .chat-msg-area,
  body.narrow  .chat-msg-area {
    /* Поле ввода закреплено (position:fixed), то есть вынуто из потока —
       лента о нём ничего не знает и идёт ПОД ним. Поэтому запас снизу
       обязателен и равен реальной высоте поля плюс воздух.
       Высоту меряет скрипт и кладёт в --chat-input-h; запасные 96px —
       на случай, если измерение почему-то не отработало. */
    padding-bottom: 4px;
    /* Лента заканчивается ровно там, где начинается закреплённое поле ввода.
       Отступом снизу этого не добиться: у прокручиваемого flex-контейнера
       браузер не учитывает нижний padding в конце прокрутки — та же ловушка,
       что была с панелью навигации. Внешний отступ уменьшает саму коробку,
       поэтому работает. */
    margin-bottom: var(--chat-input-h, 96px);
  }

  body.tg-app .chat-input-row,
  body.narrow  .chat-input-row {
    position: fixed; left: 0; right: 0;
    bottom: calc(var(--kb, 0px) + var(--nav-h, 74px));
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 0.5px solid var(--border);
    z-index: 60;
  }

  /* клавиатура открыта: поле садится прямо на неё, панель убираем */
  body.kb-open .chat-input-row {
    bottom: var(--kb, 0px);
    /* safe-area снизу не нужна — там клавиатура, а не край экрана */
    padding-bottom: 8px;
  }
  body.kb-open .bottom-nav { display: none; }

  /* HIDDEN HELPER */
  .hidden { display: none !important; }

  /* ─── CHAT ─── */
  .chat-wrap { display:flex;flex-direction:column;height:100%;flex:1;padding:12px 16px 0;overflow:hidden; }
  .chat-msg-area { flex:1;overflow-y:auto;padding:4px 0 12px;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth; }
  .chat-msg { max-width:88%;padding:10px 14px;border-radius:14px;font-size:14px;line-height:1.6;word-wrap:break-word;animation:fadeUp .2s ease both; }
  .chat-msg.user { align-self:flex-end;background:rgba(83,74,183,0.3);border:0.5px solid rgba(83,74,183,0.3);color:var(--text);border-bottom-right-radius:4px; }
  .chat-msg.bot { align-self:flex-start;background:var(--card);border:0.5px solid var(--border);color:var(--text2);border-bottom-left-radius:4px; }
  /* Высота распорки = высота закреплённого поля ввода плюс воздух.
     На витрине (десктоп, поле в обычном потоке) она не нужна — там ноль. */
  .chat-bottom-spacer { flex: 0 0 auto; height: 0; }
  body.tg-app .chat-bottom-spacer,
  body.narrow  .chat-bottom-spacer { height: 14px; }   /* воздух над полем */

  .chat-msg b { color: var(--text); font-weight: 600; }
  .chat-msg .msg-time { font-size:10px;color:var(--text3);margin-top:4px;opacity:.7; }
  .chat-input-row { display:flex;gap:8px;padding:8px 0 12px;flex-shrink:0; }
  .chat-input-row input { flex:1;padding:12px 14px;border-radius:12px;border:0.5px solid var(--border);background:var(--bg2);color:var(--text);font-size:14px;font-family:'DM Sans',sans-serif;outline:none; }
  .chat-input-row input::placeholder { color:var(--text3); }
  .chat-input-row input:focus { border-color:var(--mist); }
  .chat-send-btn { width:44px;height:44px;border-radius:12px;border:none;background:linear-gradient(135deg,#534AB7,#3d3589);color:white;font-size:18px;cursor:pointer;flex-shrink:0;transition:all .2s; }
  .chat-send-btn:hover { transform:scale(1.05);box-shadow:0 4px 16px rgba(83,74,183,.4); }
  .chat-send-btn:active { transform:scale(.95); }
  .chat-welcome { text-align:center;padding:20px 12px;color:var(--text2);font-size:13px;line-height:1.7; }
  .chat-welcome strong { color:var(--gold);font-family:'Cormorant Garamond',serif;font-size:20px;font-weight:400;display:block;margin-bottom:6px; }


