/* ============================================
   KTCN x CNTT PHOTOBOOTH — FULL CSS
   ============================================ */
:root {
  --tech-dark: #0a1628;
  --tech-navy: #0d1b3e;
  --tech-blue: #1e40af;
  --tech-cyan: #06b6d4;
  --tech-sky: #38bdf8;
  --tech-gold: #fbbf24;
  --tech-amber: #f59e0b;
  --tech-white: #f8fafc;
  --tech-gray: #64748b;
  --tech-glow: 0 0 20px rgba(56, 189, 248, 0.5);
  --tech-glow-gold: 0 0 20px rgba(251, 191, 36, 0.5);

  --header-h: 60px;
  --progress-h: 60px;
  --footer-h: 80px;
  --sidebar-w: 280px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--tech-dark);
  color: var(--tech-white);
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 20% 30%, rgba(6, 182, 212, 0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(251, 191, 36, 0.12), transparent 40%),
    linear-gradient(180deg, #0a1628 0%, #0d1b3e 50%, #0a1628 100%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.1;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.4) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ============================================
   LAYOUTS
   ============================================ */
.app-layout {
  display: grid;
  grid-template-rows: var(--header-h) var(--progress-h) 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.admin-layout {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  font-size: 15px;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: linear-gradient(90deg, #0d1b3e 0%, #1e40af 50%, #0d1b3e 100%);
  border-bottom: 3px solid var(--tech-gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.app-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.5));
}
.app-logo svg { width: 100%; height: 100%; }
.app-title { flex: 1; line-height: 1.1; }
.app-title-line1 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--tech-sky);
  text-transform: uppercase;
}
.app-title-line2 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--tech-gold);
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}
.app-nav { display: flex; gap: 8px; }
.app-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 20px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(56, 189, 248, 0.3);
  transition: 0.25s;
}
.app-nav a:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--tech-cyan);
  transform: translateY(-2px);
}
.app-nav a.active {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  box-shadow: var(--tech-glow-gold);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  background: rgba(10, 22, 40, 0.6);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.4;
  transition: 0.3s;
}
.progress-step.active { opacity: 1; }
.progress-step.done { opacity: 0.7; }
.progress-step.active .progress-num {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.8);
}
.progress-step.done .progress-num {
  background: var(--tech-cyan);
  color: var(--tech-dark);
}
.progress-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  border: 2px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: var(--tech-sky);
  transition: 0.3s;
}
.progress-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tech-sky);
}
.progress-line {
  width: 40px;
  height: 2px;
  background: rgba(56, 189, 248, 0.2);
}

/* ============================================
   MAIN + STEPS
   ============================================ */
.app-main {
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.app-step {
  display: none;
  width: 100%;
  height: 100%;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--footer-h);
}
.app-step.active {
  display: grid;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================
   SIDEBAR
   ============================================ */
.step-sidebar {
  background: rgba(13, 27, 62, 0.5);
  border-right: 1px solid rgba(56, 189, 248, 0.15);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-cyan) transparent;
}
.step-sidebar::-webkit-scrollbar { width: 4px; }
.step-sidebar::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 2px; }

.step-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tech-gold);
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-title::before {
  content: '';
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, var(--tech-gold), var(--tech-amber));
  border-radius: 2px;
}
.step-desc {
  font-size: 12px;
  color: var(--tech-sky);
  opacity: 0.85;
  line-height: 1.5;
}

.sidebar-info { display: flex; flex-direction: column; gap: 8px; }
.info-item {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-item.highlight {
  background: rgba(251, 191, 36, 0.1);
  border-color: var(--tech-gold);
}
.info-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--tech-sky);
  opacity: 0.8;
}
.info-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--tech-white);
  word-break: break-word;
}
.info-item.highlight .info-value {
  color: var(--tech-gold);
  font-size: 20px;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}

.pick-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.pick-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 2px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--tech-sky);
  transition: 0.3s;
}
.pick-dot.filled {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.original-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.original-thumbs img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--tech-cyan);
  cursor: pointer;
  transition: 0.2s;
}
.original-thumbs img:hover { transform: scale(1.1); border-color: var(--tech-gold); }

.shots-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.shots-mini img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--tech-cyan);
}

/* ============================================
   STEP CONTENT
   ============================================ */
.step-content {
  padding: 18px 22px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-cyan) transparent;
}
.step-content::-webkit-scrollbar { width: 6px; }
.step-content::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 3px; }
.step-content.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ⭐ STEP 1 SELECT */
.select-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.preview-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ============================================
   CAMERA PREVIEW BOX — Layer: video(1) < frame(3) < text(5)
   ============================================ */
.camera-preview-box {
  position: relative;
  aspect-ratio: var(--frame-aspect, 3/4);
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  width: auto;
  background: #0a1628;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid var(--tech-cyan);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), var(--tech-glow);
  flex-shrink: 1;
  transition: aspect-ratio 0.3s ease;
}

.camera-preview-box video {
  position: absolute;          /* BẬT LÊN */
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 1;
}



.preview-frame-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 3;
  display: none;
}
.preview-frame-overlay.show { display: block; }

.preview-text-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 5;
  display: none;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 22, 40, 0.85);
  color: var(--tech-sky);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: opacity 0.3s;
  z-index: 4;
  text-align: center;
  padding: 20px;
}
.preview-placeholder.hidden { opacity: 0; pointer-events: none; }
.preview-placeholder span:first-child { font-size: 22px; }

.camera-status {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(10, 22, 40, 0.9);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tech-white);
  z-index: 6;
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: none;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  transition: 0.3s;
}
.camera-status.active .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.5s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.preview-hint {
  font-size: 11px;
  color: var(--tech-sky);
  opacity: 0.7;
  text-align: center;
  letter-spacing: 0.5px;
  font-style: italic;
  flex-shrink: 0;
}

.frame-list-area {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-cyan) transparent;
}
.frame-list-area::-webkit-scrollbar { width: 6px; }
.frame-list-area::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 3px; }

/* ============================================
   FOOTER
   ============================================ */
.step-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(10, 22, 40, 0.8);
  border-top: 2px solid rgba(56, 189, 248, 0.2);
  backdrop-filter: blur(10px);
}

/* ============================================
   BUTTONS
   ============================================ */
button {
  padding: 12px 24px;
  border: 2px solid var(--tech-cyan);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(30, 64, 175, 0.3));
  color: var(--tech-white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  
}
button:hover:not(:disabled) {
  border-color: var(--tech-gold);
  box-shadow: var(--tech-glow-gold);
  transform: translateY(-2px);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.btn-main {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--tech-cyan), var(--tech-blue));
  border-color: var(--tech-cyan);
  font-size: 14px;
}
button.btn-main:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
}
button.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--tech-sky);
}
button.btn-small { padding: 8px 16px; font-size: 11px; letter-spacing: 1px; }
button.btn-full { width: 100%; justify-content: center; }
.btn-arrow, .btn-icon { font-size: 16px; }

/* ============================================
   INPUTS
   ============================================ */
input[type="text"], input[type="number"], select, input[type="color"] {
  padding: 10px 14px;
  border-radius: 6px;
  border: 2px solid rgba(56, 189, 248, 0.25);
  background: rgba(10, 22, 40, 0.7);
  color: var(--tech-white);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: 0.2s;
  width: 100%;
}
input[type="color"] { padding: 4px; }
input:focus, select:focus { border-color: var(--tech-cyan); box-shadow: var(--tech-glow); }
input::placeholder { color: var(--tech-gray); }
select { cursor: pointer; }

/* ============================================
   FRAME GRID (SELECT)
   ============================================ */
.frame-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.frame-item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(13, 27, 62, 0.7);
  border: 2px solid rgba(56, 189, 248, 0.3);
  transition: 0.3s;
  aspect-ratio: 3/4;
}
.frame-item:hover {
  transform: translateY(-4px);
  border-color: var(--tech-cyan);
  box-shadow: var(--tech-glow);
}
.frame-item.selected {
  border-color: var(--tech-gold);
  box-shadow: var(--tech-glow-gold);
}
.frame-item.selected::before {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  z-index: 4;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
}
.frame-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: repeating-conic-gradient(#1a2333 0% 25%, #0d1b3e 0% 50%) 50% / 16px 16px;
}
.frame-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(10, 22, 40, 0.95), transparent);
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-gold);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   ⭐ CAMERA (STEP 2) — như cũ
   ============================================ */
