.resource-pack-editor-site {
  min-height: 100vh;
}

.rpe-shell {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100vw - 48px));
  margin: 28px auto 56px;
  color: #f8fbff;
}

.resource-pack-editor-site [hidden],
.rpe-import[hidden],
.rpe-browser[hidden],
.rpe-editor[hidden] {
  display: none !important;
}

.rpe-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.rpe-actions,
.rpe-editor-actions,
.rpe-tool-actions,
.rpe-view-actions,
.rpe-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rpe-button,
.rpe-tool-grid button {
  border: 1px solid rgba(255, 215, 106, .28);
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff8d6;
  background: rgba(8, 11, 17, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.rpe-button:hover,
.rpe-tool-grid button:hover {
  border-color: rgba(255, 215, 106, .62);
  background: rgba(255, 215, 106, .12);
}

.rpe-button:active,
.rpe-tool-grid button:active {
  transform: translateY(1px);
}

.rpe-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.rpe-button-primary,
.rpe-tool-grid button.is-active {
  color: #1b1402;
  border-color: rgba(255, 226, 126, .92);
  background: linear-gradient(180deg, #fff1a8, #ffd45a);
  box-shadow: 0 14px 30px rgba(255, 205, 72, .18);
}

.rpe-button-ghost {
  color: #d7e1ee;
  border-color: rgba(255, 255, 255, .16);
}

.rpe-import {
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: min(620px, calc(100vh - 230px));
  padding: clamp(34px, 7vh, 88px) 16px 34px;
}

.rpe-import-copy {
  width: min(820px, 100%);
  min-width: 0;
  margin-bottom: 24px;
}

.rpe-import-copy p {
  margin: 0 0 10px;
  color: #ffd76a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.rpe-import-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.rpe-import-copy span {
  display: block;
  max-width: 760px;
  color: rgba(231, 238, 247, .74);
  line-height: 1.75;
}

.tool-app-body .rpe-dropzone {
  display: grid;
  min-width: 0;
  white-space: normal;
  word-break: normal;
}

.rpe-dropzone {
  width: min(820px, 100%);
  min-height: clamp(180px, 24vh, 240px);
  border: 1px dashed rgba(255, 215, 106, .45);
  border-radius: 18px;
  color: #f8fbff;
  background:
    linear-gradient(135deg, rgba(255, 215, 106, .08), transparent 42%),
    rgba(3, 6, 10, .62);
  cursor: pointer;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 24px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.rpe-dropzone.is-dragover {
  border-color: rgba(255, 235, 139, .92);
  background: rgba(255, 215, 106, .13);
}

.rpe-upload-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: #ffd76a;
  background: rgba(255, 215, 106, .1);
}

.rpe-upload-icon .site-link-icon {
  width: 24px;
  height: 24px;
}

.rpe-dropzone strong {
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.15;
}

.rpe-dropzone span:not(.rpe-upload-icon),
.rpe-dropzone em {
  color: rgba(231, 238, 247, .75);
  font-style: normal;
  line-height: 1.55;
}

.rpe-message {
  width: min(820px, 100%);
  margin: 16px 0 0;
  min-height: 24px;
  color: #ffd76a;
  font-weight: 800;
}

.rpe-message.is-error {
  color: #ff7d7d;
}

.rpe-browser,
.rpe-editor {
  border: 1px solid rgba(255, 215, 106, .16);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(14, 19, 27, .94), rgba(5, 8, 13, .9)),
    rgba(5, 8, 13, .92);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .36);
  backdrop-filter: blur(16px);
}

.rpe-browser {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  align-content: start;
}

.rpe-summary {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(360px, auto);
  gap: 18px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  padding: 16px;
  background: rgba(4, 7, 12, .58);
}

.rpe-pack-head {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.rpe-pack-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}

.rpe-pack-head span {
  color: #ffd76a;
  font-weight: 800;
}

.rpe-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(106px, 1fr));
  gap: 10px;
  margin: 0;
}

.rpe-summary dl div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 13px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, .24);
}

.rpe-summary dt,
.rpe-summary dd {
  margin: 0;
}

.rpe-summary dt {
  color: rgba(231, 238, 247, .68);
  font-size: 12px;
}

.rpe-summary dd {
  color: #ffe27e;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.rpe-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  color: rgba(231, 238, 247, .82);
  font-size: 13px;
  font-weight: 800;
}

.rpe-progress i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}

.rpe-progress b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff1a8, #ffd45a);
}

.rpe-library {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rpe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 0;
}

.rpe-search {
  display: grid;
  gap: 8px;
  flex: 0 1 340px;
  color: rgba(231, 238, 247, .72);
  font-size: 13px;
  font-weight: 800;
}

.rpe-search input,
.rpe-field input[type="range"] {
  min-width: 0;
}

.rpe-search input,
.rpe-field input[type="color"] {
  border: 1px solid rgba(255, 215, 106, .22);
  border-radius: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .32);
}

.rpe-search input {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
}

.rpe-filter-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 420px;
  min-width: 0;
}

.rpe-filter-list button {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  color: rgba(231, 238, 247, .8);
  background: rgba(255, 255, 255, .06);
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.rpe-filter-list button.is-active {
  color: #1b1402;
  border-color: rgba(255, 226, 126, .9);
  background: linear-gradient(180deg, #fff1a8, #ffd45a);
}

.rpe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  justify-content: start;
  gap: 14px;
  min-height: 0;
}

.rpe-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: 18px;
  min-height: 250px;
  display: grid;
  place-items: center;
  color: rgba(231, 238, 247, .72);
  text-align: center;
}

