/* ═════════════════════════════════════════════════════════════════════════
   DrakeAPI — Дизайн-система «Twitch AI Panel» (T19 Master Theme)
   Поддержка мульти-скинов (Пульт / Кокпит) и раздельных пресетов фонов
   ═════════════════════════════════════════════════════════════════════════ */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: cockpitOut .18s ease both; }
::view-transition-new(root) { animation: cockpitIn .24s ease both; }
@keyframes cockpitOut { to { opacity: 0; transform: translateX(-6px); } }
@keyframes cockpitIn { from { opacity: 0; transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
@media (max-width: 600px) {
  button, .btn, .btn-xs, .nav-btn { min-height: 44px; }
  input, select { max-width: 100%; }
  .row { flex-wrap: wrap; }
  .table-wrap { overflow-x: auto; }
  .topbar-right { min-width: 0; max-width: 65%;  justify-content: flex-end; }
  .topbar-right a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .app-topbar { height: auto; min-height: 64px; align-items: flex-start; padding-top: 8px; padding-bottom: 8px; }
  .topbar-right .badge { display: none; }
  .topbar-right a[href='/dashboard'] { max-width: 110px; white-space: nowrap; }
  .topbar-right { flex-wrap: nowrap; }
  main a:not(.btn):not(.btn-xs) { display: inline-flex; align-items: center; min-height: 44px; }
}
:focus-visible { outline: 2px solid var(--acc2); outline-offset: 3px; }

[data-panel-layout="cockpit"] .card h2,
[data-panel-layout="cockpit"] .card h3 {
  
  -webkit-background-clip: text;
  background-clip: text;
  
}

/* ── 4. Пресеты фонов (выбираются отдельно) ──────────────────────────────── */

/* ── 5. Базовые стили и сброс ────────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page-gradient);
  
  
  font: 14.5px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover {  text-decoration: none; }

h1 {  margin: 0 0 10px; font-weight: 700;  }
h1.big { font-size: 64px; margin: 0; color: var(--accent); }
h2 { margin: 0 0 14px; font-weight: 600}
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
h4 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }

code {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 2px 6px;
  font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
}
pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
}
pre code { background: none; border: none; padding: 0; color: inherit; }

/* ── 6. Архитектура лэйаута: Сайдбар + Стеклянный Топбар ─────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease;
}

.sidebar-header {
  
  
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
  font-weight: 700;
  
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-brand .logo {
  
  font-size: 19px;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  
}

.nav-btn {
  display: flex;
  align-items: center;
  
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-btn.active {
  
  
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  
  
}

/* Основная рабочая область */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.25s ease;
}

.app-topbar {
  height: var(--topbar-height);
  
  
  
  
  
  
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 28px)}

.topbar-left {
  display: flex;
  align-items: center;
  
}

.topbar-right {
  display: flex;
  align-items: center;
  
}

.burger-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-btn);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}

/* Старый топбар для совместимости без ломания разметки */
.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: relative;
  z-index: 10;
}
.top .brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.top .logo { color: var(--accent); font-size: 20px; }
.top nav { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13.5px; }
.top nav a { color: var(--text-muted); padding: 5px 8px; border-radius: var(--radius-btn); }
.top nav a:hover { color: var(--text); background: var(--bg-hover); }

main, .app-content {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 28px) clamp(16px, 2.5vw, 24px) 60px;
  min-width: 0;
}

section { margin-bottom: 32px; }

footer {
  border-top: 1px solid var(--border-light);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  
  background: var(--sidebar-bg);
}

/* ── 7. Стеклянные карточки и сетки ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--gap-grid); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap-grid); }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap-grid); }

/* ── 8. Кнопки и формы ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--accent);
  background: var(--bg-active);
  color: var(--text);
  text-decoration: none;
}
.btn.primary, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-xs {     background: var(--bg-hover); color: var(--text);  }
.btn-xs:hover { border-color: var(--accent); }

input, select, textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar input {
  padding-left: 32px;
}
.search-bar::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  font-size: 12px;
  opacity: 0.6;
  pointer-events: none;
}

/* ── 9. Бейджи, статусы и чипы ──────────────────────────────────────────── */
.badge {
  
  
  
  
  
  
  
  border: 1px solid transparent;
}
.badge-success {
  
  border-color: rgba(0, 200, 83, 0.35);
  
}
.badge-warning {
  
  border-color: rgba(255, 167, 38, 0.35);
  
}
.badge-danger {
  
  border-color: rgba(244, 67, 54, 0.35);
  
}

.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.chip.acc { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--error); flex: none; }
.dot.on { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* ── 10. Селектор раскладок и тем (Свотчи из Twitch AI) ──────────────────── */
.director-skin-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.director-skin-option {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
  color: var(--text);
  font-family: inherit}
.director-skin-option:hover {
  border-color: var(--accent);
}
.director-skin-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--bg-active);
}
.director-skin-swatch {
  height: 38px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  display: flex;
  gap: 4px;
  padding: 5px;
  margin-bottom: 6px;
}
.director-skin-swatch i {
  border-radius: 2px;
  display: block;
}
.director-skin-swatch.pult i:nth-child(1) { width: 14px; background: var(--success); height: 100%; }
.director-skin-swatch.pult i:nth-child(2) { flex: 1; background: var(--border); height: 100%; }
.director-skin-swatch.pult i:nth-child(3) { width: 22px; background: var(--border-light); height: 100%; }