.camera-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), var(--tech-glow);
  border: 3px solid var(--tech-cyan);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 4/3;
  background: #000;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}

/* ⭐ Guide nhấp nháy */
.capture-guide-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  animation: guidePulse 1.4s ease-in-out infinite;
}
@keyframes guidePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.pose-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
}

.camera-corners span {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid var(--tech-gold);
  z-index: 4;
}
.camera-corners span:nth-child(1) { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.camera-corners span:nth-child(2) { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.camera-corners span:nth-child(3) { bottom: 12px; left: 12px; border-right: 0; border-top: 0; }
.camera-corners span:nth-child(4) { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }

.countdown {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 140px;
  font-weight: 900;
  color: var(--tech-gold);
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.9), 0 0 80px rgba(6, 182, 212, 0.8);
  background: rgba(10, 22, 40, 0.3);
  pointer-events: none;
  z-index: 5;
}
.countdown.show { display: flex; animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.05); } }

/* ============================================
   PICK GRID (STEP 3)
   ============================================ */
.pick-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.pick-item {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 3px solid rgba(56, 189, 248, 0.25);
  background: rgba(10, 22, 40, 0.6);
  transition: all 0.25s;
  aspect-ratio: 1;
}
.pick-item:hover { transform: scale(1.04); border-color: var(--tech-cyan); box-shadow: var(--tech-glow); }
.pick-item.picked { border-color: var(--tech-gold); box-shadow: var(--tech-glow-gold); }
.pick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-badge {
  position: absolute;
  top: 6px; left: 6px;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.6);
  z-index: 2;
}
.pick-check {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(10, 22, 40, 0.9);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  z-index: 2;
}
.pick-item.picked .pick-check { background: var(--tech-cyan); color: var(--tech-dark); }

/* ============================================
   PREVIEW COMPACT + DECORATE
   ============================================ */
.preview-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  transition: 0.25s;
  max-width: 100%;
  max-height: 100%;
  padding: 8px;
  background: rgba(6, 182, 212, 0.05);
  border: 2px dashed rgba(56, 189, 248, 0.3);
  border-radius: 10px;
}
.preview-compact:hover { border-color: var(--tech-cyan); box-shadow: var(--tech-glow); }
.preview-compact img {
  max-width: 100%;
  max-height: calc(100vh - var(--header-h) - var(--progress-h) - var(--footer-h) - 60px);
  border-radius: 8px;
  display: block;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.preview-compact.loading-preview { cursor: wait; flex-direction: column; gap: 12px; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--tech-gold);
  border-right-color: var(--tech-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.preview-compact.has-overlay {
  padding: 0;
  border: none;
  background: transparent;
  cursor: default;
  display: block;
}
.preview-compact.has-overlay:hover { box-shadow: none; border: none; }

.preview-inner {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
  user-select: none;
}

.preview-inner img#combined-preview-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - var(--header-h) - var(--progress-h) - var(--footer-h) - 60px);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.hashtag-drag-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  cursor: grab;
  z-index: 5;
  touch-action: none;
}
.hashtag-drag-layer:active,
.hashtag-drag-layer.dragging { cursor: grabbing; }

.hashtag-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-family: "Segoe UI", Arial, sans-serif;
  text-shadow:
    -2px -2px 0 rgba(0, 0, 0, 0.9),
     2px -2px 0 rgba(0, 0, 0, 0.9),
    -2px  2px 0 rgba(0, 0, 0, 0.9),
     2px  2px 0 rgba(0, 0, 0, 0.9),
     0 0 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  letter-spacing: 0.5px;
}

/* ============================================
   RESULT (STEP 5)
   ============================================ */
.result-layout {
  display: flex;
  grid-template-columns: 1fr 240px;
  gap: 20px;
  align-items: center;
  justify-content: center;
}
.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(13, 27, 62, 0.7);
  border: 2px solid var(--tech-gold);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--tech-glow-gold);
}
.qr-panel img {
  width: 200px;
  height: 200px;
  background: #fff;
  padding: 8px;
  border-radius: 6px;
  display: block;
}
.qr-actions { display: flex; gap: 8px; }

/* ============================================
   HASHTAG
   ============================================ */
.hashtag-section-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.hashtag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hashtag {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  user-select: none;
  transition: 0.2s;
  font-size: 11px;
  font-weight: 600;
  color: var(--tech-sky);
}
.hashtag:hover { background: rgba(6, 182, 212, 0.25); color: var(--tech-white); }
.hashtag.selected {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: var(--tech-glow-gold);
}

/* ============================================
   TUNE PANEL (BƯỚC 4)
   ============================================ */
.tune-panel {
  background: rgba(13, 27, 62, 0.7);
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.tune-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tech-gold);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.pos-btn {
  padding: 8px 0;
  font-size: 16px;
  border: 2px solid rgba(56, 189, 248, 0.3);
  background: rgba(6, 182, 212, 0.08);
  color: var(--tech-sky);
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  letter-spacing: 0;
  text-transform: none;
  min-width: 0;
}
.pos-btn:hover { border-color: var(--tech-cyan); background: rgba(6, 182, 212, 0.2); }
.pos-btn.active {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: var(--tech-glow-gold);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.2);
  outline: none;
  padding: 0;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--tech-gold);
  border: 2px solid var(--tech-dark);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--tech-gold);
  border: 2px solid var(--tech-dark);
  cursor: pointer;
}

.color-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.color-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0;
  min-width: 0;
  transition: 0.2s;
}
.color-btn:hover { transform: scale(1.15); }
.color-btn.active {
  border-color: var(--tech-gold);
  box-shadow: 0 0 0 2px var(--tech-dark), 0 0 12px rgba(251, 191, 36, 0.8);
}
#tune-color-custom {
  width: 28px !important;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 2px;
  cursor: pointer;
}

/* ============================================
   ADMIN
   ============================================ */
.admin-layout .admin-main {
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 380px 1fr 300px;    /* rộng hơn (cũ: 320/1fr/240) */
  gap: 14px;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.admin-panel {
  background: rgba(13, 27, 62, 0.7);
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
   padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  border-width: 3px;
}
.admin-panel-scroll { overflow-y: auto; }
.admin-panel-scroll::-webkit-scrollbar { width: 5px; }
.admin-panel-scroll::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 3px; }

.panel-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--tech-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  flex-shrink: 0;
}

.admin-form { display: flex; flex-direction: column; gap: 10px; }
.admin-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tech-sky);
  margin-bottom: 0px;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form input[type="color"],
.admin-form select {
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 7px;
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  background: rgba(10, 22, 40, 0.7);
  color: var(--tech-white);
  width: 100%;
  border-width: 2px;
}
.admin-form input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
.admin-form input:focus,
.admin-form select:focus { border-color: var(--tech-cyan); }

.file-picker-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(6, 182, 212, 0.1);
  border: 2px dashed var(--tech-cyan);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.25s;
  font-weight: 600;
  font-size: 13px;
  color: var(--tech-cyan);
}
.file-picker-compact:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--tech-gold);
  color: var(--tech-gold);
}
.file-picker-compact input { display: none; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.form-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 5px; }

