:root{
  --bg-left: #F7ECFA;
  --bg-right:#D9C2FF;
  --accent:  #7C3AED;
  --accent2: #A78BFA;
  --text:    #44267e;
  --muted:   #6B21A8;
  --white:   #FFFFFF;

  --bubble-user:#F3E8FF;
  --bubble-bot: #FFFFFF;
  --bubble-sys: #F8F0FF;

  --shadow: 0 10px 30px rgba(124,58,237,.18);
  --shadow-soft: 0 6px 20px rgba(124,58,237,.12);

  --composer-h: 72px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; min-height:100dvh;
  background: linear-gradient(90deg,var(--bg-left),var(--bg-right));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overflow: hidden;
}
.app{
  width:100vw;
  height:100dvh;
  height:100svh;
  display:flex; flex-direction:column; overflow:hidden;
}

/* Шапка — в потоке, не перекрывает контент */
header{
  position: sticky; top:0; z-index:5;
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 16px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(15px);
  box-shadow: 0 6px 16px rgba(124,58,237,.12);
  min-height: 60px;
  flex-wrap: wrap;
  gap: 10px;
}
header .title{ font-weight:800; letter-spacing:.4px; color:var(--text); }
header .right{ display:flex; gap:10px; align-items:center; }
header .gear{
  cursor:pointer; padding:6px; border-radius:10px; color:var(--accent);
  background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease;
}
header .gear:hover{ transform: rotate(-10deg) scale(1.04); }

.header {
  height: 100%;
  display: flex;
  align-items: center;
}

.header-logo {
  height: 44px;
  width: auto;
  max-width: 350px;
  object-fit: contain;
}

/* Стили для навигационной панели */
.header-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 20px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
  max-width: 600px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.nav-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.nav-btn:active {
  transform: translateY(0);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border-color: transparent;
}

.nav-btn.loading {
  position: relative;
  color: transparent;
}

.nav-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.mode-label{
  color:var(--muted); font-weight:700; text-transform: lowercase;
  padding:3px 8px; border-radius:999px; background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
}

#chatWrap{
  flex:1; min-height:0; display:flex; flex-direction:column;
}

/* Чат — скролл только тут, первое сообщение не под шапкой */
.chat{
  position: relative;
  flex:1; overflow:auto;
  padding: 64px 12px calc(12px + var(--composer-h)) 80px;
  display:flex; flex-direction:column; gap:10px;
  -ms-overflow-style: none; scrollbar-width: none;
  overscroll-behavior: contain;
}
.chat::-webkit-scrollbar{ width:0; height:0; }

.row{display:flex; width:100%;}
.row.user{ justify-content:flex-end; }
.row.bot{ justify-content:flex-start; }
.row.system{ justify-content:center; }

