/* Mobile responsive layout, PIN lock overlay, on-demand engine banner & remote control modal */
.pin-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 10, 16, 0.96); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.pin-card {
  width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.pin-input {
  width: 100%; text-align: center; font-size: 24px; letter-spacing: 6px;
  padding: 12px; background: #0b0e16; border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-weight: 700;
}

.engine-banner {
  margin-bottom: 12px; padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(91, 140, 255, 0.12));
  border: 1px solid rgba(124, 92, 255, 0.45);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.engine-banner-title { font-weight: 700; font-size: 14px; }
.engine-banner-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.private-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel-2); cursor: pointer;
}
.private-pill.on {
  border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); color: #fde68a;
}

.remote-url-box {
  background: #0c1018; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; font-size: 12px; display: flex; flex-direction: column; gap: 6px;
}
.remote-section {
  background: #0e121c; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px;
}
.btn-warn { background: #b45309; color: #fff; }

#inp-mask-canvas, #mask-canvas, #draw-canvas { touch-action: none; }

/* Photo-App Gallery & Swipe Lightbox */
.gal-density { display: inline-flex; gap: 3px; background: #0d111a; padding: 2px; border-radius: 8px; border: 1px solid var(--border); }
.gal-dens-btn.active { background: var(--accent); color: #fff; }
.gal-bulk-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 12px; margin-bottom: 10px; border-radius: 10px;
  background: rgba(124, 92, 255, 0.16); border: 1px solid rgba(124, 92, 255, 0.45);
}
.gallery-wrap { display: flex; flex-direction: column; gap: 14px; }
.gal-date-header {
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 4px 2px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.gal-date-grid { display: grid; gap: 8px; }
.gal-date-grid.cols-lg { grid-template-columns: repeat(3, 1fr); }
.gal-date-grid.cols-md { grid-template-columns: repeat(5, 1fr); }
.gal-date-grid.cols-sm { grid-template-columns: repeat(7, 1fr); }
.gal-card.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(124,92,255,0.3); }
.gal-sel-badge {
  position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(11,13,18,0.75); border: 1px solid #fff; color: #fff;
  font-size: 13px; display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.gal-card.selected .gal-sel-badge { background: var(--accent); border-color: var(--accent); }

.lb-topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lb-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: #07090e; border-radius: 10px; min-height: 220px; overflow: hidden; touch-action: pan-y;
}
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 74vh; object-fit: contain; display: block; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 38px; height: 56px; border-radius: 10px; border: none;
  background: rgba(11, 13, 18, 0.55); color: #fff; font-size: 26px; cursor: pointer;
}
.lb-nav:hover { background: rgba(124, 92, 255, 0.75); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-details { background: #0d111a; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--muted); }
.lb-details summary { cursor: pointer; font-weight: 600; color: var(--text); }

@media (max-width: 820px) {
  .app-shell { padding: 8px 10px 24px; }
  .topbar {
    position: sticky; top: 0; z-index: 40;
    padding: 10px; gap: 8px; margin-bottom: 10px;
    background: rgba(19, 23, 34, 0.94); backdrop-filter: blur(8px);
  }
  .brand-sub { display: none; }
  .nav-tabs {
    width: 100%; overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  .nav-tab { white-space: nowrap; min-height: 38px; padding: 6px 12px; font-size: 12px; }
  .status-pills { width: 100%; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }

  .studio-grid, .trainer-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .stage-panel { order: -1; min-height: 280px; }
  .stage-image { max-height: 55vh; }
  .param-bar { grid-template-columns: repeat(2, 1fr); }
  .ratio-pills { flex-wrap: wrap; }
  .ratio-pill { min-height: 36px; flex: 1 1 auto; }
  .btn-generate { min-height: 48px; font-size: 15px; }
  .stage-actions { gap: 6px; }
  .stage-actions .btn { min-height: 36px; flex: 1 1 auto; text-align: center; }

  .gal-date-grid.cols-lg { grid-template-columns: repeat(1, 1fr) !important; }
  .gal-date-grid.cols-md { grid-template-columns: repeat(2, 1fr) !important; }
  .gal-date-grid.cols-sm { grid-template-columns: repeat(3, 1fr) !important; }
  .lb-nav { width: 32px; height: 44px; font-size: 22px; }
  .dataset-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .modal-card { width: 96vw !important; max-width: 96vw !important; padding: 12px; }
  .lightbox-card { width: 96vw; padding: 10px; }
  .gallery-search { width: 100%; }
}