.admin-frame-list { display: flex; flex-direction: column; gap: 5px; }
.admin-frame-item {
  display: flex;
  gap: 8px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 5px;
  padding: 6px;
  align-items: center;
  transition: 0.2s;
}
.admin-frame-item:hover { background: rgba(6, 182, 212, 0.12); border-color: var(--tech-cyan); }
.admin-frame-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 3px;
  background: repeating-conic-gradient(#1a2333 0% 25%, #0d1b3e 0% 50%) 50% / 8px 8px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}
.admin-frame-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.admin-frame-item-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-frame-item-meta { font-size: 9px; color: var(--tech-sky); opacity: 0.8; }
.admin-frame-item-del {
  padding: 3px 6px;
  font-size: 9px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}
.admin-frame-item-del:hover { background: #ef4444; color: #fff; }

.hashtag-form-compact { display: flex; gap: 5px; flex-shrink: 0; }
.hashtag-list-compact { display: flex; flex-wrap: wrap; gap: 5px; overflow-y: auto; }
.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: var(--tech-sky);
}
.hashtag-chip .del { cursor: pointer; font-weight: bold; opacity: 0.7; }
.hashtag-chip .del:hover { color: #ef4444; opacity: 1; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: linear-gradient(135deg, #0d1b3e, #1e40af);
  color: var(--tech-white);
  padding: 12px 24px;
  border-radius: 6px;
  border: 2px solid var(--tech-cyan);
  opacity: 0;
  transition: 0.35s;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 13px;
  box-shadow: var(--tech-glow);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: linear-gradient(135deg, #064e3b, #10b981); border-color: #10b981; }
.toast.error { background: linear-gradient(135deg, #7f1d1d, #ef4444); border-color: #ef4444; }

.loading { padding: 20px; text-align: center; color: var(--tech-sky); font-style: italic; opacity: 0.7; font-size: 13px; }

/* ============================================
   ZOOM MODAL
   ============================================ */
.zoom-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.95);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.zoom-modal.active { display: flex; animation: fadeIn 0.25s; }
.zoom-content { max-width: 95vw; max-height: 90vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.zoom-content img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8), var(--tech-glow);
  border: 2px solid var(--tech-cyan);
  transition: transform 0.15s ease-out;
  user-select: none;
  cursor: zoom-in;
}
.zoom-close, .zoom-prev, .zoom-next {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-cyan);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: 0.25s;
  z-index: 2;
}
.zoom-close { top: 20px; right: 20px; }
.zoom-prev { top: 50%; left: 20px; transform: translateY(-50%); font-size: 30px; padding-bottom: 6px; }
.zoom-next { top: 50%; right: 20px; transform: translateY(-50%); font-size: 30px; padding-bottom: 6px; }
.zoom-close:hover, .zoom-prev:hover, .zoom-next:hover { background: var(--tech-cyan); color: var(--tech-dark); }
.zoom-info {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-white);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  pointer-events: none;
}

/* ============================================
   FRAME PREVIEW MODAL
   ============================================ */
.frame-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(5, 10, 20, 0.95);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.frame-preview-modal.active { display: flex; animation: fadeIn 0.3s; }
.frame-preview-close {
  position: fixed;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-cyan);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: 0.25s;
  z-index: 2;
}
.frame-preview-close:hover { background: var(--tech-cyan); color: var(--tech-dark); transform: rotate(90deg); }
.frame-preview-content {
  background: linear-gradient(135deg, #0d1b3e 0%, #0a1628 100%);
  border: 2px solid var(--tech-cyan);
  border-radius: 14px;
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 40px rgba(6, 182, 212, 0.4);
  position: relative;
}
.frame-preview-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--tech-gold), var(--tech-cyan), var(--tech-gold));
}
.frame-preview-header { text-align: center; margin-bottom: 16px; }
.frame-preview-header h2 {
  color: var(--tech-gold);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.fp-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.fp-tag {
  padding: 4px 12px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--tech-cyan);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-sky);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.fp-tag.gold { background: rgba(251, 191, 36, 0.15); border-color: var(--tech-gold); color: var(--tech-gold); }
.frame-preview-image-wrap { display: flex; justify-content: center; margin: 16px 0; }
.fp-checkerboard {
  display: inline-block;
  padding: 10px;
  background: repeating-conic-gradient(#1a2333 0% 25%, #0d1b3e 0% 50%) 50% / 20px 20px;
  border: 2px solid var(--tech-cyan);
  border-radius: 10px;
}
.fp-checkerboard img { display: block; max-width: 100%; max-height: 55vh; border-radius: 4px; }
.frame-preview-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ============================================
   STICKERS
   ============================================ */
.stickers-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sticker {
  position: absolute;
  font-size: 28px;
  opacity: 0.55;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.6));
  animation: floatSticker 8s ease-in-out infinite;
}
.sticker.s1 { top: 12%; left: 2%; }
.sticker.s2 { top: 30%; right: 2%; animation-delay: 1.2s; animation-name: floatStickerAlt; }
.sticker.s3 { top: 55%; left: 1%; animation-delay: 2.4s; }
.sticker.s4 { top: 75%; right: 1%; animation-delay: 3.6s; animation-name: floatStickerAlt; }
.sticker.s5 { top: 45%; left: 4%; animation-delay: 1.8s; }
.sticker.s6 { top: 80%; left: 4%; animation-delay: 4.2s; }
@keyframes floatSticker {
  0%, 100% { transform: translateY(0) rotate(-8deg); opacity: 0.4; }
  50% { transform: translateY(-20px) rotate(8deg); opacity: 0.7; }
}
@keyframes floatStickerAlt {
  0%, 100% { transform: translateY(0) rotate(6deg); opacity: 0.4; }
  50% { transform: translateY(-25px) rotate(-10deg); opacity: 0.7; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Laptop 1366×768 */
@media (max-width: 1400px) {
  .admin-grid { grid-template-columns: 280px 1fr 220px; }
  
}

/* Laptop nhỏ / iPad Air landscape */
@media (max-width: 1200px) and (min-width: 901px) {
  .admin-grid { grid-template-columns: 260px 1fr 200px; gap: 8px; }
  .admin-layout .admin-main { padding: 8px; }
  .admin-panel { padding: 0px; }
}

/* App: chuyển layout sidebar cho tablet */
@media (max-width: 1100px) {
  :root { --sidebar-w: 240px; }
  .select-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .camera-preview-box { max-height: 60vh; height: 883px; }
  /* ============================================
   ⭐ SIDEBAR TOGGLE — Thu gọn/Mở rộng step-sidebar
   ============================================ */
.step-sidebar {
  position: relative;
  transition: padding 0.3s ease;
}

.app-step {
  transition: grid-template-columns 0.3s ease;
}



.sidebar-toggle-btn {
  position: absolute;
  top: 22px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.15);
  border: 1.5px solid var(--tech-cyan);
  color: var(--tech-cyan);
  font-size: 13px;
  font-weight: 900;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

}
.sidebar-toggle-btn:hover {
  background: var(--tech-cyan);
  color: var(--tech-dark);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

/* Trạng thái thu gọn */
body.sidebar-collapsed {
  --sidebar-w: 48px;
}

body.sidebar-collapsed .step-sidebar {
  padding: 8px 4px;
  align-items: center;
  gap: 0;
}

body.sidebar-collapsed .step-sidebar > *:not(.sidebar-toggle-btn) {
  display: none !important;
}

body.sidebar-collapsed .sidebar-toggle-btn {
  left: 6px;
  right: 6px;
  width: auto;
  height: 34px;
  font-size: 14px;
}

/* iPad mirror mode — cũng kế thừa tự động nhờ body.sidebar-collapsed */

/* Ẩn nút trên mobile rất nhỏ (sidebar dạng thanh ngang rồi) */
@media (max-width: 480px) {
  .sidebar-toggle-btn { display: none; }
}
}

/* iPad Air portrait 820×1180 */
@media (max-width: 900px) {
  :root {
    --header-h: 52px;
    --progress-h: 48px;
    --footer-h: 70px;
    --sidebar-w: 200px;
  }


  .progress-label { display: none; }
  .step-title { font-size: 16px; }
  .app-title-line2 { font-size: 15px; }
  .frame-grid-compact { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .pick-grid-compact { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .result-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .qr-panel img { width: 140px; height: 140px; }

  .admin-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 8px;
  }
  .admin-grid > section:first-child { grid-column: 1 / 2; grid-row: 1 / 3; }
  .admin-grid > section:nth-child(2) { grid-column: 2 / 3; grid-row: 1 / 2; }
  .admin-grid > section:nth-child(3) { grid-column: 2 / 3; grid-row: 2 / 3; }
}

/* Mobile */
@media (max-width: 700px) {
  :root { --sidebar-w: 160px; --header-h: 48px; }
  .app-header { padding: 0 12px; gap: 10px; }
  .app-logo { width: 36px; height: 36px; }
  .app-title-line1 { font-size: 9px; letter-spacing: 2px; }
  .app-title-line2 { font-size: 13px; }
  .app-nav a { width: 34px; height: 34px; font-size: 16px; }
  .step-sidebar { padding: 14px 10px; }
  .step-title { font-size: 14px; letter-spacing: 1px; }
  .step-desc { font-size: 11px; }
  .step-content { padding: 12px; }
  .step-footer { padding: 0 12px; gap: 6px; }
  button { padding: 10px 16px; font-size: 11px; }
  button.btn-main { padding: 12px 20px; font-size: 12px; }
  .countdown { font-size: 80px; }
  .progress-num { width: 26px; height: 26px; font-size: 12px; }
  .progress-line { width: 20px; }
  .info-value { font-size: 12px; }
  .info-item.highlight .info-value { font-size: 18px; }

  .admin-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow-y: auto;
  }
  .admin-grid > section { grid-column: auto !important; grid-row: auto !important; max-height: none; }
}

/* ============ CAPTURE GUIDE — khung nhấp nháy ============ */
.capture-guide-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  animation: guidePulse 1.4s ease-in-out infinite;
}

@keyframes guidePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.pose-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
}

