.cover-maker-site {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

@font-face {
  font-family: "MinecraftCover";
  src: url("/downloads/MinecraftBold-nMK1.otf") format("opentype");
  font-display: swap;
}

.cover-maker-site {
  --cover-bg: #05070c;
  --cover-panel: rgba(10, 13, 19, .9);
  --cover-panel-strong: rgba(14, 18, 27, .96);
  --cover-line: rgba(255, 255, 255, .08);
  --cover-line-strong: rgba(255, 255, 255, .14);
  --cover-text: #eef5ff;
  --cover-muted: #94a2b8;
  --cover-soft: #5f6f86;
  --cover-accent: #ffd76a;
  --cover-accent-2: #f5b93f;
  --cover-accent-3: #a87518;
  --cover-accent-soft: rgba(255, 215, 106, .16);
  --cover-accent-border: rgba(255, 215, 106, .35);
  --cover-accent-glow: rgba(255, 196, 70, .28);
  --cover-cyan: #ffe6a3;
  --cover-gold: var(--cover-accent);
  min-height: 100vh;
}

.cover-maker-site .base-bg {
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 215, 106, .12), transparent 34%),
    radial-gradient(circle at 78% 16%, rgba(245, 185, 63, .09), transparent 30%),
    linear-gradient(180deg, rgba(4, 7, 14, .96), rgba(3, 4, 8, .98));
}

.cover-maker-site[style*="--section-background-image"] .base-bg {
  background-image:
    linear-gradient(180deg, rgba(3, 5, 10, .68), rgba(3, 5, 10, .94)),
    var(--section-background-image);
  background-position: center;
  background-size: cover;
}

.cover-maker-site .media-bg {
  filter: brightness(.48) contrast(.92) saturate(.86);
}

.cover-maker-site .dim-bg {
  background:
    linear-gradient(90deg, rgba(4, 7, 17, .72), rgba(4, 9, 19, .5) 48%, rgba(4, 7, 17, .72)),
    linear-gradient(180deg, rgba(2, 4, 10, .26), rgba(3, 0, 10, .72));
}

.cover-maker-workbench {
  position: relative;
  z-index: 1;
  width: min(1880px, calc(100vw - 20px));
  min-height: calc(100vh - 96px);
  margin: 28px auto 24px;
  color: var(--cover-text);
}

.cover-maker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--cover-line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(14, 19, 29, .82), rgba(5, 8, 14, .72)),
    rgba(5, 7, 12, .76);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
  backdrop-filter: blur(20px);
}

.toolbar-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-title p {
  margin: 0 6px 0 0;
  color: var(--cover-text);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .02em;
}

