:root {
  --bg-dark: #0a0a0c;
  --panel-bg: rgba(14, 14, 18, 0.95);
  --border-color: rgba(255, 255, 255, 0.12);
  --text-main: #c76d80;
  --glow-color: rgba(199, 109, 128, 0.35);
}

/* Цветовые темы сайта */
[data-theme="wine"] {
  --text-main: #c76d80;
  --glow-color: rgba(199, 109, 128, 0.35);
  --border-color: rgba(199, 109, 128, 0.25);
}

[data-theme="matrix"] {
  --text-main: #00ff66;
  --glow-color: rgba(0, 255, 102, 0.35);
  --border-color: rgba(0, 255, 102, 0.25);
}

[data-theme="amber"] {
  --text-main: #ffb000;
  --glow-color: rgba(255, 176, 0, 0.35);
  --border-color: rgba(255, 176, 0, 0.3);
}

[data-theme="cyan"] {
  --text-main: #00f0ff;
  --glow-color: rgba(0, 240, 255, 0.35);
  --border-color: rgba(0, 240, 255, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-main);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 16px;
}

/* Служебные скрытые теги */
#cam-video, #cam-canvas {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Терминальное окно */
.terminal-frame {
  width: 100%;
  max-width: 1200px;
  height: 94vh;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 0 25px var(--glow-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Верхний тайтлбар */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.back-arrow {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1;
  transition: color 0.25s, transform 0.25s;
}

.back-arrow:hover {
  opacity: 0.7;
  transform: translateX(-4px);
}

.titlebar-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.titlebar-text {
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

/* Вьюпорт */
.viewport {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(16, 20, 16, 0.3) 0%, rgba(0, 0, 0, 0.98) 100%);
}

#ascii-output {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: pre;
  color: var(--text-main);
  text-shadow: 0 0 5px var(--glow-color);
  margin: auto;
  text-align: center;
  display: block;
}

#color-canvas {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* CRT Эффекты */
.scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
  background-size: 100% 3px;
  pointer-events: none;
  z-index: 4;
}

.vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 5;
}

/* Кнопка старта */
.start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(5, 5, 8, 0.75);
  z-index: 10;
}

.start-btn {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--text-main);
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 0 15px var(--glow-color);
  transition: all 0.2s ease;
}

.start-btn:hover {
  background: var(--text-main);
  color: #000;
}

/* Нижний статусбар (HUD) */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.7);
  font-size: 12px;
  z-index: 6;
  gap: 12px;
}

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

.hud-badge {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid currentColor;
}

.hud-badge.standby { color: #ffb000; }
.hud-badge.live { color: var(--text-main); }
.hud-badge.paused { color: #ff5f56; }

.hud-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
}

.hud-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hud-btn.active {
  background: var(--text-main);
  color: #000;
  border-color: var(--text-main);
}

/* Подсказки клавиатуры */
.hints {
  padding: 4px 14px 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.7);
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

kbd {
  display: inline-block;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.05);
}