/* ============================================
   ⭐ iPAD CONTROLLER
   ============================================ */
.ipad-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--tech-dark);
}

/* ─── SCREEN 1: CONNECT ─── */
.connect-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
}

.connect-box {
  background: linear-gradient(135deg, rgba(13, 27, 62, 0.9), rgba(10, 22, 40, 0.95));
  border: 2px solid var(--tech-cyan);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(56, 189, 248, 0.3);
}

.connect-logo {
  font-size: 60px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.6));
}

.connect-box h1 {
  color: var(--tech-gold);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.connect-desc {
  color: var(--tech-sky);
  font-size: 14px;
  margin-bottom: 24px;
  opacity: 0.85;
}

.room-input {
  width: 100%;
  padding: 20px;
  font-size: 32px !important;
  font-weight: 900 !important;
  letter-spacing: 12px !important;
  text-align: center;
  text-transform: uppercase;
  background: rgba(10, 22, 40, 0.9) !important;
  border: 3px solid var(--tech-cyan) !important;
  border-radius: 12px !important;
  color: var(--tech-gold) !important;
  font-family: 'Courier New', monospace !important;
  margin-bottom: 16px;
}

.connect-status {
  color: var(--tech-sky);
  font-size: 13px;
  margin-top: 14px;
  opacity: 0.7;
}

.connect-hint {
  color: var(--tech-sky);
  font-size: 12px;
  margin-top: 20px;
  opacity: 0.6;
  line-height: 1.6;
}

.connect-hint code {
  background: rgba(6, 182, 212, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--tech-cyan);
  font-size: 11px;
}

/* ─── SCREEN 2: MAIN ─── */
.main-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ipad-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(90deg, #0d1b3e, #1e40af, #0d1b3e);
  border-bottom: 3px solid var(--tech-gold);
  flex-shrink: 0;
}

.ipad-header-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--tech-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex: 1;
}

.ipad-header-badge {
  padding: 6px 14px;
  background: rgba(6, 182, 212, 0.2);
  border: 2px solid var(--tech-cyan);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 900;
  color: var(--tech-cyan);
  letter-spacing: 2px;
  font-family: monospace;
}

.ipad-btn-small {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  color: #ef4444;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ipad-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(10, 22, 40, 0.7);
  flex-shrink: 0;
}

.ipad-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  padding: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ipad-left,
.ipad-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.ipad-video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  border: 3px solid var(--tech-cyan);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.3);
}

/* ⭐ Video WebRTC — nét, mirror */
.ipad-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
  /* Không dùng image-rendering crisp-edges — giữ nguyên chất lượng WebRTC */
}

/* ⭐ Frame overlay — khung PNG đè lên video */
.ipad-frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 2;
  display: none;
}
.ipad-frame-overlay.show { display: block; }

/* ⭐ Countdown iPad */
.ipad-countdown {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 200px;
  font-weight: 900;
  color: var(--tech-gold);
  text-shadow:
    0 0 60px rgba(251, 191, 36, 1),
    0 0 120px rgba(6, 182, 212, 0.9),
    4px 4px 0 rgba(10, 22, 40, 0.9);
  background: rgba(10, 22, 40, 0.35);
  pointer-events: none;
  z-index: 5;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ipad-countdown.show {
  display: flex;
  animation: ipadCountPulse 0.5s ease-in-out infinite alternate;
}
@keyframes ipadCountPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}
.ipad-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 22, 40, 0.9);
  color: var(--tech-sky);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  z-index: 4;
  text-align: center;
  padding: 20px;
}

.ipad-video-placeholder span {
  animation: pulseOpacity 2s ease-in-out infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.ipad-video-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 5px 12px;
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid #ef4444;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 1px;
  animation: pulseDot 1.5s infinite;
}

.ipad-info-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.ipad-capture-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: rgba(251, 191, 36, 0.08);
  border: 2px solid var(--tech-gold);
  border-radius: 12px;
  flex-shrink: 0;
}

.ipad-capture-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.ipad-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(13, 27, 62, 0.7);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ipad-panel-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--tech-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  flex-shrink: 0;
}

.ipad-hint {
  font-size: 11px;
  color: var(--tech-sky);
  opacity: 0.75;
  line-height: 1.4;
  flex-shrink: 0;
}

.ipad-frame-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 2px;
}

.frame-item-ipad {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(13, 27, 62, 0.7);
  border: 3px solid rgba(56, 189, 248, 0.3);
  transition: 0.2s;
  aspect-ratio: 3/4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.frame-item-ipad:active {
  transform: scale(0.96);
}

.frame-item-ipad img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: repeating-conic-gradient(#1a2333 0% 25%, #0d1b3e 0% 50%) 50% / 12px 12px;
}

.frame-item-ipad.selected {
  border-color: var(--tech-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.7);
}

.frame-item-ipad.selected::before {
  content: '✓';
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  background: var(--tech-gold);
  color: var(--tech-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  z-index: 3;
}

.frame-item-ipad-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 8px;
  background: linear-gradient(to top, rgba(10, 22, 40, 0.95), transparent);
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-gold);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Photo pick trên iPad */
.ipad-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ⭐ CHUẨN HOÁ LAYER ORDER — Camera → Frame → Text */
.camera-preview-box {
  isolation: isolate;                 /* tạo stacking context riêng */
}
.camera-preview-box video           { z-index: 1 !important; }
.camera-preview-box .preview-frame-overlay { z-index: 3 !important; }
.camera-preview-box .preview-text-overlay  { z-index: 5 !important; }
.camera-preview-box .preview-placeholder   { z-index: 4 !important; }
.camera-preview-box .camera-status,
.camera-preview-box .btn-zoom-preview      { z-index: 10 !important; }

.pick-item-ipad {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid rgba(56, 189, 248, 0.3);
  aspect-ratio: 1;
  transition: 0.2s;
  touch-action: manipulation;
}

.pick-item-ipad:active { transform: scale(0.96); }

.pick-item-ipad img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.pick-item-ipad.picked {
  border-color: var(--tech-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.7);
}

.pick-check-ipad {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(10, 22, 40, 0.9);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
}

.pick-item-ipad.picked .pick-check-ipad {
  background: var(--tech-gold);
  border-color: var(--tech-gold);
  color: var(--tech-dark);
}

/* Hashtag iPad */
.ipad-hashtag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 2px;
}

.hashtag-ipad {
  padding: 10px 18px;
  border-radius: 24px;
  background: rgba(6, 182, 212, 0.12);
  border: 2px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--tech-sky);
  transition: 0.2s;
  touch-action: manipulation;
  user-select: none;
}

.hashtag-ipad:active { transform: scale(0.96); }

.hashtag-ipad.selected {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.7);
}

