:root {
  --bg-dark: #060b16;
  --bg-panel: #0d1627;
  --bg-card: #132038;
  --bg-card-hover: #192a48;
  --teal-primary: #1e4d5c;
  --teal-glow: #0ea5e9;
  --amber-primary: #c84b0f;
  --amber-bright: #f97316;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-glow: rgba(14, 165, 233, 0.45);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 15% 10%, rgba(30, 77, 92, 0.32), transparent 45%),
              radial-gradient(circle at 85% 20%, rgba(200, 75, 15, 0.18), transparent 40%),
              var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Sticky Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 11, 22, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: 16px;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 16px rgba(200, 75, 15, 0.35);
}

.brand-title {
  display: block;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 22px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #fff;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.22s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-primary), var(--amber-bright));
  color: #fff;
  box-shadow: 0 6px 20px rgba(200, 75, 15, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.5);
}

.btn-teal {
  background: linear-gradient(135deg, var(--teal-primary), #0284c7);
  color: #fff;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.28);
}

.btn-teal:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.45);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

#langBtn {
  min-width: 52px;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  line-height: 1;
  user-select: none;
  box-sizing: border-box;
}

/* Hero Section */
.hero {
  padding: 56px 0 36px;
}

.hero-header {
  text-align: center;
  max-width: 880px;
  margin: 0 auto 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.hero h1 {
  font-size: clamp(28px, 4.2vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.text-gradient {
  background: linear-gradient(90deg, #38bdf8, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead {
  font-size: 17px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Mode Selector Pills (4 v2.0 Modes) */
.mode-selector-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.mode-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.22s ease;
}

.mode-card-btn:hover {
  background: var(--bg-card);
  border-color: rgba(56, 189, 248, 0.4);
}

.mode-card-btn.active {
  background: linear-gradient(145deg, rgba(30, 77, 92, 0.55), rgba(19, 32, 56, 0.95));
  border-color: var(--amber-bright);
  box-shadow: 0 0 24px rgba(249, 115, 22, 0.22);
}

.mode-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 6px;
}

.mode-icon {
  font-size: 20px;
}

.mode-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
}

.mode-title {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 3px;
}

.mode-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Stepper Progress Bar (Steps 1 -> 2 -> 3) */
.workflow-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  gap: 12px;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
}

.step-pill.active {
  background: rgba(14, 165, 233, 0.14);
  border-color: var(--teal-glow);
}

.step-pill.completed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.step-pill.active .step-num {
  background: var(--teal-glow);
  color: #04101c;
  border-color: var(--teal-glow);
}

.step-pill.completed .step-num {
  background: var(--success);
  color: #03150e;
  border-color: var(--success);
}

.step-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
}

.step-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Simulator Grid */
.sim-workspace {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  align-items: start;
}

/* Left Column: Interactive Phone & Optical Scanner */
.phone-console {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.phone-Statusbar {
  background: var(--teal-primary);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phone-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
}

.phone-app-brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.phone-mode-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.3);
  color: #7dd3fc;
}

.phone-body {
  padding: 18px;
}

/* Optical Viewport with Real Photos + Laser + Bounding Boxes */
.optical-viewport {
  position: relative;
  height: 310px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #040811;
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 16px;
}

.viewport-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.35s ease;
}

.optical-viewport.scanning .viewport-img {
  transform: scale(1.03);
  filter: contrast(1.08) brightness(0.92);
}

/* Camera Shutter Flash Overlay */
.camera-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}

.camera-flash.trigger {
  animation: shutterFlash 0.45s ease-out;
}

@keyframes shutterFlash {
  0% { opacity: 0.92; }
  100% { opacity: 0; }
}

/* Laser Sweep Line */
.laser-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #38bdf8, #f97316, #38bdf8, transparent);
  box-shadow: 0 0 18px 4px rgba(56, 189, 248, 0.75);
  top: 10%;
  opacity: 0;
  z-index: 12;
  pointer-events: none;
}

.optical-viewport.scanning .laser-beam {
  opacity: 1;
  animation: laserSweep 2.1s ease-in-out infinite;
}

@keyframes laserSweep {
  0% { top: 6%; }
  50% { top: 92%; }
  100% { top: 6%; }
}

/* Forensic Bounding Boxes */
.bbox {
  position: absolute;
  border: 2px solid #38bdf8;
  background: rgba(14, 165, 233, 0.12);
  border-radius: 6px;
  z-index: 10;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.25);
}

.bbox.amber {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.14);
  box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
}

