* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

.is-hidden {
  display: none !important;
}

body {
  background-color: #000;
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

/* Full-Screen Camera Viewport */
.camera-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

#videoPreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 1;
}

#videoPreview.is-mirrored {
  transform: scaleX(-1);
}

/* Rule of Thirds Grid */
.camera-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.14);
}

.grid-line.horizontal {
  width: 100%;
  height: 1px;
}

.grid-line.horizontal.h1 { top: 33.33%; }
.grid-line.horizontal.h2 { top: 66.66%; }

.grid-line.vertical {
  height: 100%;
  width: 1px;
}

.grid-line.vertical.v1 { left: 33.33%; }
.grid-line.vertical.v2 { left: 66.66%; }

/* Floating Top Overlay */
.floating-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.9) 0%, rgba(2, 6, 23, 0.54) 75%, rgba(2, 6, 23, 0) 100%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  min-width: 0;
}

.title-line1 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.3px;
}

/* Gold Bold Title Beside Logo Row */
.title-line2 {
  font-size: 13.5px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.35px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.top-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-icon-circle:active {
  transform: rotate(180deg) scale(0.92);
  background: rgba(14, 165, 233, 0.8);
}

.logo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  padding: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  border: 1.5px solid rgba(251, 191, 36, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Compact Pill Bar for Rig, Shift & Shift Transition Window */
.pill-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pill-group {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 4px 10px;
  gap: 6px;
}

.pill-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.4px;
}

.pill-group select {
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.pill-group select option {
  background: #0f172a;
  color: #f8fafc;
}

.session-window-pill {
  background: rgba(14, 165, 233, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Floating Bottom Overlay */
.floating-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(2, 6, 23, 0.9) 0%, rgba(2, 6, 23, 0.48) 78%, rgba(2, 6, 23, 0) 100%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Enlarged & Slightly Raised Watermark Preview HUD Card */
.hud-card {
  display: flex;
  align-items: stretch;
  gap: 11px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  border-left: 4.5px solid #fbbf24;
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* Mini Google Maps Box on Left of HUD (Enlarged) */
.hud-map-box {
  width: 88px;
  min-width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  background: #1e293b;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

#hudMapImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #cbd5e1;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

/* Enlarged Structured Text Info on Right of Mini Map */
.hud-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3.5px;
}

.hud-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding-bottom: 4px;
  margin-bottom: 2px;
}

.hud-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.hud-main-title {
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
}

/* Gold Bold Company Title in HUD */
.hud-sub-title {
  font-size: 12.5px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.25px;
  white-space: nowrap;
}

.hud-logo-wrap {
  display: flex;
  align-items: center;
}

.hud-mini-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 2px;
}

.hud-detail-row {
  display: flex;
  align-items: baseline;
  font-size: 11.5px;
  line-height: 1.28;
}

.hud-tag-label {
  width: 88px;
  min-width: 88px;
  color: #e2e8f0;
  font-weight: 600;
}

.hud-tag-sep {
  margin-right: 5px;
  color: #94a3b8;
}

.hud-val-keyword {
  color: #fbbf24;
  font-family: monospace;
  font-size: 12px;
  font-weight: 800;
}

.hud-val-date {
  color: #ffffff;
  font-weight: 700;
}

.hud-loc-row {
  align-items: flex-start;
}

.hud-val-loc {
  flex: 1;
  min-width: 0;
}

.loc-primary {
  color: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loc-secondary {
  color: #cbd5e1;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom-Left Italic GJEXBAYJZ Watermark Row */
.bottom-left-watermark-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 4px 2px;
  pointer-events: none;
}

.corner-watermark-italic {
  font-size: 10px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Shutter Control Bar */
.shutter-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 2px 8px;
}

.btn-side-action {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  min-width: 88px;
}

.btn-side-action:active {
  background: rgba(14, 165, 233, 0.4);
  color: #ffffff;
}

.btn-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 4px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s;
}

.btn-shutter:active {
  transform: scale(0.92);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 50%;
  transition: background 0.15s;
}

.btn-shutter:active .shutter-inner {
  background: #0ea5e9;
}

/* Preview Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-content {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  width: 100%;
  max-width: 495px;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 15px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.modal-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-logo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
  padding: 2px;
}

.modal-gold-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.3px;
}

.modal-sub-title {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.btn-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-img-wrapper {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #020617;
  border: 1px solid #334155;
  max-height: 44dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewImg {
  width: 100%;
  height: auto;
  max-height: 44dvh;
  object-fit: contain;
  display: block;
}

/* Crew Name & Role Input Section (1 Row per Person + '+' Button) */
.crew-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
}

.crew-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.crew-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.crew-section-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #f8fafc;
}

.crew-section-sub {
  font-size: 9.5px;
  color: #fbbf24;
  font-weight: 600;
}

.btn-add-crew {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-add-crew:active {
  background: #0369a1;
}

.plus-icon {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.crew-rows-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.crew-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.crew-num {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  width: 18px;
  text-align: center;
}

.input-crew-name {
  flex: 1.05;
  min-width: 0;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 7px;
  color: #f8fafc;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

/* Hybrid Role Combobox: Manual Typing + Prominent Arrow Button to Open Popup Listbox */
.role-combo-wrap {
  flex: 1.15;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.input-crew-role {
  width: 100%;
  min-width: 0;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 7px;
  color: #fbbf24;
  padding: 8px 34px 8px 9px;
  font-size: 11.5px;
  font-weight: 700;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.input-crew-name:focus,
.input-crew-role:focus {
  border-color: #0ea5e9;
  background: #0f172a;
}

.btn-role-arrow {
  position: absolute;
  right: 2px;
  top: 2px;
  bottom: 2px;
  width: 30px;
  background: #0f172a;
  border: none;
  border-left: 1px solid #334155;
  border-radius: 0 5px 5px 0;
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-role-arrow:active {
  background: #0284c7;
  color: #ffffff;
}

.btn-remove-crew {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  width: 28px;
  height: 32px;
  border-radius: 7px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-msg {
  font-size: 11.5px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.status-msg.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid #334155;
  background: #0f172a;
}

.btn-modal {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-cancel {
  background: #334155;
  color: #e2e8f0;
  flex: 0.72;
}

.btn-submit {
  background: #1e293b;
  border: 1.5px solid #ef4444;
  color: #ffffff;
}

.btn-submit:active {
  background: #b91c1c;
}

.icon-check-red {
  flex-shrink: 0;
}

.btn-share {
  background: #16a34a;
  color: #ffffff;
}

.btn-modal:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Dedicated Popup Listbox Modal for Easy Role Selection */
.role-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(6px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.role-picker-dialog {
  background: #0f172a;
  border: 1.5px solid #fbbf24;
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
}

.role-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.role-picker-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fbbf24;
}

.role-picker-sub {
  font-size: 10.5px;
  color: #cbd5e1;
  margin-top: 2px;
}

.btn-close-picker {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-picker-search-wrap {
  padding: 10px 14px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.role-picker-search {
  width: 100%;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.role-picker-search:focus {
  border-color: #fbbf24;
}

.role-picker-listbox {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.role-picker-item {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.role-picker-item:hover,
.role-picker-item:active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.role-picker-item-num {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 600;
  margin-right: 8px;
}

.role-picker-item-check {
  color: #fbbf24;
  font-size: 13px;
  font-weight: 900;
}

/* Non-Blocking Toast Banner */
.toast-banner {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  color: #f8fafc;
  padding: 9px 16px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  z-index: 450;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
}