/* Final photo */
.ipad-final-photo {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.ipad-final-photo img:first-child {
  max-width: 100%;
  max-height: 50%;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

.ipad-final-photo .ipad-qr {
  max-width: 180px;
  background: #fff;
  padding: 10px;
  border-radius: 10px;
}

/* Responsive iPad portrait */
@media (max-width: 900px) {
  .ipad-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .ipad-video-wrap { max-height: 40vh; }
  .ipad-header-title { font-size: 13px; }
  .ipad-header-badge { font-size: 12px; padding: 4px 10px; }
}

/* ⭐ Nút iPad trên header */
.nav-btn-ipad {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 20px;
  background: rgba(56, 189, 248, 0.15);
  border: 2px solid var(--tech-sky);
  color: var(--tech-sky);
  padding: 0;
  cursor: pointer;
  transition: 0.25s;
}
.nav-btn-ipad:hover {
  background: var(--tech-sky);
  color: var(--tech-dark);
  transform: translateY(-2px);
}
.nav-btn-ipad.connected {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: #fff;
}

/* ⭐ Modal QR */
.ipad-pair-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ipad-pair-modal.active { display: flex; }

.ipad-pair-close {
  position: fixed;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--tech-cyan);
  color: var(--tech-cyan);
  font-size: 20px;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.ipad-pair-content {
  background: linear-gradient(135deg, #0d1b3e, #0a1628);
  border: 2px solid var(--tech-cyan);
  border-radius: 20px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}

.ipad-pair-content h2 {
  color: var(--tech-gold);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.ipad-pair-content p {
  color: var(--tech-sky);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.ipad-pair-content code {
  background: rgba(6, 182, 212, 0.2);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--tech-cyan);
  font-size: 13px;
}

.ipad-room-code {
  font-family: 'Courier New', monospace;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 12px;
  color: var(--tech-gold);
  padding: 20px;
  background: rgba(10, 22, 40, 0.9);
  border: 3px solid var(--tech-gold);
  border-radius: 14px;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
}

.ipad-pair-qr {
  display: inline-block;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
}

.ipad-pair-qr img {
  display: block;
  width: 200px;
  height: 200px;
}

.ipad-pair-hint {
  font-size: 12px;
  opacity: 0.7;
}

.ipad-pair-status {
  padding: 12px 20px;
  background: rgba(251, 191, 36, 0.1);
  border: 2px solid var(--tech-gold);
  border-radius: 10px;
  color: var(--tech-gold);
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
}

.ipad-pair-status.connected {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}
.ipad-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  transform: scaleX(-1);   /* Mirror cho khớp laptop */
}

/* ============================================
   ⭐ iPAD CONTROLLER UI — REDESIGN
   ============================================ */

/* ─── CONNECT SCREEN ─── */
.ipad-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--tech-dark);
}

.connect-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 30% 30%, rgba(6, 182, 212, 0.15), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(251, 191, 36, 0.12), transparent 50%),
    linear-gradient(180deg, #0a1628 0%, #0d1b3e 50%, #0a1628 100%);
}

.connect-box {
  background: linear-gradient(135deg, rgba(13, 27, 62, 0.95), rgba(10, 22, 40, 0.98));
  border: 3px solid var(--tech-cyan);
  border-radius: 24px;
  padding: 50px 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(56, 189, 248, 0.4);
}

.connect-logo {
  font-size: 80px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 30px rgba(56, 189, 248, 0.8));
  animation: floatLogo 3s ease-in-out infinite;
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.connect-box h1 {
  color: var(--tech-gold);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
}

.connect-desc {
  color: var(--tech-sky);
  font-size: 16px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.room-input {
  width: 100%;
  padding: 24px 20px;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 16px;
  text-align: center;
  text-transform: uppercase;
  background: rgba(10, 22, 40, 0.95);
  border: 4px solid var(--tech-cyan);
  border-radius: 16px;
  color: var(--tech-gold);
  font-family: 'Courier New', monospace;
  margin-bottom: 20px;
  outline: none;
  transition: 0.3s;
}
.room-input:focus {
  border-color: var(--tech-gold);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}
.room-input::placeholder {
  color: rgba(100, 116, 139, 0.5);
  letter-spacing: 8px;
}

.btn-big {
  padding: 22px 32px !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  letter-spacing: 2px !important;
  border-radius: 14px !important;
  touch-action: manipulation;
}

.connect-status {
  color: var(--tech-sky);
  font-size: 14px;
  margin-top: 18px;
  opacity: 0.8;
}

.connect-hint-box {
  margin-top: 30px;
  padding: 20px;
  background: rgba(6, 182, 212, 0.08);
  border: 2px dashed rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hint-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--tech-sky);
  line-height: 1.5;
}

.hint-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.hint-step code {
  background: rgba(6, 182, 212, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--tech-cyan);
  font-size: 12px;
  font-weight: 700;
}

/* ─── MAIN SCREEN ─── */
.ipad-main-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--tech-dark);
}

/* Header */
.ipad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: linear-gradient(90deg, #0d1b3e, #1e40af, #0d1b3e);
  border-bottom: 4px solid var(--tech-gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.ipad-header-left,
.ipad-header-right {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ipad-header-right {
  justify-content: flex-end;
}

.ipad-header-center {
  flex: 0 0 auto;
}

.ipad-header-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--tech-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.progress-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 2px solid rgba(56, 189, 248, 0.3);
  color: var(--tech-sky);
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
}
.pill-step.active {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
  transform: scale(1.15);
}
.pill-step.done {
  background: var(--tech-cyan);
  border-color: var(--tech-cyan);
  color: var(--tech-dark);
}
.pill-line {
  width: 24px;
  height: 3px;
  background: rgba(56, 189, 248, 0.25);
  border-radius: 2px;
}

.room-badge {
  padding: 8px 16px;
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--tech-cyan);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 900;
  color: var(--tech-cyan);
  letter-spacing: 2px;
  font-family: monospace;
}

.ipad-btn-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  color: #ef4444;
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.ipad-btn-close:active {
  background: #ef4444;
  color: #fff;
  transform: scale(0.95);
}

/* Body: 2 columns */
.ipad-body {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ipad-col-video,
.ipad-col-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

/* ─── VIDEO WRAPPER ─── */
.video-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  border: 4px solid var(--tech-cyan);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(56, 189, 248, 0.4);
}

.ipad-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.video-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(10, 22, 40, 0.9);
  border: 2px solid #ef4444;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: 2px;
  z-index: 3;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 22, 40, 0.95);
  color: var(--tech-sky);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  z-index: 4;
  text-align: center;
  padding: 20px;
  transition: opacity 0.3s;
}
.video-placeholder .spinner {
  width: 50px;
  height: 50px;
}

/* ─── INFO BOX ─── */
.selected-frame-info {
  background: rgba(13, 27, 62, 0.8);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.info-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info-line .info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-sky);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.85;
}

.info-line .info-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--tech-gold);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── CAPTURE PANEL ─── */
.capture-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.15));
  border: 3px solid var(--tech-gold);
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.3);
  flex-shrink: 0;
}

.capture-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}

.capture-count {
  font-size: 24px;
  font-weight: 900;
  color: var(--tech-gold);
  font-family: monospace;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.btn-capture-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 24px 32px;
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border: 3px solid #fff;
  border-radius: 16px;
  color: var(--tech-dark);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.5);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-capture-big:active {
  transform: scale(0.96);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.7);
}
.btn-capture-big:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon-big {
  font-size: 32px;
}

/* ─── PANEL CONTENT ─── */
.panel-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(13, 27, 62, 0.75);
  border: 3px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 18px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(56, 189, 248, 0.2);
  flex-shrink: 0;
}

.panel-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--tech-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--tech-sky);
  opacity: 0.85;
}

/* ─── FRAME GRID ─── */
.frame-grid-ipad {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-cyan) transparent;
}
.frame-grid-ipad::-webkit-scrollbar {
  width: 6px;
}
.frame-grid-ipad::-webkit-scrollbar-thumb {
  background: var(--tech-cyan);
  border-radius: 3px;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--tech-sky);
  font-size: 13px;
  font-weight: 600;
}

.frame-item-ipad {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(13, 27, 62, 0.7);
  border: 3px solid rgba(56, 189, 248, 0.3);
  transition: 0.2s;
  aspect-ratio: 3/4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.frame-item-ipad:active {
  transform: scale(0.96);
}
.frame-item-ipad.selected {
  border-color: var(--tech-gold);
  border-width: 4px;
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
  transform: scale(1.02);
}
.frame-item-ipad.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: var(--tech-gold);
  color: var(--tech-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  z-index: 3;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.9);
}

.frame-item-ipad img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: repeating-conic-gradient(#1a2333 0% 25%, #0d1b3e 0% 50%) 50% / 14px 14px;
}

.frame-item-ipad-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(10, 22, 40, 0.95), transparent);
  font-size: 11px;
  font-weight: 700;
  color: var(--tech-gold);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── BTN ACTION BIG ─── */
