.bb-photo-editor {
  --pe-bg: #091a2b;
  --pe-surface: #122b43;
  --pe-line: #294761;
  --pe-text: #f4faff;
  --pe-muted: #b4cddd;
  --pe-cyan: #57d6fa;
  --pe-orange: #ff8b27;
  color-scheme: dark;
  position: fixed;
  inset: 0;
  width: min(800px, calc(100vw - 32px));
  height: min(850px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--pe-line);
  border-radius: 8px;
  background: var(--pe-bg);
  color: var(--pe-text);
  font-family: var(--font-varela-round, "Varela Round", system-ui, sans-serif);
  box-shadow: 0 22px 80px #020a15aa;
  overflow: hidden;
}
.bb-photo-editor::backdrop { background: #020a15df; }
.bb-photo-editor *, .bb-photo-editor *::before, .bb-photo-editor *::after { box-sizing: border-box; }
.bb-photo-editor [hidden] { display: none !important; }
.bb-photo-editor-shell { display: grid; grid-template-rows: auto minmax(100px, 1fr) auto auto; height: 100%; }
.bb-photo-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: var(--pe-surface); border-bottom: 1px solid var(--pe-line); }
.bb-photo-editor-eyebrow { display: block; color: var(--pe-cyan); font-size: 11px; font-weight: 700; letter-spacing: .12em; margin-bottom: 4px; }
.bb-photo-editor-header h2 { color: var(--pe-text); font-size: 21px; font-weight: 700; line-height: 1.25; margin: 0; }
.bb-photo-editor-destination { color: var(--pe-muted); font-size: 13px; line-height: 1.4; margin: 5px 0 0; overflow-wrap: anywhere; }
.bb-photo-editor button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 44px; padding: 10px 16px; border: 1px solid var(--pe-line); border-radius: 4px; background: var(--pe-surface); color: var(--pe-text); font: 700 15px/1.2 var(--font-varela-round, "Varela Round", system-ui, sans-serif); cursor: pointer; box-shadow: none; transform: none; }
.bb-photo-editor button:active { transform: translateY(1px); filter: brightness(.88); }
.bb-photo-editor button:disabled { opacity: .45; cursor: default; }
.bb-photo-editor button:focus-visible, .bb-photo-editor input:focus-visible, .bb-photo-editor-crop:focus-visible { outline: 3px solid var(--pe-cyan); outline-offset: 3px; }
.bb-photo-editor .bb-photo-editor-close { width: 44px; padding: 0; font: 28px/1 system-ui, sans-serif; }
.bb-photo-editor-stage { display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; overflow: hidden; background: #050f1a; }
.bb-photo-editor-image-wrap { position: relative; flex: none; overflow: hidden; }
.bb-photo-editor-image { width: 100%; height: 100%; display: block; user-select: none; object-fit: fill; }
.bb-photo-editor-loading { color: var(--pe-muted); margin: 16px; font-size: 15px; }
.bb-photo-editor-crop { position: absolute; border: 2px solid var(--pe-cyan); box-shadow: 0 0 0 2000px #010916a6; cursor: grab; touch-action: none; user-select: none; }
.bb-photo-editor-crop.is-dragging { cursor: grabbing; }
.bb-photo-editor-grid { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to right, transparent calc(33.333% - .5px), #e6f8ff66 calc(33.333% - .5px), #e6f8ff66 calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), #e6f8ff66 calc(66.666% - .5px), #e6f8ff66 calc(66.666% + .5px), transparent calc(66.666% + .5px)), linear-gradient(to bottom, transparent calc(33.333% - .5px), #e6f8ff66 calc(33.333% - .5px), #e6f8ff66 calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), #e6f8ff66 calc(66.666% - .5px), #e6f8ff66 calc(66.666% + .5px), transparent calc(66.666% + .5px)); }
.bb-photo-editor .bb-photo-editor-handle { position: absolute; width: 44px; height: 44px; min-height: 44px; padding: 0; background: transparent; border: 0; border-radius: 0; transform: none; touch-action: none; }
.bb-photo-editor-handle::after { content: ""; display: block; width: 12px; height: 12px; background: var(--pe-cyan); border: 2px solid #e9fbff; border-radius: 2px; box-shadow: 0 0 6px #081727; pointer-events: none; }
.bb-photo-editor .bb-photo-editor-handle-nw { left: 0; top: 0; align-items: flex-start; justify-content: flex-start; cursor: nwse-resize; }
.bb-photo-editor .bb-photo-editor-handle-n { left: calc(50% - 22px); top: 0; align-items: flex-start; cursor: ns-resize; }
.bb-photo-editor .bb-photo-editor-handle-ne { right: 0; top: 0; align-items: flex-start; justify-content: flex-end; cursor: nesw-resize; }
.bb-photo-editor .bb-photo-editor-handle-e { right: 0; top: calc(50% - 22px); justify-content: flex-end; cursor: ew-resize; }
.bb-photo-editor .bb-photo-editor-handle-se { right: 0; bottom: 0; align-items: flex-end; justify-content: flex-end; cursor: nwse-resize; }
.bb-photo-editor .bb-photo-editor-handle-s { left: calc(50% - 22px); bottom: 0; align-items: flex-end; cursor: ns-resize; }
.bb-photo-editor .bb-photo-editor-handle-sw { left: 0; bottom: 0; align-items: flex-end; justify-content: flex-start; cursor: nesw-resize; }
.bb-photo-editor .bb-photo-editor-handle-w { left: 0; top: calc(50% - 22px); justify-content: flex-start; cursor: ew-resize; }
.bb-photo-editor-controls { padding: 12px 20px 6px; border-top: 1px solid var(--pe-line); }
.bb-photo-editor-controls > p:first-child { margin: 0 0 10px; color: var(--pe-muted); font-size: 13px; line-height: 1.4; }
.bb-photo-editor-brightness { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.bb-photo-editor-brightness label { font-weight: 700; font-size: 15px; color: var(--pe-text); }
.bb-photo-editor-brightness output { color: var(--pe-cyan); font-size: 14px; font-variant-numeric: tabular-nums; }
.bb-photo-editor-brightness input { grid-column: 1 / -1; width: 100%; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; accent-color: var(--pe-cyan); cursor: pointer; box-shadow: none; }
.bb-photo-editor-result { margin: 0; min-height: 0; color: #ffd2aa; font-size: 13px; line-height: 1.4; }
.bb-photo-editor-result:not(:empty) { margin-top: 5px; }
.bb-photo-editor-footer { display: flex; gap: 10px; padding: 12px 20px max(16px, env(safe-area-inset-bottom)); }
.bb-photo-editor-footer .bb-photo-editor-reset { margin-right: auto; color: var(--pe-cyan); }
.bb-photo-editor-footer .bb-photo-editor-use { background: var(--pe-orange); border-color: var(--pe-orange); color: #151c26; }
@media (max-width: 600px) {
  .bb-photo-editor { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .bb-photo-editor-header { padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
  .bb-photo-editor-header h2 { font-size: 20px; }
  .bb-photo-editor-controls { padding: 12px 16px 6px; }
  .bb-photo-editor-footer { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .bb-photo-editor-footer button { padding: 10px 12px; }
}
@media (max-height: 520px) and (min-width: 601px) {
  .bb-photo-editor-shell { grid-template-columns: minmax(200px, 1fr) 250px; grid-template-rows: auto 1fr auto; }
  .bb-photo-editor-header { grid-column: 1 / -1; padding: 10px 16px; }
  .bb-photo-editor-stage { grid-column: 1; grid-row: 2 / 4; }
  .bb-photo-editor-controls { grid-column: 2; border-top: 0; }
  .bb-photo-editor-footer { grid-column: 2; flex-wrap: wrap; padding: 10px; }
  .bb-photo-editor-footer .bb-photo-editor-reset { width: 100%; margin: 0; }
  .bb-photo-editor-footer .bb-photo-editor-cancel, .bb-photo-editor-footer .bb-photo-editor-use { flex: 1; }
}
