/* ===========================
   背影合成工坊 — Tool Page Styles
   暗色沉浸 · 金色品牌 · 工具感
   =========================== */

body {
  background: var(--bk);
  color: var(--white);
  animation: none;
}

/* --- Tool Nav --- */
.tool-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
}
.tool-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tool-logo {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
}
.tool-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--w-50);
  transition: color var(--transition);
}
.tool-back:hover { color: var(--gold); }

/* --- Status Banner --- */
.tool-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: all var(--transition);
}
.tool-status.info {
  border-color: rgba(200, 169, 110, 0.25);
  background: rgba(200, 169, 110, 0.06);
}
.tool-status.success {
  border-color: rgba(80, 200, 120, 0.25);
  background: rgba(80, 200, 120, 0.06);
}
.tool-status.error {
  border-color: rgba(230, 90, 90, 0.3);
  background: rgba(230, 90, 90, 0.08);
}
.tool-status.loading {
  border-color: rgba(200, 169, 110, 0.2);
  background: rgba(200, 169, 110, 0.05);
}
.status-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-status.info .status-icon {
  background: rgba(200, 169, 110, 0.15);
  color: var(--gold);
}
.tool-status.success .status-icon {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}
.tool-status.error .status-icon {
  background: rgba(230, 90, 90, 0.15);
  color: #e65a5a;
}
.tool-status.loading .status-icon::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(200, 169, 110, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.status-icon svg {
  width: 14px;
  height: 14px;
}
.status-content {
  flex: 1;
  min-width: 0;
}
.status-title {
  font-size: 0.938rem;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 3px;
}
.status-desc {
  font-size: 0.813rem;
  color: var(--w-50);
  line-height: 1.5;
}
.status-progress {
  margin-top: 10px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.status-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  border-radius: 2px;
  transition: width 0.2s ease;
}
.status-retry {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: var(--radius);
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-size: 0.813rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.status-retry:hover {
  background: var(--gold);
  color: var(--bk);
}

/* --- Technical Logs --- */
.tech-logs {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.tech-logs summary {
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--w-50);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.tech-logs summary:hover { color: var(--gold); }
.tech-logs pre {
  padding: 10px 12px;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(0, 0, 0, 0.35);
  white-space: pre-wrap;
  word-break: break-all;
}
.tech-logs .btn-tool {
  margin: 0 12px 12px;
}

/* --- Compatibility Check --- */
.compat-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.813rem;
  color: var(--w-50);
}
.compat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--w-30);
}
.compat-dot.ok {
  background: #50c878;
  box-shadow: 0 0 6px rgba(80, 200, 120, 0.4);
}
.compat-dot.warn {
  background: #f0ad4e;
  box-shadow: 0 0 6px rgba(240, 173, 78, 0.4);
}
.compat-dot.error {
  background: #e65a5a;
  box-shadow: 0 0 6px rgba(230, 90, 90, 0.4);
}

/* --- Step 2 spacing with compat --- */
#step2 .compat-check + .btn-tool {
  margin-top: 0;
}

/* --- Tool Main --- */
.tool-main {
  min-height: calc(100vh - 56px);
  padding: 48px 0 80px;
}

/* --- Tool Header --- */
.tool-header {
  text-align: center;
  margin-bottom: 56px;
}
.tool-badge {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid rgba(200, 169, 110, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: rgba(200, 169, 110, 0.06);
  margin-bottom: 20px;
}
.tool-header h1 {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--white);
  margin-bottom: 12px;
}
.tool-header p {
  color: var(--w-50);
  font-size: 0.938rem;
  max-width: 480px;
  margin: 0 auto;
}

/* --- Steps --- */
.tool-step {
  margin-bottom: 56px;
}
.step-label {
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* --- Upload Zones --- */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.upload-zone {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--gold);
  background: rgba(200, 169, 110, 0.05);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--w-30);
  text-align: center;
}
.upload-placeholder svg {
  opacity: 0.4;
}
.upload-placeholder span {
  font-size: 0.938rem;
  font-weight: 500;
  color: var(--w-50);
}
.upload-placeholder small {
  font-size: 0.75rem;
  color: var(--w-30);
}
.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-replace {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all var(--transition);
}
.upload-replace:hover {
  background: var(--gold);
  border-color: var(--gold);
}

