.photo-editor {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  margin: auto;
  border: 1px solid var(--line, #cfc2b5);
  border-radius: 22px;
  background: var(--paper, #fcf9f5);
  color: var(--ink, #2d2a23);
  box-shadow: 0 24px 100px #21191445;
  overscroll-behavior: contain;
}
.photo-editor::backdrop { background: #21191499; }
.photo-editor button { font: 600 12px/1.35 var(--ui, Arial, sans-serif); }
.photo-editor button:disabled { cursor: default; }
.photo-editor__header { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 21px 24px 14px; }
.photo-editor__eyebrow { margin: 0 0 6px; color: var(--warm); font-size: 10px; text-transform: uppercase; letter-spacing: .11em; }
.photo-editor__header h2 { margin: 0; font: 500 clamp(26px, 5vw, 35px)/1.12 var(--serif, Georgia, serif); letter-spacing: -.025em; }
.photo-editor__icon { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; }
.photo-editor svg { width: 20px; height: 20px; flex-shrink: 0; }
.photo-editor__body { padding: 0 24px 16px; }
.photo-editor__hint { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0 0 14px; max-width: 58ch; }
.photo-editor__stage { display: flex; justify-content: center; align-items: center; padding: 12px; border-radius: 14px; background: #e9e1d9; overflow: hidden; }
.photo-editor__frame { position: relative; flex-shrink: 0; overflow: hidden; background: #fff; box-shadow: 0 4px 18px #21191420; }
.photo-editor__frame canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.photo-editor__frame canvas:active { cursor: grabbing; }
.photo-editor__frame:focus-within { outline: 2px solid var(--warm); outline-offset: 4px; }
.photo-editor__grid, .photo-editor__corners { position: absolute; inset: 0; pointer-events: none; }
.photo-editor__grid { background: linear-gradient(to right, transparent calc(33.333% - .5px), #fff7 33.333%, transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), #fff7 66.666%, transparent calc(66.666% + .5px)), linear-gradient(to bottom, transparent calc(33.333% - .5px), #fff7 33.333%, transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), #fff7 66.666%, transparent calc(66.666% + .5px)); }
.photo-editor__corners { border: 1px solid #fff9; }
.photo-editor__gesture { text-align: center; color: var(--muted); font-size: 10px; line-height: 1.5; margin: 8px 0 16px; }
.photo-editor__formats { border: 0; padding: 0; margin: 0 0 15px; }
.photo-editor__formats legend, .photo-editor__zoom label { font-size: 12px; font-weight: 650; margin-bottom: 7px; }
.photo-editor__formats > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.photo-editor__formats button { min-height: 44px; border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 6px 8px; }
.photo-editor__formats button[aria-pressed="true"] { background: var(--soft); border-color: var(--rose-border); box-shadow: inset 0 0 0 1px var(--rose-border); }
.photo-editor__zoom { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.photo-editor__zoom label { margin: 0; }
.photo-editor__zoom output { color: var(--warm); font-size: 12px; font-variant-numeric: tabular-nums; }
.photo-editor__zoom input { width: 100%; grid-column: 1 / -1; accent-color: var(--warm); min-height: 38px; cursor: pointer; margin: 0; }
.photo-editor__tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 7px; }
.photo-editor__position { display: flex; gap: 5px; }
.photo-editor__position .photo-editor__icon { border-radius: 9px; }
.photo-editor__rotate { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: transparent; padding: 8px 11px; }
.photo-editor__reset { margin-left: auto; min-height: 44px; border: 0; padding: 6px 0; background: transparent; text-decoration: underline; text-underline-offset: 4px; color: var(--warm); }
.photo-editor__status { font-size: 12px; color: #833e3d; margin: 10px 0 0; }
.photo-editor__status:empty { display: none; }
.photo-editor__privacy { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 14px 0 0; }
.photo-editor__footer { position: sticky; bottom: 0; display: flex; gap: 10px; background: var(--paper); border-top: 1px solid var(--line); padding: 14px 24px max(14px, env(safe-area-inset-bottom)); }
.photo-editor__footer button { min-height: 48px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; }
.photo-editor__cancel { background: transparent; }
.photo-editor__apply { display: flex; align-items: center; justify-content: center; gap: 9px; flex: 1; background: var(--rose); border-color: var(--rose-border) !important; }
@media (hover: hover) {
  .photo-editor button:not(:disabled):hover { background: var(--soft); }
  .photo-editor__apply:not(:disabled):hover { background: #e8b3b2; }
}
@media (max-width: 480px) {
  .photo-editor { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .photo-editor__header { padding: max(17px, env(safe-area-inset-top)) 16px 12px; gap: 8px; }
  .photo-editor__body { padding-inline: 16px; }
  .photo-editor__footer { padding-inline: 16px; gap: 7px; }
  .photo-editor__footer button { padding-inline: 10px; }
  .photo-editor__tools { gap: 8px; }
  .photo-editor__position { gap: 3px; }
  .photo-editor__rotate { padding-inline: 8px; }
}
@media (max-width: 360px) {
  .photo-editor__header h2 { font-size: 25px; }
  .photo-editor__position { flex: 1 0 100%; justify-content: space-between; }
  .photo-editor__gesture { font-size: 9px; }
  .photo-editor__footer button { font-size: 11px; }
}
