/* ==========================================================================
   Hydra QR Studio v2 - Compact, Responsive Modern Stylesheet
   Designed to fit 100% desktop zoom with zero overflow, and fluid on mobile.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg-core: #050b16;
  --bg-panel: rgba(13, 23, 38, 0.88);
  --bg-card: rgba(18, 32, 54, 0.65);
  --border-line: rgba(45, 75, 115, 0.38);
  --border-active: rgba(0, 220, 255, 0.65);
  
  --text-main: #edf5ff;
  --text-muted: #8fa5c2;
  --text-dim: #5c7494;
  
  --accent-cyan: #00d9ff;
  --accent-blue: #005bff;
  --accent-glow: rgba(0, 217, 255, 0.28);
  --success-green: #00e676;
  --success-glow: rgba(0, 230, 118, 0.35);
  --danger-red: #ff3d71;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", system-ui, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 85% -10%, rgba(0, 91, 255, 0.12), transparent 50%),
              radial-gradient(circle at 10% 110%, rgba(0, 217, 255, 0.08), transparent 50%),
              var(--bg-core);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP SHELL (Fits 100% zoom on 1080p desktop)
   ========================================================================== */

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 18px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   COMPACT TOPBAR (~48px height)
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 12px;
  flex-shrink: 0;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 217, 255, 0.4);
  background: rgba(0, 91, 255, 0.15);
  object-fit: contain;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 217, 255, 0.14);
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid rgba(0, 217, 255, 0.3);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

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

/* Real-Time Scan Badge */
.scan-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 230, 118, 0.10);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  color: #a3ffc7;
  transition: all 0.25s ease;
}

.scan-badge.invalid {
  background: rgba(255, 61, 113, 0.12);
  border-color: rgba(255, 61, 113, 0.4);
  color: #ff99b3;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-green);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-beacon 2s infinite ease-in-out;
}

.scan-badge.invalid .badge-dot {
  background: var(--danger-red);
  box-shadow: 0 0 8px rgba(255, 61, 113, 0.4);
  animation: none;
}

@keyframes pulse-beacon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Mobile Nav (Hidden on Desktop) */
.mobile-nav {
  display: none;
}

/* ==========================================================================
   DUAL PANE WORKSPACE (Desktop Layout)
   ========================================================================== */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 480px);
  gap: 16px;
  flex: 1;
  min-height: 0; /* Critical for internal flex/grid scroll */
}

/* LEFT: CONTROLS PANEL */
.controls-panel {
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Sleek Scrollbar */
.controls-panel::-webkit-scrollbar {
  width: 5px;
}
.controls-panel::-webkit-scrollbar-track {
  background: transparent;
}
.controls-panel::-webkit-scrollbar-thumb {
  background: rgba(45, 75, 115, 0.4);
  border-radius: 4px;
}
.controls-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 217, 255, 0.4);
}

/* COMPACT CARDS */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.step-num {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 217, 255, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 217, 255, 0.25);
}

.card-head h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-main);
  flex: 1;
}