.btn-action-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--tech-cyan), var(--tech-blue));
  border: 3px solid var(--tech-cyan);
  border-radius: 14px;
  color: var(--tech-white);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}
.btn-action-big:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(6, 182, 212, 0.7);
}
.btn-action-big:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-action-big .arrow {
  font-size: 22px;
  font-weight: 900;
}
.btn-action-big.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}
.btn-action-big.btn-secondary-big {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--tech-sky);
}

/* ─── CAPTURE GUIDE LIST ─── */
.capture-guide-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  justify-content: center;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(6, 182, 212, 0.08);
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  font-size: 14px;
  color: var(--tech-sky);
  line-height: 1.5;
}

.guide-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  color: var(--tech-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

/* ─── PICK GRID ─── */
.pick-grid-ipad {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-cyan) transparent;
}
.pick-grid-ipad::-webkit-scrollbar { width: 6px; }
.pick-grid-ipad::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 3px; }

.pick-item-ipad {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid rgba(56, 189, 248, 0.3);
  aspect-ratio: 1;
  transition: 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pick-item-ipad:active { transform: scale(0.96); }
.pick-item-ipad img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pick-item-ipad.picked {
  border-color: var(--tech-gold);
  border-width: 4px;
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
}

.pick-check-ipad {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 22, 40, 0.95);
  border: 3px solid var(--tech-cyan);
  color: var(--tech-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  z-index: 2;
}
.pick-item-ipad.picked .pick-check-ipad {
  background: var(--tech-gold);
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.9);
}

/* ─── HASHTAG ─── */
.hashtag-list-ipad {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px;
  align-content: flex-start;
}
.hashtag-list-ipad::-webkit-scrollbar { width: 6px; }
.hashtag-list-ipad::-webkit-scrollbar-thumb { background: var(--tech-cyan); border-radius: 3px; }

.hashtag-ipad {
  padding: 14px 22px;
  border-radius: 28px;
  background: rgba(6, 182, 212, 0.12);
  border: 3px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--tech-sky);
  transition: 0.2s;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hashtag-ipad:active {
  transform: scale(0.94);
}
.hashtag-ipad.selected {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
  transform: scale(1.05);
}

/* ─── FINAL PHOTO ─── */
.final-photo-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  overflow-y: auto;
  padding: 10px 0;
}

.final-photo-wrap img:first-child {
  max-width: 100%;
  max-height: 55%;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  border: 3px solid var(--tech-cyan);
}

.final-photo-wrap .ipad-qr {
  max-width: 200px;
  background: #fff;
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── RESPONSIVE iPAD ─── */

/* iPad portrait 820×1180 */
@media (max-width: 900px) and (min-width: 701px) {
  .ipad-body {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 14px;
  }
  .ipad-header {
    padding: 12px 16px;
    gap: 12px;
  }
  .ipad-header-title {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .pill-step {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  .pill-line {
    width: 16px;
  }
  .frame-grid-ipad {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
  .panel-content {
    padding: 14px;
  }
  .panel-title {
    font-size: 15px;
  }
  .btn-action-big {
    padding: 15px 20px;
    font-size: 14px;
  }
  .btn-capture-big {
    padding: 20px 24px;
    font-size: 18px;
  }
  .btn-icon-big {
    font-size: 26px;
  }
}

/* iPad landscape nhỏ */
@media (max-width: 1200px) and (min-width: 901px) {
  .ipad-body {
    grid-template-columns: 1.1fr 1fr;
  }
}

/* Mobile */
@media (max-width: 700px) {
  .ipad-body {
    grid-template-columns: 1fr;
    grid-template-rows: 45vh 1fr;
    gap: 10px;
    padding: 10px;
  }
  .ipad-header {
    padding: 10px 14px;
    gap: 8px;
  }
  .pill-line {
    width: 12px;
  }
  .frame-grid-ipad {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .connect-box {
    padding: 30px 24px;
  }
  .connect-box h1 {
    font-size: 24px;
  }
  .room-input {
    font-size: 32px;
    padding: 18px 14px;
    letter-spacing: 10px;
  }
}
/* ⭐ Placeholder loading cho pick grid */
.pick-grid-ipad .empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--tech-sky);
  font-size: 13px;
  font-weight: 600;
}

/* ⭐ Toast iPad to hơn */
.ipad-layout .toast {
  font-size: 15px;
  padding: 16px 28px;
  border-radius: 12px;
  border-width: 3px;
}

/* ============================================
   ⭐ MODE BADGE
   ============================================ */
.mode-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(6, 182, 212, 0.3));
  border: 2px solid var(--tech-cyan);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  color: var(--tech-cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-right: 12px;
  animation: modeBadgePulse 2s ease-in-out infinite;
}
@keyframes modeBadgePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.8); }
}

/* ============================================
   ⭐ iPAD MIRROR MODE — Responsive
   ============================================ */

/* iPad Air landscape 1180×820 */
@media (max-width: 1200px) {
  body.mode-ipad {
    --sidebar-w: 240px;
    --header-h: 56px;
    --progress-h: 52px;
    --footer-h: 72px;
  }

  body.mode-ipad .app-title-line2 { font-size: 16px; }
  body.mode-ipad .step-title { font-size: 17px; }
  body.mode-ipad .step-desc { font-size: 11px; }
  body.mode-ipad .select-layout { grid-template-columns: 1fr 300px; gap: 12px; }
  body.mode-ipad .camera-preview-box { max-height: 55vh; }
  body.mode-ipad .info-item { padding: 8px 10px; }
  body.mode-ipad .info-value { font-size: 13px; }
  body.mode-ipad .info-item.highlight .info-value { font-size: 17px; }
  body.mode-ipad .frame-grid-compact { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  body.mode-ipad .pick-grid-compact { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  body.mode-ipad .result-layout { grid-template-columns: 1fr 1fr; }
  body.mode-ipad .qr-big-panel { max-width: 340px; padding: 18px 16px; }
  body.mode-ipad .qr-big-img { max-width: 260px; padding: 12px; }
  body.mode-ipad .info-form-wrap { padding: 16px 14px; }
  body.mode-ipad button.btn-main { padding: 12px 24px; font-size: 13px; }
}

/* iPad Air portrait 820×1180 */
@media (max-width: 900px) {
  body.mode-ipad {
    --sidebar-w: 220px;
    --header-h: 52px;
    --progress-h: 48px;
    --footer-h: 68px;
  }

  body.mode-ipad .app-header { padding: 0 14px; gap: 10px; }
  body.mode-ipad .app-logo { width: 38px; height: 38px; }
  body.mode-ipad .app-title-line1 { font-size: 9px; letter-spacing: 2px; }
  body.mode-ipad .app-title-line2 { font-size: 14px; }
  body.mode-ipad .app-nav a { width: 36px; height: 36px; font-size: 17px; }
  body.mode-ipad .progress-label { display: none; }
  body.mode-ipad .progress-num { width: 28px; height: 28px; font-size: 13px; }
  body.mode-ipad .progress-line { width: 24px; }
  body.mode-ipad .step-sidebar { padding: 14px 12px; gap: 10px; }
  body.mode-ipad .step-title { font-size: 15px; letter-spacing: 1.5px; }
  body.mode-ipad .step-desc { font-size: 11px; }
  body.mode-ipad .step-content { padding: 12px 14px; }

  body.mode-ipad .select-layout {
    grid-template-columns: 1fr 260px;
    gap: 10px;
  }
  body.mode-ipad .camera-preview-box { max-height: 50vh; }
  body.mode-ipad .frame-grid-compact { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  body.mode-ipad .pick-grid-compact { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

  body.mode-ipad .result-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 14px;
    align-items: start;
    overflow-y: auto;
  }
  body.mode-ipad .qr-big-panel { max-width: 100%; padding: 16px 14px; gap: 12px; }
  body.mode-ipad .qr-big-img { max-width: 240px; padding: 10px; }
  body.mode-ipad .qr-big-title { font-size: 13px; }
  body.mode-ipad .qr-big-actions { flex-wrap: wrap; }

  body.mode-ipad .info-form-wrap { padding: 14px 12px; }
  body.mode-ipad .info-form-title { font-size: 14px; }
  body.mode-ipad .form-field input { padding: 10px 12px; font-size: 13px; }

  body.mode-ipad button { padding: 10px 18px; font-size: 12px; }
  body.mode-ipad button.btn-main { padding: 12px 22px; font-size: 13px; }
  body.mode-ipad .step-footer { padding: 0 14px; gap: 8px; }
}

/* Mobile dọc (dưới 700px) */
@media (max-width: 700px) {
  body.mode-ipad {
    --sidebar-w: 100%;
    --header-h: 48px;
    --progress-h: 44px;
    --footer-h: 64px;
  }
  body.mode-ipad .app-step { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  body.mode-ipad .step-sidebar { border-right: none; border-bottom: 1px solid rgba(56, 189, 248, 0.15); max-height: 35vh; }
  body.mode-ipad .select-layout { grid-template-columns: 1fr; grid-template-rows: 40vh 1fr; }
  body.mode-ipad .camera-preview-box { max-height: 40vh; }
  body.mode-ipad .result-layout { grid-template-columns: 1fr; }
  body.mode-ipad .qr-big-img { max-width: 200px; }
}

/* ============================================
   ⭐ INFO MODAL — Nhập thông tin trước khi tạo QR
   ============================================ */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.92);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.info-modal.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.info-modal-content {
  background: linear-gradient(135deg, #0d1b3e 0%, #0a1628 100%);
  border: 3px solid var(--tech-gold);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 480px;
  width: 100%;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.85),
    0 0 50px rgba(251, 191, 36, 0.35);
  position: relative;
  overflow: hidden;
}
.info-modal-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--tech-gold), var(--tech-cyan), var(--tech-gold));
}