.tool-app-body .rpe-texture-card {
  display: grid;
  align-items: stretch;
  justify-content: initial;
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow: hidden;
}

.rpe-texture-card {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  padding: 9px;
  background: rgba(5, 8, 13, .72);
  cursor: pointer;
  text-align: left;
  color: #f8fbff;
  font: inherit;
  gap: 8px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.rpe-texture-card:hover,
.rpe-texture-card.is-current {
  border-color: rgba(255, 215, 106, .62);
  background: rgba(255, 215, 106, .07);
  transform: translateY(-1px);
}

.rpe-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 11px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: #151a22;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .08) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.rpe-thumb img {
  display: block;
  width: 82%;
  height: 82%;
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0;
}

.rpe-thumb.is-loaded img {
  opacity: 1;
}

.rpe-thumb-status {
  position: absolute;
  inset: auto 8px 8px;
  overflow: hidden;
  color: rgba(231, 238, 247, .56);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rpe-thumb.is-loaded .rpe-thumb-status {
  display: none;
}

.rpe-thumb.is-error .rpe-thumb-status {
  color: #ff9a9a;
}

.rpe-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.rpe-card-meta,
.rpe-card-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(231, 238, 247, .64);
  font-size: 11px;
}

.rpe-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rpe-card-badges span {
  border-radius: 999px;
  padding: 4px 7px;
  color: #1b1402;
  background: #ffd76a;
  font-size: 11px;
  font-weight: 900;
}

.rpe-card-badges .is-muted {
  color: rgba(231, 238, 247, .82);
  background: rgba(255, 255, 255, .1);
}

.rpe-pagination {
  justify-content: center;
  margin-top: 2px;
  color: rgba(231, 238, 247, .76);
  font-weight: 800;
}

.rpe-editor {
  padding: 18px;
  min-height: calc(100dvh - 260px);
  display: flex;
  flex-direction: column;
}

.rpe-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 16px;
}

.rpe-editor-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.rpe-editor-head strong,
.rpe-editor-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rpe-editor-head strong {
  font-size: 22px;
}

.rpe-editor-head span {
  color: rgba(231, 238, 247, .66);
}

.rpe-editor-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 18px;
  align-items: stretch;
}

.rpe-canvas-panel,
.rpe-tool-panel {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  background: rgba(0, 0, 0, .26);
}

.rpe-canvas-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rpe-canvas-viewport {
  position: relative;
  flex: 1;
  min-height: clamp(360px, calc(100dvh - 360px), 560px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background-color: #121820;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .055) 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  cursor: crosshair;
  touch-action: none;
}

.rpe-canvas-wrap {
  --rpe-pixel-size: 16px;
  --rpe-pan-x: 0px;
  --rpe-pan-y: 0px;
  --rpe-checker-size: clamp(8px, calc(var(--rpe-pixel-size) / 2), 18px);
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 106, .24);
  border-radius: 12px;
  background-color: #171c24;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .1) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .1) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .1) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .1) 75%);
  background-position: 0 0, 0 var(--rpe-checker-size), var(--rpe-checker-size) calc(var(--rpe-checker-size) * -1), calc(var(--rpe-checker-size) * -1) 0;
  background-size: calc(var(--rpe-checker-size) * 2) calc(var(--rpe-checker-size) * 2);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .34);
  transform: translate(var(--rpe-pan-x), var(--rpe-pan-y));
  transform-origin: 0 0;
}

.rpe-canvas-viewport.is-panning {
  cursor: grabbing;
}

.rpe-canvas-viewport.is-space {
  cursor: grab;
}

.rpe-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  background: transparent;
}

.rpe-canvas-wrap.is-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .2) 1px, transparent 1px);
  background-size: var(--rpe-pixel-size) var(--rpe-pixel-size);
}

.rpe-canvas-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  color: rgba(231, 238, 247, .72);
  font-size: 13px;
  font-weight: 800;
}

.rpe-zoom-readout {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  border: 1px solid rgba(255, 215, 106, .22);
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff3b0;
  background: rgba(0, 0, 0, .46);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}

.rpe-tool-panel {
  height: fit-content;
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.rpe-tool-panel h2 {
  margin: 0;
  color: #ffd76a;
  font-size: 18px;
}

.rpe-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rpe-tool-grid button {
  border-radius: 14px;
  padding-inline: 10px;
}

.rpe-field {
  display: grid;
  gap: 8px;
  color: rgba(231, 238, 247, .76);
  font-size: 13px;
  font-weight: 800;
}

.rpe-field input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
}

.rpe-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(231, 238, 247, .78);
  font-weight: 800;
}

.rpe-view-actions {
  align-items: stretch;
}

.rpe-view-actions .rpe-button {
  flex: 1 1 130px;
  justify-content: center;
}

.rpe-hint {
  margin: 0;
  color: rgba(231, 238, 247, .66);
  line-height: 1.7;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .rpe-summary,
  .rpe-editor-body {
    grid-template-columns: 1fr;
  }

  .rpe-summary dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .rpe-shell {
    width: min(100% - 24px, 1280px);
    margin-top: 22px;
  }

  .rpe-topbar,
  .rpe-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .rpe-import {
    padding: 26px 0;
  }

  .rpe-browser,
  .rpe-editor {
    padding: 12px;
    min-height: auto;
  }

  .rpe-dropzone {
    min-height: 190px;
  }

  .rpe-summary dl {
    grid-template-columns: 1fr;
  }

  .rpe-grid {
    grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  }

  .tool-app-body .rpe-texture-card {
    max-width: none;
  }

  .rpe-canvas-panel {
    padding: 12px;
  }

  .rpe-canvas-viewport {
    min-height: 360px;
  }
}
