/* Chat */
  .chat-area {
    flex: 0 1 auto; overflow-y: auto; padding: 16px 16px 8px;
    max-height: min(46dvh, 430px);
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(155,217,255,0.28) rgba(4,8,14,0.72);
  }
  .chat-area::-webkit-scrollbar,
  .profile-content::-webkit-scrollbar,
  .diary-list::-webkit-scrollbar,
  .diary-detail::-webkit-scrollbar,
  .bonds-content::-webkit-scrollbar {
    width: 6px;
  }
  .chat-area::-webkit-scrollbar-track,
  .profile-content::-webkit-scrollbar-track,
  .diary-list::-webkit-scrollbar-track,
  .diary-detail::-webkit-scrollbar-track,
  .bonds-content::-webkit-scrollbar-track {
    background: rgba(4,8,14,0.72);
  }
  .chat-area::-webkit-scrollbar-thumb,
  .profile-content::-webkit-scrollbar-thumb,
  .diary-list::-webkit-scrollbar-thumb,
  .diary-detail::-webkit-scrollbar-thumb,
  .bonds-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(155,217,255,0.34), rgba(224,189,122,0.22));
    border-radius: 999px;
  }
  .msg { margin-bottom: 14px; animation: fadeUp 0.5s ease; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

  .msg-oracle {
    background:
      linear-gradient(145deg, rgba(24,31,27,0.95), rgba(11,14,13,0.92));
    border: 1px solid rgba(197,154,92,0.18);
    border-left-color: rgba(224,189,122,0.54);
    border-radius: 8px 8px 8px 2px;
    padding: 16px 18px; max-width: 90%;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
  }
  .msg-oracle p, .msg-oracle .oracle-text { font-size: 14.5px; color: #ddd6c8; line-height: 1.7; }
  .msg-oracle .oracle-text strong { color: var(--copper-soft); font-weight: 600; }
  .msg-oracle .oracle-text em { color: var(--teal); font-style: italic; }
  .msg-oracle .oracle-text .md-h {
    font-size: 13px; font-weight: 700; color: var(--copper);
    letter-spacing: 1px; text-transform: uppercase; margin: 14px 0 6px;
  }
  .msg-oracle .oracle-text .md-h:first-child { margin-top: 0; }
  .msg-oracle .oracle-text .md-list {
    list-style: none; padding: 0; margin: 6px 0;
  }
  .msg-oracle .oracle-text .md-list li {
    padding-left: 16px; position: relative; margin-bottom: 4px;
  }
  .msg-oracle .oracle-text .md-list li::before {
    content: '◆'; position: absolute; left: 0; color: var(--copper); font-size: 8px; top: 5px;
  }
  .msg-oracle .accent { color: var(--copper-soft); font-weight: 600; }
  .msg-oracle .meta {
    font-size: 10px; color: var(--dim); margin-top: 10px;
    display: flex; align-items: center; gap: 6px;
  }
  .msg-oracle .meta-dot {
    width: 5px; height: 5px;
    background: var(--teal); border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

  .msg-user-wrap { display: flex; justify-content: flex-end; margin-bottom: 14px; animation: fadeUp 0.3s ease; }
  .msg-user {
    background: linear-gradient(135deg, rgba(88,116,95,0.45), rgba(32,42,36,0.92));
    border: 1px solid rgba(119,196,173,0.18);
    border-radius: 8px 8px 2px 8px;
    padding: 12px 18px; max-width: 82%;
    font-size: 14.5px; color: #edf2e8; line-height: 1.55;
    box-shadow: 0 10px 32px rgba(0,0,0,0.18);
  }

  /* Pattern card */
  .pattern-card {
    background: linear-gradient(145deg, rgba(24,31,27,0.95), rgba(11,14,13,0.92));
    border: 1px solid rgba(197,154,92,0.2);
    border-radius: 8px;
    padding: 16px 18px; margin-bottom: 14px;
    animation: fadeUp 0.6s ease;
  }
  .pattern-card .label {
    font-size: 9px; color: var(--copper); letter-spacing: 3px;
    text-transform: uppercase; margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
  }
  .pattern-icon {
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(197,154,92,0.12); border: 1px solid rgba(197,154,92,0.28);
    display: flex; align-items: center; justify-content: center;
  }
  .pattern-icon-inner {
    width: 6px; height: 6px; background: var(--teal); border-radius: 50%;
  }
  .pattern-card p { font-size: 13.5px; color: #c7c0b2; line-height: 1.6; }
  .pattern-card .hl { color: var(--copper-soft); font-weight: 600; }

  /* Viral card */
  .viral-card {
    background: rgba(197,154,92,0.05);
    border: 1px solid rgba(197,154,92,0.12);
    border-radius: 8px; padding: 16px 18px; margin-bottom: 14px;
    animation: fadeUp 0.6s ease 0.2s both;
  }
  .viral-card p { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
  .viral-btns { display: flex; gap: 8px; }
  .viral-btns button {
    flex: 1; padding: 11px; border-radius: 8px;
    font-size: 13.5px; border: none; cursor: pointer;
    transition: all 0.2s; font-family: inherit; font-weight: 500;
  }
  .viral-btns button:active { transform: scale(0.96); }
  .btn-send {
    background: linear-gradient(135deg, rgba(197,154,92,0.25), rgba(88,116,95,0.15));
    color: var(--copper-soft);
    border: 1px solid rgba(197,154,92,0.3) !important;
  }
  .btn-later { background: transparent; color: var(--dim); border: 1px solid rgba(197,154,92,0.12) !important; }

  /* Input bar */
  .input-bar {
    padding: 8px 16px 30px; display: flex; gap: 10px;
    align-items: center;
    background: linear-gradient(transparent 0%, var(--bg) 50%);
    position: sticky; bottom: 0;
  }
  .composer {
    position: sticky; bottom: 0;
    background: linear-gradient(transparent 0%, rgba(5,7,6,0.96) 32%);
  }
  /* Depth & Tone settings */
  .oracle-settings {
    padding: 8px 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    align-items: center;
  }
  .setting-group { min-width: 0; }
  .setting-label {
    display: none;
    font-size: 10px; color: var(--dim); letter-spacing: 1px;
    text-transform: uppercase; white-space: nowrap;
  }
  .setting-pills {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  }
  .pill {
    height: 28px; padding: 0 6px; border-radius: 8px;
    border: 1px solid rgba(197,154,92,0.12);
    background: rgba(255,255,255,0.025); color: var(--dim);
    font-size: 10.5px; font-family: inherit; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
  }
  .pill.active {
    color: #fff4d8; border-color: rgba(224,189,122,0.4);
    background: rgba(197,154,92,0.16);
  }
  .pill:active { transform: scale(0.95); }

  .oracle-modes {
    padding: 10px 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px;
  }
  /* Разбор переписки — главный вход: во всю ширину и первым. */
  .mode-btn.lead {
    grid-column: 1 / -1;
    height: 42px;
    font-size: 14px;
    color: var(--copper-soft);
    border-color: rgba(155,217,255,0.34);
    background: linear-gradient(135deg, rgba(155,217,255,0.16), rgba(124,231,255,0.08));
  }
  .mode-btn.lead::before { content: '≡'; font-size: 15px; }
  .mode-btn.lead.active {
    border-color: rgba(155,217,255,0.6);
    background: linear-gradient(135deg, rgba(155,217,255,0.28), rgba(124,231,255,0.14));
  }
  .mode-btn {
    height: 36px; border-radius: 8px; border: 1px solid rgba(197,154,92,0.14);
    background: rgba(255,255,255,0.035); color: var(--muted); font-size: 13px;
    font-family: inherit; cursor: pointer; transition: all 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
  }
  .mode-btn::before {
    content: '◌';
    color: var(--teal);
    font-size: 12px;
    line-height: 1;
    opacity: 0.82;
  }
  #modeOracle::before { content: '◉'; }
  #modeTarot::before { content: 'III'; font-size: 10px; letter-spacing: 0.5px; }
  #modeDialogue::before { content: '≡'; font-size: 14px; }
  #modeDialogueEnergy::before { content: '◇'; }
  #modeDream::before { content: '◐'; }
  .mode-btn.active {
    color: #fff4d8; border-color: rgba(224,189,122,0.46);
    background: linear-gradient(135deg, rgba(197,154,92,0.22), rgba(88,116,95,0.14));
    box-shadow: inset 0 0 18px rgba(224,189,122,0.08);
  }
  .mode-btn:active { transform: scale(0.97); }
  .input-bar input {
    flex: 1; background: rgba(8,11,10,0.82);
    border: 1px solid rgba(197,154,92,0.16); border-radius: 8px;
    padding: 13px 20px; font-size: 14.5px; color: #e8e4f0;
    outline: none; font-family: inherit;
    transition: all 0.2s;
  }
  .input-bar input::placeholder { color: #5d5f58; }
  .input-bar input:focus { border-color: rgba(224,189,122,0.52); background: rgba(13,18,16,0.92); }
  .send-btn {
    width: 44px; height: 44px; border-radius: 8px;
    background: linear-gradient(145deg, #d4a45f, #7f5b32);
    border: none; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
  }
  .send-btn:active { transform: scale(0.88); }
  .send-btn:hover { box-shadow: 0 0 24px rgba(224,189,122,0.35); }
  .send-btn svg { width: 18px; height: 18px; }

  /* Typing */
  .typing { display: flex; gap: 5px; padding: 16px 18px; align-items: center; }
  .typing span {
    width: 7px; height: 7px; background: var(--copper); border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
  }
  .typing span:nth-child(2) { animation-delay: 0.2s; }
  .typing span:nth-child(3) { animation-delay: 0.4s; }
  .typing-label {
    font-size: 11px; color: var(--dim); margin-left: 8px;
    animation: typingFade 2s ease-in-out infinite;
  }
  @keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.25; } 40% { transform: translateY(-10px); opacity: 1; } }
  @keyframes typingFade { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

  /* Bottom nav */
  .nav {
    display: flex; justify-content: space-around;
    padding: 8px 8px 26px;
    border-top: 1px solid rgba(197,154,92,0.12);
    position: sticky; bottom: 0; z-index: 10;
    background: rgba(5,7,6,0.96);
    backdrop-filter: blur(12px);
  }
  .nav-item {
    text-align: center; cursor: pointer;
    /* flex-доля вместо фиксированных отступов: вкладок может быть 4 или 5 (Око) */
    flex: 1 1 0; min-width: 0;
    padding: 6px 4px; border-radius: 8px;
    transition: all 0.2s;
    position: relative;
  }
  .nav-item:active { background: rgba(197,154,92,0.1); }
  .nav-item svg { width: 24px; height: 24px; margin-bottom: 2px; }
  .nav-item .nav-label { font-size: 10px; color: #64665d; font-weight: 600; }
  .nav-item.active .nav-label { color: var(--copper-soft); }
  .nav-item.active svg { color: var(--copper-soft); }
  .nav-item svg { color: #64665d; transition: color 0.2s; }
  .nav-dot {
    position: absolute; top: 4px; right: 12px;
    width: 6px; height: 6px; background: var(--teal);
    border-radius: 50%; display: none;
  }

  @media (max-width: 899px) {
    #screen-oracle .header {
      padding: 48px 20px 12px;
    }

    #screen-oracle .header-title {
      font-size: 28px;
    }

    #screen-oracle .header-sub {
      margin-top: 2px;
      font-size: 12.5px;
    }

    .chat-area {
      padding-top: 12px;
      max-height: min(44dvh, 390px);
      scrollbar-width: none;
    }

    .chat-area::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }

    .oracle-settings {
      padding-top: 6px;
      gap: 6px;
    }

    .setting-pills {
      gap: 3px;
    }

    .pill {
      position: relative;
      height: 26px;
      padding: 0 2px;
      font-size: 9px;
      overflow: hidden;
      text-overflow: ellipsis;
      color: transparent;
    }

    .pill.active {
      color: transparent;
    }

    .pill::after {
      content: attr(data-short);
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--dim);
      font-size: 10px;
      font-weight: 600;
      line-height: 1;
    }

    .pill.active::after {
      color: #fff4d8;
    }

    .oracle-modes {
      padding-top: 8px;
      gap: 6px;
    }

    .mode-btn {
      height: 34px;
      font-size: 12.5px;
      gap: 6px;
    }

    .input-bar {
      padding: 6px 16px 18px;
      gap: 8px;
    }

    .input-bar input {
      padding: 11px 16px;
      font-size: 14px;
    }

    .send-btn {
      width: 42px;
      height: 42px;
    }

    .nav {
      padding: 6px 8px 16px;
    }

    .nav-item {
      padding: 5px 10px;
    }

    .nav-item svg {
      width: 22px;
      height: 22px;
    }

    @media (max-height: 760px) {
      .chat-area {
        max-height: min(39dvh, 320px);
      }

      .nav {
        padding-bottom: 12px;
      }
    }
  }

  /* Onboarding */
  .onboarding {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    width: 100%;
    min-width: 0;
    padding: 40px 28px; text-align: center;
  }
  .eye-symbol { margin-bottom: 28px; position: relative; }
  .eye-glow {
    position: absolute; inset: -20px; border-radius: 50%;
    background: radial-gradient(circle, rgba(224,189,122,0.16) 0%, transparent 70%);
    animation: glowPulse 3s ease-in-out infinite;
  }
  @keyframes glowPulse { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.1); } }

  .onboarding h1 {
    font-size: 42px; font-weight: 800; margin-bottom: 6px; color: var(--text);
    letter-spacing: 0;
    text-shadow: 0 0 26px rgba(224,189,122,0.22);
  }
  .onboarding h1.auth-title-compact { font-size: 24px; }
  .onboarding .subtitle {
    font-size: 14px; color: var(--muted); margin-bottom: 44px; line-height: 1.6;
  }
  .onboarding .form-group {
    width: 100%;
    max-width: 340px;
    margin-bottom: 14px;
    position: relative;
  }
  .onboarding .form-label {
    font-size: 11px; color: var(--copper); letter-spacing: 1px;
    text-transform: uppercase; text-align: left;
    margin-bottom: 6px; display: block; padding-left: 4px;
  }
  .onboarding input {
    width: 100%; background: rgba(8,11,10,0.78);
    border: 1px solid rgba(197,154,92,0.16); border-radius: 8px;
    padding: 15px 18px; font-size: 16px; color: #e8e4f0;
    outline: none; font-family: inherit;
    transition: all 0.2s;
  }
  .onboarding input::placeholder { color: #5d5f58; }
  .onboarding input:focus { border-color: rgba(224,189,122,0.52); background: rgba(13,18,16,0.92); }
  .start-btn {
    width: 100%; max-width: 340px; padding: 17px;
    background: linear-gradient(145deg, #d4a45f, #8a6334);
    border: 1px solid rgba(255,235,185,0.18); border-radius: 8px;
    color: #fff6df; font-size: 16px; font-weight: 720;
    cursor: pointer; margin-top: 12px;
    transition: all 0.2s;
    font-family: inherit; letter-spacing: 0.5px;
  }
  .start-btn:active { transform: scale(0.97); }
  .start-btn:hover { box-shadow: 0 6px 30px rgba(224,189,122,0.28); }
  .ghost-start-btn {
    width: 100%;
    max-width: 340px;
    padding: 14px;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid rgba(197,154,92,0.16);
    background: rgba(255,255,255,0.035);
    color: var(--copper-soft);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
  }
  .ghost-start-btn:active { transform: scale(0.97); }
  .ghost-start-btn:hover {
    border-color: rgba(224,189,122,0.34);
    background: rgba(197,154,92,0.075);
  }
  .onboarding .hint {
    font-size: 11px; color: var(--dim); margin-top: 20px; line-height: 1.5;
  }

  /* Diary */
  .diary-list { flex: 1; padding: 0 16px; overflow-y: auto; padding-bottom: 80px; }
  .diary-toolbar {
    display: flex; justify-content: flex-end; margin: 0 16px 12px;
  }
  .diary-clear-btn {
    min-height: 34px; padding: 0 12px; border-radius: 8px;
    border: 1px solid rgba(208,137,141,0.2);
    background: rgba(208,137,141,0.08); color: #dcb0b2;
    font-family: inherit; font-size: 12.5px; cursor: pointer;
  }
  .diary-clear-btn:active { transform: scale(0.98); }
  .diary-patterns {
    margin-bottom: 18px;
  }
  .diary-section-label {
    font-size: 9px; color: var(--copper); letter-spacing: 3px;
    text-transform: uppercase; margin: 0 2px 10px;
    display: flex; align-items: center; gap: 8px;
  }
  .diary-pattern {
    background: linear-gradient(145deg, rgba(24,31,27,0.95), rgba(11,14,13,0.92));
    border: 1px solid rgba(197,154,92,0.18);
    border-radius: 8px;
    padding: 16px 18px; margin-bottom: 10px;
    box-shadow: var(--shadow);
  }
  .diary-pattern-top {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 8px;
  }
  .diary-pattern-title { font-size: 14px; color: var(--copper-soft); font-weight: 650; }
  .diary-pattern-count {
    font-size: 11px; color: #d9caa4; padding: 4px 8px;
    border-radius: 999px; background: rgba(197,154,92,0.12);
    border: 1px solid rgba(197,154,92,0.22);
    flex-shrink: 0;
  }
  .diary-pattern-desc { font-size: 13.5px; color: #c7c0b2; line-height: 1.55; margin-bottom: 10px; }
  .diary-pattern-advice {
    font-size: 12.5px; color: #ddd0b5; line-height: 1.5;
    padding-top: 10px; border-top: 1px solid rgba(197,154,92,0.1);
  }
  .diary-pattern-empty {
    background: rgba(197,154,92,0.05);
    border: 1px solid rgba(197,154,92,0.12);
    border-radius: 8px;
    padding: 16px 18px; margin-bottom: 18px;
    font-size: 13.5px; color: var(--muted); line-height: 1.6;
  }
  .diary-empty-state {
    text-align: center;
    padding: 60px 24px;
  }
  .diary-empty-state div {
    font-size: 14px;
    color: #6f7167;
    line-height: 1.7;
  }
  .diary-entry {
    background: linear-gradient(145deg, rgba(22,27,24,0.92), rgba(10,13,12,0.92));
    border: 1px solid rgba(197,154,92,0.14);
    border-radius: 8px;
    padding: 16px 18px; margin-bottom: 10px;
    cursor: pointer; transition: transform 0.2s, border-color 0.2s, background 0.2s;
  }
  .diary-entry:active { transform: scale(0.99); }
  .diary-entry:hover {
    border-color: rgba(224,189,122,0.3);
    background: linear-gradient(145deg, rgba(27,35,29,0.92), rgba(14,18,16,0.92));
  }
  .diary-entry .date {
    font-size: 11px; color: var(--copper); margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
  }
  .diary-entry .date::before {
    content: ''; width: 4px; height: 4px; background: var(--teal);
    border-radius: 50%;
  }
  .diary-entry .text { font-size: 14px; color: #ddd6c8; line-height: 1.55; }
  .diary-entry .transit {
    font-size: 11px; color: var(--dim); margin-top: 10px;
    padding-top: 10px; border-top: 1px solid rgba(197,154,92,0.08);
    display: flex; gap: 12px;
  }
  .diary-detail {
    flex: 1; padding: 0 16px 96px; overflow-y: auto;
  }
  .detail-back {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 12px; margin-bottom: 16px;
    border-radius: 8px; border: 1px solid rgba(197,154,92,0.18);
    background: rgba(255,255,255,0.035); color: var(--copper-soft);
    font-family: inherit; font-size: 13px; cursor: pointer;
  }
  .detail-card {
    background: linear-gradient(145deg, rgba(22,27,24,0.95), rgba(10,13,12,0.94));
    border: 1px solid rgba(197,154,92,0.18);
    border-radius: 8px;
    padding: 18px; margin-bottom: 12px;
  }
  .detail-label {
    font-size: 9px; color: var(--copper); letter-spacing: 3px;
    text-transform: uppercase; margin-bottom: 10px;
  }
  .detail-date { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.4; }
  .detail-text {
    font-size: 15px; color: var(--text); line-height: 1.65;
    white-space: pre-wrap; overflow-wrap: anywhere;
  }
  .detail-meta {
    display: grid; gap: 8px; margin-top: 16px; padding-top: 14px;
    border-top: 1px solid rgba(197,154,92,0.12);
  }
  .detail-meta-row {
    display: flex; justify-content: space-between; gap: 12px;
    font-size: 13px; line-height: 1.4;
  }
  .detail-meta-row.stacked { display: block; }
  .detail-meta-row span:first-child { color: var(--copper); }
  .detail-meta-row span:last-child { color: #ddd6c8; text-align: right; overflow-wrap: anywhere; }
  .archive-message-text {
    margin-top: 8px;
    color: #d7d0ea;
    line-height: 1.65;
    white-space: pre-wrap;
  }
  .archive-message-meta {
    margin-top: 6px;
    color: #75679c;
    font-size: 12px;
  }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .detail-action-btn {
    min-height: 42px; border-radius: 8px; border: 1px solid rgba(197,154,92,0.24);
    background: rgba(197,154,92,0.12); color: #fff0cf;
    font-family: inherit; font-size: 13px; cursor: pointer;
  }
  .detail-action-btn.secondary { background: rgba(255,255,255,0.035); color: var(--muted); }
  .detail-action-btn.danger {
    grid-column: 1 / -1;
    border-color: rgba(208,137,141,0.2);
    background: rgba(208,137,141,0.08);
    color: #e0b3b5;
  }

  .profile-reset-btn {
    width: 100%;
    padding: 14px;
    background: rgba(220,80,80,0.08);
    border: 0.5px solid rgba(220,80,80,0.2);
    border-radius: 8px;
    color: #c88080;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
  }

  .add-entry-btn {
    position: fixed; bottom: 84px; right: calc(50% - 215px + 16px);
    width: 52px; height: 52px; border-radius: 8px;
    background: linear-gradient(145deg, #d4a45f, #8a6334);
    border: none; cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 24px rgba(224,189,122,0.28);
    transition: all 0.2s;
    font-size: 22px; color: #f0ecf8;
  }
  .add-entry-btn:active { transform: scale(0.9); }

  /* Profile */
  .profile-content { flex: 1; padding: 0 16px 96px; overflow-y: auto; }
  .profile-header {
    text-align: center; margin-bottom: 20px;
  }
  .profile-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(145deg, rgba(197,154,92,0.18), rgba(88,116,95,0.12));
    border: 1px solid rgba(197,154,92,0.22);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px; font-size: 28px;
  }
  .profile-name {
    max-width: 100%;
    padding: 0 8px;
    font-size: 18px; font-weight: 700; color: var(--text);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .profile-sign {
    padding: 0 8px;
    font-size: 13px; color: var(--copper); margin-top: 2px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .profile-card {
    background: linear-gradient(145deg, rgba(22,27,24,0.92), rgba(10,13,12,0.92));
    border: 1px solid rgba(197,154,92,0.14);
    border-radius: 8px;
    padding: 18px; margin-bottom: 12px;
    box-shadow: 0 14px 42px rgba(0,0,0,0.22);
  }
  .profile-card.profile-accordion {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }
  .profile-card .card-label {
    font-size: 9px; letter-spacing: 3px; color: var(--copper);
    text-transform: uppercase; margin-bottom: 14px;
  }
  .profile-accordion-head {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 0;
    background: linear-gradient(135deg, rgba(197,154,92,0.08), rgba(119,196,173,0.035));
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
  }
  .profile-accordion-head:hover {
    background: linear-gradient(135deg, rgba(197,154,92,0.13), rgba(119,196,173,0.055));
  }
  .profile-accordion-title {
    min-width: 0;
    color: var(--copper-soft);
    font-size: 12px;
    font-weight: 720;
    letter-spacing: 1.4px;
    line-height: 1.25;
    text-transform: uppercase;
    overflow-wrap: anywhere;
  }
  .profile-accordion-meta {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(197,154,92,0.12);
    color: var(--dim);
    font-size: 10.5px;
    white-space: nowrap;
  }
  .profile-accordion-chevron {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s ease;
  }
  .profile-accordion.open .profile-accordion-chevron {
    transform: rotate(180deg);
  }
  .profile-accordion-body {
    display: none;
    padding: 4px 18px 16px;
    border-top: 1px solid rgba(197,154,92,0.09);
  }
  .profile-accordion.open .profile-accordion-body {
    display: block;
  }
  .stat-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px;
    align-items: start;
    padding: 10px 0; border-bottom: 1px solid rgba(197,154,92,0.08);
    cursor: pointer; border-radius: 8px;
    transition: background 0.2s, padding-left 0.2s, padding-right 0.2s;
  }
  .stat-row:hover {
    background: rgba(197,154,92,0.08);
    padding-left: 8px; padding-right: 8px;
  }
  .stat-row:active { background: rgba(197,154,92,0.14); }
  .stat-row:last-child { border: none; }
  .stat-row-long { grid-template-columns: 1fr; }
  .stat-label { min-width: 0; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
  .stat-value {
    max-width: 190px;
    min-width: 0;
    justify-self: end;
    text-align: right;
    font-size: 13.5px; color: #ddd6c8; font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .stat-row-long .stat-value {
    max-width: 100%;
    justify-self: start;
    text-align: left;
  }
  .stat-value.warn { color: #e0a48b; }
  .stat-value.good { color: var(--teal); }
  .stat-value.accent { color: var(--copper-soft); }

  /* Bonds */
  .bonds-content { flex: 1; padding: 0 16px 96px; overflow-y: auto; }
  .bond-empty { text-align: center; padding: 22px 12px 18px; }
  .bond-empty-icon {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(197,154,92,0.06);
    border: 1px solid rgba(197,154,92,0.14);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
  }
  .bond-empty p { font-size: 14.5px; color: var(--muted); line-height: 1.65; margin-bottom: 24px; }
  .bond-form {
    display: grid; gap: 12px; margin: 4px 0 16px;
    padding: 14px; border-radius: 8px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(197,154,92,0.18);
  }
  .bond-field label {
    display: block; margin-bottom: 7px;
    color: var(--copper); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  }
  .bond-field input {
    width: 100%; padding: 13px 14px;
    background: rgba(8,11,10,0.78);
    border: 1px solid rgba(197,154,92,0.18);
    border-radius: 8px; color: #e8e4f0; font-family: inherit; font-size: 15px;
    outline: none;
  }
  .bond-field input:focus { border-color: rgba(224,189,122,0.52); }
  .bond-actions { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; }
  .bond-secondary-btn {
    width: 44px; height: 44px; border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(197,154,92,0.22);
    color: var(--copper-soft); cursor: pointer; font-family: inherit; font-size: 18px;
  }
  .bond-card {
    margin-top: 14px; padding: 15px;
    border-radius: 8px;
    background: rgba(13,18,16,0.86);
    border: 1px solid rgba(197,154,92,0.2);
  }
  .bond-card-title { color: var(--text); font-size: 17px; font-weight: 700; margin-bottom: 6px; }
  .bond-card-sub { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-bottom: 13px; }
  .bond-meter { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; margin: 8px 0 12px; }
  .bond-meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--copper), var(--teal)); }
  .bond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
  .bond-chip {
    padding: 9px 10px; border-radius: 8px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(197,154,92,0.14);
    min-width: 0;
  }
  .bond-chip span { display:block; color:var(--dim); font-size:10px; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
  .bond-chip strong { display:block; color:var(--copper-soft); font-size:13px; line-height:1.25; font-weight:650; overflow-wrap:anywhere; }
  .bond-note { color:#c7c0b2; font-size:13px; line-height:1.55; margin-top:10px; }
  .bond-result-actions { display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-top:14px; }
  .invite-btn {
    padding: 15px 36px;
    background: linear-gradient(145deg, #d4a45f, #8a6334);
    border: none; border-radius: 8px;
    color: #f0ecf8; font-size: 15px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: all 0.2s; letter-spacing: 0.3px;
  }
  .invite-btn.compact { padding: 13px 14px; font-size: 14px; width: 100%; }
  .invite-btn:active { transform: scale(0.96); }
  .invite-btn:hover { box-shadow: 0 6px 24px rgba(224,189,122,0.28); }

  .screen-title {
    font-size: 24px; font-weight: 760; color: var(--text);
    padding: 52px 20px 20px; text-align: center;
    letter-spacing: 0;
    text-shadow: 0 0 22px rgba(224,189,122,0.16);
  }

  /* Toast */
  .toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(30,38,33,0.98), rgba(11,14,13,0.98));
    color: var(--copper-soft); padding: 12px 24px; border-radius: 8px;
    font-size: 14px; z-index: 99; animation: fadeUp 0.3s ease;
    border: 1px solid rgba(197,154,92,0.3);
    font-weight: 500;
  }

  /* Matrix diagram */
  .matrix-wrap {
    padding: 8px 0 16px; text-align: center;
  }
  .matrix-wrap svg { max-width: 100%; height: auto; }
  .matrix-node {
    cursor: pointer;
    outline: none;
  }
  .matrix-node .matrix-node-circle,
  .matrix-node .matrix-node-center,
  .matrix-node .matrix-num {
    transition: all 0.2s;
  }
  .matrix-node:hover .matrix-node-circle,
  .matrix-node:focus .matrix-node-circle {
    fill: rgba(197,154,92,0.22); stroke: rgba(224,189,122,0.72);
  }
  .matrix-node:hover .matrix-node-center,
  .matrix-node:focus .matrix-node-center {
    fill: rgba(119,196,173,0.22); stroke: rgba(224,189,122,0.82);
  }
  .matrix-node:hover .matrix-num,
  .matrix-node:focus .matrix-num { fill: #f1eaff; }
  .matrix-node-circle { fill: rgba(197,154,92,0.1); stroke: rgba(197,154,92,0.42); stroke-width: 1.5; }
  .matrix-node-center { fill: rgba(119,196,173,0.13); stroke: rgba(224,189,122,0.58); stroke-width: 2; }
  .matrix-num { fill: var(--copper-soft); font-size: 14px; font-weight: 700; font-family: inherit; }
  .matrix-label { fill: #8f8a7e; font-size: 8px; font-family: inherit; letter-spacing: 0.5px; }
  .matrix-line { stroke: rgba(197,154,92,0.2); stroke-width: 1; }
  .matrix-line-main { stroke: rgba(119,196,173,0.35); stroke-width: 1.5; }

  /* Daily forecast */
  .forecast-card {
    background: linear-gradient(145deg, rgba(24,31,27,0.95) 0%, rgba(10,13,12,0.95) 100%);
    border: 1px solid rgba(197,154,92,0.22);
    border-radius: 8px;
    padding: 16px 18px; margin-bottom: 14px;
    animation: fadeUp 0.6s ease;
  }
  .forecast-header {
    font-size: 9px; letter-spacing: 3px; color: var(--copper);
    text-transform: uppercase; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
  }
  .forecast-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 0; border-bottom: 1px solid rgba(197,154,92,0.08);
  }
  .forecast-row:last-child { border: none; }
  .forecast-key { font-size: 12px; color: var(--muted); }
  .forecast-val { font-size: 12px; color: var(--copper-soft); font-weight: 600; }
  .forecast-advice {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid rgba(197,154,92,0.12);
    font-size: 13.5px; color: #c7c0b2; line-height: 1.55;
    font-style: italic;
  }

  /* Auth */
  .auth-error {
    color: #e0a48b; font-size: 13px; min-height: 18px;
    text-align: center; margin: 8px 0;
  }
  .auth-toggle {
    font-size: 13px; color: var(--dim); margin-top: 16px; text-align: center;
  }
  .auth-toggle a { color: var(--copper-soft); text-decoration: none; }
  .auth-skip {
    font-size: 12px; margin-top: 12px; text-align: center;
  }
  .auth-skip a { color: var(--dim); text-decoration: none; }
  .auth-status {
    background: linear-gradient(145deg, rgba(22,27,24,0.92), rgba(10,13,12,0.92));
    border: 1px solid rgba(197,154,92,0.14);
    border-radius: 8px; padding: 18px; margin: 0 16px 12px;
  }
  .profile-content .auth-status {
    margin-left: 0;
    margin-right: 0;
  }
  .auth-status-label {
    font-size: 9px; letter-spacing: 3px; color: var(--copper);
    text-transform: uppercase; margin-bottom: 10px;
  }
  .auth-status-title {
    font-size: 18px;
    color: var(--text);
    font-weight: 760;
    margin-bottom: 8px;
    line-height: 1.25;
  }
  .auth-status-copy {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 8px 0 14px;
  }
  .auth-status-email { font-size: 14px; color: var(--text); font-weight: 600; }
  .auth-status-plan { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .auth-logout-btn {
    margin-top: 12px; padding: 10px 20px; border-radius: 8px;
    border: 1px solid rgba(208,137,141,0.2);
    background: rgba(208,137,141,0.08); color: #e0b3b5;
    font-family: inherit; font-size: 13px; cursor: pointer;
  }
  .auth-login-btn {
    width: 100%; padding: 13px;
    background: linear-gradient(145deg, rgba(197,154,92,0.2), rgba(88,116,95,0.12));
    border: 1px solid rgba(197,154,92,0.3); border-radius: 8px;
    color: var(--copper-soft); font-family: inherit; font-size: 14px;
    cursor: pointer;
  }
  .auth-status-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .auth-login-btn.primary {
    background: linear-gradient(145deg, #d4a45f, #8a6334);
    color: #fff6df;
  }
  .auth-login-btn.secondary {
    background: rgba(255,255,255,0.035);
    border-color: rgba(197,154,92,0.16);
    color: var(--muted);
  }
  .auth-note {
    max-width: 320px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0 auto 24px;
  }
  #screen-auth {
    z-index: 20; position: fixed; inset: 0;
    background: var(--bg);
    overflow-y: auto;
  }
  #screen-auth .onboarding {
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 56px;
    padding-bottom: 34px;
  }
  #screen-auth .eye-symbol {
    margin-bottom: 16px;
  }
  #screen-auth:not(.active) { display: none; }
  .start-btn:disabled {
    opacity: 0.5; cursor: not-allowed;
  }

  @media (min-width: 900px) {
    #screen-oracle.active {
      display: grid;
      grid-template-columns: 248px minmax(0, 760px);
      grid-template-rows: auto minmax(0, 1fr) auto;
      justify-content: center;
      column-gap: 26px;
      min-height: 0;
    }

    #screen-oracle .header {
      grid-column: 1 / -1;
      grid-row: 1;
    }

    .chat-area {
      grid-column: 2;
      grid-row: 2;
      width: min(760px, 100%);
      margin: 0 auto;
      padding: 22px 0 12px;
      max-height: none;
      min-height: 0;
    }

    .msg-oracle {
      max-width: 78%;
    }

    .msg-user {
      max-width: 68%;
    }

    .composer {
      display: contents;
    }

    .oracle-settings {
      grid-column: 1;
      grid-row: 2 / span 2;
      align-self: start;
      display: grid;
      gap: 12px;
      padding: 22px 0 0;
    }

    .setting-group {
      display: grid;
      gap: 8px;
    }

    .setting-label {
      display: block;
    }

    .setting-pills {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
    }

    .pill {
      height: 32px;
      padding: 0 8px;
      border-radius: 8px;
      font-size: 11px;
    }

    .oracle-modes {
      grid-column: 1;
      grid-row: 2;
      align-self: end;
      grid-template-columns: 1fr;
      gap: 10px;
      padding: 136px 0 12px;
    }

    #modeDream {
      grid-column: auto;
    }

    .mode-btn {
      height: 48px;
      justify-content: flex-start;
      padding: 0 14px;
      font-size: 13.5px;
      background: linear-gradient(135deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
      border-color: rgba(155,217,255,0.14);
    }

    .mode-btn::before {
      width: 24px;
      text-align: center;
    }

    .input-bar {
      grid-column: 2;
      grid-row: 3;
      padding-left: 0;
      padding-right: 0;
      padding-bottom: 22px;
      background: linear-gradient(transparent 0%, rgba(2,5,10,0.94) 28%);
    }

    .nav {
      width: min(760px, 100%);
      margin: 0 auto;
      justify-content: center;
      gap: 10px;
      padding: 10px 0 18px;
      border-top: 1px solid rgba(155,217,255,0.12);
      background: rgba(2,5,10,0.74);
    }

    .nav-item {
      min-width: 112px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 9px 14px;
      border: 1px solid transparent;
    }

    .nav-item svg {
      width: 20px;
      height: 20px;
      margin-bottom: 0;
    }

    .nav-item .nav-label {
      font-size: 12px;
    }

    .nav-item.active {
      border-color: rgba(155,217,255,0.18);
      background: rgba(155,217,255,0.06);
    }

    .onboarding {
      max-width: 430px;
      margin: 0 auto;
    }

    .diary-list,
    .diary-detail,
    .bonds-content {
      width: min(940px, 100%);
      margin: 0 auto;
      padding-left: 0;
      padding-right: 0;
      padding-bottom: 88px;
    }

    .profile-content {
      width: min(860px, 100%);
      margin: 0 auto;
      padding-left: 0;
      padding-right: 0;
      padding-bottom: 88px;
    }

    .profile-card {
      margin-bottom: 12px;
    }

    .profile-accordion-body {
      max-height: 460px;
      overflow-y: auto;
    }

    .diary-patterns {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .diary-section-label,
    .diary-pattern-empty {
      grid-column: 1 / -1;
    }

    .diary-pattern {
      margin-bottom: 0;
    }

    .diary-toolbar {
      width: min(940px, 100%);
      margin-left: auto;
      margin-right: auto;
    }

    .bonds-content {
      display: grid;
      grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
      align-content: start;
      gap: 18px;
    }

    .bond-empty,
    .bond-form {
      grid-column: 1;
    }

    #bondResult {
      grid-column: 2;
      grid-row: 1 / span 2;
      min-width: 0;
    }

    .add-entry-btn {
      right: calc(50% - 470px);
      bottom: 82px;
    }

    .toast {
      top: 34px;
    }
  }

/* ─────────── ОКО ВЕЛЕСА ─────────── */
.oko-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 88px;
  -webkit-overflow-scrolling: touch;
}
.oko-loading, .oko-empty {
  color: var(--dim);
  font-size: 13px;
  padding: 14px 2px;
  text-align: center;
}
.oko-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.oko-stat {
  background: rgba(12,18,26,0.72);
  border: 0.5px solid rgba(155,217,255,0.14);
  border-radius: 14px;
  padding: 14px 12px;
}
.oko-stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--copper-soft);
  line-height: 1.1;
}
.oko-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.oko-stat-hint { font-size: 10px; color: var(--dim); margin-top: 2px; }
.oko-card {
  background: rgba(12,18,26,0.72);
  border: 0.5px solid rgba(155,217,255,0.14);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.oko-card-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 10px;
}
.oko-bars { margin-top: 10px; }
.oko-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.oko-bar-day { color: var(--dim); min-width: 42px; }
.oko-bar-day.wide { min-width: 108px; color: var(--muted); }
.oko-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(155,217,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.oko-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--copper), var(--teal));
  border-radius: 3px;
}
.pct-0 { width: 0%; }
.pct-5 { width: 5%; }
.pct-10 { width: 10%; }
.pct-15 { width: 15%; }
.pct-20 { width: 20%; }
.pct-25 { width: 25%; }
.pct-30 { width: 30%; }
.pct-35 { width: 35%; }
.pct-40 { width: 40%; }
.pct-45 { width: 45%; }
.pct-50 { width: 50%; }
.pct-55 { width: 55%; }
.pct-60 { width: 60%; }
.pct-65 { width: 65%; }
.pct-70 { width: 70%; }
.pct-75 { width: 75%; }
.pct-80 { width: 80%; }
.pct-85 { width: 85%; }
.pct-90 { width: 90%; }
.pct-95 { width: 95%; }
.pct-100 { width: 100%; }
.oko-bar-val { color: var(--muted); min-width: 46px; text-align: right; }
.oko-reset-link {
  width: 100%;
  margin-top: 8px;
}
.oko-reset-note { margin-top: 6px; }
.oko-note {
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 11px;
  border-radius: 10px;
  margin-bottom: 7px;
  border-left: 2px solid var(--copper);
  background: rgba(155,217,255,0.05);
  color: var(--text);
}
.oko-note.weak {
  border-left-color: var(--danger);
  background: rgba(208,137,141,0.06);
}
.oko-admin-log-item {
  padding: 10px 0;
  border-bottom: 0.5px solid rgba(155,217,255,0.1);
}
.oko-admin-log-item:last-child { border-bottom: 0; }
.oko-admin-log-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--copper-soft);
  font-size: 12.5px;
  font-weight: 650;
}
.oko-admin-log-top span:last-child {
  flex-shrink: 0;
  color: var(--dim);
  font-weight: 400;
}
.oko-admin-log-target {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.oko-admin-log-detail {
  color: var(--dim);
  font-size: 11.5px;
  margin-top: 3px;
  line-height: 1.4;
}
.oko-tag {
  font-size: 10px;
  color: var(--teal);
  border: 0.5px solid rgba(124,231,255,0.3);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
}
.stat-value.dim { color: var(--dim); font-weight: 400; }
.oko-remove {
  background: none;
  border: 0.5px solid rgba(208,137,141,0.28);
  color: var(--danger);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.oko-ally-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.oko-ally-form input {
  flex: 1;
  min-width: 0;
  background: rgba(8,11,14,0.78);
  border: 0.5px solid rgba(155,217,255,0.16);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.oko-ally-form input:focus { outline: none; border-color: rgba(155,217,255,0.4); }
.oko-add-btn {
  background: rgba(155,217,255,0.1);
  border: 0.5px solid rgba(155,217,255,0.28);
  color: var(--copper-soft);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.oko-ally-error { color: var(--danger); font-size: 12px; margin-top: 7px; min-height: 14px; }
.oko-error {
  border-left: 2px solid var(--danger);
  background: rgba(208,137,141,0.05);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 7px;
}
.oko-error-top { font-size: 10px; color: var(--dim); letter-spacing: 0.04em; }
.oko-error-msg { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.oko-refresh {
  width: 100%;
  padding: 13px;
  background: rgba(155,217,255,0.07);
  border: 0.5px solid rgba(155,217,255,0.2);
  border-radius: 14px;
  color: var(--copper-soft);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.oko-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.oko-refresh.secondary {
  background: rgba(224,189,122,0.08);
  border-color: rgba(224,189,122,0.22);
}
@media (min-width: 760px) {
  .oko-grid { grid-template-columns: repeat(4, 1fr); }
  .oko-content { padding: 0 24px 40px; }
}

/* ─────────── ПРИГЛАШЕНИЯ ─────────── */
.referral-card { margin-top: 10px; }
.referral-progress {
  font-size: 13px;
  color: var(--copper-soft);
  margin: 8px 0 2px;
}
.referral-next { font-size: 12px; color: var(--dim); margin-bottom: 10px; }
.referral-link-row { display: flex; gap: 8px; margin-bottom: 10px; }
.referral-link-row input {
  flex: 1;
  min-width: 0;
  background: rgba(8,11,14,0.78);
  border: 0.5px solid rgba(155,217,255,0.16);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
}
.referral-link-row input:focus { outline: none; border-color: rgba(155,217,255,0.4); }

/* ─────────── ДЕСКТОП: БОКОВАЯ НАВИГАЦИЯ + РАБОЧАЯ ОБЛАСТЬ ─────────── */
/* Класс has-nav ставится в startApp: до старта онбординг занимает всю ширину. */
.nav-brand { display: none; }

@media (min-width: 900px) {
  .app.has-nav {
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .app.has-nav .screen {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    overflow: hidden;
  }

  .app.has-nav .nav {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    inset: auto;
    width: auto;
    margin: 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 3px;
    padding: 26px 14px 22px;
    border-top: none;
    border-right: 1px solid rgba(155,217,255,0.12);
    background: rgba(2,5,10,0.5);
  }

  .app.has-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px 22px;
    color: var(--copper-soft);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  .app.has-nav .nav-brand svg { width: 26px; height: 26px; flex: none; }

  .app.has-nav .nav-item {
    flex: none;
    min-width: 0;
    justify-content: flex-start;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 10px;
    text-align: left;
  }
  .app.has-nav .nav-item .nav-label { font-size: 13.5px; }
  .app.has-nav .nav-item:hover:not(.active) { background: rgba(155,217,255,0.045); }
  .app.has-nav .nav-item.active {
    background: rgba(155,217,255,0.1);
    border-color: rgba(155,217,255,0.24);
  }
  .app.has-nav .nav-dot { top: 9px; right: 9px; }

  /* Рабочая область: контент больше не прячется под нижней полосой. */
  .app.has-nav .profile-content,
  .app.has-nav .diary-list,
  .app.has-nav .diary-detail,
  .app.has-nav .bonds-content,
  .app.has-nav .oko-content {
    padding-bottom: 32px;
  }

  .app.has-nav .oko-content {
    width: min(940px, 100%);
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    overflow-y: auto;
  }

  .app.has-nav .screen-title { padding-top: 32px; }

  /* Оракул уже двухколоночный внутри себя — сужаем под новую ширину. */
  .app.has-nav #screen-oracle.active {
    grid-template-columns: 236px minmax(0, 690px);
    column-gap: 22px;
  }
  .app.has-nav #screen-oracle .header { padding: 30px 24px 14px; }

  /* «Глубина» и «Тон» встают друг под другом: в боковой колонке пара
     групп по три пилюли не помещается, и подписи наезжают. */
  .app.has-nav .oracle-settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .app.has-nav .pill {
    font-size: 11.5px;
    padding: 0 4px;
  }
}

/* Око: люди и лимиты, воронка */
.oko-lost { color: var(--danger); font-size: 11px; }
.oko-user {
  border-top: 0.5px solid rgba(155,217,255,0.1);
  padding: 11px 0 12px;
}
.oko-user:first-of-type { border-top: none; }
.oko-user-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.oko-user-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.oko-user-name { font-size: 14px; color: var(--text); font-weight: 600; }
.oko-user-mail { font-size: 11px; color: var(--dim); word-break: break-all; }
.oko-user-tags {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 48%;
}
.oko-role-tag,
.oko-activity {
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.oko-role-tag {
  color: var(--muted);
  background: rgba(155,217,255,0.07);
  border: 0.5px solid rgba(155,217,255,0.14);
}
.oko-role-tag.creator {
  color: var(--copper-soft);
  background: rgba(224,189,122,0.09);
  border-color: rgba(224,189,122,0.24);
}
.oko-role-tag.ally {
  color: var(--teal);
  background: rgba(124,231,255,0.07);
  border-color: rgba(124,231,255,0.22);
}
.oko-activity { color: var(--dim); background: rgba(255,255,255,0.035); }
.oko-activity.active { color: var(--success); }
.oko-activity.warm { color: var(--copper-soft); }
.oko-user-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.oko-user-metrics span {
  min-width: 0;
  border: 0.5px solid rgba(155,217,255,0.1);
  background: rgba(155,217,255,0.04);
  border-radius: 9px;
  padding: 7px 8px;
  color: var(--dim);
  font-size: 10.5px;
}
.oko-user-metrics b {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.1;
  margin-bottom: 2px;
}
.oko-user-meta { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.oko-user-limit {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.oko-user-limit.disabled { opacity: 0.8; }
.oko-user-limit-label { font-size: 11px; color: var(--dim); }
.oko-user-limit input {
  width: 74px;
  background: rgba(8,11,14,0.78);
  border: 0.5px solid rgba(155,217,255,0.16);
  border-radius: 9px;
  padding: 7px 9px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.oko-user-limit input:focus { outline: none; border-color: rgba(155,217,255,0.4); }
.oko-user-limit .oko-add-btn { padding: 7px 12px; font-size: 11.5px; }

.matrix-footer-text {
  fill: #6f7167;
  font-size: 8px;
  font-family: inherit;
}

.copy-fallback-input {
  position: fixed;
  opacity: 0;
}
.oko-owner-note {
  margin-top: 10px;
  border-top: 0.5px solid rgba(155,217,255,0.08);
  padding-top: 10px;
}
.oko-owner-note label {
  display: block;
  color: var(--dim);
  font-size: 11px;
  margin-bottom: 6px;
}
.oko-owner-note textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: rgba(8,11,14,0.78);
  border: 0.5px solid rgba(155,217,255,0.16);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  font-family: inherit;
}
.oko-owner-note textarea:focus { outline: none; border-color: rgba(155,217,255,0.4); }
.oko-note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}
.oko-note-actions span {
  color: var(--dim);
  font-size: 10.5px;
}
@media (max-width: 480px) {
  .oko-actions { grid-template-columns: 1fr; }
  .oko-user-top { flex-direction: column; }
  .oko-user-tags {
    justify-content: flex-start;
    max-width: none;
  }
  .oko-user-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oko-note-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ============================================================
   Десктопные сценарии по экранам (план: design/nextSteps).
   До этого от 900px менялась только общая композиция: боковая
   навигация и центральная колонка. Дневник и профиль оставались
   растянутой мобильной версией в одну колонку.
   ============================================================ */

@media (min-width: 900px) {
  /* Дневник: список слева, запись справа. Оба экрана показываем
     одновременно, поэтому рабочая область делится на две колонки.
     Переключение экранов в JS не трогаем — раскладку решает :has(). */
  .app.has-nav:has(#screen-diary.active),
  .app.has-nav:has(#screen-diary-detail.active) {
    grid-template-columns: 218px minmax(300px, 372px) minmax(0, 1fr);
  }

  .app.has-nav:has(#screen-diary.active) #screen-diary,
  .app.has-nav:has(#screen-diary-detail.active) #screen-diary {
    display: flex;
    grid-column: 2;
    border-right: 1px solid rgba(155, 217, 255, 0.09);
  }

  .app.has-nav:has(#screen-diary.active) #screen-diary-detail,
  .app.has-nav:has(#screen-diary-detail.active) #screen-diary-detail {
    display: flex;
    grid-column: 3;
  }

  /* Кнопки возврата нужны там, где панель одна. Рядом со списком
     они предлагали бы уйти с экрана, который и так открыт. */
  #screen-diary-detail .detail-back,
  #screen-diary-detail .detail-action-btn.secondary {
    display: none;
  }

  /* Кнопка добавления относится к списку, поэтому на двух панелях
     прижимаем её к колонке списка, а не к правому краю окна. */
  .app.has-nav:has(#screen-diary.active) .add-entry-btn,
  .app.has-nav:has(#screen-diary-detail.active) .add-entry-btn {
    position: absolute;
    right: 20px;
    bottom: 24px;
  }

  #diaryDetail:empty::after {
    content: 'Выбери запись слева — Велес раскроет её целиком.';
    display: block;
    padding: 28px 22px;
    color: #75679c;
    font-size: 14px;
    line-height: 1.6;
    border: 1px dashed rgba(155, 217, 255, 0.16);
    border-radius: 14px;
    margin-top: 8px;
  }
}

/* Профиль на десктопе остаётся одной колонкой вниз, простынёй.
   Двухколоночная раскладка здесь неверна: раскрытая натальная карта
   с девятью позициями зажимается в узкий столбец, а блок аккаунта
   наезжает на неё снизу. Ширину задаёт правило выше (860px). */


/* ─────────── ОЦЕНКА ОТВЕТОВ ─────────── */
.rate-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 0.5px solid rgba(197,154,92,0.14);
  flex-wrap: wrap;
}
.rate-q { font-size: 11px; color: var(--dim); letter-spacing: 0.04em; }
.rate-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(197,154,92,0.2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
}
.rate-btn:hover {
  border-color: rgba(224,189,122,0.46);
  color: var(--copper-soft);
  background: rgba(197,154,92,0.12);
}
.rate-btn.miss:hover {
  border-color: rgba(208,137,141,0.5);
  color: var(--danger);
  background: rgba(208,137,141,0.1);
}
.rate-btn:active { transform: scale(0.95); }
.rate-row.done { border-top-color: rgba(155,217,255,0.12); }
.rate-done { font-size: 11.5px; color: var(--teal); }
.rate-done.miss { color: var(--danger); }

.rate-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.rate-share {
  font-size: 28px;
  font-weight: 600;
  color: var(--copper-soft);
  line-height: 1;
}
.rate-summary-label { font-size: 12px; color: var(--muted); }
.oko-bar-fill.weak { background: linear-gradient(90deg, var(--danger), rgba(208,137,141,0.6)); }
.oko-bar-n { color: var(--dim); font-size: 10px; }

/* ─────────── ДАТА РОЖДЕНИЯ ТРЕМЯ СПИСКАМИ ─────────── */
.birth-picker {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.1fr;
  gap: 7px;
}
.birth-picker select {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid rgba(155,217,255,0.18);
  background: rgba(8,11,14,0.78);
  color: var(--text);
  /* 16px: при меньшем размере iOS зумит страницу на фокусе. */
  font-size: 16px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(155,217,255,0.5) 50%),
                    linear-gradient(135deg, rgba(155,217,255,0.5) 50%, transparent 50%);
  background-position: calc(100% - 15px) 21px, calc(100% - 10px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.birth-picker select:focus {
  outline: none;
  border-color: rgba(155,217,255,0.5);
}
.birth-picker select:invalid,
.birth-picker select option[value=""] { color: var(--dim); }
.birth-picker.invalid select {
  border-color: rgba(220,80,80,0.5);
  background-color: rgba(220,80,80,0.05);
}
@media (max-width: 360px) {
  .birth-picker { gap: 5px; }
  .birth-picker select { padding: 0 5px; font-size: 16px; }
}

/* ─────────── МОБИЛЬНЫЕ МЕЛОЧИ ─────────── */
@media (max-width: 899px) {
  /* iOS увеличивает страницу при фокусе на поле со шрифтом меньше 16px
     и обратно уже не возвращает. Ставим 16px именно на телефонах,
     на десктопе прежние размеры не трогаем. */
  #msgInput,
  #bondNameInput,
  #bondBirthInput,
  .bond-field input,
  .form-group input,
  textarea {
    font-size: 16px;
  }

  /* Пилюли глубины и тона были 26px высотой — мелко для пальца. */
  .pill { height: 34px; }
}

/* Форма входа лежит внутри .onboarding, а это flex с align-items:center.
   Без своей ширины обёртка сжималась по содержимому: на экране 375px
   поля занимали 219px, треть ширины пропадала. */
#authForm {
  width: 100%;
  max-width: 340px;
}

/* ─────────── РЕЖИМЫ ОДНИМ РЯДОМ НА ТЕЛЕФОНЕ ─────────── */
/* Пять кнопок сеткой занимали 130px по вертикали, при том что 76%
   запросов идут в «Оракул» и режим не переключают вовсе. На экране
   667px управление съедало больше места, чем сам разговор.
   Теперь это один прокручиваемый ряд высотой 34px. */
@media (max-width: 899px) {
  .oracle-modes {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    padding: 8px 16px 0;
  }
  .oracle-modes::-webkit-scrollbar { display: none; }
  .oracle-modes { scroll-behavior: smooth; }

  .mode-btn,
  .mode-btn.lead {
    flex: 0 0 auto;
    grid-column: auto;
    height: 34px;
    /* Отступы подобраны так, чтобы все пять режимов помещались
       на экране 375px без прокрутки: «Сонник» уезжал за край. */
    padding: 0 8px;
    gap: 0;
    /* Полную подпись прячем размером, короткую даём псевдоэлементом:
       тот же приём, что уже используют пилюли глубины и тона. */
    font-size: 0;
  }
  .mode-btn::before { display: none; }
  .mode-btn::after {
    content: attr(data-short);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }
  /* «Разбор переписки» остаётся первым в ряду — заметен положением,
     а не тем, что занимает целую строку. */
  .mode-btn.lead {
    border-color: rgba(155,217,255,0.3);
    background: linear-gradient(135deg, rgba(155,217,255,0.12), rgba(124,231,255,0.06));
  }
}

/* Освободившееся от режимов место отдаём разговору. Раньше потолок был
   44dvh, и даже когда снизу появлялось место, чат не рос.
   Потолок нужен: без него чат забирает всю высоту и выталкивает панель
   ввода за экран. 360px — это шапка плюс настройки, режимы, ввод
   и навигация; остаток отдаётся разговору. */
@media (max-width: 899px) {
  .chat-area {
    /* 318px = шапка 110 + сводка настроек 25 + режимы 42 + ввод 69 + навигация 69.
       Остаток экрана уходит разговору. */
    max-height: max(200px, calc(100dvh - 318px));
  }
}

/* ─────────── ОТСТУПЫ ПОД ВЫРЕЗ ЭКРАНА ─────────── */
/* В разметке стоит viewport-fit=cover, но env(safe-area-inset) нигде
   не использовался: вместо него были зашиты 48px сверху и 26px снизу —
   догадка про вырез и полосу жестов. В браузере и на телефонах без
   выреза это просто съедало место, а на устройствах с крупным вырезом
   могло не хватить. Теперь отступ берётся у системы. */
@media (max-width: 899px) {
  /* Руны идут полосой .app::after сверху: они тоже должны уезжать
     вниз на телефонах с вырезом, иначе спрячутся под ним. */
  .app::after {
    top: calc(8px + env(safe-area-inset-top, 0px));
  }
  /* Отступ шапки обязан пропускать руны: при 14px текст «ОРАКУЛ»
     ложился прямо на них. Полоса рун заканчивается на 25px. */
  #screen-oracle .header {
    padding-top: calc(32px + env(safe-area-inset-top, 0px));
    padding-bottom: 10px;
  }
  #screen-oracle .header-title {
    font-size: 24px;
  }
  .nav {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}

/* ─────────── СВЁРНУТЫЕ НАСТРОЙКИ ОТВЕТА ─────────── */
.settings-toggle { display: none; }

@media (max-width: 899px) {
  /* Глубину и тон меняют редко, а полоса пилюль стояла всегда.
     Свернули в строку-сводку: видно текущий выбор, разворачивается тапом. */
  .settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 7px 16px 3px;
    background: none;
    border: none;
    color: var(--dim);
    font-family: inherit;
    font-size: 11.5px;
    cursor: pointer;
  }
  .settings-summary { color: var(--muted); }
  .settings-caret {
    font-size: 13px;
    line-height: 1;
    transition: transform 0.2s;
  }
  .settings-toggle.is-open .settings-caret { transform: rotate(180deg); }
  .oracle-settings.is-collapsed { display: none; }
}

/* Развёрнутые настройки добавляют 40px — ужимаем разговор ровно на них,
   иначе панель ввода уходит за нижний край. */
@media (max-width: 899px) {
  #screen-oracle.settings-open .chat-area {
    max-height: max(160px, calc(100dvh - 358px));
  }
}
