/* Mobile Dedicated Styles for text-remover */
:root {
  --primary: #ef4444;
}

/* Multi-Tool Suite Navigation Tabs (Mobile 2x2 Grid) */
.suite-tabs-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto 0.75rem auto;
  padding: 0 0.25rem;
}
.suite-tabs-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.suite-tab-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.suite-tab-item svg {
  flex-shrink: 0;
  stroke: currentColor;
}
.suite-tab-item:active {
  background: rgba(255, 255, 255, 0.6);
}
.suite-tab-item.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.suite-tab-item.active svg {
  stroke: #ef4444;
}

/* Studio Card Container */
.m-studio-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  max-width: 480px;
  margin: 0 auto;
}

/* Mobile AI Light Sweep Showcase (Unified 350px Stage) */
.ai-scan-stage {
  position: relative;
  width: 100% !important;
  max-width: 350px !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto 0.75rem auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  user-select: none;
  background: #ffffff;
  cursor: pointer;
}

.ai-scan-clean-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #ffffff;
}
.ai-scan-clean-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ai-scan-text-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  animation: aiTextWipe 5.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: clip-path, opacity;
}
.ai-scan-text-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ai-scan-beam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  z-index: 5;
  pointer-events: none;
  animation: aiBeamSweep 5.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: left, opacity;
}

.ai-scan-beam-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: 70px;
  pointer-events: none;
}

@keyframes aiTextWipe {
  0%, 15% { clip-path: inset(0 0 0 0); opacity: 1; }
  45% { clip-path: inset(0 0 0 100%); opacity: 1; }
  75% { clip-path: inset(0 0 0 100%); opacity: 1; }
  85% { clip-path: inset(0 0 0 100%); opacity: 0; }
  90% { clip-path: inset(0 0 0 0); opacity: 0; }
  96%, 100% { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes aiBeamSweep {
  0%, 14% { left: 0%; opacity: 0; }
  15% { left: 0%; opacity: 1; }
  45% { left: 100%; opacity: 1; }
  48%, 100% { left: 100%; opacity: 0; }
}

/* Dedicated Upload Action Row Below Demo Showcase */
.m-stage-upload-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0.85rem auto 0.5rem auto;
  width: 100%;
  max-width: 350px;
}

.m-stage-upload-row.is-hidden,
#mStageUploadRow[style*="display: none"],
#mStageUploadRow[style*="display:none"] {
  display: none !important;
}

.m-btn-upload-primary {
  width: 100% !important;
  height: 46px !important;
  min-height: 46px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #0f172a !important;
  border-radius: 10px !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.15s ease !important;
  -webkit-tap-highlight-color: transparent !important;
}

.m-btn-upload-primary:active {
  transform: scale(0.99) !important;
  background: #1e293b !important;
}

.m-upload-hint {
  font-size: 0.72rem !important;
  color: #94a3b8 !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
}

/* Canvas Viewport */
.m-canvas-wrap {
  width: 100% !important;
  max-width: 350px !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  background: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-canvas-wrap .canvas-layers-box {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.m-canvas-wrap #baseImageCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.m-canvas-wrap #maskOverlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: none;
}
.brush-cursor-ring {
  position: absolute;
  border: 2px solid rgba(239, 68, 68, 0.95);
  background: rgba(239, 68, 68, 0.25);
  border-radius: 50%;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
  z-index: 40;
  will-change: left, top, width, height;
}

/* Unified In-Canvas Processing Overlay */
.canvas-processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 1rem;
  text-align: center;
  border-radius: inherit;
  pointer-events: auto;
  user-select: none;
}
.processing-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: inpaintSpinnerSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes inpaintSpinnerSpin {
  to { transform: rotate(360deg); }
}
.processing-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.processing-tip {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 260px;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Operations Dock / Toolbar */
.m-toolbar {
  background: #f8fafc;
  border-radius: 14px;
  padding: 0.8rem;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Brush Control Box */
.m-brush-control-box {
  background: #ffffff;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.m-brush-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.m-brush-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}
.m-brush-label svg {
  stroke: #ef4444;
}
.brush-val {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ef4444;
  font-family: monospace;
}
.m-brush-slider-row input[type="range"] {
  width: 100%;
  accent-color: #ef4444;
  cursor: pointer;
}
.m-brush-presets-row {
  display: flex;
  gap: 6px;
}
.brush-chip {
  flex: 1;
  padding: 4px 6px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}
.brush-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.brush-chip:active {
  transform: scale(0.96);
}

/* Tool Actions */
.m-btn-group {
  display: flex;
  gap: 6px;
}
.m-action-pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.m-action-pill svg {
  flex-shrink: 0;
}
.m-action-pill:active {
  background: #f1f5f9;
  transform: scale(0.97);
}

/* Primary Execution Buttons */
.m-cta-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.m-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #0f172a !important;
  padding: 10px 14px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.m-btn-primary:active {
  transform: scale(0.99);
  background: #1e293b !important;
}
.m-btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  padding: 10px 14px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.m-btn-export:active {
  transform: scale(0.99);
  background: #f8fafc !important;
}
