:root {
  --bg: #050505;
  --bg-side: rgba(15, 15, 18, 0.6);
  --bg-panel: rgba(25, 25, 30, 0.4);
  --bg-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f0f0f5;
  --text-dim: #8a8a9a;
  --blue: #569cd6; --purple: #c586c0; --green: #6a9955; --red: #f44747; --orange: #ce9178; --cyan: #4ec9b0;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; font-family: var(--font-sans); background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button { border: none; background: none; font: inherit; color: inherit; cursor: pointer; }
input { cursor: text; }

#bgCanvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.window { position: absolute; inset: 20px; background: rgba(10, 10, 12, 0.7); backdrop-filter: blur(30px); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 40px 100px rgba(0,0,0,0.9); z-index: 10; transition: inset 0.4s ease; }
body.zen-mode .window { inset: 0; border-radius: 0; border: none; }
body.zen-mode .sidebar, body.zen-mode .tabbar, body.zen-mode .bottom-bar { display: none; }
body.zen-mode .main { padding: 80px 15vw; }

.titlebar { background: rgba(0,0,0,0.4); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.dots { display: flex; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.dot.red { background: #ff5f56; } .dot.yellow { background: #ffbd2e; } .dot.green { background: #27c93f; }
.titlebar-center { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }
.titlebar-actions { display: flex; gap: 12px; }
.tb-btn { padding: 6px 14px; border-radius: 8px; font-size: 12px; color: var(--text-dim); transition: 0.2s; border: 1px solid transparent; }
.tb-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }

.tabbar { display: flex; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); overflow-x: auto; }
.tab { padding: 12px 24px; font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; transition: 0.3s; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--blue); background: rgba(255,255,255,0.02); }

.body-layout { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 280px; background: rgba(0,0,0,0.2); border-right: 1px solid var(--border); display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 13px; }
.sb-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.sb-title { font-size: 11px; color: var(--text-dim); letter-spacing: 1.5px; font-weight: 600; }
.sb-actions { display: flex; gap: 8px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.sb-actions span:hover { color: var(--text); }

.sb-tree { flex: 1; overflow-y: auto; padding: 10px 0; }
.sb-folder { padding: 4px 16px; color: var(--text); display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.sb-folder .arrow { font-size: 10px; color: var(--text-dim); width: 12px; }
.sb-folder:hover { background: var(--bg-hover); }

.sb-item { padding: 4px 16px 4px 34px; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.1s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item:hover { color: var(--text); background: var(--bg-hover); }
.sb-item.active { color: var(--text); background: var(--bg-hover); border-left: 2px solid var(--blue); }

.icon { font-family: var(--font-mono); font-size: 10px; font-weight: 700; display: inline-block; text-align: center; width: 16px; }
.icon.blue { color: var(--blue); } .icon.orange { color: var(--orange); } .icon.purple { color: var(--purple); } .icon.green { color: var(--green); } .icon.cyan { color: var(--cyan); } .icon.md { color: #519aba; } .icon.txt { color: #cbcb41; } .icon.json { color: #cbcb41; } .icon.xml { color: #e37933; }

.sb-footer { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sb-btn { padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text-dim); text-align: center; transition: 0.2s; background: rgba(255,255,255,0.02); }
.sb-btn:hover { border-color: var(--blue); color: var(--text); }

.main-area { flex: 1; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 40px 60px; scroll-behavior: smooth; }

.terminal { height: 260px; background: rgba(15,15,20,0.95); backdrop-filter: blur(10px); border-top: 1px solid var(--border); display: flex; flex-direction: column; transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1); position: absolute; bottom: 0; left: 0; right: 0; z-index: 20; }
.terminal.closed { height: 0; border: none; overflow: hidden; }
.term-head { padding: 8px 16px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); display: flex; justify-content: space-between; background: rgba(0,0,0,0.3); }
.term-body { flex: 1; padding: 16px; font-family: var(--font-mono); font-size: 13px; overflow-y: auto; line-height: 1.6; }
.term-line { display: flex; gap: 10px; margin-bottom: 4px; }
.term-prompt { color: var(--green); font-weight: bold; }
.term-in { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-mono); }

.bottom-bar { background: var(--blue); padding: 4px 16px; display: flex; gap: 16px; align-items: center; font-family: var(--font-mono); font-size: 12px; color: #fff; }
.bb-item { padding: 2px 8px; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.bb-item:hover { background: rgba(255,255,255,0.2); }

/* ==========================================
   ИСПРАВЛЕННЫЕ МОДАЛЬНЫЕ ОКНА (ПОИСК, ТЕМЫ)
   ========================================== */

.overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.8); 
  backdrop-filter: blur(10px); 
  z-index: 100; 
  display: flex; 
  justify-content: center; 
  align-items: flex-start; /* Прижимаем к верху */
  padding-top: 15vh; /* Отступ сверху */
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 0.3s; 
}
.overlay.open { opacity: 1; pointer-events: all; }

.modal { 
  width: 100%; 
  max-width: 600px; 
  background: rgba(25,25,30,0.95); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  overflow: hidden; 
  /* Плавная анимация выплывания */
  transform: translateY(-20px) scaleY(0.95); 
  transform-origin: top center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
  box-shadow: 0 20px 60px rgba(0,0,0,0.8); 
  display: flex;
  flex-direction: column;
  /* Убираем жесткую высоту, чтобы он рос вместе с контентом */
  height: auto; 
  max-height: 70vh; 
}
.overlay.open .modal { transform: translateY(0) scaleY(1); }

.modal-input { 
  width: 100%; 
  padding: 16px 20px; 
  font-family: var(--font-mono); 
  font-size: 16px; 
  background: transparent; 
  color: var(--text); 
  border-bottom: 1px solid var(--border); 
  outline: none; 
}

.modal-list { 
  /* Убираем flex: 1, чтобы список не растягивался */
  flex: 0 1 auto; 
  max-height: 400px; 
  overflow-y: auto; 
  padding: 8px; 
}

.modal-item { 
  padding: 12px 16px; 
  font-family: var(--font-mono); 
  font-size: 14px; 
  color: var(--text-dim); 
  cursor: pointer; 
  border-radius: 8px; 
  transition: 0.1s; 
}
.modal-item:hover, .modal-item.selected { background: rgba(86, 156, 214, 0.15); color: var(--text); }

.modal-footer { 
  padding: 12px 16px; 
  border-top: 1px solid var(--border); 
  font-size: 11px; 
  color: var(--text-dim); 
  display: flex; 
  gap: 16px; 
  background: rgba(0,0,0,0.2); 
  font-family: var(--font-mono); 
}
kbd { background: rgba(255,255,255,0.1); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-family: var(--font-sans); }

/* Фикс размера для окна тем */
#themeOverlay .modal { max-width: 360px; }

/* ========================================== */

.toast-container { position: fixed; bottom: 40px; right: 40px; z-index: 1000; display: flex; flex-direction: column; gap: 12px; }
.toast { background: rgba(25,25,30,0.95); border: 1px solid var(--border); border-left: 4px solid var(--blue); padding: 14px 20px; border-radius: 8px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); position: relative; overflow: hidden; min-width: 250px; }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--blue); animation: progress 3s linear forwards; }
@keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes progress { from { width: 100%; } to { width: 0%; } }