.bbox-label {
  position: absolute;
  top: -24px;
  left: -2px;
  background: #0284c7;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.bbox.amber .bbox-label {
  background: var(--amber-primary);
}

/* Viewport Top & Bottom HUD Badges */
.hud-top-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  z-index: 11;
  pointer-events: none;
}

.hud-badge {
  background: rgba(6, 11, 22, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.hud-badge.node-badge {
  background: rgba(200, 75, 15, 0.88);
  border-color: #fb923c;
  color: #fff;
}

/* Photo Angle / Node Slot Thumbnails */
.slots-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.photo-slots-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.slot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  transition: all 0.2s;
}

.slot-card:hover {
  border-color: #38bdf8;
}

.slot-card.active {
  border-color: var(--amber-bright);
  background: rgba(200, 75, 15, 0.16);
}

.slot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.slot-node-tag {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
}

.slot-role-name {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

/* AI Scan Telemetry Console */
.scan-telemetry-box {
  background: #050a14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.progress-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0ea5e9, #f97316, #10b981);
  transition: width 0.35s ease;
}

.telemetry-log {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  color: #93c5fd;
  max-height: 88px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-item.done {
  color: #34d399;
}

/* Right Column: Live Structured Engineering Datasheet (v2.0) */
.datasheet-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.datasheet-panel.scanning-blur {
  opacity: 0.55;
  transform: scale(0.99);
}

.ds-top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.ds-category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #38bdf8;
  margin-bottom: 4px;
}

.ds-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.ds-Badges-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.market-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 99px;
}

.market-active {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.market-obsolete {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.confidence-pill {
  font-size: 12px;
  font-weight: 800;
  color: #cbd5e1;
}

/* Forensic Reasoning Callout */
.forensic-dictamen {
  background: rgba(30, 77, 92, 0.25);
  border-left: 4px solid #38bdf8;
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 18px;
}

.forensic-dictamen strong {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  color: #7dd3fc;
  margin-bottom: 4px;
}

.forensic-dictamen p {
  font-size: 13.5px;
  color: #e2e8f0;
}

/* Nominal Specs Grid */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.spec-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.spec-cell-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spec-cell-val {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}

/* Dynamic v2.0 Specialized Module Box */
.v2-specialized-box {
  background: rgba(200, 75, 15, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.v2-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.v2-box-title {
  font-size: 14px;
  font-weight: 800;
  color: #fdba74;
  display: flex;
  align-items: center;
  gap: 8px;
}

.v2-node-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.v2-node-item {
  background: rgba(13, 22, 39, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.v2-node-item-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 4px;
}

.v2-node-item p {
  font-size: 12.5px;
  color: #cbd5e1;
}

/* Action Buttons Bar */
.ds-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Feature Pillars Section */
.section {
  padding: 56px 0;
  border-top: 1px solid var(--border-subtle);
}

.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 36px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
}

.section-header p {
  color: var(--text-muted);
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.pillar-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
}

.pillar-card h3 {
  font-size: 16px;
  margin: 10px 0 8px;
}

.pillar-card p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Modals (PDF Preview & FieldOps JSON Adapter) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: #fff;
  color: #0f172a;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  border-radius: var(--radius-md);
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-window.dark-modal {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-glow);
}

.modal-topbar {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #fff;
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.pdf-sheet {
  padding: 28px 32px;
}

.pdf-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #1e4d5c;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.pdf-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.pdf-box {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.pdf-box h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: #1e4d5c;
  margin-bottom: 6px;
}

.code-pre {
  background: #050a14;
  color: #38bdf8;
  padding: 16px;
  border-radius: 8px;
  font-family: 'Consolas', monospace;
  font-size: 12.5px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
}

.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13.5px;
}

.footer a {
  color: #38bdf8;
  text-decoration: none;
}

@media screen and (max-width: 980px) {
  .topbar-inner {
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }
  .nav-links {
    display: none;
  }
  .mode-selector-bar,
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sim-workspace {
    grid-template-columns: 1fr;
  }
  .workflow-stepper {
    flex-direction: column;
    align-items: stretch;
  }
}

@media screen and (max-width: 600px) {
  .brand-subtitle {
    display: none;
  }
  #topRunScanBtn {
    display: none;
  }
}

@media print {
  body > *:not(#pdfModalBackdrop) {
    display: none !important;
  }
  #pdfModalBackdrop {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
  }
  .modal-window {
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  .modal-topbar {
    display: none !important;
  }
}