/* --- Tool Buttons --- */
.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 36px;
  border-radius: var(--radius);
  font-size: 0.938rem;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  font-family: var(--font);
}
.btn-tool:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-lt), var(--gold));
  background-size: 200% 200%;
  color: var(--white);
}
.btn-gold:hover:not(:disabled) {
  background-position: 100% 100%;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(200, 169, 110, 0.4);
}
.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid var(--w-30);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--w-50);
}
.btn-lg {
  padding: 16px 48px;
  font-size: 1rem;
}

/* --- Loading States --- */
.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 0.875rem;
}

/* --- Fusion Overlay (Composition Progress) --- */
.fusion-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 190;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fusion-card {
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.fusion-icon-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fusion-layer {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid rgba(200, 169, 110, 0.35);
}
.fusion-layer-1 {
  background: rgba(200, 169, 110, 0.06);
  animation: fusion-slide-1 2s ease-in-out infinite;
}
.fusion-layer-2 {
  background: rgba(200, 169, 110, 0.12);
  animation: fusion-slide-2 2s ease-in-out infinite;
}
.fusion-layer-3 {
  background: rgba(200, 169, 110, 0.2);
  animation: fusion-slide-3 2s ease-in-out infinite;
}
@keyframes fusion-slide-1 {
  0%, 100% { transform: translate(-10px, -10px) rotate(-3deg); }
  50% { transform: translate(-5px, -5px) rotate(-1deg); }
}
@keyframes fusion-slide-2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(2px, 2px) rotate(1deg); }
}
@keyframes fusion-slide-3 {
  0%, 100% { transform: translate(10px, 10px) rotate(3deg); }
  50% { transform: translate(5px, 5px) rotate(1deg); }
}
.fusion-overlay.error .fusion-layer {
  border-color: rgba(230, 90, 90, 0.35);
  background: rgba(230, 90, 90, 0.06);
  animation: none;
}
.fusion-overlay.error .fusion-layer-1 { transform: translate(-8px, -8px) rotate(-3deg); }
.fusion-overlay.error .fusion-layer-2 { transform: translate(0, 0); }
.fusion-overlay.error .fusion-layer-3 { transform: translate(8px, 8px) rotate(3deg); }
.fusion-percent {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--gold);
  line-height: 1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.fusion-overlay.error .fusion-percent { color: #e65a5a; }
.fusion-stage {
  font-size: 0.938rem;
  color: var(--white);
  font-weight: 500;
  margin-bottom: 20px;
}
.fusion-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}
.fusion-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
}
.fusion-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: ml-shimmer 1.5s ease-in-out infinite;
}
.fusion-overlay.error .fusion-bar-fill {
  background: linear-gradient(90deg, #e65a5a, #c04040);
}
.fusion-overlay.error .fusion-bar-fill::after {
  animation: none;
}
.fusion-desc {
  font-size: 0.813rem;
  color: var(--w-50);
  line-height: 1.6;
  min-height: 24px;
  margin-bottom: 16px;
}
.fusion-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  flex-wrap: wrap;
}
.fusion-steps:empty { display: none; }
.fs-item {
  color: var(--w-30);
  transition: color 0.3s ease;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}
.fs-item.active {
  color: var(--gold);
  font-weight: 500;
  border-color: rgba(200, 169, 110, 0.3);
  background: rgba(200, 169, 110, 0.08);
}
.fs-item.done {
  color: #50c878;
}
.fs-arrow {
  color: var(--w-30);
}
.fusion-retry {
  margin-top: 20px;
  padding: 10px 28px;
  border-radius: var(--radius);
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  font-family: var(--font);
}
.fusion-retry:hover {
  background: var(--gold);
  color: var(--bk);
}

/* --- Model Loading Card --- */
.model-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.model-loading-card {
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.ml-icon-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(200, 169, 110, 0.3);
  animation: ml-pulse 2s ease-out infinite;
}
@keyframes ml-pulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
.ml-icon-core {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(200, 169, 110, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  animation: ml-rotate 4s linear infinite;
}
@keyframes ml-rotate {
  to { transform: rotate(360deg); }
}
.ml-percent {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--gold);
  line-height: 1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.ml-stage {
  font-size: 0.938rem;
  color: var(--white);
  font-weight: 500;
  margin-bottom: 20px;
}
.ml-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}
.ml-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
}
.ml-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: ml-shimmer 1.5s ease-in-out infinite;
}
@keyframes ml-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.ml-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.813rem;
  color: var(--w-50);
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}
.ml-dot-sep {
  color: var(--w-30);
}
.ml-tip {
  font-size: 0.813rem;
  color: var(--w-50);
  line-height: 1.6;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  margin-bottom: 24px;
  transition: opacity 0.3s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-stages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
}
.ml-stage-item {
  color: var(--w-30);
  transition: color 0.3s ease;
}
.ml-stage-item.active {
  color: var(--gold);
  font-weight: 500;
}
.ml-stage-item.done {
  color: #50c878;
}
.ml-stage-arrow {
  color: var(--w-30);
}
/* (legacy loading styles removed — replaced by fusion-overlay) */