.msg{
  max-width:86%; padding:100px 12px; border-radius:14px; line-height:1.4;
  display:inline-flex; flex-direction:column; gap:6px; border:none;
  box-shadow: var(--shadow-soft);
  word-wrap: break-word;
}
.msg.user{ background:var(--bubble-user); color:var(--text); border-top-right-radius:4px; }
.msg.bot{ background:var(--bubble-bot); color:#1f1147; border-top-left-radius:4px; }
.msg.system{ background:var(--bubble-sys); color:var(--text); }
.time{ font-size:12px; color:#5b3d8f; opacity:.85; }
.attachments{ display:flex; gap:8px; flex-wrap:wrap; }
.attachments img{ max-width:240px; max-height:180px; border-radius:10px; border:none; box-shadow: var(--shadow); }

/* Композер — закреплён снизу, чат имеет нижний паддинг под него */
.composer{
  position: fixed; left:0; right:0; bottom:0; z-index:30;
  padding:10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(10px);
  display:flex; gap:10px; align-items:center;
  box-shadow: 0 -6px 20px rgba(124,58,237,.10);
}
.text{
  flex:1; display:flex; background: rgba(255,255,255,.85);
  border-radius:12px; padding:8px 12px; border:none;
  box-shadow: var(--shadow-soft);
}
.text input{
  flex:1; outline:none; border:none; background:transparent; color:var(--text);
  font-size:14px; padding:8px 12px;
}
.btn{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border:none; color:#fff; font-weight:800; padding:8px 12px; border-radius:12px; cursor:pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.btn:disabled{ opacity:.6; cursor:not-allowed; }
.hidden{display:none!important}
.top-sentinel{ height:4px; }

.login{
  margin:auto;
  background: rgba(255,255,255,.6); border-radius:16px;
  padding:20px; max-width:480px; width:100%; backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.login h2{ margin-top:0; color:var(--text); }
.login .row{ display:flex; gap:8px; }
.login input{
  flex:1; padding:10px; border-radius:10px; border:none; background: rgba(255,255,255,.9);
  color:var(--text); box-shadow: var(--shadow-soft);
}

/* Стили для энергословаря */
.energy-dict-topics {
  position: fixed;
  bottom: var(--composer-h);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  padding: 12px 16px;
  z-index: 25;
  max-height: 40vh;
  overflow-y: auto;
}

.energy-dict-header {
  margin-bottom: 12px;
}

.energy-dict-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.energy-dict-topics-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.energy-dict-topic-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.energy-dict-topic-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.energy-dict-topic-btn:active {
  transform: translateY(0);
}

/* Стили для вертикального отображения результатов (без нумерации) */
.energy-dict-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.energy-dict-result-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
}

.energy-dict-result-item:last-child {
  border-bottom: none;
}

.energy-dict-result-content {
  flex: 1;
}

.energy-dict-result-word {
  font-weight: bold;
  color: var(--text);
}

.energy-dict-result-code {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.energy-dict-result-error {
  color: #ef4444;
  font-style: italic;
}

/* Адаптивность для навигации */
@media (max-width: 10024px) {
  .header-nav {
    gap: 6px;
    max-width: 500px;
  }
  
  .nav-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
}

@media (max-width: 10024px) {
  .header {
    flex-direction: column;
    gap: 8px;
    height: auto;
    padding: 8px;
  }
  
  .header-nav {
    order: 3;
    width: 100%;
    margin: 8px 0 0 0;
    gap: 4px;
  }
  
  .nav-btn {
    flex: 1;
    min-width: 0;
    font-size: 10px;
    padding: 4px 8px;
  }
  
  .right {
    order: 2;
    width: 100%;
    justify-content: center;
    margin: 8px 0;
  }

  .header-logo {
    height: 38px;
    max-width: 350px;
  }
  
  .mode-label {
    font-size: 11px;
    padding: 2px 6px;
  }
  
  .gear {
    padding: 5px;
    font-size: 12px;
  }

  .energy-dict-topics {
    padding: 10px 12px;
    max-height: 35vh;
  }
  
  .energy-dict-topic-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .energy-dict-topics-list {
    gap: 6px;
  }

  .composer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 2048px) {
  .header-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-btn {
    flex: 0 0 auto;
    font-size: 9px;
    padding: 3px 6px;
  }
  
  /* Скрыть scrollbar но оставить функциональность */
  .header-nav::-webkit-scrollbar {
    display: none;
  }
  .header-nav {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .header-logo {
    height: 36px;
    max-width: 200px;
  }

  .energy-dict-topics {
    padding: 8px 10px;
    max-height: 30vh;
  }
  
  .energy-dict-header h3 {
    font-size: 13px;
  }
  
  .energy-dict-topic-btn {
    padding: 5px 8px;
    font-size: 11px;
  }
  
  .energy-dict-topics-list {
    gap: 4px;
  }

  .text input {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .btn, .attachment-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .chat {
    padding: 12px 8px calc(8px + var(--composer-h)) 8px;
  }

  .msg {
    max-width: 92%;
    padding: 8px 10px;
  }
}

/* запрет пустых сообщений — микрошевеление */
@keyframes shake {
  0%,100% { transform: translateX(0) }
  20% { transform: translateX(-4px) }
  40% { transform: translateX(4px) }
  60% { transform: translateX(-2px) }
  80% { transform: translateX(2px) }
}
.text.shake { animation: shake .35s; }

/* Splash c clip-path */
.splash{
  position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center;
  background: linear-gradient(90deg, var(--bg-left), var(--bg-right));
  opacity:0; pointer-events:none;
}
.splash.show{ display:flex; animation: splashLife 4.2s ease-in-out forwards; }
@keyframes splashLife{
  0%{opacity:0}
  18%{opacity:1}
  88%{opacity:1}
  100%{opacity:0}
}
.split{
  width: clamp(200px, 50vw, 500px);
  text-align:center; color:var(--accent);
  text-shadow: 0 2px 20px rgba(124,58,237,.25);
  font-weight:900; letter-spacing:.6px;
}
.line{
  width:0; height:3px; margin: 12px auto; border-radius:3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
  animation: lineGrow .9s ease-out .35s forwards;
}
@keyframes lineGrow{ to{width: 78%;} }

.topWord img,
.botWord img {
  max-height: 80px;
  width: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
}
.topWord{
  transform: translateY(10px);
  opacity: 0.001;
  -webkit-clip-path: inset(100% 0 0 0);
          clip-path: inset(100% 0 0 0);
  animation: revealTop 1s cubic-bezier(.2,.75,.2,1) .85s forwards;
}
@keyframes revealTop{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}
.botWord{
  transform: translateY(-10px);
  opacity: 0.001;
  -webkit-clip-path: inset(0 0 100% 0);
          clip-path: inset(0 0 100% 0);
  animation: revealBottom 1s cubic-bezier(.2,.75,.2,1) .95s forwards;
}
@keyframes revealBottom{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}

.fade-bottom{
  position: sticky; bottom: var(--composer-h); left:0; right:0; height: 96px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(46,16,101,.22), rgba(46,16,101,0));
  opacity: 0; transition: opacity .2s ease;
  margin-top: calc(-96px - var(--composer-h));
}

.mode-overlay{
  position:fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  z-index: 40;
}
.mode-overlay.show{ display:flex; }
.mode-dialog{
  background: rgba(255,255,255,.9);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(66,24,116,.25);
  padding: 18px;
  width: min(92vw, 680px);
  animation: popIn .18s ease-out;
}
@keyframes popIn{
  from{ transform: translateY(8px) scale(.98); opacity: .8; }
  to{ transform: translateY(0) scale(1); opacity: 1; }
}
.mode-title{ margin: 0 0 10px 0; color: var(--text); font-weight: 900; }
.mode-grid{
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
@media (max-width: 800px){ .mode-grid{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 2048px){ .mode-grid{ grid-template-columns: 1fr; } }
.mode-card{
  border: none; cursor: pointer; text-align: left;
  padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f7f0ff);
  box-shadow: var(--shadow-soft);
  display: grid; gap: 6px; align-content: start;
  transition: transform .15s ease, box-shadow .15s ease, outline .15s ease;
}
.mode-card:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.mode-card.active{ outline: 3px solid var(--accent); }
.mode-card .icon{ font-size: 28px; }
.mode-card .name{ font-weight: 900; color: var(--text); }
.mode-card .desc{ font-size: 14px; color: #6b4da7; }

.mode-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top: 10px; }
.mode-close{
  background: rgba(255,255,255,.9); color: var(--text);
  border:1px solid rgba(124,58,237,.15);
  border-radius: 10px; padding: 8px 12px; cursor:pointer;
}
.mode-apply{
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  border:none; border-radius: 10px; padding: 8px 14px; cursor:pointer; box-shadow: var(--shadow);
  font-weight: 800;
}

.mode-toast{
  position:fixed; left:50%; top:14px; transform: translateX(-50%) translateY(-20px);
  background: rgba(255,255,255,.9); color: var(--text); font-weight:800; border-radius:999px;
  padding:8px 14px; box-shadow: var(--shadow); opacity:0; z-index:50;
  transition: transform .25s ease, opacity .25s ease;
}
.mode-toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

/* Стиль для сообщения об ошибке */
.error-message {
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
}

/* ——— Карточка профиля в чате ——— */
.profile-card{
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-soft);
}
.profile-header{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.profile-header .avatar{
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 900; font-size: 20px;
  box-shadow: var(--shadow-soft);
}
.profile-header .name{ font-weight: 900; color: var(--text); line-height: 1.1; }
.profile-header .id{ font-size: 12px; color: #6b4da7; }
.profile-grid{ display: grid; gap: 6px; margin: 6px 0; }
.profile-grid .row{
  display: grid; grid-template-columns: 140px 1fr; gap: 10px;
  border-bottom: 1px dashed rgba(124,58,237,.15);
  padding-bottom: 6px;
}
.profile-grid .row:last-child{ border-bottom: none; padding-bottom: 0; }
.profile-grid .k{ color:#6b4da7; font-weight:700; }
.profile-grid .v{ color: var(--text); }
.profile-grid .mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.profile-sub{
  margin-top: 8px;
  font-weight: 800; font-size: 12px;
  padding: 8px 10px; border-radius: 10px;
}
.profile-sub.ok{
  background: rgba(16,185,129,.12);
  color: #065f46; border: 1px solid rgba(16,185,129,.25);
}
.profile-sub.warn{
  background: rgba(239,68,68,.10);
  color: #7f1d1d; border: 1px solid rgba(239,68,68,.25);
}
@media (max-width: 2048px){
  .profile-grid .row{ grid-template-columns: 120px 1fr; }
}

/* ——— Карточка ресурсных дней ——— */
.resource-day-card{
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 12px; padding:10px; background: rgba(255,255,255,.85);
}
.resource-day-card .title{ font-weight:900; margin-bottom:8px; color:var(--text); }
.rd-row{ display:flex; justify-content:space-between; padding:6px 8px; border-bottom:1px dashed rgba(124,58,237,.15); border-radius:8px; }
.rd-row:last-child{ border-bottom: none; }
.rd-row .dt{ color:#6b4da7; font-weight:700; }
.rd-row .en{ color: var(--text); }
.rd-row.score-3{ background: rgba(16,185,129,.10); }
.rd-row.score-2{ background: rgba(59,130,246,.08); }

/* ——— Карточка чакр ——— */
.chakra-card{
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 12px; padding:10px; background: rgba(255,255,255,.85);
}
.chakra-card .title{ font-weight:900; margin-bottom:8px; color:var(--text); }
.chakra-card .row{ display:grid; grid-template-columns: 120px 1fr; gap:8px; padding:6px 0; border-bottom:1px dashed rgba(124,58,237,.15); }
.chakra-card .row:last-child{ border-bottom: none; }
.chakra-card .k{ color:#6b4da7; font-weight:700; }
.chakra-card .v{ color: var(--text); }

/* ——— Мобильная шапка: одна строка со скроллом ——— */
@media (max-width: 820px){
  header{ 
    flex-wrap: nowrap;
    align-items: center; 
    gap: 6px;
  }
  .header-nav{
    order: 2;
    width: 100%;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    margin: 6px 0 0 0;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .header-nav::-webkit-scrollbar{ display:none; }
  .nav-btn{
    flex: 0 0 auto;
    margin-right: 8px;
    font-size: 12px;
    padding: 6px 10px;
  }
  .right{ order: 3; margin-left: auto; }
  .header-logo{ height: 38px; }
}
@media (max-width: 420px){
  .nav-btn{ font-size: 11px; padding: 5px 8px; }
  .header-logo{ height: 34px; }
}

/* Стили для красивого отображения ресурсного дня */
.resource-day-container {
    max-width: 100%;
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.current-day-card {
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    border: 2px solid transparent;
}

.current-day-card.green {
    background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(16,185,129,0.05));
    border-color: rgba(16,185,129,0.3);
}

.current-day-card.yellow {
    background: linear-gradient(135deg, rgba(168,85,247,0.1), rgba(168,85,247,0.05));
    border-color: rgba(168,85,247,0.3);
}

.current-day-card.neutral {
    background: linear-gradient(135deg, rgba(107,114,128,0.1), rgba(107,114,128,0.05));
    border-color: rgba(107,114,128,0.3);
}

.current-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.day-emoji {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
}

.day-info {
    flex: 1;
}

.day-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 2px;
}

.day-subtitle {
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
}

.day-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    opacity: 0.9;
}

/* Таблица ресурсных дней */
.resource-days-table {
    background: rgba(255,255,255,0.8);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(124,58,237,0.1);
}

.table-header {
    text-align: center;
    margin-bottom: 16px;
}

.table-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 4px;
}

.table-subtitle {
    font-size: 12px;
    color: var(--muted);
    opacity: 0.8;
}

.days-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.days-column {
    display: flex;
    flex-direction: column;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(124,58,237,0.1);
}

.column-emoji {
    font-size: 18px;
}

.column-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.green-days .column-header {
    border-bottom-color: rgba(16,185,129,0.3);
}

.yellow-days .column-header {
    border-bottom-color: rgba(168,85,247,0.3);
}

.days-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.day-item {
    background: rgba(124,58,237,0.1);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.green-days .day-item {
    background: rgba(16,185,129,0.15);
    color: #065f46;
}

.yellow-days .day-item {
    background: rgba(168,85,247,0.15);
    color: #6b21a8;
}

.day-item.empty {
    background: rgba(107,114,128,0.1);
    color: var(--muted);
    font-style: italic;
}

/* Подсказка внизу */
.energy-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(168,85,247,0.1));
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
}

.tip-icon {
    font-size: 18px;
}

.tip-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

/* Адаптивность для мобильных */
@media (max-width: 2048px) {
    .days-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .current-day-card {
        padding: 14px;
    }
    
    .resource-days-table {
        padding: 14px;
    }
    
    .energy-tip {
        padding: 10px 14px;
    }
}

/* Стили для карточки активации чакр */
.chakra-time-card {
    background: rgba(255,255,255,0.9);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(124,58,237,0.15);
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.chakra-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(124,58,237,0.1);
}

.chakra-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 50%;
    color: white;
}

.chakra-title {
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
}

.chakra-system {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(124,58,237,0.08);
    border-radius: 10px;
}

.chakra-system-label {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.chakra-system-value {
    font-weight: 800;
    font-size: 20px;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.chakra-colors {
    margin-bottom: 16px;
}

.colors-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 14px;
}

.colors-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 12px;
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    border: 1px solid rgba(124,58,237,0.1);
}

.color-emoji {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease;
}

.color-emoji:hover {
    transform: scale(1.1);
}

.chakra-description {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    line-height: 1.4;
    padding: 8px;
    background: rgba(124,58,237,0.05);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

/* Адаптивность для мобильных */
@media (max-width: 2048px) {
    .chakra-time-card {
        padding: 14px;
    }
    
    .chakra-header {
        margin-bottom: 14px;
    }
    
    .chakra-system {
        padding: 8px 10px;
    }
    
    .colors-container {
        padding: 10px;
        gap: 10px;
    }
    
    .color-emoji {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */

/* Мобильное меню-гамбургер */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  margin-left: 12px;
}

.mobile-menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--accent);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Перестраиваем шапку для мобильных */
@media (max-width: 10024px) {
  header {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    order: 1;
  }

  .header-logo {
    height: 36px;
    max-width: 200px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .header-nav {
    order: 3;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: var(--shadow);
  }

  .header-nav.active {
    max-height: 300px;
    padding: 12px;
  }

  .nav-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .header-nav .nav-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(124, 58, 237, 0.2);
  }

  .right {
    order: 2;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mode-label {
    font-size: 11px;
    padding: 4px 8px;
  }

  .gear {
    padding: 6px;
    font-size: 14px;
  }
}

/* Улучшения для очень маленьких экранов */
/* @media (max-width: 360px) {
  header {
    padding: 6px 8px;
  }

  .header-logo {
    height: 32px;
    max-width: 160px;
  }

  .mode-label {
    font-size: 10px;
    padding: 3px 6px;
  }

  .gear {
    padding: 4px;
    font-size: 12px;
  }

  .mobile-menu-toggle {
    width: 20px;
    height: 16px;
    margin-left: 8px;
  }
} */

/* Адаптация композера для мобильных */
@media (max-width: 10024px) {
  .composer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .text input {
    font-size: 16px; /* Убираем zoom на iOS */
    padding: 10px 12px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Адаптация чата для мобильных */
@media (max-width: 10024px) {
  .chat {
    padding: 56px 8px calc(8px + var(--composer-h)) 8px;
  }

  .msg {
    max-width: 92%;
    padding: 8px 10px;
  }

  .attachments img {
    max-width: 200px;
    max-height: 150px;
  }
}

/* Адаптация энергословаря для мобильных */
@media (max-width: 10024px) {
  .energy-dict-topics {
    padding: 10px 12px;
    max-height: 50vh;
  }

  .energy-dict-topics-list {
    gap: 6px;
  }

  .energy-dict-topic-btn {
    padding: 8px 10px;
    font-size: 13px;
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}

@media (max-width: 2048px) {
  .energy-dict-topic-btn {
    flex: 1 1 100%;
  }
}

/* Адаптация модальных окон для мобильных */
@media (max-width: 10024px) {
  .mode-dialog {
    width: 95vw;
    margin: 0 10px;
    padding: 16px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-card {
    padding: 12px;
  }

  .mode-card .icon {
    font-size: 24px;
  }

  .mode-card .name {
    font-size: 14px;
  }

  .mode-card .desc {
    font-size: 12px;
  }
}

/* Улучшение скролла на iOS */
.chat {
  -webkit-overflow-scrolling: touch;
}

/* Безопасные отступы для новых iPhone */
@supports (padding: max(0px)) {
  .composer {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Улучшение тач-целей */
.nav-btn, .gear, .mobile-menu-toggle {
  min-height: 44px;
  min-width: 44px;
}

/* Анимация появления мобильного меню */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-nav.active .nav-container {
  animation: slideDown 0.3s ease;
}

:root{
  --bg-left: #F7ECFA;
  --bg-right:#D9C2FF;
  --accent:  #7C3AED;
  --accent2: #A78BFA;
  --text:    #44267e;
  --muted:   #6B21A8;
  --white:   #FFFFFF;

  --bubble-user:#F3E8FF;
  --bubble-bot: #FFFFFF;
  --bubble-sys: #F8F0FF;

  --shadow: 0 10px 30px rgba(124,58,237,.18);
  --shadow-soft: 0 6px 20px rgba(124,58,237,.12);

  --composer-h: 72px;
  --mode-indicator-h: 50px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; min-height:100dvh;
  background: linear-gradient(90deg,var(--bg-left),var(--bg-right));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overflow: hidden;
}
.app{
  width:100vw;
  height:100dvh;
  height:100svh;
  display:flex; flex-direction:column; overflow:hidden;
}

/* ===== ОБНОВЛЕННАЯ СТРУКТУРА ШАПКИ ===== */
header{
  position: sticky; top:0; z-index:50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(15px);
  box-shadow: 0 6px 16px rgba(124,58,237,.12);
}



.header-logo-container {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.header-logo {
  height: 44px;
  width: auto;
  max-width: 350px;
  object-fit: contain;
}


/* Кнопка меню навигации */
.nav-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  transition: all 0.3s ease;
}

.nav-menu-toggle:hover {
  background: rgba(124,58,237,0.1);
  transform: scale(1.05);
}

.nav-menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--accent);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.nav-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.gear{
  cursor:pointer; padding:8px; border-radius:10px; color:var(--accent);
  background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}
.gear:hover{ transform: rotate(-10deg) scale(1.04); }

/* Выпадающее меню навигации */
.nav-dropdown {
  position: absolute;
  top: 100%;
  right: 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(124,58,237,0.1);
  min-width: 200px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
  z-index: 100;
}

.nav-dropdown.active {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
}

.nav-dropdown-content {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.nav-dropdown-btn:hover {
  background: rgba(124,58,237,0.1);
  transform: translateX(4px);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-text {
  flex: 1;
}

.nav-dropdown-btn.loading {
  position: relative;
  color: transparent;
}

.nav-dropdown-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== ИНДИКАТОР РЕЖИМА ЧАТА ===== */
.chat-mode-indicator {
  position: sticky;
  top: 60px; /* Высота шапки */
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(124,58,237,0.1);
  box-shadow: 0 2px 8px rgba(124,58,237,0.1);
}

.mode-indicator-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 20px;
  color: white;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-soft);
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mode-icon {
  font-size: 16px;
}

.mode-text {
  white-space: nowrap;
}

/* Адаптивность для мобильных  лого*/
@media (max-width: 10024px) {

  .gear {
    padding: 6px;
    min-width: 36px;
    min-height: 36px;
  }

  .nav-dropdown {
    right: 12px;
    left: 12px;
    min-width: auto;
  }

  .chat-mode-indicator {
    top: 56px;
    padding: 6px 12px;
  }

  .mode-indicator-content {
    padding: 5px 14px;
    font-size: 13px;
  }
}

@media (max-width: 2048px) {


  .nav-menu-toggle {
    width: 20px;
    height: 16px;
    padding: 6px;
  }

  .chat-mode-indicator {
    top: 52px;
    padding: 4px 10px;
  }

  .mode-indicator-content {
    padding: 4px 12px;
    font-size: 12px;
  }

  .mode-icon {
    font-size: 14px;
  }
}



/* ===== ОСНОВНОЙ ЧАТ С ОТСТУПОМ 63px ===== */
#chatWrap{
  flex:1; min-height:0; display:flex; flex-direction:column;
}

.chat{
  position: relative;
  flex:1; overflow:auto;
  padding: 63px 12px calc(12px + var(--composer-h)) 80px; /* Отступ сверху 63px */
  display:flex; flex-direction:column; gap:10px;
  -ms-overflow-style: none; scrollbar-width: none;
  overscroll-behavior: contain;
}
.chat::-webkit-scrollbar{ width:0; height:0; }

.row{display:flex; width:100%;}
.row.user{ justify-content:flex-end; }
.row.bot{ justify-content:flex-start; }
.row.system{ justify-content:center; }

.msg{
  max-width:86%; padding:10px 12px; border-radius:14px; line-height:1.4;
  display:inline-flex; flex-direction:column; gap:6px; border:none;
  box-shadow: var(--shadow-soft);
  word-wrap: break-word;
}
.msg.user{ background:var(--bubble-user); color:var(--text); border-top-right-radius:4px; }
.msg.bot{ background:var(--bubble-bot); color:#1f1147; border-top-left-radius:4px; }
.msg.system{ background:var(--bubble-sys); color:var(--text); }
.time{ font-size:12px; color:#5b3d8f; opacity:.85; }
.attachments{ display:flex; gap:8px; flex-wrap:wrap; }
.attachments img{ max-width:240px; max-height:180px; border-radius:10px; border:none; box-shadow: var(--shadow); }

.composer{
  position: fixed; left:0; right:0; bottom:0; z-index:30;
  padding:10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(10px);
  display:flex; gap:10px; align-items:center;
  box-shadow: 0 -6px 20px rgba(124,58,237,.10);
}
.text{
  flex:1; display:flex; background: rgba(255,255,255,.85);
  border-radius:12px; padding:8px 12px; border:none;
  box-shadow: var(--shadow-soft);
}
.text input{
  flex:1; outline:none; border:none; background:transparent; color:var(--text);
  font-size:14px; padding:8px 12px;
}
.btn{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border:none; color:#fff; font-weight:800; padding:8px 12px; border-radius:12px; cursor:pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.btn:disabled{ opacity:.6; cursor:not-allowed; }
.hidden{display:none!important}
.top-sentinel{ height:4px; }

.login{
  margin:auto;
  background: rgba(255,255,255,.6); border-radius:16px;
  padding:20px; max-width:480px; width:100%; backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.login h2{ margin-top:0; color:var(--text); }
.login .row{ display:flex; gap:8px; }
.login input{
  flex:1; padding:10px; border-radius:10px; border:none; background: rgba(255,255,255,.9);
  color:var(--text); box-shadow: var(--shadow-soft);
}

.energy-dict-topics {
  position: fixed;
  bottom: var(--composer-h);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  padding: 12px 16px;
  z-index: 25;
  max-height: 40vh;
  overflow-y: auto;
}

.energy-dict-header {
  margin-bottom: 12px;
}

.energy-dict-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.energy-dict-topics-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.energy-dict-topic-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.energy-dict-topic-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.energy-dict-topic-btn:active {
  transform: translateY(0);
}

.energy-dict-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.energy-dict-result-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
}

.energy-dict-result-item:last-child {
  border-bottom: none;
}

.energy-dict-result-content {
  flex: 1;
}

.energy-dict-result-word {
  font-weight: bold;
  color: var(--text);
}

.energy-dict-result-code {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.energy-dict-result-error {
  color: #ef4444;
  font-style: italic;
}

@keyframes shake {
  0%,100% { transform: translateX(0) }
  20% { transform: translateX(-4px) }
  40% { transform: translateX(4px) }
  60% { transform: translateX(-2px) }
  80% { transform: translateX(2px) }
}
.text.shake { animation: shake .35s; }

.splash{
  position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center;
  background: linear-gradient(90deg, var(--bg-left), var(--bg-right));
  opacity:0; pointer-events:none;
}
.splash.show{ display:flex; animation: splashLife 4.2s ease-in-out forwards; }
@keyframes splashLife{
  0%{opacity:0}
  18%{opacity:1}
  88%{opacity:1}
  100%{opacity:0}
}
.split{
  width: clamp(200px, 50vw, 500px);
  text-align:center; color:var(--accent);
  text-shadow: 0 2px 20px rgba(124,58,237,.25);
  font-weight:900; letter-spacing:.6px;
}
.line{
  width:0; height:3px; margin: 12px auto; border-radius:3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
  animation: lineGrow .9s ease-out .35s forwards;
}
@keyframes lineGrow{ to{width: 78%;} }

.topWord img,
.botWord img {
  max-height: 80px;
  width: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
}
.topWord{
  transform: translateY(10px);
  opacity: 0.001;
  -webkit-clip-path: inset(100% 0 0 0);
          clip-path: inset(100% 0 0 0);
  animation: revealTop 1s cubic-bezier(.2,.75,.2,1) .85s forwards;
}
@keyframes revealTop{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}
.botWord{
  transform: translateY(-10px);
  opacity: 0.001;
  -webkit-clip-path: inset(0 0 100% 0);
          clip-path: inset(0 0 100% 0);
  animation: revealBottom 1s cubic-bezier(.2,.75,.2,1) .95s forwards;
}
@keyframes revealBottom{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}

.fade-bottom{
  position: sticky; bottom: var(--composer-h); left:0; right:0; height: 96px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(46,16,101,.22), rgba(46,16,101,0));
  opacity: 0; transition: opacity .2s ease;
  margin-top: calc(-96px - var(--composer-h));
}

.mode-overlay{
  position:fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  z-index: 40;
}
.mode-overlay.show{ display:flex; }
.mode-dialog{
  background: rgba(255,255,255,.9);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(66,24,116,.25);
  padding: 18px;
  width: min(92vw, 680px);
  animation: popIn .18s ease-out;
}
@keyframes popIn{
  from{ transform: translateY(8px) scale(.98); opacity: .8; }
  to{ transform: translateY(0) scale(1); opacity: 1; }
}
.mode-title{ margin: 0 0 10px 0; color: var(--text); font-weight: 900; }
.mode-grid{
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
@media (max-width: 800px){ .mode-grid{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 2048px){ .mode-grid{ grid-template-columns: 1fr; } }
.mode-card{
  border: none; cursor: pointer; text-align: left;
  padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f7f0ff);
  box-shadow: var(--shadow-soft);
  display: grid; gap: 6px; align-content: start;
  transition: transform .15s ease, box-shadow .15s ease, outline .15s ease;
}
.mode-card:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.mode-card.active{ outline: 3px solid var(--accent); }
.mode-card .icon{ font-size: 28px; }
.mode-card .name{ font-weight: 900; color: var(--text); }
.mode-card .desc{ font-size: 14px; color: #6b4da7; }

.mode-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top: 10px; }
.mode-close{
  background: rgba(255,255,255,.9); color: var(--text);
  border:1px solid rgba(124,58,237,.15);
  border-radius: 10px; padding: 8px 12px; cursor:pointer;
}
.mode-apply{
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  border:none; border-radius: 10px; padding: 8px 14px; cursor:pointer; box-shadow: var(--shadow);
  font-weight: 800;
}

.mode-toast{
  position:fixed; left:50%; top:14px; transform: translateX(-50%) translateY(-20px);
  background: rgba(255,255,255,.9); color: var(--text); font-weight:800; border-radius:999px;
  padding:8px 14px; box-shadow: var(--shadow); opacity:0; z-index:50;
  transition: transform .25s ease, opacity .25s ease;
}
.mode-toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

.error-message {
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
}

.profile-card{
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-soft);
}
.profile-header{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.profile-header .avatar{
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 900; font-size: 20px;
  box-shadow: var(--shadow-soft);
}
.profile-header .name{ font-weight: 900; color: var(--text); line-height: 1.1; }
.profile-header .id{ font-size: 12px; color: #6b4da7; }
.profile-grid{ display: grid; gap: 6px; margin: 6px 0; }
.profile-grid .row{
  display: grid; grid-template-columns: 140px 1fr; gap: 10px;
  border-bottom: 1px dashed rgba(124,58,237,.15);
  padding-bottom: 6px;
}
.profile-grid .row:last-child{ border-bottom: none; padding-bottom: 0; }
.profile-grid .k{ color:#6b4da7; font-weight:700; }
.profile-grid .v{ color: var(--text); }
.profile-grid .mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.profile-sub{
  margin-top: 8px;
  font-weight: 800; font-size: 12px;
  padding: 8px 10px; border-radius: 10px;
}
.profile-sub.ok{
  background: rgba(16,185,129,.12);
  color: #065f46; border: 1px solid rgba(16,185,129,.25);
}
.profile-sub.warn{
  background: rgba(239,68,68,.10);
  color: #7f1d1d; border: 1px solid rgba(239,68,68,.25);
}
@media (max-width: 2048px){
  .profile-grid .row{ grid-template-columns: 120px 1fr; }
}

/* Адаптация чата для мобильных */
@media (max-width: 10024px) {
  .chat {
    padding: 128px 8px calc(8px + var(--composer-h)) 8px; /* Сохраняем отступ 63px */
  }

  .msg {
    max-width: 92%;
    padding: 8px 10px;
  }

  .attachments img {
    max-width: 200px;
    max-height: 150px;
  }

  .composer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .text input {
    font-size: 16px;
    padding: 10px 12px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Адаптация энергословаря для мобильных */
@media (max-width: 10024px) {
  .energy-dict-topics {
    padding: 10px 12px;
    max-height: 50vh;
  }

  .energy-dict-topics-list {
    gap: 6px;
  }

  .energy-dict-topic-btn {
    padding: 8px 10px;
    font-size: 13px;
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}

@media (max-width: 2048px) {
  .energy-dict-topic-btn {
    flex: 1 1 100%;
  }
}

/* Адаптация модальных окон для мобильных */
@media (max-width: 10024px) {
  .mode-dialog {
    width: 95vw;
    margin: 0 10px;
    padding: 16px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-card {
    padding: 12px;
  }

  .mode-card .icon {
    font-size: 24px;
  }

  .mode-card .name {
    font-size: 14px;
  }

  .mode-card .desc {
    font-size: 12px;
  }
}

/* Улучшение скролла на iOS */
.chat {
  -webkit-overflow-scrolling: touch;
}

/* Безопасные отступы для новых iPhone */
@supports (padding: max(0px)) {
  .composer {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Улучшение тач-целей */
.nav-dropdown-btn, .gear, .nav-menu-toggle {
  min-height: 44px;
  min-width: 44px;
}

:root{
  --bg-left: #F7ECFA;
  --bg-right:#D9C2FF;
  --accent:  #7C3AED;
  --accent2: #A78BFA;
  --text:    #44267e;
  --muted:   #6B21A8;
  --white:   #FFFFFF;

  --bubble-user:#F3E8FF;
  --bubble-bot: #FFFFFF;
  --bubble-sys: #F8F0FF;

  --shadow: 0 10px 30px rgba(124,58,237,.18);
  --shadow-soft: 0 6px 20px rgba(124,58,237,.12);

  --composer-h: 72px;
  --mode-indicator-h: 50px;
  --footer-h: 80px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; min-height:100dvh;
  background: linear-gradient(90deg,var(--bg-left),var(--bg-right));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overflow: hidden;
}
.app{
  width:100vw;
  height:100dvh;
  height:100svh;
  display:flex; flex-direction:column; overflow:hidden;
}

/* Cookie Consent */
.cookie-consent {
  position: fixed;
  bottom: var(--footer-h);
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(15px);
  border-top: 1px solid rgba(124,58,237,0.2);
  padding: 16px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(124,58,237,0.15);
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.cookie-text {
  flex: 1;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.cookie-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cookie-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Footer */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(124,58,237,0.15);
  padding: 12px 16px;
  z-index: 25;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-text {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
  font-weight: 600;
}

.footer-download-btn {
  background: transparent;
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-download-btn:hover {
  background: rgba(124,58,237,0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

header{
  position: sticky; top:0; z-index:50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(15px);
  box-shadow: 0 6px 16px rgba(124,58,237,.12);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  min-height: 60px;
  gap: 15px;
}



.header-logo {
  /* height: 150px; */
  width: auto;
  max-width: 350px;
  object-fit: contain;
}

.header-nav-section {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  transition: all 0.3s ease;
}

.nav-menu-toggle:hover {
  background: rgba(124,58,237,0.1);
  transform: scale(1.05);
}

.nav-menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--accent);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.nav-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.gear{
  cursor:pointer; padding:8px; border-radius:10px; color:var(--accent);
  background: rgba(255,255,255,.6);
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}
.gear:hover{ transform: rotate(-10deg) scale(1.04); }

.nav-dropdown {
  position: absolute;
  top: 100%;
  right: 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(124,58,237,0.1);
  min-width: 200px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
  z-index: 100;
}

.nav-dropdown.active {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
}

.nav-dropdown-content {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.nav-dropdown-btn:hover {
  background: rgba(124,58,237,0.1);
  transform: translateX(4px);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-text {
  flex: 1;
}

.nav-dropdown-btn.loading {
  position: relative;
  color: transparent;
}

.nav-dropdown-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.chat-mode-indicator {
  position: sticky;
  top: 60px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(124,58,237,0.1);
  box-shadow: 0 2px 8px rgba(124,58,237,0.1);
}

.mode-indicator-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 20px;
  color: white;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-soft);
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mode-icon {
  font-size: 16px;
}

.mode-text {
  white-space: nowrap;
}

#chatWrap{
  flex:1; min-height:0; display:flex; flex-direction:column;
  padding-bottom: calc(var(--footer-h) + var(--composer-h));
}

.chat{
  position: relative;
  flex:1; overflow:auto;
  padding: 63px 12px 12px 80px;
  display:flex; flex-direction:column; gap:10px;
  -ms-overflow-style: none; scrollbar-width: none;
  overscroll-behavior: contain;
}
.chat::-webkit-scrollbar{ width:0; height:0; }

.row{display:flex; width:100%;}
.row.user{ justify-content:flex-end; }
.row.bot{ justify-content:flex-start; }
.row.system{ justify-content:center; }

.msg{
  max-width:86%; padding:10px 12px; border-radius:14px; line-height:1.4;
  display:inline-flex; flex-direction:column; gap:6px; border:none;
  box-shadow: var(--shadow-soft);
  word-wrap: break-word;
}
.msg.user{ background:var(--bubble-user); color:var(--text); border-top-right-radius:4px; }
.msg.bot{ background:var(--bubble-bot); color:#1f1147; border-top-left-radius:4px; }
.msg.system{ background:var(--bubble-sys); color:var(--text); }
.time{ font-size:12px; color:#5b3d8f; opacity:.85; }
.attachments{ display:flex; gap:8px; flex-wrap:wrap; }
.attachments img{ max-width:240px; max-height:180px; border-radius:10px; border:none; box-shadow: var(--shadow); }

.composer{
  position: fixed; left:0; right:0; bottom:var(--footer-h); z-index:30;
  padding:10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(10px);
  display:flex; gap:10px; align-items:center;
  box-shadow: 0 -6px 20px rgba(124,58,237,.10);
}
.text{
  flex:1; display:flex; background: rgba(255,255,255,.85);
  border-radius:12px; padding:8px 12px; border:none;
  box-shadow: var(--shadow-soft);
}
.text input{
  flex:1; outline:none; border:none; background:transparent; color:var(--text);
  font-size:14px; padding:8px 12px;
}
.btn{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border:none; color:#fff; font-weight:800; padding:8px 12px; border-radius:12px; cursor:pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.btn:disabled{ opacity:.6; cursor:not-allowed; }
.hidden{display:none!important}
.top-sentinel{ height:4px; }

.login{
  margin:auto;
  background: rgba(255,255,255,.6); border-radius:16px;
  padding:20px; max-width:480px; width:100%; backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.login h2{ margin-top:0; color:var(--text); }
.login .row{ display:flex; gap:8px; }
.login input{
  flex:1; padding:10px; border-radius:10px; border:none; background: rgba(255,255,255,.9);
  color:var(--text); box-shadow: var(--shadow-soft);
}

.energy-dict-topics {
  position: fixed;
  bottom: calc(var(--footer-h) + var(--composer-h));
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  padding: 12px 16px;
  z-index: 25;
  max-height: 40vh;
  overflow-y: auto;
}

.energy-dict-header {
  margin-bottom: 12px;
}

.energy-dict-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.energy-dict-topics-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.energy-dict-topic-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.energy-dict-topic-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.energy-dict-topic-btn:active {
  transform: translateY(0);
}

.energy-dict-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.energy-dict-result-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
}

.energy-dict-result-item:last-child {
  border-bottom: none;
}

.energy-dict-result-content {
  flex: 1;
}

.energy-dict-result-word {
  font-weight: bold;
  color: var(--text);
}

.energy-dict-result-code {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.energy-dict-result-error {
  color: #ef4444;
  font-style: italic;
}

@keyframes shake {
  0%,100% { transform: translateX(0) }
  20% { transform: translateX(-4px) }
  40% { transform: translateX(4px) }
  60% { transform: translateX(-2px) }
  80% { transform: translateX(2px) }
}
.text.shake { animation: shake .35s; }

.splash{
  position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center;
  background: linear-gradient(90deg, var(--bg-left), var(--bg-right));
  opacity:0; pointer-events:none;
}
.splash.show{ display:flex; animation: splashLife 4.2s ease-in-out forwards; }
@keyframes splashLife{
  0%{opacity:0}
  18%{opacity:1}
  88%{opacity:1}
  100%{opacity:0}
}
.split{
  width: clamp(200px, 50vw, 500px);
  text-align:center; color:var(--accent);
  text-shadow: 0 2px 20px rgba(124,58,237,.25);
  font-weight:900; letter-spacing:.6px;
}
.line{
  width:0; height:3px; margin: 12px auto; border-radius:3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
  animation: lineGrow .9s ease-out .35s forwards;
}
@keyframes lineGrow{ to{width: 78%;} }

.topWord img,
.botWord img {
  max-height: 80px;
  width: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
}
.topWord{
  transform: translateY(10px);
  opacity: 0.001;
  -webkit-clip-path: inset(100% 0 0 0);
          clip-path: inset(100% 0 0 0);
  animation: revealTop 1s cubic-bezier(.2,.75,.2,1) .85s forwards;
}
@keyframes revealTop{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}
.botWord{
  transform: translateY(-10px);
  opacity: 0.001;
  -webkit-clip-path: inset(0 0 100% 0);
          clip-path: inset(0 0 100% 0);
  animation: revealBottom 1s cubic-bezier(.2,.75,.2,1) .95s forwards;
}
@keyframes revealBottom{
  to{
    transform: translateY(0);
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
            clip-path: inset(0 0 0 0);
  }
}

.fade-bottom{
  position: sticky; bottom: calc(var(--footer-h) + var(--composer-h)); left:0; right:0; height: 96px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(46,16,101,.22), rgba(46,16,101,0));
  opacity: 0; transition: opacity .2s ease;
  margin-top: calc(-96px - var(--composer-h) - var(--footer-h));
}

.mode-overlay{
  position:fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  z-index: 40;
}
.mode-overlay.show{ display:flex; }
.mode-dialog{
  background: rgba(255,255,255,.9);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(66,24,116,.25);
  padding: 18px;
  width: min(92vw, 680px);
  animation: popIn .18s ease-out;
}
@keyframes popIn{
  from{ transform: translateY(8px) scale(.98); opacity: .8; }
  to{ transform: translateY(0) scale(1); opacity: 1; }
}
.mode-title{ margin: 0 0 10px 0; color: var(--text); font-weight: 900; }
.mode-grid{
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
@media (max-width: 800px){ .mode-grid{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 2048px){ .mode-grid{ grid-template-columns: 1fr; } }
.mode-card{
  border: none; cursor: pointer; text-align: left;
  padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f7f0ff);
  box-shadow: var(--shadow-soft);
  display: grid; gap: 6px; align-content: start;
  transition: transform .15s ease, box-shadow .15s ease, outline .15s ease;
}
.mode-card:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.mode-card.active{ outline: 3px solid var(--accent); }
.mode-card .icon{ font-size: 28px; }
.mode-card .name{ font-weight: 900; color: var(--text); }
.mode-card .desc{ font-size: 14px; color: #6b4da7; }

.mode-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top: 10px; }
.mode-close{
  background: rgba(255,255,255,.9); color: var(--text);
  border:1px solid rgba(124,58,237,.15);
  border-radius: 10px; padding: 8px 12px; cursor:pointer;
}
.mode-apply{
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  border:none; border-radius: 10px; padding: 8px 14px; cursor:pointer; box-shadow: var(--shadow);
  font-weight: 800;
}

.mode-toast{
  position:fixed; left:50%; top:14px; transform: translateX(-50%) translateY(-20px);
  background: rgba(255,255,255,.9); color: var(--text); font-weight:800; border-radius:999px;
  padding:8px 14px; box-shadow: var(--shadow); opacity:0; z-index:50;
  transition: transform .25s ease, opacity .25s ease;
}
.mode-toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

.error-message {
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
}

.profile-card{
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-soft);
}
.profile-header{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.profile-header .avatar{
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 900; font-size: 20px;
  box-shadow: var(--shadow-soft);
}
.profile-header .name{ font-weight: 900; color: var(--text); line-height: 1.1; }
.profile-header .id{ font-size: 12px; color: #6b4da7; }
.profile-grid{ display: grid; gap: 6px; margin: 6px 0; }
.profile-grid .row{
  display: grid; grid-template-columns: 140px 1fr; gap: 10px;
  border-bottom: 1px dashed rgba(124,58,237,.15);
  padding-bottom: 6px;
}
.profile-grid .row:last-child{ border-bottom: none; padding-bottom: 0; }
.profile-grid .k{ color:#6b4da7; font-weight:700; }
.profile-grid .v{ color: var(--text); }
.profile-grid .mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.profile-sub{
  margin-top: 8px;
  font-weight: 800; font-size: 12px;
  padding: 8px 10px; border-radius: 10px;
}
.profile-sub.ok{
  background: rgba(16,185,129,.12);
  color: #065f46; border: 1px solid rgba(16,185,129,.25);
}
.profile-sub.warn{
  background: rgba(239,68,68,.10);
  color: #7f1d1d; border: 1px solid rgba(239,68,68,.25);
}

@media (max-width: 10024px) {
  .cookie-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .cookie-text {
    font-size: 13px;
  }
  
  .footer-content {
    gap: 6px;
  }
  
  .footer-text {
    font-size: 11px;
  }
  
  .footer-download-btn {
    font-size: 11px;
    padding: 6px 12px;
  }

  .header-main {
    padding: 8px 12px;
    gap: 10px;
  }

  .header-logo { 
    position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  }

  .header-nav-section {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  position: relative;
}

  .gear {
    padding: 6px;
    min-width: 36px;
    min-height: 36px;
  }

  .nav-dropdown {
    right: 12px;
    left: 12px;
    min-width: auto;
  }

  .chat-mode-indicator {
    top: 56px;
    padding: 6px 12px;
  }

  .mode-indicator-content {
    padding: 5px 14px;
    font-size: 13px;
  }

  .chat {
    padding: 128px 8px calc(8px + var(--composer-h)) 8px;
  }

  .msg {
    max-width: 92%;
    padding: 8px 10px;
  }

  .attachments img {
    max-width: 200px;
    max-height: 150px;
  }

  .composer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .text input {
    font-size: 16px;
    padding: 10px 12px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }

  .energy-dict-topics {
    padding: 10px 12px;
    max-height: 50vh;
  }

  .energy-dict-topics-list {
    gap: 6px;
  }

  .energy-dict-topic-btn {
    padding: 8px 10px;
    font-size: 13px;
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .mode-dialog {
    width: 95vw;
    margin: 0 10px;
    padding: 16px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-card {
    padding: 12px;
  }

  .mode-card .icon {
    font-size: 24px;
  }

  .mode-card .name {
    font-size: 14px;
  }

  .mode-card .desc {
    font-size: 12px;
  }
}

@media (max-width: 2048px) {
  .cookie-consent {
    bottom: var(--footer-h);
    padding: 12px;
  }
  
  .app-footer {
    padding: 10px 12px;
  }

  .header-main {
    padding: 6px 10px;
    display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  }

  .header-logo {
    height: 60%;
    width: 65%;
    /* max-width: 275px; */
  }

  .nav-menu-toggle {
    width: 20px;
    height: 16px;
    padding: 6px;
  }

  .chat-mode-indicator {
    top: 52px;
    padding: 4px 10px;
  }

  .mode-indicator-content {
    padding: 4px 12px;
    font-size: 12px;
  }

  .mode-icon {
    font-size: 14px;
  }

  .energy-dict-topic-btn {
    flex: 1 1 100%;
  }

  .profile-grid .row{ grid-template-columns: 120px 1fr; }
}

/* @media (max-width: 360px) {
  .header-main {
    padding: 6px 8px;
  }

  .header-logo {
    height: 64px;
    max-width: 350px;
  }
} */

.chat {
  -webkit-overflow-scrolling: touch;
}

@supports (padding: max(0px)) {
  .composer {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

.nav-dropdown-btn, .gear, .nav-menu-toggle {
  min-height: 44px;
  min-width: 44px;
}

/* Обновляем стили для сплеш-экрана */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, var(--bg-left), var(--bg-right));
  opacity: 0;
  pointer-events: none;
  padding: 20px; /* Добавляем отступы */
  box-sizing: border-box;
}

.split {
  width: 100%; /* Меняем на 100% вместо clamp */
  max-width: min(90vw, 500px); /* Ограничиваем максимальную ширину */
  text-align: center;
  color: var(--accent);
  text-shadow: 0 2px 20px rgba(124,58,237,.25);
  font-weight: 900;
  letter-spacing: .6px;
}

.topWord img,
.botWord img {
  max-height: 80px;
  width: 100%; /* Меняем на 100% */
  max-width: 100%; /* Добавляем ограничение */
  height: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain; /* Сохраняем пропорции */
}

/* Для мобильных устройств */
@media (max-width: 10024px) {
  .splash {
    padding: 16px;
  }
  
  .split {
    max-width: 95vw; /* Увеличиваем на мобильных */
  }
  
  .topWord img,
  .botWord img {
    max-height: 60px; /* Уменьшаем высоту на мобильных */
  }
}

@media (max-width: 2048px) {
  .topWord img,
  .botWord img {
    max-height: 50px; /* Еще меньше на маленьких экранах */
  }
  
  .line {
    margin: 8px auto; /* Уменьшаем отступы */
  }
}

/* Добавим в конец CSS файла */

/* Стили для футера с документами */
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.footer-link {
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(124, 58, 237, 0.2);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.footer-link:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  color: var(--accent);
}

.footer-link:active {
  transform: translateY(0);
}

/* Адаптивность для ссылок в футере */
@media (max-width: 768px) {
  .footer-links {
    gap: 8px;
  }
  
  .footer-link {
    font-size: 11px;
    padding: 5px 10px;
  }
}

@media (max-width: 480px) {
  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
/*   .footer-link {
  width: 100%;
  max-width: 200px;
  text-align: center;
  font-size: 10px;
  padding: 4px 8px;
} */
}

