      :root {
        --bg: #0a0a0b;
        --card: #141416;
        --card-hover: #1a1a1d;
        --text: #fafafa;
        --text-muted: #71717a;
        --primary: #3b82f6;
        --primary-hover: #2563eb;
        --primary-soft: rgba(59, 130, 246, 0.1);
        --success: #22c55e;
        --warning: #f59e0b;
        --danger: #ef4444;
        --border: #27272a;
        --input-bg: #18181b;
        --radius: 12px;
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Oxygen, Ubuntu, sans-serif;
        background-color: var(--bg);
        color: var(--text);
        line-height: 1.6;
        min-height: 100vh;
      }

      .container {
        max-width: 900px;
        margin: 0 auto;
        padding: 1.5rem;
      }

      /* Header */
      header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
        flex-wrap: wrap;
      }

      .header-content h1 {
        font-size: 1.75rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }

      .header-content h1 .icon {
        color: var(--primary);
      }

      .header-content p {
        color: var(--text-muted);
        margin-top: 0.25rem;
        font-size: 0.9rem;
      }

      .header-actions {
        display: flex;
        gap: 0.5rem;
      }

      /* Buttons */
      .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
      }

      .btn-primary {
        background: var(--primary);
        color: white;
      }

      .btn-primary:hover {
        background: var(--primary-hover);
      }

      .btn-outline {
        background: transparent;
        color: var(--text);
        border: 1px solid var(--border);
      }

      .btn-outline:hover {
        background: var(--card);
        border-color: var(--text-muted);
      }

      .btn-success {
        background: var(--success);
        color: white;
      }

      .btn-success:hover {
        opacity: 0.9;
      }

      .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
      }

      .btn-icon {
        padding: 0.5rem;
        width: 36px;
        height: 36px;
      }

      /* Tabs */
      .tabs {
        margin-bottom: 1.5rem;
      }

      .tab-list {
        display: flex;
        gap: 0.25rem;
        background: var(--card);
        padding: 4px;
        border-radius: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      .tab-btn {
        flex: 1;
        min-width: fit-content;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        font-weight: 500;
        color: var(--text-muted);
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
      }

      .tab-btn:hover {
        color: var(--text);
      }

      .tab-btn.active {
        background: var(--bg);
        color: var(--text);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
      }

      .tab-content {
        display: none;
      }

      .tab-content.active {
        display: block;
        animation: fadeIn 0.2s ease;
      }

      @keyframes fadeIn {
        from {
          opacity: 0;
          transform: translateY(5px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      /* Cards */
      .card {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        overflow: hidden;
      }

      .card-header {
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid var(--border);
      }

      .card-title {
        font-size: 1.1rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }

      .card-title .icon {
        color: var(--primary);
      }

      .card-desc {
        color: var(--text-muted);
        font-size: 0.85rem;
        margin-top: 0.25rem;
      }

      .card-body {
        padding: 1.5rem;
      }

      /* Form Elements */
      .form-group {
        margin-bottom: 1.25rem;
      }

      .form-group:last-child {
        margin-bottom: 0;
      }

      label {
        display: block;
        font-size: 0.875rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
      }

      .label-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      .label-hint {
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: normal;
      }

      input,
      select {
        width: 100%;
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
        background: var(--input-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text);
        transition: border-color 0.2s, box-shadow 0.2s;
      }

      input:focus,
      select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-soft);
      }

      input::placeholder {
        color: var(--text-muted);
      }

      select {
        cursor: pointer;
      }

      .help-text {
        color: var(--text-muted);
        font-size: 0.75rem;
        margin-top: 0.375rem;
      }

      /* Grid Layout */
      .grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
      }

      @media (max-width: 640px) {
        .grid-2 {
          grid-template-columns: 1fr;
        }
      }

      /* Result Cards */
      .result-card {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 1rem;
      }

      .result-card.primary {
        background: var(--primary-soft);
        border-color: rgba(59, 130, 246, 0.3);
      }

      .result-title {
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.5rem;
      }

      .result-value {
        font-size: 1.75rem;
        font-weight: 700;
      }

      .result-value.primary {
        color: var(--primary);
      }

      .result-value.success {
        color: var(--success);
      }

      .result-value.warning {
        color: var(--warning);
      }

      .result-value.danger {
        color: var(--danger);
      }

      .result-unit {
        font-size: 0.875rem;
        color: var(--text-muted);
        font-weight: normal;
      }

      /* Result Grid */
      .result-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
      }

      .result-item {
        background: rgba(255, 255, 255, 0.02);
        padding: 0.75rem;
        border-radius: 8px;
      }

      .result-item-label {
        font-size: 0.7rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
      }

      .result-item-value {
        font-size: 1.1rem;
        font-weight: 600;
        margin-top: 0.25rem;
      }

      /* Alert */
      .alert {
        padding: 0.875rem 1rem;
        border-radius: 8px;
        margin-top: 1rem;
        display: flex;
        gap: 0.75rem;
        align-items: flex-start;
      }

      .alert-warning {
        background: rgba(245, 158, 11, 0.1);
        border: 1px solid rgba(245, 158, 11, 0.3);
        color: var(--warning);
      }

      .alert-info {
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.3);
        color: var(--primary);
      }

      .alert-icon {
        flex-shrink: 0;
        font-size: 1.1rem;
      }

      .alert-content {
        flex: 1;
      }

      .alert-title {
        font-weight: 600;
        font-size: 0.85rem;
      }

      .alert-desc {
        font-size: 0.8rem;
        opacity: 0.9;
        margin-top: 0.25rem;
      }

      /* Method Toggle */
      .method-toggle {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
      }

      .method-btn {
        flex: 1;
        padding: 0.5rem;
        font-size: 0.8rem;
        font-weight: 500;
        background: var(--input-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s;
      }

      .method-btn.active {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
      }

      /* Summary Output */
      .summary-output {
        background: var(--input-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1rem;
        font-family: "SF Mono", Monaco, "Courier New", monospace;
        font-size: 0.8rem;
        white-space: pre-wrap;
        overflow-x: auto;
        margin-top: 1rem;
        max-height: 400px;
        overflow-y: auto;
      }

      /* Footer */
      footer {
        text-align: center;
        color: var(--text-muted);
        font-size: 0.8rem;
        margin-top: 2rem;
        padding: 1rem;
      }

      /* Copy feedback */
      .copy-feedback {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        color: var(--success);
        font-size: 0.8rem;
        margin-left: 0.5rem;
      }

      /* Responsive */
      @media (max-width: 640px) {
        .container {
          padding: 1rem;
        }

        .header-content h1 {
          font-size: 1.4rem;
        }

        .tab-btn {
          padding: 0.5rem 0.75rem;
          font-size: 0.75rem;
        }

        .card-header {
          padding: 1rem;
        }

        .card-body {
          padding: 1rem;
        }

        .result-value {
          font-size: 1.5rem;
        }
      }
/* ===== Modal (Calib Help) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.modal-card {
  width: min(560px, 100%);
  background: #fff;
  color: #111;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Asegura que el botón de cerrar (btn-outline) se vea sobre fondo blanco */
.modal-card .btn-outline {
  color: #111;
  border-color: rgba(0, 0, 0, 0.18);
}

.modal-card .btn-outline:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.26);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-body {
  padding: 14px;
  font-size: 0.98rem;
  line-height: 1.35;
}

.modal-body ol {
  padding-left: 18px;
  margin: 0;
}

.modal-body li {
  margin: 10px 0;
}

.hint-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}

.modal-footer {
  padding: 12px 14px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* ===== Software Mode Panel ===== */
.mode-panel {
  margin-bottom: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.mode-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mode-btn {
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.mode-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.mode-guide {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.mode-guide-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.mode-guide-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.mode-guide-list li {
  margin: 0.35rem 0;
}

/* ===== Mode visibility helpers ===== */
.mode-only-lightburn,
.mode-only-ezcad {
  display: none;
}

.mode-lightburn .mode-only-lightburn {
  display: block;
}

.mode-ezcad .mode-only-ezcad {
  display: block;
}

/* ===== Theme by mode (swap --primary) ===== */
.mode-lightburn {
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --primary-soft: rgba(239, 68, 68, 0.12);
}

.mode-ezcad {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);
}

/* ===== License ===== */
.license-badge {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  white-space: nowrap;
}

.license-badge.gamma { color: #2563eb; }
.license-badge.patreon { color: #ef4444; }
.license-badge.paid { color: #16a34a; }

.hidden { display: none !important; }

.license-lock {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.license-lock-card {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.license-lock-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.license-lock-note {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
