.preview-canvas {
  min-width: 0;
  align-self: start;
  border-radius: 8px;
}
.preview-canvas .picture-wrap {
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
}
.preview-canvas .picture-wrap img {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.wallpaper-preview.phone .detail-picture {
  aspect-ratio: auto;
}
.wallpaper-preview.phone .detail-picture img {
  object-fit: contain;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(calc(100svh - var(--detail-chrome, 152px)), 1600px);
  margin: auto;
}
@media (min-width: 1024px) {
  .wallpaper-preview.phone .detail-picture img {
    object-fit: contain;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(calc(100svh - var(--detail-chrome, 152px)), 1600px);
    margin: auto;
  }
}
@media (min-width: 1440px) {
  .wallpaper-preview.phone .detail-picture img {
    object-fit: contain;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(calc(100svh - var(--detail-chrome, 152px)), 1600px);
    margin: auto;
  }
}
.preview-dialog img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 70svh;
  object-fit: contain;
}
@media (min-width: 1024px) {
  .wallpaper-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .preview-canvas,
  .wallpaper-preview.phone .preview-canvas {
    flex: 1 1 auto;
    min-height: 0;
    align-self: stretch;
    position: relative;
    width: auto;
    margin-inline: 0;
  }
  .preview-canvas .picture-wrap {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: none;
  }
  .preview-canvas picture {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
  }
  .preview-canvas .picture-wrap img,
  .wallpaper-preview.phone .preview-canvas .picture-wrap img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
  }
  .preview-controls {
    flex: 0 0 auto;
  }
}
.download-panel {
  padding: 16px;
  border-radius: 8px;
  box-shadow: none;
}
.wallpaper-metadata {
  margin: 0 0 16px;
}
.metadata-heading {
  font-size: 15px;
  margin: 0 0 12px;
}
.metadata-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  font-size: 13px;
}
.metadata-facts dt {
  color: var(--text-muted);
}
.metadata-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.metadata-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.download-panel-side {
  padding: 12px;
}
.download-panel-side .wallpaper-metadata {
  margin: 0 0 10px;
}
.download-panel-side .metadata-heading {
  font-size: 13.5px;
  margin: 0 0 8px;
}
.crop-dialog {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0;
  max-width: min(520px, 92vw);
  background: var(--surface);
  color: var(--text);
}
.crop-dialog::backdrop {
  background: #0000008c;
}
.crop-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}
.crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.crop-head h2 {
  margin: 0;
  font-size: 17px;
}
.crop-close {
  border: 1px solid var(--control-border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.crop-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.crop-preset {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}
.crop-preset small {
  color: var(--text-muted);
  font-size: 11px;
}
.crop-preset:hover {
  background: var(--surface-raised);
}
.crop-inputs {
  display: flex;
  align-items: end;
  gap: 10px;
}
.crop-inputs label {
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.crop-inputs input {
  width: 110px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.crop-status {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.crop-status[data-state=error] {
  color: #b3372c;
}
.detail-page .detail-side {
  width: 232px;
}
.detail-page .detail-side .side-head {
  text-align: center;
  padding: 4px 0 10px;
}
.detail-page .detail-side .detail-res {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 6px 0 2px;
}
.detail-page .detail-side .detail-similar {
  display: block;
  font-size: 13px;
  color: #2ea8dc;
  text-decoration: none;
  margin: 2px 0;
}
.detail-page .detail-side .detail-similar:hover {
  text-decoration: underline;
}
.detail-page .detail-side .detail-source {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.detail-page .detail-side .detail-palette {
  display: flex;
  gap: 2px;
  height: 18px;
  margin: 6px 0 2px;
  padding: 0;
  list-style: none;
}
.detail-page .detail-side .detail-palette li {
  flex: 1 1 0;
  min-width: 0;
  height: 18px;
  border-radius: 2px;
  background-clip: padding-box;
}
.detail-page .detail-side .detail-flag {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.detail-page .detail-side .side-section {
  border-top: 1px solid var(--hairline);
  padding: 6px 0;
  margin: 0;
}
.detail-page .detail-side .side-section > summary {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.detail-page .detail-side .side-facts {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 4px 8px;
  margin: 8px 0 2px;
}
.detail-page .detail-side .side-facts dt {
  font-size: 12.5px;
  color: var(--text-muted);
}
.detail-page .detail-side .side-facts dd {
  font-size: 12.5px;
  margin: 0;
  color: var(--text);
  display: flex;
  align-items: center;
  min-height: 20px;
  min-width: 0;
  overflow: hidden;
}
.detail-page .detail-side .side-copy {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, .06);
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 12px;
  color: #cfd4d8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-page .detail-side .side-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 2px;
}
.detail-page .detail-side .tool-btn {
  font-size: 12.5px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
}
.detail-page .detail-side .tool-btn:hover {
  background: rgba(255, 255, 255, .14);
}
.detail-page .detail-side .download-panel-side {
  border-top: 1px solid var(--hairline);
  padding: 8px 0 4px;
}
.detail-page .detail-side .download-panel-side .button {
  width: 100%;
  white-space: nowrap;
  font-size: 14px;
  min-height: 42px;
  padding: 0 12px;
}
.detail-page .detail-side .download-panel-side .meta {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 6px 0 0;
}
.detail-page .detail-side .detail-desc-side {
  border-top: 1px solid var(--hairline);
  padding: 8px 0;
}
.detail-page .detail-side .detail-desc p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 6px 0 0;
}
.detail-page .detail-side .side-legal {
  margin: 10px 0 4px;
  padding: 10px;
  background: rgba(255, 255, 255, .045);
  border-radius: 4px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
.detail-page .detail-side .side-legal p {
  margin: 0 0 4px;
}
.detail-page .detail-side .side-legal p:last-child {
  margin-bottom: 0;
}
.detail-page .detail-side .side-legal a {
  color: var(--text-muted);
  text-decoration: underline;
}
.detail-page .detail-side .side-tools-section[open] > summary {
  margin-bottom: 6px;
}
.detail-page .detail-side .side-tools .tool-btn {
  flex: 1 1 auto;
}
.detail-page .detail-side .side-tools .full-preview {
  flex: 1 1 100%;
}
.detail-page .detail-side .side-facts .purity-badge {
  background: none;
  border: 0;
  padding: 0;
  font-weight: 600;
}
.detail-page .detail-side .side-facts .purity-sfw {
  color: #6fd37a;
}
.detail-page .detail-side .side-facts .purity-sketchy {
  color: #e0b64a;
}
.detail-page .detail-side .side-facts .purity-nsfw {
  color: #e0605f;
}
.detail-page .detail-side .side-facts .side-link {
  color: #4ea8de;
  text-decoration: none;
  font-weight: 600;
}
.detail-page .detail-side .side-copy {
  font-size: 11.5px;
  letter-spacing: -.01em;
}
.detail-page .detail-side .side-tools-section .download-panel-side {
  border-top: 0;
  padding: 8px 0 0;
  margin-top: 6px;
}