/* --- Matting Result --- */
.matting-result {
  margin-top: 24px;
}
.checkerboard {
  display: inline-block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.06) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #111;
}
.checkerboard canvas {
  display: block;
  max-width: 100%;
  max-height: 500px;
}
.matting-hint {
  margin-top: 14px;
  font-size: 0.813rem;
  color: var(--w-50);
  text-align: center;
}

/* --- Composition Canvas --- */
.composition-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.composition-wrap canvas {
  display: block;
  width: 100%;
  cursor: grab;
  touch-action: none;
}
.composition-wrap canvas:active {
  cursor: grabbing;
}
.composition-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--w-50);
  font-size: 0.75rem;
  pointer-events: none;
  white-space: nowrap;
}

/* --- Controls --- */
.controls {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.control-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.control-item > label {
  font-size: 0.875rem;
  color: var(--w-50);
  white-space: nowrap;
}
.control-item input[type="range"] {
  width: 140px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.control-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: transform 0.15s;
  border: none;
}
.control-item input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(200, 169, 110, 0.5);
}
.control-item input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}
.control-value {
  font-size: 0.875rem;
  color: var(--w-70);
  min-width: 40px;
  font-variant-numeric: tabular-nums;
}

/* --- Toggle Switch --- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  transition: var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: var(--transition);
}
.switch input:checked + .toggle-slider {
  background: var(--gold);
}
.switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* --- Result --- */
.result-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.result-wrap canvas {
  display: block;
  width: 100%;
}
.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* --- Tips --- */
.tool-tips {
  margin-top: 64px;
  padding: 24px 28px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
}
.tool-tips h3 {
  font-size: 0.938rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-tips h3::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}
.tool-tips ul {
  list-style: none;
  padding: 0;
}
.tool-tips li {
  font-size: 0.813rem;
  color: var(--w-50);
  line-height: 1.8;
  padding-left: 18px;
  position: relative;
}
.tool-tips li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--gold);
  font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
  .controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .control-item {
    width: 100%;
  }
  .control-item input[type="range"] {
    flex: 1;
    width: auto;
    min-width: 100px;
  }
  .tool-header h1 {
    font-size: 1.5rem;
  }
  .result-actions {
    flex-direction: column;
  }
  .result-actions .btn-tool {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .tool-main {
    padding: 32px 0 64px;
  }
  .tool-header {
    margin-bottom: 40px;
  }
}

/* --- Small Button --- */
.btn-sm {
  padding: 8px 18px;
  font-size: 0.813rem;
  border-radius: var(--radius);
}

/* --- Matting Actions --- */
.matting-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}
.matting-actions .matting-hint {
  margin: 0;
  flex: 1;
}
@media (max-width: 480px) {
  .matting-actions {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}

/* --- Download Group --- */
.download-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.download-format {
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 0.813rem;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}
.download-format:hover {
  border-color: var(--gold);
}
.download-format option {
  background: var(--bk);
  color: var(--white);
}
@media (max-width: 480px) {
  .download-group {
    flex-direction: column;
    width: 100%;
  }
  .download-format {
    width: 100%;
    text-align: center;
  }
}

/* --- Module Error Overlay --- */
.module-error {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.module-error-card {
  text-align: center;
  max-width: 380px;
}
.me-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: rgba(230, 90, 90, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e65a5a;
}
.module-error-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 12px;
  font-family: var(--font-heading);
}
.module-error-card p {
  font-size: 0.875rem;
  color: var(--w-50);
  line-height: 1.6;
  margin-bottom: 8px;
}
.me-hint {
  font-size: 0.75rem !important;
  color: var(--w-30) !important;
}
.module-error-card .btn-tool {
  margin-top: 20px;
}

/* --- Keyboard Focus Styles --- */
.upload-zone:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--gold);
}
