/* ==========================================================================
   MODEL PICKER - EDITORIAL DESIGN SYSTEM
   Instrument Serif Headings | Inter Body | Asymmetrical Layout
   Bold Saturated Accents | Intentional Spacing Hierarchy
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface & Canvas */
  --bg-app: #08090c;
  --bg-surface: #0f1117;
  --bg-surface-elevated: #151821;
  --bg-card: #12141c;
  --bg-card-hover: #191c28;
  --bg-input: #0b0d13;
  --bg-subtle: #1e2230;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: #3b82f6;

  /* Bold Saturated Personality Colors */
  --accent-cobalt: #2563eb;
  --accent-cobalt-light: #3b82f6;
  --accent-emerald: #059669;
  --accent-coral: #ea580c;
  --accent-amber: #d97706;
  --accent-crimson: #dc2626;
  --accent-violet: #7c3aed;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Typography */
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing Scale */
  --space-tight: 6px;
  --space-sm: 10px;
  --space-md: 18px;
  --space-lg: 28px;
  --space-xl: 44px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: #232838;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cobalt);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 9, 12, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-cobalt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.pulse-dot.locked {
  background-color: var(--accent-crimson);
}

.user-capsule {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-capsule:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-elevated);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-cobalt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.admin-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.4);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ==========================================================================
   FOCUSED WORKSPACE LAYOUT
   Desktop: Models list (left), Sticky Camera (right)
   Mobile: Camera (top), Models list (below)
   ========================================================================== */
.app-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 48px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
  align-items: start;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .catalog-panel {
    order: 1;
  }
  .hud-viewfinder-card {
    order: 2;
    position: sticky;
    top: 76px;
  }
}

@media (max-width: 1023px) {
  .app-container {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 14px 36px 14px;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .hud-viewfinder-card {
    order: 1;
  }
  .catalog-panel {
    order: 2;
  }
  .models-grid {
    max-height: none;
    overflow-y: visible;
  }
}

/* ==========================================================================
   LEFT COLUMN: EDITORIAL MODEL EXPLORER
   ========================================================================== */
.catalog-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.section-label {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.search-input-box {
  position: relative;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.search-input-box input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.search-input-box input:focus {
  border-color: var(--accent-cobalt-light);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Category Filter Tabs with tight spacing */
.category-scroll-strip {
  display: flex;
  gap: var(--space-tight);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.category-scroll-strip::-webkit-scrollbar {
  display: none;
}

.category-tab {
  white-space: nowrap;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.category-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.category-tab.active {
  background: var(--accent-cobalt);
  color: #ffffff;
  border-color: var(--accent-cobalt);
}

/* Catalog Header */
.catalog-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.catalog-count-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Model Cards Grid */
.models-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  padding-right: 2px;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.model-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.model-card.active-card {
  border-color: var(--accent-cobalt-light);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.model-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.model-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.model-card-name {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 400;
  line-height: 1.25;
  color: #ffffff;
  min-width: 0;
  flex: 1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.badge-active {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.model-card-arch {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-word;
}

.model-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.48;
  word-break: break-word;
  overflow-wrap: break-word;
}

.model-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.model-card-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tap-hint {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-cobalt-light);
}

.model-card.active-card .tap-hint {
  color: #34d399;
}

.rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-amber);
  font-size: 0.82rem;
}

.btn-outline-rate {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-outline-rate:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
}

/* ==========================================================================
   CAMERA VIEWFINDER
   ========================================================================== */
.hud-viewfinder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hud-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 17, 23, 0.7);
}

.hud-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.hud-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.active-model-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.camera-actions-minimal {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #020204;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

video#webcamVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

canvas#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(37, 99, 235, 0.08) 0%, rgba(8, 9, 12, 0.95) 75%);
  z-index: 2;
  transition: opacity 0.2s ease;
}

.placeholder-icon {
  color: var(--accent-cobalt-light);
  margin-bottom: 12px;
  opacity: 0.9;
}

.placeholder-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.placeholder-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.4;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--accent-cobalt);
  color: #ffffff;
  font-weight: 600;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #202434;
  border-color: var(--border-medium);
}

.btn-outline-cyan {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn-outline-cyan:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border-color: rgba(220, 38, 38, 0.35);
}
.btn-danger:hover {
  background: rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   CONCURRENCY LOCK OVERLAY (EDITORIAL)
   ========================================================================== */
.lock-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 5, 8, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lock-modal-panel {
  max-width: 460px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  text-align: center;
}

.lock-radar-circle {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
}

.lock-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  margin-bottom: 6px;
  color: #ffffff;
}

.lock-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

.lock-lease-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
}

.lock-lease-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
}
.lock-lease-row:last-child {
  margin-bottom: 0;
}
.lock-lease-row .label {
  color: var(--text-muted);
}
.lock-lease-row .val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   AUTH MODAL WITH TIGHT FIELD SPACING
   ========================================================================== */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-panel {
  max-width: 400px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 400;
  margin-bottom: 4px;
  color: #ffffff;
}

.auth-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.45;
}