.cover-primary,
.cover-ghost,
.cover-danger,
.stage-tools button,
.layer-actions button,
.section-title button,
.text-tool-row button,
.background-actions button,
.zoom-tools button,
.asset-categories button {
  appearance: none;
  min-height: 38px;
  border: 1px solid var(--cover-line);
  border-radius: 12px;
  color: var(--cover-text);
  background: rgba(255, 255, 255, .055);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.cover-primary {
  padding: 0 18px;
  color: #2b1b05;
  border-color: rgba(255, 239, 167, .58);
  background: linear-gradient(180deg, #ffefa7 0%, var(--cover-accent) 45%, var(--cover-accent-2) 100%);
  box-shadow: 0 12px 30px var(--cover-accent-glow), inset 0 1px 0 rgba(255, 255, 255, .42);
}

.cover-ghost,
.cover-danger {
  padding: 0 16px;
}

.cover-danger {
  width: 100%;
  color: #ffcfce;
  border-color: rgba(255, 99, 99, .22);
  background: rgba(255, 99, 99, .08);
}

.cover-primary:hover,
.cover-ghost:hover,
.cover-danger:hover,
.stage-tools button:hover,
.layer-actions button:hover,
.section-title button:hover,
.text-tool-row button:hover,
.background-actions button:hover,
.zoom-tools button:hover,
.asset-categories button:hover,
.asset-categories button.active {
  transform: translateY(-1px);
  color: #fff3c4;
  border-color: var(--cover-accent-border);
  background: linear-gradient(180deg, rgba(255, 215, 106, .22), rgba(168, 117, 24, .2));
  box-shadow: 0 12px 26px rgba(20, 22, 36, .34), 0 0 20px rgba(255, 196, 70, .12);
}

.cover-primary:hover {
  color: #2b1b05;
  border-color: rgba(255, 239, 167, .72);
  background: linear-gradient(180deg, #fff4b8 0%, #ffdd79 45%, var(--cover-accent-2) 100%);
  box-shadow: 0 14px 32px var(--cover-accent-glow), inset 0 1px 0 rgba(255, 255, 255, .48);
}

.cover-editor-grid {
  display: grid;
  grid-template-columns: clamp(340px, 19vw, 400px) minmax(860px, 1fr) clamp(330px, 18vw, 400px);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}

.cover-panel,
.cover-stage-panel {
  border: 1px solid var(--cover-line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(18, 23, 34, .9), rgba(7, 10, 16, .9)),
    rgba(8, 10, 16, .92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .36), inset 0 0 0 1px rgba(255, 255, 255, .03);
  backdrop-filter: blur(18px);
}

.cover-panel {
  height: clamp(620px, calc(100vh - 164px), 920px);
  max-height: calc(100vh - 136px);
  overflow: hidden;
}

.cover-assets-panel,
.cover-inspector-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.panel-heading,
.stage-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-kicker {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--cover-cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.panel-heading h1,
.stage-head h2,
.section-title h2 {
  margin: 0;
  color: var(--cover-text);
  font-size: 19px;
  line-height: 1.2;
}

.panel-count,
.section-title span {
  display: inline-flex;
  min-width: 36px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  color: var(--cover-gold);
  background: rgba(255, 255, 255, .045);
  font-size: 12px;
  font-weight: 900;
}

.cover-search {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--cover-muted);
  font-size: 12px;
  font-weight: 800;
}

.cover-search input,
.property-grid input,
.property-grid select,
.wide-field select,
.wide-field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  color: var(--cover-text);
  background: rgba(2, 5, 10, .72);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.cover-search input,
.property-grid input,
.property-grid select,
.wide-field select {
  padding: 0 11px;
}

.wide-field textarea {
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.5;
}

.cover-search input:focus,
.property-grid input:focus,
.property-grid select:focus,
.wide-field select:focus,
.wide-field textarea:focus {
  border-color: var(--cover-accent-border);
  box-shadow: 0 0 0 3px var(--cover-accent-soft);
}

.property-grid input[type="color"] {
  padding: 5px;
}

.property-grid input[type="range"] {
  padding: 0;
  accent-color: var(--cover-accent);
}

.asset-local-import {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
}

.asset-local-import .cover-primary {
  min-height: 36px;
  padding: 0 14px;
}

.asset-local-import span {
  min-width: 0;
  color: var(--cover-muted);
  font-size: 12px;
  line-height: 1.35;
}

.library-source-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 15px;
  background: rgba(1, 4, 9, .56);
}

.library-source-tabs button {
  appearance: none;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  color: var(--cover-muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.library-source-tabs button:hover {
  transform: translateY(-1px);
  color: #fff3c4;
  border-color: var(--cover-accent-border);
  background: linear-gradient(180deg, rgba(255, 215, 106, .16), rgba(168, 117, 24, .14));
}

.library-source-tabs button.active {
  color: #2b1b05;
  border-color: rgba(255, 239, 167, .58);
  background: linear-gradient(180deg, #ffefa7 0%, var(--cover-accent) 45%, var(--cover-accent-2) 100%);
  box-shadow: 0 12px 28px var(--cover-accent-glow), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.asset-category-shell {
  display: grid;
  gap: 0;
  margin: 10px 0 10px;
}

.asset-category-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  color: var(--cover-text);
  background: rgba(2, 5, 10, .72);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.asset-category-toggle strong {
  color: var(--cover-gold);
}

.asset-category-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .18s ease;
}

.asset-category-shell.is-open .asset-category-caret {
  transform: rotate(225deg) translate(-2px, -2px);
}

.asset-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height .18s ease, margin-top .18s ease;
}

.asset-category-shell.is-open .asset-categories {
  max-height: 180px;
  margin-top: 8px;
  overflow: auto;
  padding-right: 2px;
}

.asset-categories button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--cover-muted);
  font-size: 12px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
  overflow: auto;
  min-height: 0;
  padding: 2px 4px 12px 0;
  scrollbar-color: rgba(255, 215, 106, .45) rgba(255, 255, 255, .05);
}

.asset-loading,
.asset-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 16px;
  color: var(--cover-muted);
  text-align: center;
}

.asset-loading img {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  border-radius: 14px;
}

.asset-card {
  position: relative;
  display: grid;
  grid-template-rows: 86px auto auto;
  gap: 7px;
  min-height: 142px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 14px;
  color: var(--cover-text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
  cursor: pointer;
  overflow: hidden;
}

.asset-card:hover {
  border-color: var(--cover-accent-border);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .28);
}

.asset-thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 86px;
  min-height: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 215, 106, .08), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)),
    #0b0f14;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
  overflow: hidden;
}

