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

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  background: #1a1a1a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- views ---------- */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.15s ease-in;
}

.view[hidden] {
  display: none !important;
}

/* ---------- loading spinner ---------- */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 24px;
}

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

/* ---------- login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-sub {
  color: #888;
  font-size: 16px;
  margin-bottom: 40px;
}

/* ---------- landing page ---------- */
.landing-page {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #0a0a14;
  position: relative;
}

.landing-page::before,
.landing-page::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: 180px;
  pointer-events: none;
  z-index: 0;
}

.landing-page::before {
  left: 0;
  background:
    linear-gradient(170deg, rgba(0, 212, 255, 0.35) 0%, transparent 40%),
    linear-gradient(200deg, rgba(16, 185, 129, 0.30) 30%, transparent 70%),
    linear-gradient(160deg, rgba(236, 72, 153, 0.20) 60%, transparent 90%);
  filter: blur(40px);
}

.landing-page::after {
  right: 0;
  background:
    linear-gradient(190deg, rgba(139, 92, 246, 0.35) 0%, transparent 40%),
    linear-gradient(210deg, rgba(236, 72, 153, 0.30) 30%, transparent 70%),
    linear-gradient(170deg, rgba(0, 212, 255, 0.20) 60%, transparent 90%);
  filter: blur(40px);
}

@media (max-width: 600px) {
  .landing-page::before,
  .landing-page::after {
    width: 60px;
    filter: blur(30px);
  }
}

.landing-hero,
.landing-features,
.landing-details,
.landing-footer {
  position: relative;
  z-index: 1;
}

.landing-hero {
  text-align: center;
  padding: 80px 24px 48px;
  max-width: 800px;
  margin: 0 auto;
}

.landing-title {
  font-size: 44px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
}

.landing-title-brand {
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #ff6bf0, #ff6b6b);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hue-shift 8s linear infinite;
}

@keyframes hue-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.landing-tagline {
  font-size: 22px;
  color: #00d4ff;
  font-weight: 500;
  margin-bottom: 16px;
}

.landing-desc {
  font-size: 17px;
  color: #999;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* ---------- features ---------- */
.landing-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 24px 48px;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .landing-hero {
    padding: 48px 20px 32px;
  }

  .landing-title {
    font-size: 32px;
  }

  .landing-tagline {
    font-size: 18px;
  }

  .landing-desc {
    font-size: 15px;
  }

  .landing-features {
    grid-template-columns: 1fr;
    padding: 0 20px 32px;
  }

  .landing-details {
    padding: 32px 20px;
  }

  .landing-section-title {
    font-size: 22px;
  }

  .landing-pricing {
    padding: 32px 20px;
  }
}

.landing-feature {
  background: #222;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.feature-icon {
  margin-bottom: 12px;
}

.feature-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 15px;
  color: #888;
  line-height: 1.5;
}

/* ---------- pricing ---------- */
.landing-pricing {
  padding: 48px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.landing-section-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
}

.pricing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .pricing-cards {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  background: #222;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #333;
}

.pricing-card-premium {
  border-color: #00d4ff;
}

.pricing-tier {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.pricing-price {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.pricing-once {
  font-size: 13px;
  font-weight: 400;
  color: #888;
}

.pricing-list {
  list-style: none;
  padding: 0;
}

.pricing-list li {
  font-size: 15px;
  color: #ccc;
  padding: 5px 0;
  padding-left: 18px;
  position: relative;
}

.pricing-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00d4ff;
}

.pricing-list-heading {
  font-weight: 600;
  color: #00d4ff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 12px;
  padding-left: 0 !important;
}

.pricing-list-heading::before {
  display: none !important;
}

/* ---------- landing details ---------- */
.landing-details {
  padding: 48px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.detail-group {
  margin-bottom: 32px;
  text-align: center;
}

.detail-group-title {
  font-size: 19px;
  font-weight: 700;
  color: #00d4ff;
  margin-bottom: 8px;
}

.detail-group-desc {
  font-size: 16px;
  color: #999;
  line-height: 1.6;
  margin-bottom: 12px;
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.detail-chip {
  font-size: 13px;
  color: #ccc;
  background: #2a2a2a;
  padding: 6px 14px;
  border-radius: 20px;
}

/* ---------- landing footer ---------- */
.landing-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid #2a2a2a;
}

.landing-legal {
  color: #666;
  font-size: 13px;
  text-decoration: none;
}

.landing-legal:hover {
  color: #888;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: #333;
  font-size: 16px;
  font-weight: 500;
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
}

.btn-google:active {
  background: #eee;
}

/* ---------- user avatar ---------- */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-connected {
  background: #1a3a2a;
  color: #4ecb71;
  border-color: #2a5a3a;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #222;
  min-height: 48px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  color: #00d4ff;
  font-size: 24px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-icon:active {
  opacity: 0.6;
}

/* ---------- video / canvas ---------- */
video, .main-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #111;
}

.main-canvas {
  touch-action: none;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: #1a1a1a;
  position: relative;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 28px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  min-height: 48px;
  min-width: 48px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.95);
  opacity: 0.8;
}

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}


