.avi-pick-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(2, 6, 23, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.avi-pick-backdrop[hidden] { display: none !important; }
.avi-pick-panel {
  width: min(980px, 100%);
  max-height: 96vh;
  overflow: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  font-family: system-ui, Segoe UI, Arial, sans-serif;
  color: #e2e8f0;
}
.avi-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 8px;
  border-bottom: 1px solid #1e293b;
}
.avi-pick-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.avi-pick-sub {
  margin: 0;
  padding: 0 16px 10px;
  font-size: 13px;
  color: #94a3b8;
}
.avi-pick-body {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 12px;
  padding: 12px 16px 16px;
}
@media (max-width: 760px) { .avi-pick-body { grid-template-columns: 1fr; } }
.avi-pick-stage-wrap {
  position: relative;
  background: #020617;
  border-radius: 10px;
  border: 1px solid #1e293b;
  min-height: 320px;
  overflow: auto;
  touch-action: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.avi-pick-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}
.avi-pick-crop {
  position: absolute;
  border: 2px solid #fb923c;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.55);
  cursor: move;
  box-sizing: border-box;
  min-width: 36px;
  min-height: 36px;
  touch-action: none;
}
.avi-pick-crop[hidden] { display: none !important; }
.avi-pick-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #fb923c;
  border-radius: 2px;
  box-sizing: border-box;
  z-index: 2;
}
.avi-pick-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.avi-pick-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.avi-pick-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.avi-pick-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.avi-pick-handle.n { left: 50%; top: -7px; margin-left: -7px; cursor: ns-resize; }
.avi-pick-handle.s { left: 50%; bottom: -7px; margin-left: -7px; cursor: ns-resize; }
.avi-pick-handle.e { right: -7px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.avi-pick-handle.w { left: -7px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.avi-pick-side { display: flex; flex-direction: column; gap: 8px; }
.avi-pick-btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #1e40af;
  color: #fff;
}
.avi-pick-btn:hover { filter: brightness(1.08); }
.avi-pick-btn.is-on { outline: 2px solid #38bdf8; }
.avi-pick-btn-ghost { background: #1e293b; color: #e2e8f0; }
.avi-pick-btn-auto { background: linear-gradient(135deg, #059669, #047857); }
.avi-pick-btn-ai { background: linear-gradient(135deg, #ec4899, #db2777); }
.avi-pick-btn-go { background: linear-gradient(135deg, #ea580c, #c2410c); margin-top: 4px; }
.avi-pick-btn:disabled { opacity: 0.55; cursor: wait; }
.avi-pick-meta { font-size: 12px; color: #94a3b8; line-height: 1.45; min-height: 3em; }
.avi-pick-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #cbd5e1; }
.avi-pick-range {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  font-size: 12px;
  color: #cbd5e1;
}
.avi-pick-range input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #38bdf8;
}
.avi-pick-tools {
  display: grid;
  gap: 6px;
}
.avi-pick-tools[hidden] {
  display: none !important;
}
.avi-pick-tools .avi-tool.is-on {
  outline: 2px solid #38bdf8;
  background: #0ea5e9;
  color: #0f172a;
}
.avi-pick-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.78);
  font-size: 14px;
  z-index: 5;
  border-radius: 10px;
}
.avi-pick-loading[hidden] { display: none !important; }
.avi-pick-close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}