.info-modal-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.6));
}

.info-modal-title {
  color: var(--tech-gold);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.info-modal-desc {
  color: var(--tech-sky);
  font-size: 13px;
  text-align: center;
  margin-bottom: 22px;
  opacity: 0.85;
}

.info-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-modal-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-modal-form .form-field label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tech-sky);
  opacity: 0.9;
}
.info-modal-form .form-field label .req {
  color: var(--tech-gold);
  font-size: 14px;
}
.info-modal-form input {
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  border: 2px solid rgba(56, 189, 248, 0.3);
  background: rgba(10, 22, 40, 0.85);
  color: var(--tech-white);
  outline: none;
  transition: 0.2s;
  width: 100%;
}
.info-modal-form input:focus {
  border-color: var(--tech-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}
.info-modal-form input.error {
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  animation: shake 0.3s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.info-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.info-modal-actions button {
  flex: 1;
  justify-content: center;
  padding: 14px 20px;
  font-size: 14px;
  border-radius: 10px;
}

/* iPad — Modal to hơn, dễ chạm */
@media (max-width: 900px) {
  .info-modal-content {
    padding: 28px 22px 22px;
    max-width: 100%;
  }
  .info-modal-form input {
    padding: 16px 18px;
    font-size: 18px;
  }
  .info-modal-actions button {
    padding: 16px 20px;
    font-size: 16px;
  }
}

.text-remove-bg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(251, 191, 36, 0.1);
  border: 1.5px dashed rgba(251, 191, 36, 0.5);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tech-gold);
  user-select: none;
  transition: 0.2s;
}
.text-remove-bg-row:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: var(--tech-gold);
}
.text-remove-bg-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--tech-gold);
  flex-shrink: 0;
}
/* Nút thêm khung */
.admin-form .btn-main.btn-full {
  padding: 14px 24px;
  font-size: 14px;
  letter-spacing: 1.5px;
}

/* ============================================
   ⭐ STYLE ROW — Chọn phong cách hashtag
   ============================================ */
.style-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.style-btn {
  padding: 10px 6px;
  font-size: 18px;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.08);
  border: 2px solid rgba(56, 189, 248, 0.3);
  color: var(--tech-sky);
  cursor: pointer;
  transition: 0.2s;
  letter-spacing: 0;
  text-transform: none;
  min-width: 0;
}
.style-btn:hover {
  border-color: var(--tech-cyan);
  background: rgba(6, 182, 212, 0.18);
  transform: translateY(-2px);
}
.style-btn.active {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.7);
}

/* ============================================
   ⭐ GESTURE HINT — Hướng dẫn cử chỉ
   ============================================ */
.gesture-hint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(6, 182, 212, 0.08);
  border: 1.5px dashed rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  font-size: 11px;
  color: var(--tech-sky);
  line-height: 1.5;
}
.gh-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gh-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.6));
}

/* ⭐ Hashtag text — hỗ trợ style classes */
.hashtag-text.style-glow {
  text-shadow:
    0 0 12px currentColor,
    0 0 24px currentColor,
    -2px -2px 0 rgba(0, 0, 0, 0.9),
     2px -2px 0 rgba(0, 0, 0, 0.9),
    -2px  2px 0 rgba(0, 0, 0, 0.9),
     2px  2px 0 rgba(0, 0, 0, 0.9);
}
.hashtag-text.style-shadow {
  text-shadow:
    4px 6px 12px rgba(0, 0, 0, 0.85),
    2px 3px 0 rgba(0, 0, 0, 0.55);
}
.hashtag-text.style-outline {
  text-shadow:
    -3px -3px 0 #fff, 3px -3px 0 #fff, -3px 3px 0 #fff, 3px 3px 0 #fff,
    -3px  0   0 #fff, 3px  0   0 #fff,  0  -3px 0 #fff,  0   3px 0 #fff,
    -4px -4px 0 #000, 4px -4px 0 #000, -4px 4px 0 #000, 4px 4px 0 #000;
}
.hashtag-text.style-neon {
  text-shadow:
    0 0 8px currentColor,
    0 0 16px currentColor,
    0 0 32px currentColor,
    0 0 64px currentColor,
    0 0 4px #fff;
}
.hashtag-text.style-gradient {
  background: linear-gradient(180deg, currentColor 0%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.9))
          drop-shadow(-2px -2px 0 rgba(0, 0, 0, 0.9));
}
.hashtag-text.style-default {
  text-shadow:
    -2px -2px 0 rgba(0, 0, 0, 0.9),
     2px -2px 0 rgba(0, 0, 0, 0.9),
    -2px  2px 0 rgba(0, 0, 0, 0.9),
     2px  2px 0 rgba(0, 0, 0, 0.9);
}

/* iPad — to hơn, dễ chạm hơn */
@media (max-width: 900px) {
  body.mode-ipad .style-btn { padding: 14px 8px; font-size: 22px; }
  body.mode-ipad .gesture-hint { font-size: 13px; padding: 12px 14px; }
  body.mode-ipad .gh-icon { font-size: 18px; }
}

/* ═══════════════════════════════════════════
   ⭐ HUD BAR NGANG — Thay sidebar dọc trên iPad
   ═══════════════════════════════════════════ */
.hud-bar {
                        /* Ẩn mặc định (laptop dùng sidebar) */
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(13,27,62,0.95), rgba(30,64,175,0.95), rgba(13,27,62,0.95));
  border-bottom: 2px solid var(--tech-gold);
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* ⭐ CHỈ HIỆN TRÊN iPAD (mirror mode) */
body.mode-ipad .hud-bar { display: flex; }

/* Mobile nhỏ cũng hiện */
@media (max-width: 900px) {
  body.mode-host .hud-bar { display: flex; }
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  flex: 1;
  min-width: 0;
}
.hud-progress {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.1);
  flex: 1.2;
}