.btn-primary {
  background: #00d4ff;
  color: #000;
}

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

.btn-secondary {
  background: #333;
  color: #fff;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 36px;
  border-radius: 8px;
}

.btn-danger {
  background: #ff4444;
  color: #fff;
}

/* Shutter button */
.btn-round {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 0;
  background: #fff;
}

.shutter {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #1a1a1a;
  background: #fff;
}

.btn-round:active .shutter {
  background: #ccc;
}

/* Icon-only button (toolbar) */
.btn-icon-action {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
}

/* ---------- project list ---------- */
.project-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.project-card {
  display: flex;
  align-items: center;
  background: #2a2a2a;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.project-card:active {
  background: #333;
}

.project-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.project-thumb.loaded {
  opacity: 1;
  animation: none;
}

.project-info {
  flex: 1;
  margin-left: 16px;
}

.project-name {
  font-size: 16px;
  font-weight: 600;
}

.project-dims {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* ---------- delete section in edit ---------- */
.delete-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #333;
  display: flex;
  justify-content: flex-end;
}

.delete-section[hidden] {
  display: none !important;
}

.empty-state {
  text-align: center;
  color: #666;
  padding: 60px 20px;
  font-size: 16px;
}

.free-limit-msg {
  text-align: center;
  color: #888;
  font-size: 13px;
  padding: 16px 20px;
  line-height: 1.5;
}

.free-limit-msg a {
  color: #00d4ff;
  text-decoration: none;
  font-weight: 600;
}

.free-limit-msg a:active {
  opacity: 0.7;
}

/* ---------- modal ---------- */
.modal-backdrop {
  display: none;
}

.modal-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.modal-heading {
  display: none;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

@media (min-width: 640px) {
  #setup-step-1 {
    padding: 0;
    justify-content: center;
    align-items: center;
    background: none;
  }

  #setup-step-1 .modal-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
  }

  #setup-step-1 .modal-card {
    position: relative;
    flex: none;
    width: 440px;
    max-width: 90vw;
    background: #2a2a2a;
    border-radius: 16px;
    border: 1px solid #444;
    padding: 32px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    z-index: 1;
  }

  #setup-step-1 .modal-heading {
    display: block;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
  }

  #view-setup:has(#setup-step-1:not([hidden])) > .topbar {
    display: none;
  }
}

/* ---------- setup / forms ---------- */
.setup-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.setup-step[hidden] {
  display: none !important;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #888;
  margin-bottom: 6px;
}

.preset-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preset-row .input {
  flex: 1;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.input {
  width: 100%;
  padding: 12px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  outline: none;
}

.input:focus {
  border-color: #00d4ff;
}

/* ---------- profile ---------- */
.profile-content {
  padding: 24px 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .profile-content {
    padding: 40px 32px;
  }

  .profile-section {
    max-width: none;
  }

  .profile-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .profile-btn {
    flex: 1;
    min-width: 180px;
  }

  .profile-btn-danger {
    flex: 0;
    min-width: 180px;
    margin-top: 0;
  }
}

.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 12px;
}