.badge-mini {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 99px;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 10px;
}
.form-group:last-child {
  margin-bottom: 0;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.label-row label {
  margin-bottom: 0;
}

.value-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 217, 255, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-prefix-icon {
  position: absolute;
  left: 12px;
  color: var(--accent-cyan);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.input-with-icon .text-input {
  padding-left: 38px;
}

.input-with-icon:focus-within .input-prefix-icon {
  opacity: 1;
  transform: scale(1.05);
  color: #fff;
}

.text-input {
  width: 100%;
  background: rgba(6, 13, 24, 0.9);
  border: 1px solid var(--border-line);
  color: var(--text-main);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* SEGMENTED CONTROL */
.segmented-control {
  display: flex;
  background: rgba(6, 13, 24, 0.9);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.segment-btn.active {
  background: rgba(0, 140, 255, 0.25);
  color: #fff;
  border: 1px solid rgba(0, 217, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 217, 255, 0.15);
}

/* RANGE SLIDERS */
.range-slider {
  width: 100%;
  height: 5px;
  background: rgba(30, 50, 78, 0.6);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.sub-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  display: block;
}

/* COMPACT DROPZONE */
.drop-compact {
  border: 1px dashed var(--border-line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: rgba(6, 13, 24, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.drop-compact:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 217, 255, 0.05);
}

.drop-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.drop-inner strong {
  color: var(--accent-cyan);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* PATTERN CAROUSEL / GRID */
.pattern-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  max-height: 172px;
  overflow-y: auto;
  padding: 2px;
  margin-bottom: 10px;
}

.pattern-carousel::-webkit-scrollbar {
  width: 4px;
}
.pattern-carousel::-webkit-scrollbar-thumb {
  background: rgba(45, 75, 115, 0.4);
  border-radius: 3px;
}

.pattern-card {
  position: relative;
  background: rgba(6, 13, 24, 0.85);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.pattern-card:hover {
  border-color: rgba(0, 217, 255, 0.5);
  transform: translateY(-1px);
}

.pattern-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-glow);
  background: rgba(0, 91, 255, 0.18);
}

.pattern-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.pattern-title {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pattern-custom-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 225, 255, 0.25);
  color: #00e1ff;
  border: 1px solid rgba(0, 225, 255, 0.5);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* PALETTE GRID */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.palette-btn {
  background: rgba(6, 13, 24, 0.9);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.palette-btn:hover {
  border-color: rgba(0, 217, 255, 0.5);
}

.palette-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 91, 255, 0.15);
  box-shadow: 0 0 8px var(--accent-glow);
}

.palette-swatch {
  height: 8px;
  border-radius: 2px;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #00d9ff, #005bff);
}

.palette-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-btn.active .palette-name {
  color: #fff;
}

/* LOGO PRESETS */
.logo-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.logo-preset-btn {
  background: rgba(6, 13, 24, 0.7);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-preset-btn:hover {
  border-color: rgba(0, 217, 255, 0.4);
  color: #fff;
}

.logo-preset-btn.active {
  background: rgba(0, 91, 255, 0.22);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* BACKGROUND PRESETS */
.bg-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.bg-preset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(6, 13, 24, 0.7);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bg-preset-btn:hover {
  border-color: rgba(0, 217, 255, 0.4);
  color: #fff;
}

.bg-preset-btn.active {
  background: rgba(0, 91, 255, 0.22);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-glow);
}

.bg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.theme-dot {
  background: linear-gradient(135deg, #020612 50%, #ffffff 50%);
}

.white-dot {
  background: #ffffff;
  border-color: #cbd5e1;
}

.black-dot {
  background: #020612;
  border-color: #334155;
}

.trans-dot {
  background: repeating-conic-gradient(#64748b 0% 25%, #0f172a 0% 50%) 50% / 4px 4px;
}

.custom-dot {
  background: #00d9ff;
}

/* CUSTOM COLOR INPUT ROW */
.bg-custom-row {
  margin-top: 8px;
}

.input-with-swatch {
  position: relative;
  display: flex;
  align-items: center;
}

.color-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.color-swatch-box {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #0A1628;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-swatch-box:hover {
  transform: scale(1.15);
}

.hex-input {
  padding-left: 36px !important;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.mt-12 {
  margin-top: 12px;
}

/* TOGGLES */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mt-8 {
  margin-top: 8px;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0;
  user-select: none;
}

.toggle-label input {
  display: none;
}

.toggle-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-line);
  background: rgba(6, 13, 24, 0.9);
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
}

.toggle-label input:checked + .toggle-box {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-glow);
}

.toggle-label input:checked + .toggle-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #020914;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ==========================================================================
   RIGHT: PREVIEW & EXPORT PANEL (Sticky, Fits Screen)
   ========================================================================== */

.preview-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.preview-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 16px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

/* Square Canvas Container */
.canvas-wrap {
  width: 100%;
  aspect-ratio: 1;
  max-height: 380px;
  max-width: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-line);
  background: radial-gradient(circle at center, #0a1322, #040812);
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}

/* Spinner Overlay */
.spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.spinner-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 217, 255, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.7s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Shimmer Progress Indicator */
.shimmer-progress-wrap {
  width: 150px;
  height: 4px;
  background: rgba(0, 91, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 217, 255, 0.25);
  margin-bottom: 2px;
}

.shimmer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), #ffffff, var(--accent-cyan), transparent);
  background-size: 200% 100%;
  animation: shimmerMove 1.4s infinite linear;
}

@keyframes shimmerMove {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-step-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

/* Telemetry Bar */
.telemetry-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  margin-top: 10px;
  background: rgba(6, 13, 24, 0.75);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-line);
}

.telem-item {
  display: flex;
  gap: 5px;
  font-size: 10.5px;
}

.telem-label {
  color: var(--text-dim);
}

.telem-val {
  color: var(--text-main);
  font-weight: 600;
}

.telem-val.success {
  color: var(--success-green);
}

/* Export Actions */
.export-actions {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #00d9ff, #005bff);
  color: #020b18;
  box-shadow: 0 4px 14px rgba(0, 140, 255, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 18px rgba(0, 217, 255, 0.45);
}

.btn-secondary {
  background: rgba(0, 91, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(0, 217, 255, 0.4);
}

.btn-secondary:hover {
  background: rgba(0, 91, 255, 0.35);
}

.export-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-ghost {
  background: rgba(6, 13, 24, 0.65);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  font-size: 11px;
  padding: 7px 10px;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: rgba(0, 217, 255, 0.4);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS (< 900px)
   ========================================================================== */

@media (max-width: 900px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 10px 12px 24px;
  }

  .mobile-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 12px;
  }

  .mobile-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
  }

  .mobile-tab.active {
    background: rgba(0, 91, 255, 0.3);
    color: #fff;
    border: 1px solid var(--accent-cyan);
  }

  .workspace {
    display: block;
  }

  .controls-panel {
    display: none;
  }

  .controls-panel.mobile-active {
    display: flex;
  }

  .preview-panel {
    display: none;
  }

  .preview-panel.mobile-active {
    display: flex;
  }

  .canvas-wrap {
    max-width: 320px;
    max-height: 320px;
  }

  .pattern-carousel {
    max-height: 220px;
  }
}

/* --------------------------------------------------------------------------
   Scan Verification Modal
-------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 220, 255, 0.15);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  overflow: hidden;
  animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(0, 91, 255, 0.08);
  border-bottom: 1px solid var(--border-line);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.verify-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verify-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
}

.verify-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  width: fit-content;
}

.verify-status.pass {
  background: rgba(0, 255, 170, 0.12);
  color: #00FFAA;
  border: 1px solid rgba(0, 255, 170, 0.3);
}

.verify-status.fail {
  background: rgba(255, 75, 75, 0.12);
  color: #FF4B4B;
  border: 1px solid rgba(255, 75, 75, 0.3);
}

.verify-payload {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-line);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  word-break: break-all;
}

.verify-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-line);
  display: flex;
  justify-content: flex-end;
  background: rgba(6, 13, 24, 0.4);
}

/* Webcam Physical Device Inspection */
.btn-full {
  width: 100%;
  justify-content: center;
}

.webcam-section {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.webcam-box {
  position: relative;
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 8px;
  border: 1px solid var(--accent-cyan);
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0, 220, 255, 0.2);
}

.webcam-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webcam-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  pointer-events: none;
}

