
/* DiffCam Hybrid — Industrial Tactical Edition v0.3.5
   Hard-edge HUD, Ghost Camera Viewfinder, 4-Axis Telemetry. */
:root {
  color-scheme: dark;
  --bg: #070A0E;
  --bg2: #0C1017;
  --panel: #11161F;
  --panel2: #161D28;
  --line: #26303D;
  --line-bright: #3A495C;
  --muted: #8494A5;
  --text: #F4F7FA;
  --mint: #FF5C24;
  --violet: #53E0ED;
  --amber: #FFB84D;
  --radius: 2px;
  --accent: #FF5C24;
  --accent-glow: rgba(255, 92, 36, 0.35);
  --cyan: #53E0ED;
  --cyan-glow: rgba(83, 224, 237, 0.28);
  --danger: #FF334B;
  --font-condensed: "Bahnschrift Condensed", "Roboto Condensed", "Arial Narrow", Impact, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

html { scroll-padding-top: 20px; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 80% 0%, rgba(255, 92, 36, 0.12), transparent 45%),
    radial-gradient(circle at 15% 20%, rgba(83, 224, 237, 0.06), transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button:focus-visible, a:focus-visible, input:focus-visible, label:focus-within {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.app-shell { max-width: 1420px; padding: 0 36px; }

/* TOPBAR TATTICA */
.topbar {
  height: 80px;
  border-bottom: 2px solid var(--line);
  position: relative;
  background: linear-gradient(180deg, rgba(17, 22, 31, 0.95), rgba(7, 10, 14, 0.95));
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 75%, var(--cyan) 75%);
  box-shadow: 0 0 12px var(--accent-glow);
}

.brand { font-size: 25px; letter-spacing: -0.5px; font-weight: 950; text-transform: uppercase; }
.brand small { font-family: var(--font-mono); font-size: 9px; letter-spacing: 3.5px; color: var(--cyan); margin-top: 1px; }

.brand-icon {
  border-radius: 2px;
  border: 2px solid var(--accent);
  background: #1C100D;
  transform: none;
  box-shadow: 0 0 14px rgba(255, 92, 36, 0.25), inset 0 0 8px rgba(255, 92, 36, 0.2);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}

.brand-icon span { border-color: var(--accent); border-radius: 0; transform: skewX(-12deg); }
.brand-icon span + span { background: var(--accent); border-color: var(--cyan); }
.brand .accent { color: var(--accent); }

.topnav { border-radius: 2px; background: #0D1219; border: 1px solid var(--line-bright); padding: 3px; gap: 3px; }
.nav-link {
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-size: 11px;
  border-radius: 1px;
  font-weight: 850;
  padding: 10px 18px;
  transition: all 0.12s ease;
}
.nav-link.is-active { background: var(--accent); color: #070A0E; box-shadow: 0 0 15px rgba(255, 92, 36, 0.35); }
.nav-link.is-active .tiny-lock { color: #070A0E; background: rgba(0, 0, 0, 0.2); padding: 1px 4px; }
.nav-link:hover:not(.is-active) { color: var(--cyan); background: rgba(83, 224, 237, 0.08); }
.tiny-lock { color: var(--cyan); font-family: var(--font-mono); font-weight: 900; }

.connection-pill {
  border: 1px solid var(--cyan);
  border-left: 4px solid var(--cyan);
  border-radius: 1px;
  background: rgba(83, 224, 237, 0.08);
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 1px;
  font-size: 10px;
  text-transform: uppercase;
  box-shadow: inset 0 0 12px rgba(83, 224, 237, 0.1);
}

.connection-dot, .eyebrow-dot {
  border-radius: 0;
  width: 8px;
  height: 8px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* HERO AGGRESSIVA */
.hero {
  min-height: 300px;
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(255, 92, 36, 0.025) 14px 28px);
}

.hero-content { max-width: 720px; }

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: 2.6px;
  font-family: var(--font-mono);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(83, 224, 237, 0.07);
  border: 1px solid rgba(83, 224, 237, 0.25);
  padding: 5px 10px;
}

.version { border-radius: 1px; background: var(--accent); color: #070A0E; font-weight: 900; font-size: 9px; padding: 2px 6px; }

h1, h2, .panel-heading strong, .plan h2, .empty-archive strong {
  font-family: var(--font-condensed);
  font-stretch: condensed;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(46px, 6vw, 82px);
  letter-spacing: -0.5px;
  line-height: 0.94;
  font-weight: 950;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8);
}

h1 em { color: var(--accent); font-style: normal; text-shadow: 0 0 28px rgba(255, 92, 36, 0.35); }

.hero-description {
  max-width: 560px;
  color: #B8C6D4;
  font-size: 14px;
  line-height: 1.68;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(255, 92, 36, 0.08), transparent);
  padding: 10px 0 10px 16px;
  margin: 22px 0;
}

/* BOTTONI CON TAGLIO A 45 GRADI */
.primary-button, .secondary-button, .subtle-button {
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 900;
  font-size: 12px;
  min-height: 44px;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.primary-button {
  background: linear-gradient(135deg, #FF6B38 0%, #FF480A 100%);
  color: #070A0E;
  box-shadow: 0 6px 24px rgba(255, 92, 36, 0.3);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #FF8559 0%, #FF5C24 100%);
  color: #070A0E;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(255, 92, 36, 0.5);
}

.secondary-button { background: #1B2430; border: 1px solid var(--cyan); color: var(--cyan); }
.secondary-button:hover:not(:disabled) { background: rgba(83, 224, 237, 0.15); color: #FFF; }
.subtle-button { background: #10161F; border: 1px solid var(--line-bright); color: #A9B8C6; }
.subtle-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

/* ILLUSTRAZIONE HERO */
.abstract-frame {
  background: linear-gradient(135deg, #1A232E, #0B1017);
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.75);
}
.frame-one { opacity: 0.45; filter: grayscale(0.6); border-color: var(--cyan); }
.frame-two { border: 2px solid var(--accent); box-shadow: 0 0 30px rgba(255, 92, 36, 0.2); }
.mock-machine { border-radius: 1px; border: 6px solid #2E3B4B; background: #0B0F15; }
.mock-machine span { border-radius: 1px; background: #4A5A6E; border: 2px solid #25303E; }
.mock-machine .changed { background: var(--accent); box-shadow: 0 0 25px var(--accent); border-color: #FFF; }
.hero-target { color: var(--cyan); text-shadow: 0 0 15px var(--cyan); font-family: var(--font-mono); }
.hero-diff {
  color: #070A0E;
  background: var(--accent);
  border-radius: 0;
  letter-spacing: 1.8px;
  font-family: var(--font-mono);
  font-size: 10px;
  box-shadow: 0 0 18px rgba(255, 92, 36, 0.6);
}

/* STEP HEADINGS */
.step-heading { margin: 30px 0 16px; }
.step-number {
  border-radius: 0;
  background: var(--accent);
  border: 0;
  color: #070A0E;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 900;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}
.step-heading h2 { font-size: 24px; letter-spacing: 0.8px; margin: 0 0 3px; }
.step-heading p { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

/* UPLOAD CARDS + BOTTONI FOTOCAMERA */
.upload-grid { gap: 16px; }
.upload-card {
  border: 1px solid var(--line-bright);
  border-top: 3px solid var(--cyan);
  border-radius: 2px;
  background: var(--panel);
  padding: 14px;
  position: relative;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
#afterDrop { border-top-color: var(--accent); }

.input-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  padding: 3px 8px;
  background: rgba(83, 224, 237, 0.1);
  border: 1px solid rgba(83, 224, 237, 0.3);
}
.before-tag { color: var(--cyan); }
.after-tag { color: var(--accent); background: rgba(255, 92, 36, 0.1); border-color: rgba(255, 92, 36, 0.35); }
.image-file-label { font-family: var(--font-mono); color: #9BAAB8; }

.dropzone {
  height: 162px;
  border-radius: 1px;
  border: 1px dashed #465669;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 10px, transparent 10px 20px),
    #0A0E14;
  transition: all 0.15s ease;
}
.dropzone:hover, .upload-card.drag-over .dropzone {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(255, 92, 36, 0.06);
  box-shadow: inset 0 0 24px rgba(255, 92, 36, 0.15);
}
.upload-icon {
  border-radius: 2px;
  color: var(--accent);
  background: #1F1410;
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px rgba(255, 92, 36, 0.2);
}
.empty-upload strong { font-family: var(--font-condensed); font-size: 15px; text-transform: uppercase; letter-spacing: 0.8px; }
.upload-preview { background: #070A0E; }

.card-actions {
  margin-top: 10px;
  display: flex;
}

.camera-trigger-btn {
  width: 100%;
  padding: 10px 12px;
  background: #0D141D;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.15s ease;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.camera-trigger-btn:hover {
  background: rgba(83, 224, 237, 0.14);
  box-shadow: 0 0 14px rgba(83, 224, 237, 0.25);
}
.camera-trigger-btn.ghost-trigger {
  border-color: var(--accent);
  color: var(--accent);
  background: #18100E;
}
.camera-trigger-btn.ghost-trigger:hover {
  background: rgba(255, 92, 36, 0.16);
  box-shadow: 0 0 14px rgba(255, 92, 36, 0.3);
}

/* WORKSPACE E VISORE */
.workspace-state {
  border-radius: 1px;
  background: #141B24;
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--amber);
  color: var(--amber);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
}
.workspace-state.ready {
  border-color: var(--cyan);
  border-left: 3px solid var(--cyan);
  background: rgba(83, 224, 237, 0.08);
  color: var(--cyan);
  box-shadow: 0 0 15px rgba(83, 224, 237, 0.15);
}

.viewer-panel, .analysis-panel {
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.viewer-toolbar { padding: 10px 12px; background: #0C1017; border-bottom: 1px solid var(--line-bright); }
.mode-switch { background: #070A0E; border: 1px solid var(--line); border-radius: 1px; padding: 3px; gap: 4px; }
.mode-button {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-condensed);
  font-size: 13px;
  font-weight: 900;
  border-radius: 1px;
  color: #8494A5;
  padding: 10px 14px;
}
.mode-button.is-active { background: var(--accent); color: #070A0E; box-shadow: 0 0 14px rgba(255, 92, 36, 0.4); }
.mode-button:hover:not(:disabled):not(.is-active) { color: var(--cyan); background: rgba(83, 224, 237, 0.06); }

.viewer-stage {
  min-height: 410px;
  background: radial-gradient(circle at center, #141D28 0%, #070A0E 85%);
  user-select: none;
}
.viewer-stage::before {
  background-image:
    linear-gradient(rgba(83, 224, 237, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 224, 237, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}
.viewer-stage canvas { box-shadow: 0 0 0 1px #2E3D4F, 0 18px 40px rgba(0, 0, 0, 0.8); }
.viewer-stage canvas.is-interactive { cursor: ew-resize; touch-action: none; }

.viewer-corner { border-color: var(--accent); width: 24px; height: 24px; opacity: 0.9; }
.tl, .tr, .bl, .br { border-width: 3px; }

.viewer-bottom {
  background: #0B0F15;
  border-top: 1px solid var(--line-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.legend-dot { border-radius: 0; width: 9px; height: 9px; }
.before-dot { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.after-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.viewer-info { color: var(--cyan); }

/* SLIDER INDUSTRIALI RETTANGOLARI */
.overlay-control { background: #0E131B; border-top: 1px solid var(--line-bright); }
.control-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.control-label { margin-bottom: 8px; }
.control-label label {
  font-family: var(--font-condensed);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 13px;
  color: #DCE5EE;
}
.control-label output {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  background: rgba(83, 224, 237, 0.08);
  border: 1px solid rgba(83, 224, 237, 0.25);
  padding: 2px 6px;
  font-weight: 800;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #070A0E;
  border: 1px solid #334152;
  border-radius: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 20px;
  background: var(--accent);
  border: 2px solid #FFF;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 92, 36, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background: var(--accent);
  border: 2px solid #FFF;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 92, 36, 0.6);
}

/* PANNELLO DI ANALISI */
.analysis-panel {
  gap: 16px;
  padding: 18px;
  border-top: 3px solid var(--accent);
}
.panel-heading { border-bottom: 1px solid var(--line-bright); padding-bottom: 12px; }
.panel-heading strong { font-size: 20px; letter-spacing: 1px; }
.panel-heading small { font-family: var(--font-mono); text-transform: uppercase; font-size: 10px; letter-spacing: 1px; color: var(--cyan); }
.panel-icon { border-radius: 1px; background: #23140F; color: var(--accent); border: 1px solid var(--accent); }

/* CARD RISULTATO */
.result-card {
  background:
    repeating-linear-gradient(-45deg, rgba(255, 92, 36, 0.04) 0 8px, transparent 8px 16px),
    #0B0F15;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 25px rgba(255, 92, 36, 0.08);
}
.result-card::after {
  content: "TELEMETRY // DIFF";
  position: absolute;
  top: 8px;
  right: 10px;
  color: rgba(255, 92, 36, 0.45);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.2px;
}
.result-label { font-family: var(--font-mono); color: #F4C2B0; max-width: 200px; display: block; }
.result-line strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 38px;
  letter-spacing: -1px;
  text-shadow: 0 0 20px rgba(255, 92, 36, 0.35);
}
.result-line span { font-family: var(--font-mono); color: var(--cyan); font-size: 11px; }
.meter { border-radius: 0; height: 8px; background: #1A222D; border: 1px solid #334152; }
.meter span { background: linear-gradient(90deg, var(--accent), var(--amber)); box-shadow: 0 0 10px var(--accent); }

/* MODALE GHOST CAMERA TATTICA */
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 12, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.camera-dialog {
  width: 100%;
  max-width: 780px;
  background: var(--panel);
  border: 2px solid var(--accent);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0B0F15;
  border-bottom: 1px solid var(--line-bright);
}
.camera-title-block {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 1px;
}
.camera-close-btn {
  background: #241216;
  border: 1px solid var(--danger);
  color: #FF8A98;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
}
.camera-viewport {
  position: relative;
  width: 100%;
  height: min(62vh, 480px);
  background: #05070A;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.camera-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.45;
  filter: contrast(1.15) drop-shadow(0 0 4px var(--cyan));
}
.camera-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.camera-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(83, 224, 237, 0.65);
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 300;
}
.camera-controls {
  padding: 14px 16px;
  background: #0D1219;
  border-top: 1px solid var(--line-bright);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ghost-slider-wrap.is-hidden { display: none; }
.camera-action-bar {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}

/* PRIVACY & FOOTER */
.privacy-note { border-radius: 1px; border: 1px solid #245B66; border-left: 4px solid var(--cyan); background: #0B181E; }
.shield-symbol { border-color: var(--cyan); color: var(--cyan); border-radius: 1px; background: rgba(83, 224, 237, 0.1); }
.footer { border-top: 1px solid var(--line-bright); color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 1px; }
.archive-preview, .plan { background: var(--panel); border: 1px solid var(--line-bright); border-radius: 2px; }
.pro-plan { border: 1px solid var(--accent); border-top: 4px solid var(--accent); background: linear-gradient(145deg, #1E1412, #11161F 60%); }
.toast { background: #0F1D24; border: 1px solid var(--cyan); border-left: 4px solid var(--cyan); border-radius: 1px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; z-index: 60; }
.toast.error { border-color: var(--danger); border-left-color: var(--danger); background: #281117; }

@media (max-width: 1080px) {
  .app-shell { padding: 0 22px; }
  .hero-illustration { opacity: 0.28; right: -95px; }
  .analysis-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .control-grid-2 { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .app-shell { padding: 0 12px; }
  .topbar { min-height: 72px; height: auto; padding: 12px 0; }
  .brand { font-size: 21px; }
  .nav-link { font-size: 10px; letter-spacing: 0.6px; padding: 10px 6px; }
  .hero { padding: 34px 0 24px; min-height: unset; }
  h1 { font-size: clamp(42px, 11.5vw, 64px); }
  .hero-actions .primary-button { width: 100%; }
  .hero-actions { align-items: stretch; }
  .hero-illustration { display: none; }
  .viewer-stage { min-height: 270px; }
  .analysis-panel { display: flex; }
  .camera-modal { padding: 0; }
  .camera-dialog { height: 100dvh; max-width: none; border: 0; }
  .camera-viewport { flex: 1; height: auto; }
}