/* Tight spacing between related form fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-tight);
  margin-bottom: 12px;
}

.form-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-cobalt-light);
}

.auth-toggle-link {
  font-size: 0.8rem;
  color: var(--accent-cobalt-light);
  cursor: pointer;
  margin-top: 16px;
  display: block;
  text-align: center;
}
.auth-toggle-link:hover {
  color: #93c5fd;
}

/* ==========================================================================
   MODEL DETAILS MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-panel {
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}
.modal-close:hover {
  color: var(--text-primary);
}

.review-form-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 18px;
}

.star-rating-select {
  display: flex;
  gap: 7px;
  margin: 6px 0 12px;
  font-size: 1.4rem;
  cursor: pointer;
}

.star-btn {
  color: #334155;
  transition: var(--transition-fast);
}
.star-btn.active, .star-btn:hover {
  color: var(--accent-amber);
}

/* ==========================================================================
   ADMIN INTELLIGENCE HUB
   ========================================================================== */
.admin-hub-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.admin-table tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   SMALL & SUBTLE FOOTER
   ========================================================================== */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 32px;
  background: rgba(8, 9, 12, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-link {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-secondary);
}

/* ==========================================================================
   MOBILE RESPONSIVE SYSTEM (Smartphones & Handhelds <= 768px)
   Astra Ergonomics: Zero auto-zoom, touch targets >= 44px, compact chrome
   ========================================================================== */
@media (max-width: 768px) {
  /* Prevent any horizontal stretch on phone view */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Navigation Bar - Compact and tight */
  .top-nav {
    padding: 8px 12px;
    gap: 6px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .brand-wrapper {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }

  .brand-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }

  .nav-actions {
    gap: 5px;
    min-width: 0;
    flex-shrink: 0;
  }

  .status-pill {
    padding: 3px 6px;
    font-size: 0.65rem;
    gap: 4px;
    letter-spacing: 0.02em;
    max-width: 105px;
    min-width: 0;
  }

  #topLockText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 75px;
  }

  .user-capsule {
    padding: 3px 6px 3px 4px;
    gap: 5px;
    max-width: 110px;
    min-width: 0;
  }

  .user-avatar {
    width: 20px;
    height: 20px;
    font-size: 0.62rem;
    flex-shrink: 0;
  }

  .user-name {
    font-size: 0.74rem;
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #topNavAdminBtn {
    padding: 3px 6px !important;
    font-size: 0.68rem !important;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Workspace Container - Zero side blowout */
  .app-container {
    padding: 8px 10px 32px 10px;
    gap: 14px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Camera Stage - Optimized for portrait mobile device viewfinders */
  .camera-stage {
    aspect-ratio: 4 / 3;
    min-height: 260px;
    max-height: 48vh;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hud-header {
    padding: 8px 10px;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .hud-title {
    font-size: 1.08rem;
  }

  .camera-actions-minimal .btn {
    padding: 5px 10px;
    font-size: 0.74rem;
    min-height: 32px;
  }

  .active-model-chip {
    font-size: 0.68rem;
    padding: 3px 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: block;
  }

  .placeholder-title {
    font-size: 0.92rem;
  }

  .placeholder-subtitle {
    font-size: 0.74rem;
  }

  /* Catalog & Search */
  .section-label {
    font-size: 1.3rem;
  }

  /* Crucial: 16px font-size prevents iOS Safari viewport auto-zoom */
  .search-input-box input,
  .form-input,
  .review-form-box textarea,
  .review-form-box input {
    font-size: 16px !important;
  }

  .search-input-box input {
    padding: 9px 12px 9px 36px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Native horizontal momentum scrolling for categories without visible scrollbar */
  .category-scroll-strip {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .category-scroll-strip::-webkit-scrollbar {
    display: none;
  }

  .category-tab {
    padding: 5px 11px;
    font-size: 0.73rem;
    flex-shrink: 0;
  }

  /* Seamless full-page scrolling without trapped inner overflow on touch */
  .models-grid {
    max-height: none;
    overflow-y: visible;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Model Card touch optimization */
  .model-card {
    padding: 12px 12px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .model-card-name {
    font-size: 1.05rem;
  }

  .model-card-desc {
    font-size: 0.78rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .model-card-footer {
    padding-top: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .btn-outline-rate {
    min-height: 34px;
    padding: 5px 12px;
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Modals on phone screens */
  .modal-panel,
  .auth-panel,
  .lock-modal-panel {
    width: 92%;
    max-width: 92%;
    padding: 18px 14px;
    margin: 8px auto;
    box-sizing: border-box;
  }

  .modal-close {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
  }

  .star-rating-select {
    font-size: 1.8rem;
    gap: 8px;
    padding: 4px 0;
  }

  .star-btn {
    padding: 4px 2px;
    touch-action: manipulation;
  }

  /* Subtle Footer */
  .app-footer {
    padding: 16px 12px;
    justify-content: center;
    text-align: center;
    gap: 8px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* Extra small devices (<= 360px e.g. iPhone SE / Galaxy Mini) */
@media (max-width: 360px) {
  .brand-title {
    font-size: 0.98rem;
    max-width: 105px;
  }
  .status-pill {
    padding: 2px 5px;
    font-size: 0.62rem;
    max-width: 85px;
  }
  .user-name {
    display: none;
  }
  .user-capsule {
    padding: 2px 4px;
  }
}