.boot-screen { position: fixed; inset: 0; background: #050505; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.8s; }
.boot-screen.hidden { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 80px; color: var(--blue); margin-bottom: 24px; text-shadow: 0 0 40px var(--blue); animation: pulse 2s infinite; }
.boot-text { font-family: var(--font-mono); font-size: 14px; color: var(--text-dim); letter-spacing: 2px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); opacity: 0.7; } }

.content-section { margin-bottom: 50px; }
.section-header { font-family: var(--font-mono); font-size: 20px; color: var(--blue); margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.section-header::before { content: '#'; color: var(--text-dim); }
.section-header::after { content: ''; flex: 1; height: 1px; background: var(--border); margin-left: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 12px; padding: 24px; transition: 0.3s; }
.card:hover { background: rgba(255,255,255,0.04); border-color: rgba(86, 156, 214, 0.3); transform: translateY(-2px); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; border: 1px solid transparent; background-clip: padding-box; transition: background 0.3s ease; }
::-webkit-scrollbar-thumb:hover { background: rgba(86, 156, 214, 0.6); box-shadow: 0 0 10px rgba(86, 156, 214, 0.4); }
::-webkit-scrollbar-corner { background: transparent; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) rgba(0, 0, 0, 0.2); }
/* ==========================================
   КРАСИВЫЙ ПЛЕЕР (НОВЫЙ ДИЗАЙН)
   ========================================== */

