/* AI Background Remover Scoped CSS */
:root {
  --aibr-primary: #7c3aed;
  --aibr-primary-hover: #6d28d9;
  --aibr-primary-border: #a78bfa;
  --aibr-bg: #f8fafc;
  --aibr-card-bg: #ffffff;
  --aibr-border: #e2e8f0;
  --aibr-text: #0f172a;
  --aibr-muted: #64748b;
  --aibr-badge-bg: #ede9fe;
  --aibr-badge-text: #6d28d9;
  --aibr-ring: rgba(124, 58, 237, 0.25);
}

.aibr-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  color: var(--aibr-text);
  font-family: inherit;
}

.aibr-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.aibr-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Upload Card */
.aibr-upload-card {
  background: var(--aibr-card-bg);
  border: 1px solid var(--aibr-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.aibr-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.aibr-drop-zone {
  flex: 2 1 360px;
  border: 2px dashed var(--aibr-border);
  border-radius: 10px;
  background: var(--aibr-bg);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  position: relative;
}

.aibr-drop-zone:hover {
  border-color: var(--aibr-primary);
  background: var(--aibr-badge-bg);
}

.aibr-drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.aibr-drop-icon {
  font-size: 2rem;
  color: var(--aibr-primary);
}

.aibr-drop-title {
  font-size: 0.95rem;
  color: var(--aibr-text);
}

.aibr-drop-hint {
  font-size: 0.8rem;
  color: var(--aibr-muted);
}

.aibr-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.aibr-presets-group {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aibr-presets-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--aibr-muted);
}

.aibr-presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.aibr-preset-btn {
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--aibr-border);
  border-radius: 6px;
  background: var(--aibr-bg);
  color: var(--aibr-text);
  cursor: pointer;
  transition: all 0.2s;
}

.aibr-preset-btn:hover {
  border-color: var(--aibr-primary);
  color: var(--aibr-primary);
}

.aibr-preset-btn.active {
  background: var(--aibr-badge-bg);
  color: var(--aibr-badge-text);
  border-color: var(--aibr-primary);
  font-weight: 600;
}

/* Workspace Grid */
.aibr-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .aibr-workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Preview Panel */
.aibr-preview-panel {
  background: var(--aibr-card-bg);
  border: 1px solid var(--aibr-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.aibr-panel-head {
  margin-bottom: 0.85rem;
}

.aibr-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--aibr-text);
}

.aibr-panel-subtitle {
  font-size: 0.8rem;
  color: var(--aibr-muted);
}

.aibr-canvas-wrapper {
  background: repeating-conic-gradient(#e2e8f0 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--aibr-border);
  border-radius: 8px;
  overflow: hidden;
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.aibr-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.aibr-canvas-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.aibr-btn {
  height: 44px;
  padding: 0 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.aibr-btn-primary {
  background: var(--aibr-primary);
  color: #ffffff;
  border: 1px solid var(--aibr-primary);
}

.aibr-btn-primary:hover {
  background: var(--aibr-primary-hover);
}

.aibr-btn-secondary {
  background: var(--aibr-bg);
  color: var(--aibr-text);
  border: 1px solid var(--aibr-border);
}

.aibr-btn-secondary:hover {
  border-color: var(--aibr-primary);
  color: var(--aibr-primary);
}

/* Controls Panel */
.aibr-controls-panel {
  background: var(--aibr-card-bg);
  border: 1px solid var(--aibr-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.aibr-control-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aibr-control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--aibr-text);
}

.aibr-backdrop-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.aibr-backdrop-btn {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--aibr-border);
  background: var(--aibr-bg);
  color: var(--aibr-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.aibr-backdrop-btn:hover {
  border-color: var(--aibr-primary);
}

.aibr-backdrop-btn.active {
  background: var(--aibr-badge-bg);
  color: var(--aibr-badge-text);
  border-color: var(--aibr-primary);
  font-weight: 600;
}

.aibr-bg-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-block;
}

.aibr-swatch-checkers {
  background: repeating-conic-gradient(#94a3b8 0% 25%, #ffffff 0% 50%) 50% / 8px 8px;
  border: 1px solid var(--aibr-border);
}

.aibr-bg-name {
  line-height: 1;
}

.aibr-slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.aibr-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aibr-slider-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--aibr-primary);
}

.aibr-range {
  width: 100%;
  accent-color: var(--aibr-primary);
  height: 6px;
  cursor: pointer;
}

.aibr-info-card {
  background: var(--aibr-bg);
  border: 1px solid var(--aibr-border);
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.825rem;
  line-height: 1.4;
}

.aibr-info-title {
  color: var(--aibr-text);
  display: block;
  margin-bottom: 0.2rem;
}

.aibr-info-desc {
  color: var(--aibr-muted);
  margin: 0;
}

/* Toast */
.aibr-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 9999;
}

.aibr-toast-show {
  opacity: 1;
  transform: translateY(0);
}

/* Ad Slot Container (Strict min-height: 280px) */
.aibr-ad-container {
  min-height: 280px;
  background: var(--aibr-bg);
  border: 1px dashed var(--aibr-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem 0;
  color: var(--aibr-muted);
  font-size: 0.85rem;
}

/* Related Tools Grid */
.aibr-related-section {
  margin: 2rem 0;
}

.aibr-related-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--aibr-text);
}

.aibr-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.aibr-related-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem;
  background: var(--aibr-card-bg);
  border: 1px solid var(--aibr-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--aibr-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.aibr-related-card:hover {
  border-color: var(--aibr-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.aibr-related-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--aibr-primary);
}

.aibr-related-desc {
  font-size: 0.825rem;
  line-height: 1.4;
  color: var(--aibr-muted);
}
/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --aibr-primary: #a281da;
  --aibr-primary-hover: #a481da;
  --aibr-primary-border: #9781da;
  --aibr-bg: var(--tf-surface);
  --aibr-card-bg: var(--tf-surface);
  --aibr-border: var(--tf-surface);
  --aibr-text: var(--tf-ink);
  --aibr-muted: var(--tf-ink-faint);
  --aibr-badge-bg: var(--tf-surface);
  --aibr-badge-text: #a481da;
}