.profile-name {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.profile-email {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}

.profile-stat {
  text-align: center;
}

.profile-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.profile-stat-label {
  font-size: 12px;
  color: #666;
}

.profile-section {
  margin-bottom: 24px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 14px;
}

.profile-row-label {
  color: #666;
}

.profile-row-value {
  color: #ccc;
}

.profile-input {
  background: #111;
  color: #ccc;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  text-align: right;
  width: 180px;
}

.profile-input:focus {
  border-color: #00d4ff;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  border-radius: 10px;
}

.profile-btn-danger {
  background: transparent;
  color: #e05050;
  border: 1px solid #4a2a2a;
  margin-top: 20px;
}

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-box {
  background: #222;
  border-radius: 14px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
}

.modal-body {
  font-size: 15px;
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-input-wrap {
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: #111;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.modal-input:focus {
  border-color: #00d4ff;
}

.modal-buttons {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-btn-cancel {
  background: #333;
  color: #ccc;
}

.modal-btn-confirm {
  background: #00d4ff;
  color: #000;
}

.modal-btn-danger {
  background: #e05050;
  color: #fff;
}

.hub-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #555;
  font-size: 15px;
  padding: 40px;
}

/* ---------- canvas frame ---------- */
.canvas-frame-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 0;
}

.canvas-frame {
  position: relative;
  background: #fff;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  border: 2px solid #444;
}

.ref-image {
  position: absolute;
  transform-origin: 0 0;
  pointer-events: none;
}

.ref-sliders {
  padding: 8px 20px;
  background: #222;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.ref-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.ref-slider-row .slider {
  flex: 1;
  min-width: 0;
}

.ref-slider-row .slider-label {
  min-width: 48px;
}

/* ---------- sliders ---------- */
.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #444;
  border-radius: 2px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #00d4ff;
  cursor: pointer;
}

/* ---------- compare controls ---------- */
.compare-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #222;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}


.slider-label {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
}

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 50;
  backdrop-filter: blur(2px);
}

.sheet-backdrop[hidden] {
  display: none !important;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: #222;
  border-radius: 16px 16px 0 0;
  z-index: 51;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease-out;
}

.bottom-sheet[hidden] {
  display: none !important;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  margin: 8px auto;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  padding: 4px 16px 12px;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.sheet-count {
  font-size: 13px;
  color: #888;
  margin-right: 8px;
}

.captures-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 0 2px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.capture-grid-item {
  position: relative;
  aspect-ratio: 4/3;
  background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}

.capture-grid-item:has(img[src]) {
  animation: none;
  background: #333;
}

.capture-grid-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-grid-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #444;
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.capture-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-grid-item.selected {
  outline: 2px solid #00d4ff;
  outline-offset: -2px;
}

.capture-grid-date {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 5px;
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,0.6);
  text-align: center;
}

/* ---------- export menu ---------- */
.export-menu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 12px;
  overflow: hidden;
  z-index: 40;
  min-width: 200px;
}

.export-menu[hidden] {
  display: none !important;
}

.export-menu-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.export-menu-item:active {
  background: #333;
}

.export-menu-item:not(:last-child) {
  border-bottom: 1px solid #333;
}

.export-menu-item:disabled {
  color: #666;
  pointer-events: none;
}

/* ---------- capture badge ---------- */
.btn-badge {
  position: relative;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #00d4ff;
  color: #000;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- delete toast ---------- */
.delete-toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 60;
  font-size: 15px;
}

.delete-toast .btn-danger {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 36px;
  border-radius: 8px;
}

/* ---------- spinner overlay ---------- */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.spinner-box {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  color: #fff;
  font-size: 15px;
}

.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid #444;
  border-top-color: #00d4ff;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- detect status ---------- */
.detect-status {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  text-align: center;
  color: #00d4ff;
  font-size: 14px;
  z-index: 20;
  pointer-events: none;
}

/* ---------- progress ---------- */
.progress-wrap {
  position: absolute;
  bottom: 90px;
  left: 20px;
  right: 20px;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
  z-index: 10;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: #00d4ff;
  transition: width 0.1s;
}

/* ---------- no camera fallback ---------- */
.no-camera {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: #888;
  font-size: 18px;
}

/* ---------- GIF progress (legacy, used by export) ---------- */
.gif-progress {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 24px 36px;
  border-radius: 12px;
  font-size: 16px;
  z-index: 100;
  text-align: center;
}

/* ---------- analysis legend ---------- */
.analysis-legend {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 8px;
  padding: 6px 10px;
}

.analysis-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.analysis-legend-item:hover,
.analysis-legend-item.active {
  background: rgba(255, 255, 255, 0.2);
}

.analysis-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---------- analysis strip ---------- */
.analysis-strip {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}

.analysis-strip::-webkit-scrollbar {
  display: none;
}

@media (min-width: 500px) {
  .analysis-strip {
    flex-wrap: wrap;
  }
}

.analysis-strip .btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  min-height: 44px;
  flex-shrink: 0;
}

/* ---------- toggle button ---------- */
.btn-toggle {
  transition: background 0.15s;
}