/* Стильная кнопка Play */
.music-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 15px rgba(86, 156, 214, 0.4);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.music-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(86, 156, 214, 0.6);
}

.music-btn.playing {
  background: linear-gradient(135deg, var(--red), #ff7b72);
  box-shadow: 0 4px 15px rgba(244, 71, 71, 0.4);
}

/* Контейнер эквалайзера */
.eq-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.eq-container.active {
  opacity: 1;
}

/* Полоски эквалайзера */
.eq-bar {
  width: 4px;
  background: var(--blue);
  border-radius: 2px;
  height: 5px;
  transition: height 0.2s;
}

.eq-container.active .eq-bar {
  animation: equalize 1s infinite alternate ease-in-out;
}

/* Разные задержки для полосок, чтобы они прыгали хаотично */
.eq-container.active .eq-bar:nth-child(1) { animation-duration: 0.8s; background: var(--cyan); }
.eq-container.active .eq-bar:nth-child(2) { animation-duration: 1.1s; background: var(--blue); }
.eq-container.active .eq-bar:nth-child(3) { animation-duration: 0.9s; background: var(--purple); }
.eq-container.active .eq-bar:nth-child(4) { animation-duration: 1.2s; background: var(--blue); }

@keyframes equalize {
  0% { height: 5px; }
  100% { height: 24px; }
}

/* Красивый ползунок громкости */
input[type=range] {
  -webkit-appearance: none;
  background: transparent;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin-top: -5px;
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
/* ==========================================
   ЭКВАЛАЙЗЕР ВНУТРИ ПЛЕЕРА
   ========================================== */

.eq-container {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.eq-container.active {
  opacity: 1;
}

.eq-bar {
  background: var(--blue);
  border-radius: 2px;
  height: 3px;
  transition: height 0.2s;
}

.eq-container.active .eq-bar {
  animation: equalize 0.8s infinite alternate ease-in-out;
}

.eq-container.active .eq-bar:nth-child(1) { animation-duration: 0.7s; background: var(--cyan); }
.eq-container.active .eq-bar:nth-child(2) { animation-duration: 1.1s; background: var(--blue); }
.eq-container.active .eq-bar:nth-child(3) { animation-duration: 0.9s; background: var(--purple); }
.eq-container.active .eq-bar:nth-child(4) { animation-duration: 1.2s; background: var(--blue); }

@keyframes equalize {
  0% { height: 3px; }
  100% { height: 12px; }
}

/* Стили для ползунков */
input[type=range] {
  -webkit-appearance: none;
  background: transparent;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin-top: -4px;
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
/* ==========================================
   КРАСИВЫЙ БЛОК ДЛЯ СТАТЬИ (КАК КОММЕНТАРИЙ)
   ========================================== */
.code-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 20px;
  font-family: var(--font-sans);
  color: #d1d1d6;
  font-size: 15px;
  line-height: 1.8;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
  position: relative;
}

.code-block::before {
  content: '/* Рассуждение */';
  position: absolute;
  top: -10px;
  left: 15px;
  background: #1e1e24;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.code-block p {
  margin-bottom: 12px;
}

.code-block code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--orange);
}
/* ==========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (ДЛЯ ТЕЛЕФОНОВ)
   ========================================== */
@media (max-width: 768px) {
  .window { inset: 0 !important; border-radius: 0 !important; border: none !important; }
  .sidebar { display: none !important; }
  .main { padding: 20px 16px !important; }
  .tabbar { padding: 0 10px; }
  .tab { padding: 10px 12px !important; font-size: 12px !important; }
  .bottom-bar { display: none !important; }
  .terminal { display: none !important; }
  .hero-name { font-size: 28px !important; }
  .section-header { font-size: 18px !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  #musicWidget { display: none !important; }
}