.asset-thumb .asset-placeholder {
  position: absolute;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  opacity: .38;
  transition: opacity .16s ease, visibility .16s ease;
}

.asset-thumb img:not(.asset-placeholder) {
  position: absolute;
  z-index: 2;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity .16s ease;
}

.asset-card.is-loaded .asset-placeholder {
  visibility: hidden;
  opacity: 0;
}

.asset-card.is-loaded .asset-thumb img:not(.asset-placeholder) {
  opacity: 1;
}

.asset-card.is-error .asset-placeholder {
  visibility: visible;
  opacity: .42;
}

.asset-card.is-error .asset-thumb img:not(.asset-placeholder) {
  display: none;
}

.asset-title {
  display: block;
  min-width: 0;
  min-height: 15px;
  overflow: hidden;
  color: var(--cover-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 13px;
  color: var(--cover-soft);
  font-size: 11px;
  line-height: 1.2;
}

.cover-stage-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: clamp(620px, calc(100vh - 164px), 920px);
  max-height: calc(100vh - 136px);
  min-width: 0;
  padding: 14px;
}

.stage-tools,
.zoom-tools,
.layer-actions,
.background-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-tools button,
.zoom-tools button,
.layer-actions button,
.section-title button,
.background-actions button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--cover-muted);
  font-size: 12px;
}

.canvas-viewport {
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .035);
  border-radius: 18px;
  background: transparent;
  overflow: hidden;
}

.canvas-viewport.is-scrollable {
  place-items: start center;
  overflow: auto;
}

.canvas-shell {
  position: relative;
  width: max-content;
  max-width: none;
  border-radius: 14px;
  overflow: visible;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22), 0 0 0 1px rgba(255, 255, 255, .08);
}

.canvas-shell .canvas-container {
  border-radius: 14px;
  background:
    linear-gradient(45deg, #d4d6da 25%, transparent 25% 75%, #d4d6da 75%),
    linear-gradient(45deg, #d4d6da 25%, transparent 25% 75%, #d4d6da 75%),
    #f3f4f6;
  background-position: 0 0, 16px 16px;
  background-size: 32px 32px;
}

.smart-guides-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.smart-guide {
  position: absolute;
  background: rgba(255, 215, 106, .95);
  box-shadow: 0 0 10px rgba(255, 196, 70, .42);
}

.smart-guide-x {
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-.5px);
}

.smart-guide-y {
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-.5px);
}

