:root {
  --bg: #080808;
  --bg2: #0e0e0e;
  --bg3: #161616;
  --accent: #00FF41;
  --accent-dim: #00cc33;
  --accent-glow: rgba(0, 255, 65, 0.15);
  --text: #c0c0c0;
  --text-dim: #606060;
  --border: #222;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Courier New', monospace;
}

[data-accent="amber"] {
  --accent: #FFB000;
  --accent-dim: #cc8d00;
  --accent-glow: rgba(255, 176, 0, 0.15);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow-x: hidden;
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  text-align: center;
  padding: 24px 16px 12px;
  background: linear-gradient(180deg, #0f0f0f 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
  line-height: 1;
}

.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.subtitle {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.08em;
}

/* Layout */
#main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#output-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Drop zone */
#drop-zone {
  border: 2px dashed var(--text-dim);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg3);
}

#drop-zone:hover, #drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 20px var(--accent-glow);
}

.drop-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

#drop-zone p {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Thumbnail */
#thumbnail-container {
  background: var(--bg3);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

#thumbnail-container.hidden { display: none; }

#thumbnail {
  max-width: 100%;
  max-height: 100px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

#img-info {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Samples */
.sample-buttons {
  display: flex;
  gap: 6px;
}

.sample-btn {
  flex: 1;
  padding: 6px 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.sample-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Controls */
.control-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: block;
}

.control-label span {
  color: var(--text);
  font-weight: 400;
}

.control-group {
  display: flex;
  flex-direction: column;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  outline: none;
  border: 1px solid var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.toggle-group {
  display: flex;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 5px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 6px;
}

/* Action buttons */
.action-btn {
  width: 100%;
  padding: 8px;
  background: var(--bg3);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.05em;
}

.action-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(0);
}

#actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#camera-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hidden { display: none !important; }

/* Info bar */
#info-bar {
  padding: 8px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* Canvas */
#canvas-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,255,65,0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,255,65,0.01) 0%, transparent 50%);
}

#canvas {
  display: block;
  image-rendering: pixelated;
}

/* Scanline overlay */
#scanline-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  z-index: 2;
}

#scanline-overlay.hidden { display: none; }

/* Tooltip */
#tooltip {
  position: fixed;
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.6rem;
  color: var(--accent);
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Camera video */
#camera-video {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
}

/* Footer */
footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  font-size: 0.6rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

footer a:hover {
  text-decoration: underline;
}

.keys-hint {
  font-size: 0.55rem;
  opacity: 0.5;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 6px;
  z-index: 200;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Mobile */
@media (max-width: 768px) {
  #main-layout {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    min-width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  #canvas-wrapper {
    min-height: 50vh;
  }

  header h1 {
    font-size: 1.6rem;
  }

  footer {
    flex-direction: column;
    gap: 4px;
  }
}