.rotate-app {
  padding-top: 8px;
  padding-bottom: 24px;
  min-width: 0;
}
.rotate-document {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 19px;
}
.rotate-file-icon {
  display: grid;
  place-items: center;
  width: 57px;
  height: 67px;
  background: var(--soft);
  color: var(--brand);
  border-radius: 13px;
  font-size: 29px;
  flex-shrink: 0;
}
.rotate-document-copy {
  min-width: 0;
  flex: 1;
}
.rotate-document h2 {
  font-size: 17px;
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.rotate-document p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 9px;
}
.rotation-controls {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  margin: 24px 0;
}
.rotation-controls-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}
.rotation-controls h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
  margin: 4px 0 0;
}
.rotation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rotation-actions > .m-btn {
  flex: 1;
  min-height: 48px;
}
.rotation-scope {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 19px;
  margin-top: 20px;
}
.rotation-scope .m-field {
  min-width: 160px;
  flex: 1;
}
.rotation-help {
  color: var(--muted);
  font-size: 11px;
  flex: 1;
  margin: 0 0 9px;
  min-width: 180px;
}
.rotation-error {
  color: #b7354d;
  font-size: 12px;
  margin: 0;
  width: 100%;
  order: 2;
}
.dark .rotation-error {
  color: #ffb8c6;
}
.pages-workspace {
  margin-bottom: 27px;
}
.page-selection {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  margin-bottom: 18px;
}
.range-select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
}
.range-select-label input {
  min-width: 0;
  width: 125px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  padding: 10px;
  font: inherit;
  min-height: 40px;
}
.rotation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.rotation-page {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.rotation-page.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.rotation-thumbnail {
  display: block;
  position: relative;
  width: 100%;
  height: 178px;
  background: var(--soft);
  overflow: hidden;
  border-radius: 0;
}
.rotation-thumbnail:focus-visible {
  outline-offset: -4px;
}
.rotation-thumbnail img {
  position: absolute;
  left: 50%;
  top: 50%;
  box-shadow: 0 3px 12px #12192c20;
  transition: transform 0.22s;
  max-width: none;
  object-fit: contain;
  transform-origin: center;
}
.rotation-thumbnail .bi {
  font-size: 35px;
  color: var(--muted);
  opacity: 0.6;
}
.rotation-thumb-error {
  padding: 15px;
  font-size: 11px;
  color: var(--muted);
}
.rotation-page-details {
  padding: 13px;
}
.rotation-page-label {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 12px;
  font-weight: 650;
  min-height: 32px;
}
.rotation-page-label input {
  accent-color: var(--brand);
  width: 19px;
  height: 19px;
  margin: 0;
  flex-shrink: 0;
}
.rotation-page-label .page-number {
  flex: 1;
}
.rotation-page-indicator {
  font-size: 10px;
  font-weight: 500;
  color: var(--brand);
}
.rotation-orientation {
  font-size: 10px;
  color: var(--muted);
  margin: 5px 0 11px;
}
.rotation-page-buttons {
  display: flex;
  gap: 7px;
  justify-content: space-between;
}
.rotation-page-buttons button {
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--brand);
  background: var(--surface);
  font-size: 17px;
}
.rotation-page-buttons button:hover {
  background: var(--soft);
}
.rotation-grid.small {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.rotation-grid.small .rotation-thumbnail {
  height: 125px;
}
.rotation-grid.large {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.rotation-grid.large .rotation-thumbnail {
  height: 240px;
}
.rotation-grid.list {
  grid-template-columns: 1fr;
}
.rotation-grid.list .rotation-page {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
}
.rotation-grid.list .rotation-thumbnail {
  height: 130px;
}
.rotation-grid.list .rotation-page-details {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.rotation-grid.list .rotation-page-label {
  min-width: 160px;
  flex: 1;
}
.rotation-grid.list .rotation-orientation {
  margin: 0;
}
.rotation-grid.list .rotation-page-buttons {
  gap: 9px;
}
.rotation-preservation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 12px;
}
.rotation-preservation span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rotation-preservation i {
  color: var(--brand);
}
.rotate-app .unsupported {
  margin-top: 20px;
}
.rotate-apply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  margin: 24px 0 0;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
}
.rotate-apply-bar strong {
  font-size: 14px;
}
.rotate-apply-bar p {
  font-size: 11px;
  color: var(--muted);
  margin: 7px 0 0;
}
.rotate-app .result-stats {
  flex-wrap: wrap;
  gap: 25px;
}
.rotation-preview {
  scroll-margin-top: 18px;
}
.preview-edit-actions {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}
.preview-edit-actions .m-segment {
  margin-left: auto;
}
.rotation-preview-paper {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: 780px;
  min-height: 280px;
  padding: 18px;
  margin-top: 18px;
}
.rotation-preview-stage {
  position: relative;
  margin: auto;
  min-width: 1px;
  min-height: 1px;
}
.rotation-preview-stage canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center;
  box-shadow: 0 3px 16px #1113;
  transition: transform 0.22s;
}
.rotate-app .m-btn {
  min-height: 44px;
}
.rotate-app .m-btn.small {
  min-height: 40px;
}
.rotate-app #preview-status {
  font-size: 12px;
  color: var(--muted);
}
.rotate-app #output-filename {
  max-width: 100%;
}
.rotate-app #filename-preview {
  overflow-wrap: anywhere;
}
.rotate-app .engine-status {
  min-height: 45px;
}
.rotate-app .engine-status.ready {
  color: var(--muted);
}
.rotate-app button:disabled {
  cursor: not-allowed;
}
.rotate-app #range-error:empty {
  display: none;
}
@media (min-width: 760px) {
  .rotate-apply-bar {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    box-shadow: 0 8px 24px #17213d10;
  }
}
@media (max-width: 1000px) {
  .rotation-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rotation-grid.small {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .rotation-grid.large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rotate-document {
    flex-wrap: wrap;
  }
  .rotate-document > .m-toolbar {
    width: 100%;
  }
  .rotation-actions > .m-btn {
    flex: 1 1 40%;
  }
}
@media (max-width: 600px) {
  .rotate-app {
    padding-left: 18px;
    padding-right: 18px;
  }
  .rotation-controls {
    padding: 17px;
  }
  .rotation-controls-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .rotation-controls h2 {
    font-size: 21px;
  }
  .rotation-actions > .m-btn {
    font-size: 11px;
    padding: 10px 8px;
  }
  .rotation-scope {
    gap: 12px;
  }
  .rotation-help {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }
  .rotation-grid,
  .rotation-grid.small {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
  .rotation-grid.large {
    grid-template-columns: 1fr;
  }
  .rotation-grid.large .rotation-thumbnail {
    height: 280px;
  }
  .rotation-thumbnail {
    height: 155px;
  }
  .rotation-page-details {
    padding: 9px;
  }
  .rotation-page-label {
    font-size: 11px;
    gap: 7px;
  }
  .rotation-page-label input {
    width: 22px;
    height: 22px;
  }
  .rotation-page-buttons button {
    min-width: 44px;
    min-height: 44px;
    font-size: 17px;
  }
  .rotation-grid.list .rotation-page {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  .rotation-grid.list .rotation-page-details {
    display: block;
  }
  .rotation-grid.list .rotation-page-label {
    min-width: 0;
  }
  .rotation-grid.list .rotation-orientation {
    margin: 7px 0;
  }
  .rotation-grid.list .rotation-thumbnail {
    height: 155px;
  }
  .rotation-grid.list .rotation-page-buttons {
    justify-content: flex-start;
  }
  .rotation-preservation {
    grid-template-columns: 1fr;
  }
  .rotate-apply-bar {
    padding: 18px;
    flex-direction: column;
    align-items: stretch;
  }
  .rotate-apply-bar .m-btn {
    min-width: 0;
    font-size: 13px;
    padding: 15px 12px;
  }
  .rotate-document {
    padding: 16px;
    gap: 12px;
  }
  .rotate-file-icon {
    width: 43px;
    height: 53px;
    font-size: 24px;
  }
  .rotate-document h2 {
    font-size: 14px;
  }
  .rotate-document .m-toolbar {
    gap: 7px;
  }
  .rotate-document .m-btn {
    font-size: 11px;
    padding: 8px;
  }
  .range-select-label {
    width: 100%;
    margin: 4px 0 0;
    flex: 1;
  }
  .range-select-label input {
    width: 100%;
  }
  .preview-edit-actions .m-segment {
    margin-left: 0;
  }
  .rotation-preview-paper {
    padding: 10px;
  }
  .rotate-app .result-actions {
    flex-direction: column;
  }
  .rotate-app .result-stats strong {
    font-size: 18px;
  }
  .rotate-app .m-btn.small {
    min-height: 44px;
  }
  .rotation-grid.hide-numbers .page-number {
    display: none;
  }
}
@media (max-width: 360px) {
  .rotation-grid,
  .rotation-grid.small {
    grid-template-columns: 1fr;
  }
}