.webcam-scanner-crosshair {
  width: 120px;
  height: 120px;
  border: 2px dashed rgba(0, 220, 255, 0.8);
  border-radius: 8px;
  animation: pulseCrosshair 1.5s infinite alternate;
}

@keyframes pulseCrosshair {
  from { border-color: rgba(0, 220, 255, 0.4); transform: scale(0.96); }
  to { border-color: rgba(0, 255, 170, 0.9); transform: scale(1.02); }
}

.webcam-tip {
  background: rgba(2, 6, 18, 0.85);
  border: 1px solid var(--border-line);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Floating Toast System (Zero Native Alert Presence)
-------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(6, 14, 28, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 217, 255, 0.15);
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-item.out {
  animation: toastOut 0.25s ease forwards;
}

.toast-item.success {
  border-color: rgba(0, 255, 170, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 170, 0.2);
}

.toast-item.danger {
  border-color: rgba(255, 75, 75, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 75, 75, 0.2);
}

.toast-item.info {
  border-color: rgba(0, 217, 255, 0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   ENGINE NAV SWITCHER (Hydra Standard vs. Organic Artwork Engine)
   ========================================================================== */
.engine-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 12px 0;
  width: 100%;
  background: rgba(9, 21, 43, 0.85);
  padding: 5px;
  border-radius: 10px;
  border: 1px solid rgba(26, 44, 78, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.engine-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  user-select: none;
}
.engine-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}
.engine-tab.active {
  background: #0e244d;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.engine-tab svg {
  flex-shrink: 0;
}
.engine-chip {
  padding: 2px 6px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
}
@media (max-width: 640px) {
  .engine-tab {
    padding: 7px 8px;
    font-size: 11.5px;
    gap: 5px;
  }
  .engine-tab svg {
    width: 14px;
    height: 14px;
  }
  .engine-chip {
    padding: 1px 4px;
    font-size: 8.5px;
  }
}


@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.96); }
}
