/* ============================================================
   AR VIDEO SURFACE BUILDER — LOOKIAR
   Styles · V1
   ============================================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #050e1f;
  --bg-card:     #081729;
  --bg-card2:    #0c1f36;
  --border:      #1a3555;
  --border-focus:rgba(41,171,226,0.6);
  --text:        #f0f0f5;
  --text-muted:  #b0c4d8;
  --text-faint:  #6b85a0;
  --accent:      #29ABE2;
  --accent-glow: rgba(41,171,226,0.25);
  --accent2:     #5bc9e8;
  --success:     #22c55e;
  --error:       #f43f5e;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow-card: 0 2px 32px rgba(0,0,0,0.6);
  --transition:  .18s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .75; }

img, video { display: block; max-width: 100%; }

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden { display: none !important; }

/* ---------- HEADER ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5,14,31,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.3px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 99px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
}

/* ---------- HERO ---------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(41,171,226,0.12), transparent);
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent2);
  background: rgba(41,171,226,0.1);
  border: 1px solid rgba(41,171,226,0.2);
  padding: 5px 12px;
  border-radius: 99px;
  margin-bottom: 24px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 18px;
}

.gradient-text {
  background: linear-gradient(90deg, #ffffff 20%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

.hero-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 99px;
}

/* ---------- APP MAIN ---------- */
.app-main {
  padding-bottom: 80px;
}

/* ---------- STEPS ---------- */
.step-section {
  margin-bottom: 32px;
  animation: fadeUp .3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}

.success-num {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.25);
  color: var(--success);
  font-size: 16px;
}

.step-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- UPLOAD ZONE ---------- */
.upload-zone {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.upload-zone:hover,
.upload-zone:focus,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(41,171,226,0.04);
}

.upload-icon {
  width: 60px;
  height: 60px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: var(--text-muted);
  transition: transform var(--transition), border-color var(--transition);
}

.upload-zone:hover .upload-icon {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.upload-main {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
}

.upload-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  padding: 0;
}

.link-btn:hover { color: var(--accent2); }

.upload-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
  background: rgba(255,255,255,0.03);
  padding: 5px 10px;
  border-radius: 6px;
}

/* file loaded state */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.file-icon {
  width: 44px;
  height: 44px;
  background: rgba(41,171,226,0.1);
  border: 1px solid rgba(41,171,226,0.2);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent2);
  flex-shrink: 0;
}

