.rotate-workspace,
.rotate-workspace * { box-sizing: border-box; }

#rotateWorkspace.rotate-workspace.ig-editor {
  --ig-inspector-width: clamp(250px, 23vw, 324px);
}

.rotate-editor-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  overflow: hidden;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.rotate-editor-brand img {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-right: 7px;
  border-radius: 8px;
  box-shadow: 0 5px 13px rgba(109, 94, 252, .28);
}

.rotate-editor-brand b { color: var(--brand); }
.rotate-editor-title { display: grid; min-width: 0; gap: 2px; }
.rotate-editor-title strong,
.rotate-editor-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rotate-editor-title strong { color: var(--ink); font-size: .9rem; }
.rotate-editor-title span { color: var(--muted); font-size: .7rem; }
.rotate-header-spacer { min-width: 0; flex: 1 1 auto; }
.rotate-head-actions { display: flex; flex: 0 0 auto; gap: 4px; }

.rotate-option-rail { align-items: center; }
.rotate-option-rail[hidden] { display: none !important; }
.rotate-editor-shell.is-single { grid-template-columns: var(--ig-inspector-width) minmax(0, 1fr); }
.rotate-editor-shell.is-single .rotate-inspector { grid-column: 1; }
.rotate-editor-shell.is-single .rotate-stage-section { grid-column: 2; }
.rotate-rail-button {
  display: flex;
  width: 58px;
  min-width: 58px;
  height: 51px;
  min-height: 51px;
  flex: 0 0 51px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  padding: 0 3px;
  font: inherit;
  font-size: .64rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.rotate-rail-button svg { width: 21px; height: 21px; pointer-events: none; }
.rotate-rail-button span { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.rotate-rail-button:hover,
.rotate-rail-button.on {
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  color: var(--brand);
}
.rotate-rail-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.rotate-inspector-head {
  display: flex;
  height: 45px;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}
.rotate-inspector-head strong { color: var(--ink); font-size: .9rem; }
.rotate-inspector-head span { min-width: 0; overflow: hidden; color: var(--muted); font-size: .68rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.rotate-inspector-scroll { height: calc(100% - 45px); min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.rotate-panel { display: grid; min-width: 0; gap: 12px; padding: 14px; }
.rotate-panel[hidden] { display: none !important; }
.rotate-control-heading { display: grid; gap: 4px; }
.rotate-control-heading h2 { margin: 0; color: var(--ink-soft); font-size: .78rem; }
.rotate-control-heading p { margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.45; }

.rotate-transform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.rotate-transform-grid .btn {
  width: 100%;
  min-height: 72px;
  height: auto;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 10px 7px;
  font-size: .72rem;
}
.rotate-transform-grid .btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rotate-transform-grid .btn[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }
.rotate-state { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--dropzone); padding: 10px 12px; }
.rotate-state span { color: var(--muted); font-size: .68rem; }
.rotate-state strong { color: var(--ink-soft); font-size: .78rem; }
.rotate-full-button { width: 100%; justify-content: center; }

.rotate-results { display: grid; min-width: 0; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rotate-file-selection { display: flex; min-width: 0; align-items: center; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--dropzone); padding: 8px 10px; }
.rotate-file-selection label { display: flex; min-width: 0; align-items: center; gap: 9px; color: var(--ink-soft); font-size: .76rem; font-weight: 700; }
.rotate-file-selection input,
.rotate-file-check input { width: 17px; height: 17px; flex: 0 0 17px; accent-color: var(--brand); }
.rotate-file-row { display: grid; min-width: 0; grid-template-columns: 20px minmax(0, 1fr) 30px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 8px; }
.rotate-file-row.is-single-file { grid-template-columns: minmax(0, 1fr) 30px; }
.rotate-file-row.is-active { border-color: color-mix(in srgb, var(--brand) 62%, var(--line)); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.rotate-file-check { display: flex; min-height: 40px; align-items: center; justify-content: center; }
.rotate-file-focus { display: grid; min-width: 0; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 9px; border: 0; background: transparent; color: var(--ink-soft); padding: 0; text-align: left; cursor: pointer; touch-action: manipulation; }
.rotate-file-focus:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.rotate-file-focus img { display: block; width: 40px; height: 40px; grid-row: 1 / span 2; border: 1px solid var(--line); border-radius: 6px; background: var(--dropzone); object-fit: cover; }
.rotate-file-name { overflow: hidden; align-self: end; font-size: .76rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.rotate-file-status { overflow: hidden; align-self: start; color: var(--muted); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.rotate-file-status.is-ready { color: var(--ok); }
.rotate-file-status.is-error { color: #ef4444; }
.rotate-file-remove { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink-soft); padding: 0; font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; touch-action: manipulation; }
.rotate-file-remove:hover { border-color: #ef4444; color: #ef4444; }

.rotate-export-panel .btn { width: 100%; min-height: 42px; justify-content: center; }
.rotate-export-panel .btn[hidden] { display: none; }
.rotate-auto-note { color: var(--muted); font-size: .72rem; text-align: center; }
.rotate-stage-section { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; background: var(--dropzone); }
.rotate-stage { --rotate-stage-pad: 22px; position: relative; min-width: 0; min-height: 0; flex: 1 1 auto; overflow: hidden; background: repeating-conic-gradient(rgba(128,128,128,.13) 0 25%, transparent 0 50%) 50% / 18px 18px; }
#rotatePreview { position: absolute; inset: var(--rotate-stage-pad); display: block; width: calc(100% - 44px); height: calc(100% - 44px); object-fit: contain; filter: drop-shadow(0 14px 19px rgba(20,24,50,.2)); }
.rotate-preview-meta { min-height: 36px; margin: 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 9px 14px; font-size: .75rem; text-align: center; }

@media (max-width: 640px) {
  .rotate-editor-shell.is-single { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) var(--ig-inspector-height); }
  .rotate-editor-shell.is-single .rotate-stage-section { grid-column: 1; grid-row: 1; }
  .rotate-editor-shell.is-single .rotate-inspector { grid-column: 1; grid-row: 2; }
  .rotate-option-rail { align-items: stretch; }
  .rotate-editor-brand { font-size: 0; }
  .rotate-editor-brand img { width: 32px; height: 32px; flex-basis: 32px; margin-right: 0; }
  .rotate-editor-title { display: none; }
  .rotate-stage { --rotate-stage-pad: 10px; }
  #rotatePreview { width: calc(100% - 20px); height: calc(100% - 20px); }
  .rotate-inspector-head { height: 39px; padding: 0 12px; }
  .rotate-inspector-scroll { height: calc(100% - 39px); }
  .rotate-panel { padding: 12px; }
  .rotate-rail-button { width: auto; min-width: 44px; flex: 1 1 44px; }
  .rotate-transform-grid .btn { min-height: 54px; flex-direction: row; }
  .rotate-preview-meta { min-height: 38px; padding: 6px 10px; font-size: .69rem; }
}

@media (max-width: 420px) {
  .rotate-rail-button span { display: none; }
  .rotate-rail-button { min-width: 40px; flex-basis: 40px; }
}

@media (max-width: 640px) and (max-height: 480px) {
  #rotateWorkspace.rotate-workspace.ig-editor { --ig-inspector-height: min(180px, 32dvh); }
  .rotate-preview-meta { display: none; }
}
