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

:root {
  --bg-body: #0b0d14;
  --bg-surface: #11141c;
  --bg-elevated: #181b24;
  --border: #262a35;
  --border-light: #3a3f4e;
  --accent: #4f8cff;
  --accent-hover: #3b72db;
  --success: #3ecf8e;
  --warning: #f2c94c;
  --text-primary: #e8ecf1;
  --text-secondary: #9198a8;
  --text-muted: #5d6373;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.15s ease;
}

body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: "Inter", sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}
.status-dot.active {
  background: var(--accent);
}
.status-dot.drawing {
  background: var(--success);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
}
.coords-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  background: var(--bg-elevated);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.coord-value {
  color: var(--accent);
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.coord-separator {
  color: var(--text-muted);
  margin: 0 4px;
}
.mouth-indicator-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.mouth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}
.mouth-dot.open {
  background: var(--success);
}

.main-layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.tool-group {
  display: flex;
  gap: 6px;
}
.tool-btn {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 0;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  text-align: center;
}
.tool-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Kleur */
.color-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.current-color-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: border-color var(--transition);
}
.current-color-box:hover {
  border-color: var(--accent);
}
.btn-add-color {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-add-color:hover {
  background: var(--border);
  color: var(--accent);
}
.color-palette-popup {
  display: none;
  position: absolute;
  top: 60px;
  left: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  z-index: 20;
  width: 220px;
}
.color-palette-popup.visible {
  display: block;
}
.popup-grid {
  display: grid;
  grid-template-columns: repeat(4, 32px);
  gap: 6px;
  margin-bottom: 10px;
}
.popup-grid .swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.popup-grid .swatch:hover {
  border-color: var(--text-secondary);
}
.popup-grid .swatch.active {
  border-color: white;
  box-shadow: 0 0 0 2px var(--accent);
}
.popup-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}
.small-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

/* Sliders */
.slider-row {
  margin-bottom: 10px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.slider-value {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(79, 140, 255, 0.4);
}

/* Ogen/Neus knoppen */
.cursor-toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.toggle-btn {
  flex: 1;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 0;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  text-align: center;
}
.toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Actieknoppen */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}
.btn-primary,
.btn-secondary {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  border: none;
  transition: background var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--border);
}

/* Canvas */
.canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-body);
}
.canvas-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}
canvas#drawingCanvas {
  display: block;
  background: #f8f9fb;
}

#eyeCursor {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition:
    opacity 0.2s,
    width 0.2s,
    height 0.2s;
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.7);
}
#eyeCursor.active {
  opacity: 0.9;
}
#eyeCursor.drawing {
  border-color: var(--success);
  box-shadow: 0 0 12px rgba(62, 207, 142, 0.8);
  width: 20px;
  height: 20px;
}

/* Rechter paneel */
.right-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.live-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  background: var(--success);
  color: #000;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}
.video-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  line-height: 0;
}
#webcam {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
#cameraOutput {
  width: 100%;
  height: auto;
  display: block;
}
.camera-select {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.camera-select label {
  color: var(--text-muted);
  font-size: 11px;
}
.camera-select select {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 12px;
}

.eye-debug {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.eye-crop {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.eye-crop canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 2px;
}
.tiny-label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.mouth-bar-container {
  margin-top: 8px;
}
.mouth-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.mouth-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s;
}
.fps-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* Footer */
#appFooter {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 4px 24px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  flex-shrink: 0;
}
.console-log {
  font-family: "JetBrains Mono", monospace;
  color: var(--text-muted);
}