.file-details {
  text-align: left;
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.remove-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.remove-btn:hover { background: rgba(244,63,94,0.1); color: var(--error); border-color: rgba(244,63,94,0.3); }

/* loading */
.upload-loading {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.upload-loading, .upload-error {
  display: flex;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* error */
.error-icon { color: var(--error); margin-bottom: 8px; }

.retry-btn {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.25);
  color: var(--error);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background var(--transition);
}

.retry-btn:hover { background: rgba(244,63,94,0.18); }

/* ---------- PREVIEW CARD ---------- */
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-wrapper {
  background: #000;
  position: relative;
}

.video-wrapper video {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  display: block;
}

.video-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}

.stat-item {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item:last-child { border-right: none; }

.stat-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- CONFIG GRID ---------- */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.config-card.full-width { grid-column: 1 / -1; }

.config-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.config-input {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.config-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.config-input::placeholder { color: var(--text-faint); }

/* Radio groups */
.radio-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.radio-option input { position: absolute; opacity: 0; width: 0; height: 0; }

.radio-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-align: center;
}

.radio-option:hover .radio-box { border-color: rgba(41,171,226,0.4); }

.radio-option input:checked + .radio-box {
  border-color: var(--accent);
  background: rgba(41,171,226,0.08);
}

.radio-icon {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  width: 22px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aspect-landscape {
  width: 22px;
  height: 13px;
  border: 2px solid var(--text-muted);
  border-radius: 2px;
}

.aspect-portrait {
  width: 13px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 2px;
}

.aspect-square {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 2px;
}

.radio-option input:checked + .radio-box .aspect-landscape,
.radio-option input:checked + .radio-box .aspect-portrait,
.radio-option input:checked + .radio-box .aspect-square {
  border-color: var(--accent);
}

.radio-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.radio-sub {
  font-size: 10px;
  color: var(--text-faint);
}

/* Toggle list */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.toggle-item:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-item:first-child { padding-top: 0; }

.toggle-info { flex: 1; min-width: 0; }

.toggle-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.toggle-desc {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Toggle switch */
.toggle-switch { position: relative; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  display: block;
  width: 38px;
  height: 22px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #fff;
}

/* Output mode */
.output-mode-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.output-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.output-option:hover { border-color: rgba(41,171,226,0.35); }

.output-option.active {
  border-color: var(--accent);
  background: rgba(41,171,226,0.07);
}

.output-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.output-option.active .output-icon {
  background: rgba(41,171,226,0.1);
  border-color: rgba(41,171,226,0.25);
  color: var(--accent2);
}

.output-info { flex: 1; }

.output-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.output-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.output-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: grid;
  place-items: center;
  color: transparent;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.output-option.active .output-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- GENERATE BUTTON ---------- */
.generate-row {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-generate:hover {
  background: #1a8bbf;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.btn-generate:active { transform: translateY(0); }

/* ---------- GENERATING ---------- */
.generating-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
}

.generating-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
}

.spin-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

.spin-core {
  position: absolute;
  inset: 12px;
  background: var(--bg-card2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent2);
}

.generating-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.generating-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.progress-bar {
  width: 100%;
  max-width: 320px;
  height: 4px;
  background: var(--bg-card2);
  border-radius: 99px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width .4s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ---------- RESULT ---------- */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.result-summary {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.result-summary-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 16px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.result-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-stat-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.result-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.result-actions {
  padding: 20px 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  text-decoration: none;
}

.btn-primary:hover { opacity: .88; transform: translateY(-1px); color: #fff; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.btn-secondary:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  color: var(--text-muted);
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition);
}

.btn-ghost:hover { color: var(--text); }

/* ---------- QR CARD ---------- */
.qr-card {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
}

.qr-card-left { flex: 1; min-width: 0; }

.qr-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.qr-option {
  margin-bottom: 14px;
}

.qr-option-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.qr-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: .3px;
}

.qr-option-desc {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.55;
  margin-bottom: 10px;
}

.qr-option-desc strong { color: var(--text-muted); }

.btn-qr-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(41,171,226,0.12);
  border: 1px solid rgba(41,171,226,0.25);
  color: var(--accent2);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  width: 100%;
  justify-content: center;
  margin-bottom: 7px;
}

.btn-qr-upload:hover { background: rgba(41,171,226,0.2); }
.btn-qr-upload:disabled { opacity: .5; cursor: not-allowed; }

.qr-upload-note {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
}

.share-methods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.share-method {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
}

.standalone-size-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(41,171,226,0.06);
  border: 1px solid rgba(41,171,226,0.15);
  border-radius: 7px;
}

.standalone-size-note strong { color: var(--text); }

.qr-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-faint);
  font-size: 11px;
}

.qr-divider::before,
.qr-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.qr-input-row {
  display: flex;
  gap: 8px;
}

.qr-input-row .config-input { flex: 1; }

.btn-qr-gen {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-qr-gen:hover { opacity: .85; }

.qr-card-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qr-box {
  width: 148px;
  height: 148px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.qr-box canvas,
.qr-box img { display: block !important; }

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ccc;
  font-size: 12px;
}

.qr-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.qr-ready-label {
  font-size: 11px;
  color: var(--success);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.qr-ready-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.qr-expiry {
  font-size: 10px;
  color: var(--text-faint);
}

@media (max-width: 640px) {
  .qr-card {
    flex-direction: column-reverse;
    align-items: center;
  }

  .qr-card-right { flex-direction: row; align-items: center; gap: 16px; }
  .qr-box { width: 120px; height: 120px; }
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-faint);
}

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

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-tech { font-variant-numeric: tabular-nums; }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition);
}

.modal-close:hover { background: rgba(244,63,94,0.1); color: var(--error); }