.hud-icon { font-size: 16px; flex-shrink: 0; }
.hud-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tech-sky);
  opacity: 0.75;
  flex-shrink: 0;
}
.hud-value {
  font-size: 13px;
  font-weight: 900;
  color: var(--tech-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
}
.hud-progress .hud-value {
  color: var(--tech-gold);
  font-size: 16px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

/* ⭐ Layout: grid rows thêm 1 hàng cho HUD bar */
body.mode-ipad .app-layout {
  grid-template-rows: var(--header-h) auto var(--progress-h) 1fr;
}

/* ⭐ ẨN sidebar dọc trên iPad — HUD bar đảm nhiệm hiển thị info */
body.mode-ipad .step-sidebar {
  display: none;
}
body.mode-ipad .app-step {
  grid-template-columns: 1fr;      /* Content chiếm toàn bộ chiều ngang */
  grid-template-rows: 1fr var(--footer-h);
}

/* ⭐ Nhưng vẫn giữ nút toggle sidebar phòng trường hợp user muốn mở */
body.mode-ipad .step-sidebar.force-show {
  display: flex;
}

/* iPad cỡ vừa */
@media (max-width: 900px) {
  .hud-bar { padding: 10px 12px; gap: 6px; }
  .hud-item { padding: 6px 8px; gap: 4px; }
  .hud-label { font-size: 8px; }
  .hud-icon { font-size: 14px; }
  .hud-value { font-size: 12px; }
  .hud-progress .hud-value { font-size: 15px; }
}

/* Mobile rất nhỏ — rút gọn */
@media (max-width: 600px) {
  .hud-item:nth-child(3),
  .hud-item:nth-child(4) { display: none; }
  .hud-value { font-size: 11px; }
}

/* ═══════════════════════════════════════════
   ⭐ HASHTAG FLOAT PANEL — Panel hashtag nổi riêng biệt
   ═══════════════════════════════════════════ */
.hashtag-float-panel {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 300px;
  max-width: calc(100vw - 40px);
  background: linear-gradient(135deg, rgba(13,27,62,0.98), rgba(10,22,40,0.98));
  border: 2px solid var(--tech-gold);
  border-radius: 14px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.7),
    0 0 40px rgba(251, 191, 36, 0.35);
  z-index: 9000;
  overflow: hidden;
  transition: transform 0.3s ease, width 0.3s ease;
  backdrop-filter: blur(10px);
  display: none;   /* Chỉ hiện ở step decorate */
}
body[data-current-step="decorate"] .hashtag-float-panel { display: block; }

.hashtag-float-panel.collapsed { width: 220px; }
.hashtag-float-panel.collapsed .hfp-body { display: none; }

.hfp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(251,191,36,0.15), rgba(251,191,36,0.08));
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.hfp-header:active { cursor: grabbing; }

.hfp-icon { font-size: 18px; }
.hfp-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--tech-gold);
  flex: 1;
}
.hfp-count {
  padding: 2px 10px;
  background: var(--tech-gold);
  color: var(--tech-dark);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  font-family: monospace;
  min-width: 24px;
  text-align: center;
}
.hfp-toggle {
  width: 26px; height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.2);
  border: 1.5px solid var(--tech-gold);
  color: var(--tech-gold);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  min-width: 0;
}
.hfp-toggle:hover {
  background: var(--tech-gold);
  color: var(--tech-dark);
  transform: scale(1.1);
}

.hfp-body {
  padding: 12px 14px 14px;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tech-gold) transparent;
}
.hfp-body::-webkit-scrollbar { width: 5px; }
.hfp-body::-webkit-scrollbar-thumb { background: var(--tech-gold); border-radius: 3px; }

.hashtag-list-float {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hashtag-list-float .hashtag {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(6, 182, 212, 0.12);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  color: var(--tech-sky);
  cursor: pointer;
  transition: 0.2s;
  user-select: none;
}
.hashtag-list-float .hashtag:hover {
  background: rgba(6, 182, 212, 0.25);
  color: #fff;
  transform: translateY(-2px);
}
.hashtag-list-float .hashtag.selected {
  background: linear-gradient(135deg, var(--tech-gold), var(--tech-amber));
  border-color: var(--tech-gold);
  color: var(--tech-dark);
  font-weight: 800;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.7);
}

/* iPad — to hơn */
@media (max-width: 900px) {
  .hashtag-float-panel {
    width: 340px;
    bottom: 90px;
    right: 12px;
  }
  .hashtag-list-float .hashtag {
    font-size: 15px;
    padding: 12px 18px;
  }
  .hfp-header { padding: 14px 16px; }
  .hfp-title { font-size: 15px; }
}

@media (max-width: 600px) {
  .hashtag-float-panel {
    left: 12px; right: 12px; width: auto;
    bottom: 80px;
  }
}

body.mode-ipad #btn-toggle-hud-sidebar { display: flex; }

/* ═══════════════════════════════════════════════════════
   ⭐ FIX CUỐI — PROGRESS BAR + HUD BAR GỌN (override all)
   ═══════════════════════════════════════════════════════ */

/* ─── 1. PROGRESS BAR — số bước nhỏ gọn ─── */
.progress-bar {
  padding: 0 14px !important;
  gap: 6px !important;
  min-height: 40px !important;
  max-height: 44px !important;
}

.progress-step {
  gap: 5px !important;
  display: flex !important;
  align-items: center !important;
}

.progress-num {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  font-size: 11px !important;
  line-height: 1 !important;
  border-width: 1.5px !important;
  font-weight: 900 !important;
}

.progress-step.active .progress-num {
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6) !important;
  transform: scale(1.06) !important;
}

.progress-label {
  font-size: 9px !important;
  letter-spacing: 0.6px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.progress-line {
  width: 18px !important;
  height: 1.5px !important;
  min-width: 18px !important;
}

/* ─── 2. HUD BAR — fix display none + gọn ─── */
.hud-bar {
  display: none !important;                 /* ⭐ FIX LỖI — thiếu dòng này */
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 6px 12px !important;
  min-height: 40px !important;
  max-height: 44px !important;
}

/* Chỉ hiện trên iPad */
body.mode-ipad .hud-bar { display: flex !important; }
@media (max-width: 900px) {
  body.mode-host .hud-bar { display: flex !important; }
}

.hud-item {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 10px !important;
  min-height: 30px !important;
  border-radius: 8px !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.hud-icon {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
}

.hud-label {
  font-size: 8px !important;
  letter-spacing: 0.6px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}

.hud-value {
  font-size: 11px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1 !important;
  margin-left: auto !important;
  max-width: 100% !important;
}

.hud-progress .hud-value {
  font-size: 13px !important;
  letter-spacing: 0.5px !important;
}

/* ─── 3. RESPONSIVE — iPad ─── */
@media (max-width: 900px) {
  .progress-bar {
    padding: 0 10px !important;
    min-height: 36px !important;
    max-height: 40px !important;
  }
  .progress-num {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    font-size: 10px !important;
  }
  .progress-label {
    font-size: 8px !important;
  }
  .progress-line {
    width: 14px !important;
    min-width: 14px !important;
  }

  .hud-bar {
    padding: 5px 10px !important;
    min-height: 36px !important;
    max-height: 40px !important;
  }
  .hud-item {
    padding: 3px 8px !important;
    min-height: 28px !important;
  }
  .hud-icon {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    font-size: 10px !important;
  }
  .hud-value { font-size: 10px !important; }
  .hud-progress .hud-value { font-size: 12px !important; }
}

/* ─── 4. Mobile rất nhỏ ─── */
@media (max-width: 600px) {
  .progress-label { display: none !important; }
  .progress-num {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    font-size: 9px !important;
  }
  .progress-line { width: 12px !important; min-width: 12px !important; }

  .hud-item:nth-child(3),
  .hud-item:nth-child(4) {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════
   ⭐ PHÓNG TO KHUNG CAMERA — Bước chụp ảnh
   ═══════════════════════════════════════════════════════ */

/* Container bọc camera — cho phép giãn rộng tối đa */
.step-content.center {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px !important;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Khung camera — to hơn, chiếm tối đa không gian */
.camera-frame {
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 4/3 !important;
  min-width: 480px !important;      /* Đảm bảo tối thiểu 480px ngang */
  min-height: 360px !important;     /* Đảm bảo tối thiểu 360px cao */
}

/* Video bên trong lấp đầy khung */
.camera-frame #video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* ─── Responsive — iPad & Mobile ─── */
@media (max-width: 900px) {
  .step-content.center {
    padding: 8px !important;
  }

  .camera-frame {
    min-width: 0 !important;
    min-height: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
  }
}

@media (max-width: 700px) {
  .camera-frame {
    width: 100% !important;
    aspect-ratio: 3/4 !important;    /* Dọc trên mobile */
  }
}

/* ⭐ iPad mode — camera rộng hơn do không có sidebar */
body.mode-ipad .step-content.center {
  padding: 8px !important;
}

body.mode-ipad .camera-frame {
  height: 100% !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* ⭐ Khi sidebar bị thu gọn — camera càng rộng */
body.sidebar-collapsed .camera-frame {
  min-width: 560px !important;
}