:root {
  --bg: #0D0B0C;
  --ink: #FFF6EA;
  --dim: #9C948B;
  --faint: #6A635C;
  --edge: rgba(255, 246, 234, 0.13);
  --edge-soft: rgba(255, 246, 234, 0.06);
  --panel: #171416;
  --panel-2: #1F1B1E;
  --accent: #00FF88;
  --accent-dim: rgba(0, 255, 136, 0.15);
  
  --sign: "Arial Black", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important; /* STRICT: NO ROUNDS */
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

button {
  cursor: pointer;
  background: none;
  border: 1px solid var(--edge);
  transition: all 0.15s ease;
}

button:hover {
  border-color: var(--ink);
  background: rgba(255, 246, 234, 0.06);
}

button:active {
  background: rgba(255, 246, 234, 0.12);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* --- Layout --- */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Top Header Bar --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--edge);
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-title {
  font-family: var(--sign);
  font-size: 18px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.brand-title span {
  color: var(--dim);
}

.badge-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px dashed var(--edge);
  color: var(--accent);
  background: var(--accent-dim);
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.05em;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-val {
  color: var(--ink);
  font-weight: 700;
}

/* --- Main Workbench Grid --- */
.workbench {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .workbench {
    grid-template-columns: 1fr;
  }
}

/* --- Camera Canvas Viewport --- */
.viewport-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
  position: relative;
}

.viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--edge);
  background: var(--panel-2);
}

.viewport-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot-live {
  width: 8px;
  height: 8px;
  background: #FF3344;
  display: inline-block;
  animation: blink 1.2s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.viewport-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  color: var(--ink);
}

.btn-accent {
  background: var(--ink);
  color: #0D0B0C;
  font-weight: 700;
  border-color: var(--ink);
}

.btn-accent:hover {
  background: #FFFFFF;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hidden HTML5 Video element used as texture source (opacity:0 instead of display:none to prevent YUV green canvas bug) */
#webcam-video {
  /* Source-only element; the canvas is what the user sees. Kept in-flow but hidden. */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* Main active Processing Canvas */
#output-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

.hud-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  background: rgba(13, 11, 12, 0.85);
  border: 1px solid var(--edge);
  padding: 8px 12px;
  pointer-events: none;
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cam-prompt {
  position: absolute;
  inset: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  text-align: center;
  padding: 24px;
}

.cam-prompt-icon {
  font-family: var(--sign);
  font-size: 42px;
  color: var(--dim);
}

.cam-prompt-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  max-width: 360px;
  line-height: 1.6;
}

/* --- Control Panel / Sidebar --- */
.control-panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--edge);
  background: var(--panel-2);
  font-family: var(--sign);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--edge-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* Effect Grid Selector */
.effect-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.effect-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 8px;
  text-align: center;
  background: rgba(255, 246, 234, 0.02);
  color: var(--dim);
  border: 1px solid var(--edge);
}

.effect-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.effect-btn.active {
  background: var(--ink);
  color: #0D0B0C;
  border-color: var(--ink);
  font-weight: 700;
}

/* Range Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-title-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
}

.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--ink);
  border: none;
  cursor: pointer;
  border-radius: 0;
}

/* Toggle Switch Sharp Style */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
}

.checkbox-sharp {
  width: 18px;
  height: 18px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
}

.checkbox-sharp:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-sharp:checked::after {
  content: "✓";
  position: absolute;
  top: -2px;
  left: 3px;
  font-size: 12px;
  color: #0D0B0C;
  font-weight: bold;
}

/* --- Snapshots Gallery --- */
.info-bar {
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.footer-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer-links a {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}