.stage-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  color: var(--cover-muted);
  background: rgba(255, 255, 255, .035);
}

.stage-status strong {
  display: block;
  margin-bottom: 3px;
  color: var(--cover-gold);
  font-size: 13px;
}

.stage-status span {
  font-size: 12px;
}

.cover-inspector-panel {
  overflow: auto;
  scrollbar-color: rgba(255, 215, 106, .45) rgba(255, 255, 255, .05);
}

.panel-section {
  display: grid;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.panel-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.panel-section:last-child {
  padding-bottom: 0;
}

.cover-inspector-panel .section-title {
  margin-bottom: 2px;
}

.text-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
}

.text-tool-row button {
  flex: 1 1 128px;
  color: #2b1b05;
  border-color: rgba(255, 239, 167, .48);
  background: linear-gradient(180deg, #ffefa7 0%, var(--cover-accent) 48%, var(--cover-accent-2) 100%);
  box-shadow: 0 10px 22px rgba(255, 196, 70, .15), inset 0 1px 0 rgba(255, 255, 255, .38);
}

.layer-list {
  display: grid;
  gap: 7px;
  min-height: 76px;
  max-height: 210px;
  overflow: auto;
}

.empty-note {
  display: grid;
  place-items: center;
  min-height: 82px;
  margin: 0;
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 12px;
  color: var(--cover-soft);
  font-size: 13px;
}

.layer-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  color: var(--cover-muted);
  background: rgba(255, 255, 255, .035);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.layer-item:active,
.layer-item.is-dragging {
  cursor: grabbing;
}

.layer-item.is-dragging {
  opacity: .45;
}

.layer-item.drag-before::before,
.layer-item.drag-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 215, 106, .95);
  box-shadow: 0 0 12px rgba(255, 196, 70, .5);
}

.layer-item.drag-before::before {
  top: -5px;
}

.layer-item.drag-after::after {
  bottom: -5px;
}

.layer-item.active {
  color: var(--cover-text);
  border-color: var(--cover-accent-border);
  background: var(--cover-accent-soft);
}

.layer-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-kind {
  color: var(--cover-gold);
  font-size: 11px;
  font-weight: 900;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.property-grid label,
.wide-field {
  display: grid;
  gap: 7px;
  color: var(--cover-muted);
  font-size: 12px;
  font-weight: 800;
}

.text-properties {
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.cover-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: var(--cover-muted);
  font-weight: 800;
}

.cover-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--cover-accent);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.cover-maker-site .footer {
  position: relative;
  z-index: 1;
}

@media (max-width: 1580px) {
  .cover-maker-workbench {
    width: min(100vw - 18px, 1560px);
  }

  .cover-editor-grid {
    grid-template-columns: clamp(320px, 22vw, 360px) minmax(680px, 1fr) clamp(300px, 20vw, 340px);
  }
}

@media (max-width: 1160px) {
  .cover-maker-workbench {
    width: min(100vw - 32px, 1180px);
  }

  .cover-editor-grid {
    grid-template-columns: minmax(320px, .42fr) minmax(0, 1fr);
  }

  .cover-inspector-panel {
    grid-column: 1 / -1;
    height: auto;
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 980px) {
  .cover-maker-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-cluster {
    flex-wrap: wrap;
  }

  .cover-editor-grid {
    grid-template-columns: 1fr;
  }

  .cover-panel,
  .cover-stage-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .asset-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 420px;
  }
}

@media (max-width: 640px) {
  .cover-maker-workbench {
    width: min(100vw - 18px, 560px);
    margin-top: 12px;
  }

  .cover-maker-toolbar,
  .cover-panel,
  .cover-stage-panel {
    border-radius: 16px;
  }

  .toolbar-title p {
    width: 100%;
  }

  .cover-primary,
  .cover-ghost {
    flex: 1 1 auto;
  }

  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-head,
  .stage-status,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .property-grid {
    grid-template-columns: 1fr;
  }
}