/* ── AR MODAL (nuevo, centrado) ─────────────────────────────── */
.modal-ar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px 28px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-ar-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition);
}
.modal-ar-close:hover { background: rgba(244,63,94,0.12); color: var(--error); }

.modal-ar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

.modal-ar-qr-wrap {
  width: 216px;
  height: 216px;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  flex-shrink: 0;
  padding: 0;
}

/* El canvas/img del QR queda centrado y nunca desborda */
#modalQrCanvas {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.modal-ar-qr-wrap canvas,
.modal-ar-qr-wrap img {
  display: block !important;
  width: 160px !important;
  height: 160px !important;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.modal-ar-qr-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #bbb;
  font-size: 12px;
}

.modal-ar-instruction {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  max-width: 240px;
}

.modal-ar-nourl {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.6;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  width: 100%;
}

.modal-ar-nourl code {
  display: inline-block;
  margin-top: 4px;
  background: rgba(41,171,226,0.1);
  border: 1px solid rgba(41,171,226,0.2);
  color: var(--accent2);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
}

@media (max-width: 400px) {
  .modal-ar-card { padding: 24px 20px 20px; border-radius: 16px; }
  .modal-ar-qr-wrap { width: 190px; height: 190px; }
  #modalQrCanvas { width: 140px; height: 140px; }
  .modal-ar-qr-wrap canvas, .modal-ar-qr-wrap img { width: 140px !important; height: 140px !important; }
}

/* QR expired overlay (inside the box) */
.qr-expired-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  backdrop-filter: blur(2px);
}

/* Timer pill */
.qr-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  min-width: 0;
  white-space: nowrap;
}

.timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  transition: background .3s;
}

.timer-dot.active {
  background: var(--success);
  box-shadow: 0 0 5px var(--success);
  animation: pulse-dot 2s infinite;
}

.timer-dot.warning { background: #f59e0b; box-shadow: 0 0 5px #f59e0b; }
.timer-dot.expired { background: var(--error); box-shadow: 0 0 5px var(--error); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* Expired state */
.qr-expired-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.qr-expired-msg p {
  font-size: 11px;
  color: var(--error);
  line-height: 1.4;
}

.btn-qr-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(41,171,226,0.12);
  border: 1px solid rgba(41,171,226,0.25);
  color: var(--accent2);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-qr-refresh:hover { background: rgba(41,171,226,0.2); }

/* Options panel */
.modal-options-panel {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  max-height: 420px;
}

.modal-option-group { padding: 4px 0 12px; }

.modal-opt-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-opt-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: .3px;
}

.modal-opt-badge--accent {
  background: rgba(41,171,226,0.12);
  border-color: rgba(41,171,226,0.25);
  color: var(--accent2);
}

.modal-opt-desc {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.55;
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 11px;
  padding: 8px 0;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-modal-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(41,171,226,0.1);
  border: 1px solid rgba(41,171,226,0.2);
  color: var(--accent2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.btn-modal-download:hover { background: rgba(41,171,226,0.18); }
.btn-modal-download:disabled { opacity: .5; cursor: not-allowed; }

.modal-download-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 6px 8px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: 6px;
}

@media (max-width: 520px) {
  .modal-mobile { max-width: 100%; }
  .modal-mobile-body { flex-direction: column; }
  .modal-qr-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; padding: 16px; gap: 16px; }
  .modal-qr-box { width: 100px; height: 100px; flex-shrink: 0; }
  .modal-qr-label, .modal-qr-compat { text-align: left; }
  .modal-options-panel { max-height: none; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .hero { padding: 48px 0 40px; }
  .hero-title { font-size: 26px; }

  .video-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-item:nth-child(2) { border-right: none; }

  .config-grid { grid-template-columns: 1fr; }
  .config-card.full-width { grid-column: auto; }

  .radio-group { grid-template-columns: repeat(2, 1fr); }

  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-actions { flex-direction: column; }
  .btn-primary, .btn-secondary, .btn-ghost { width: 100%; justify-content: center; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .upload-zone { padding: 32px 20px; }

  .header-badge { display: none; }
}