.director-skin-swatch.cockpit i:nth-child(1) { flex: 1; background: linear-gradient(135deg, #8b5cf6, #ec4899); height: 100%; border-radius: 6px; }
.director-skin-swatch.cockpit i:nth-child(2) { flex: 1; background: linear-gradient(135deg, #38bdf8, #818cf8); height: 100%; border-radius: 6px; }
.director-skin-swatch.cockpit i:nth-child(3) { flex: 1; background: linear-gradient(135deg, #2dd4bf, #059669); height: 100%; border-radius: 6px; }

/* Сетка пресетов фона */
.bg-preset-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.bg-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s ease;
}
.bg-preset-btn:hover { border-color: var(--accent); color: var(--text); }
.bg-preset-btn.active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-active);
  font-weight: 600;
}
.bg-swatch-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}

/* ── 11. Тосты и уведомления ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  
  
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  color: var(--text);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  font-size: 13.5px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  
  
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── 12. Таблицы ────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
th { color: var(--text-muted); font-weight: 600;    }
tbody tr:hover { background: var(--bg-hover); }
.table-wrap {  -webkit-overflow-scrolling: touch; }

/* ── 13. Playground стили (SSE стрим) ────────────────────────────────────── */
.chat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  min-height: 260px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.msg-bubble {
  padding: 10px 15px;
  border-radius: 14px;
  
  
  white-space: pre-wrap;
  
  
}
.msg-bubble.user {
  
  
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.msg-bubble.assistant {
  
  
  
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

/* ── 14. Адаптивность и мобильный респонсив (≤ 768px, 360px) ─────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
  }
  .sidebar-backdrop.active { display: block; }
  .app-main { margin-left: 0; }
  .burger-btn { display: inline-flex; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .top nav { display: none; } /* Для старой шапки */
}

@media (max-width: 360px) {
  body { font-size: 13.5px; }
  .card { padding: 14px; }
  h1 { font-size: 22px; }
}

/* ── 15. Аудио-виджет и поля регистрации ── */
.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border-radius: var(--radius-btn);
  padding: 4px 8px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all .15s ease;
}
.audio-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border);
}
.audio-toggle.active {
  color: var(--link);
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.3);
}
.audio-toggle .audio-icon {
  font-size: 14px;
}
.hp-trap {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

/* ── Onboarding Checklist & Progress ── */
.onboarding-card {
  border-left: 3px solid var(--link);
  
  
}
.onboarding-head {
  gap: 16px;
  flex-wrap: wrap;
  }
.progress-bar-wrap {
  flex: 1;
  max-width: 200px;
  min-width: 120px;
  height: 7px;
  background: var(--bg-hover, rgba(255,255,255,0.08));
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2dd4bf, #38bdf8);
  border-radius: 99px;
  transition: width .3s ease;
}
.onboard-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.onboard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-input, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.onboard-step.is-done {
  border-color: rgba(45, 212, 191, 0.25);
  background: rgba(45, 212, 191, 0.05);
}
.onboard-step a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.onboard-step a:hover {
  color: var(--link);
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
.step-badge.ok {
  background: rgba(45, 212, 191, 0.2);
  color: #2dd4bf;
}
.step-badge.pending {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* ── Dashboard Sub-Navigation Tabs ── */
.subnav-tabs {
  
  
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  
  
  scrollbar-width: none;
}
.subnav-tabs::-webkit-scrollbar {
  display: none;
}
.subnav-tab {
  
  
  
  
  white-space: nowrap;
  }
.subnav-tab.active {
  
  
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
}

/* ── Topbar Language Switcher ── */
.lang-switch-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input, rgba(255,255,255,0.06));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 600;
}
.lang-btn {
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
  transition: all .15s ease;
}
.lang-btn:hover {
  color: var(--text);
}
.lang-btn.active {
  color: #fff;
  background: var(--primary, #38bdf8);
}
.lang-sep {
  
  font-size: 10px;
  margin: 0 1px;
}

/* ── Dedicated Documentation Portal ── */
.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 16px;
}
@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
}
.docs-sidebar {
  
  max-height: calc(100vh - 88px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  
  display: flex;
  flex-direction: column;
  gap: 8px}
.docs-nav-link:hover, .docs-nav-link.active {
  color: var(--text);
  background: var(--bg-hover);
}
@media (max-width: 860px) {
  .docs-sidebar { position: static; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
  .docs-nav-group { margin-bottom: 4px; }
}
.docs-content {
  min-width: 0;
}
.docs-section h2 {
  
  margin-top: 0}
.code-card-wrap {
  position: relative;
  
  
  }
.code-card-wrap pre,
.code-card-wrap .code-wrap pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.code-card-wrap .code-wrap { margin: 0; }
.code-card-wrap .code-wrap pre { padding-top: 56px; }

.breadcrumbs { margin: 0 0 .5rem;  }
.breadcrumbs ol {  color: var(--dim, #8a8f98)}
.breadcrumbs li + li::before {  margin-right: .25rem; }
.breadcrumbs a {   padding: .5rem 0; display: inline-block; }
.breadcrumbs li[aria-current] { color: var(--text, inherit); }

.giveaway-hero { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: center; }
.giveaway h1 { font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.05; margin: .25rem 0 1rem; }
.giveaway .eyebrow { letter-spacing: .08em; font-size: .8rem; color: var(--dim, #8a8f98); }
.giveaway-pool { font-size: clamp(4rem, 14vw, 7rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.giveaway-countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.giveaway-cell { text-align: center; padding: .75rem .25rem; border-radius: 12px; background: rgba(128, 128, 128, .12); }
.giveaway-cell b { display: block; font-size: clamp(1.5rem, 5vw, 2.5rem); font-variant-numeric: tabular-nums; }
.giveaway-cell span { font-size: .7rem; letter-spacing: .08em; color: var(--dim, #8a8f98); }
.giveaway-bar { height: 12px; border-radius: 6px; background: rgba(128, 128, 128, .2); overflow: hidden; }
.giveaway-bar i { display: block; height: 100%; background: var(--accent, currentColor); }
