:root {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-alt: #10151c;
  --border: #26303d;
  --border-hover: #384659;
  --text: #edf2f7;
  --muted: #8b98a9;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --twitch: #9146ff;
  --twitch-hover: #7c3aed;
  --vk: #0077ff;
  --vk-hover: #0066db;

  --success: #22c55e;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius: 14px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: Consolas, 'Cascadia Code', monospace;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.mb-10 {
  margin: 0 0 12px;
}

/* Экран авторизации */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, rgba(145, 70, 255, 0.12), transparent 45%), var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.auth-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: rgba(145, 70, 255, 0.14);
  border: 1px solid rgba(145, 70, 255, 0.35);
  color: #b78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-icon svg {
  width: 24px;
  height: 24px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.auth-card p {
  margin: 0 0 24px;
  font-size: 14px;
}

.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 13px;
}

/* Шапка */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--twitch), var(--vk));
  box-shadow: 0 0 12px rgba(145, 70, 255, 0.65);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Контейнер и карточки */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-subtle {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* Индикаторы статуса */
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
}

.status-dot.is-offline {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.status-title {
  font-size: 14px;
  font-weight: 700;
}

.status-detail {
  font-size: 12px;
  color: var(--muted);
}

.btn-twitch-mini {
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(145, 70, 255, 0.18);
  border: 1px solid rgba(145, 70, 255, 0.5);
  color: #e9d5ff;
}

.btn-twitch-mini:hover {
  background: var(--twitch);
  border-color: var(--twitch);
  color: #ffffff;
}

.btn-vk-mini {
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(0, 119, 255, 0.18);
  border: 1px solid rgba(0, 119, 255, 0.5);
  color: #bfdbfe;
}

.btn-vk-mini:hover {
  background: var(--vk);
  border-color: var(--vk);
  color: #ffffff;
}

/* Поля ввода и формы */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.label-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.volume-badge {
  font-size: 13px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 9px;
  border-radius: 999px;
}

.input {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

.input-mono {
  font-family: Consolas, 'Cascadia Code', monospace;
  font-size: 13px;
  color: #cbd5e1;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.preview-highlight {
  color: #e2e8f0;
  font-weight: 600;
}

.range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
}

.obs-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.obs-url-row .input {
  flex: 1 1 320px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* Кнопки */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #212936;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #2a3444;
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-twitch {
  flex: 1 1 180px;
  background: var(--twitch);
  color: #ffffff;
}

.btn-twitch:hover:not(:disabled) {
  background: var(--twitch-hover);
}

.btn-vk {
  flex: 1 1 180px;
  background: var(--vk);
  color: #ffffff;
}

.btn-vk:hover:not(:disabled) {
  background: var(--vk-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #ffffff;
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.16);
}

/* Медиафайлы */
.media-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.media-box-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-box-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.media-preview {
  min-height: 150px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: #0b0f14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  overflow: hidden;
}

.media-preview-audio {
  min-height: 92px;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: contain;
}

.media-preview audio {
  width: 100%;
}

.media-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Уведомления (Toast) */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: #1c2430;
  border: 1px solid var(--border-hover);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.22s ease;
}

.toast.is-success {
  border-color: rgba(34, 197, 94, 0.5);
}

.toast.is-error {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fecaca;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Адаптивность */
@media (max-width: 820px) {
  .two-col,
  .status-grid {
    grid-template-columns: 1fr;
  }
}