.btn-toggle.active {
  background: #00d4ff;
  color: #000;
}

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .captures-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .captures-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ---------- publish form ---------- */
.publish-form {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.publish-preview {
  width: 100%;
  height: 160px;
  background: #222;
  border-radius: 12px;
  margin-bottom: 20px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.publish-label {
  display: block;
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
  margin-top: 16px;
}

.publish-input {
  width: 100%;
  padding: 12px;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.publish-input:focus {
  outline: none;
  border-color: #00d4ff;
}

select.publish-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' fill='none' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.publish-dims {
  font-size: 16px;
  color: #ccc;
  padding: 12px;
  background: #222;
  border-radius: 8px;
}


.publish-actions {
  margin-top: 24px;
}

.publish-divider {
  text-align: center;
  color: #555;
  font-size: 12px;
  margin: 16px 0;
  position: relative;
}

.publish-divider span {
  background: #1a1a1a;
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

.publish-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #333;
}

/* ---------- publish warning + wallet ---------- */
.publish-warning {
  margin-top: 28px;
  padding: 16px;
  background: #2a1a1a;
  border: 1px solid #4a2a2a;
  border-radius: 10px;
}

.publish-warning-title {
  font-size: 14px;
  font-weight: 700;
  color: #e05050;
  margin-bottom: 6px;
}

.publish-warning-text {
  font-size: 13px;
  color: #b08080;
  line-height: 1.5;
}

.publish-wallet-section {
  margin-top: 24px;
  text-align: center;
}

.publish-wallet-status {
  font-size: 13px;
  color: #888;
  margin-bottom: 14px;
}

.publish-wallet-status.connected {
  color: #4ecb71;
  font-weight: 600;
}

.publish-wallet-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  border-radius: 12px;
}

/* ---------- published bar ---------- */
.published-bar {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: #1a1a1a;
  text-align: center;
  position: relative;
  z-index: 1;
}

.published-actions-panel {
  padding: 20px 20px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.published-label {
  font-size: 13px;
  font-weight: 600;
  color: #4ecb71;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.published-url-row {
  display: flex;
  gap: 8px;
}

.published-url {
  flex: 1;
  font-size: 13px;
  padding: 10px 12px;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
}

/* ---------- published split layout ---------- */
/* ---------- published split layout ---------- */
.hub-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-published .topbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.view-published .topbar-title {
  color: #222;
}

.view-published .btn-icon {
  color: #333;
}

.hub-main-published {
  overflow-y: auto;
  background: #f5f5f5;
}

.hub-main-published .canvas-frame-wrap {
  background: #f5f5f5;
}

.hub-sidebar {
  overflow-y: auto;
}

@media (min-width: 768px) {
  .hub-main-published {
    display: flex;
    flex-direction: row;
    overflow: hidden;
  }

  .hub-main-published > .canvas-frame-wrap {
    flex: 1;
  }

  .hub-main-published > .hub-sidebar {
    width: 380px;
    flex-shrink: 0;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ---------- published artwork details ---------- */
.published-details {
  padding: 20px 20px;
  background: #fff;
  color: #333;
  position: relative;
  z-index: 1;
}


.pub-detail-artist {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin-bottom: 16px;
}

.pub-detail-specs {
  display: flex;
  flex-direction: column;
}

.pub-spec {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #e8e8e8;
  color: #333;
}

.pub-spec-label {
  color: #999;
}

.pub-progress {
  margin-top: 20px;
}

.pub-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.capture-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.capture-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
}

.capture-track::-webkit-scrollbar {
  display: none;
}

.capture-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
}

.capture-slide img {
  width: 100%;
  max-height: 400px;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}

.capture-date {
  text-align: center;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.capture-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.capture-arrow {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}

.capture-arrow:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.capture-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.capture-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s;
}

.capture-dot.active {
  background: #4ea8ff;
}

.published-nft-info {
  margin-bottom: 12px;
}

.nft-detail {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.nft-pending {
  color: #e0a030;
}

.nft-link {
  font-size: 12px;
  color: #4ea8ff;
  text-decoration: none;
}

.nft-link:hover {
  text-decoration: underline;
}

.project-published-badge {
  font-size: 11px;
  font-weight: 600;
  color: #4ecb71;
  margin-top: 4px;
}

.published-url {
  cursor: default;
  user-select: all;
}

.published-url:focus {
  border-color: #555;
}

/* ---------- 3D viewer (published hub) ---------- */
.viewer-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.viewer-clip {
  width: 100%;
  height: 350px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 0;
  isolation: isolate;
  margin-bottom: 16px;
}

.hub-artwork-viewer {
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  --poster-color: transparent;
}

@media (min-width: 768px) {
  .hub-main-published .viewer-clip {
    height: calc(100vh - 80px);
  }
}

.viewer-loading {
  text-align: center;
  color: #666;
  padding: 40px 0;
  font-size: 14px;
}
