@font-face {
  font-family: "YEDAZL+FZHTJW--GB1-0";
  src: url("./assets/fonts/YEDAZL+FZHTJW--GB1-0.ttf") format("truetype");
}

@font-face {
  font-family: "YEDAZL+FZDBSJW--GB1-0";
  src: url("./assets/fonts/YEDAZL+FZDBSJW--GB1-0.ttf") format("truetype");
}

@font-face {
  font-family: "YEDAZL+FZS3JW--GB1-0";
  src: url("./assets/fonts/YEDAZL+FZS3JW--GB1-0.ttf") format("truetype");
}

@font-face {
  font-family: "YEDAZL+FZLTZHJW--GB1-0";
  src: url("./assets/fonts/YEDAZL+FZLTZHJW--GB1-0.ttf") format("truetype");
}

@font-face {
  font-family: "YEDAZL+Arial-BoldMT";
  src: url("./assets/fonts/YEDAZL+Arial-BoldMT.ttf") format("truetype");
}

:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171b22;
  --panel-border: #262d39;
  --text: #eef2f8;
  --muted: #99a4b4;
  --accent: #4f8cff;
  --accent-strong: #316fe8;
  --surface: #0c0f14;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

html,
body.mode-page {
  height: 100%;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.mode-page {
  overflow: hidden;
}

.mode-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-width: 0;
  background: var(--bg);
}

.mode-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
  background: #12161d;
}

.mode-toolbar h1 {
  margin: 0;
  font-size: 22px;
}

.mode-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mode-picker {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.mode-picker span {
  color: #d9dfeb;
  font-size: 13px;
}

.mode-tabs,
.cover-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #10151d;
}

.mode-tab,
.cover-switch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  text-decoration: none;
}

.mode-tab:hover,
.cover-switch-link:hover {
  background: #202734;
}

.mode-tab.is-active,
.cover-switch-link.is-active {
  background: var(--accent);
  color: #ffffff;
}

.cover-switcher {
  margin-top: 14px;
}

.workbench-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--panel-border);
  background: #202734;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: #283144;
  border-color: #3b4a64;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent-strong);
}

button.primary:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #10151d;
  color: var(--text);
  padding: 10px 12px;
}

input[type="color"] {
  width: 52px;
  height: 40px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 4px;
  background: #10151d;
}

.app-shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--panel-border);
  background: #12161d;
  padding: 18px;
  overflow-y: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar .panel + .panel {
  margin-top: 16px;
}

.panel h1,
.panel h2 {
  margin: 0 0 10px;
}

.panel h1 {
  font-size: 24px;
}

.panel h2 {
  font-size: 18px;
}

.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.field-grid,
.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid label,
.slider-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-grid label span,
.slider-field span,
.color-card strong {
  font-size: 13px;
  color: #d9dfeb;
}

.full-width {
  grid-column: 1 / -1;
}

.hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.spec-list {
  display: grid;
  gap: 8px;
}

.spec-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.spec-list strong {
  color: #eef2f8;
}

.color-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #10151d;
  border: 1px solid var(--panel-border);
}

.image-controls {
  display: grid;
  gap: 12px;
}

.image-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #10151d;
  border: 1px solid var(--panel-border);
}

.image-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.slider-field input[type="range"] {
  width: 100%;
}

.stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-border);
  background: #10141b;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

.stage-scroll {
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%, rgba(255, 255, 255, 0.03)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.03) 75%, rgba(255, 255, 255, 0.03));
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.canvas-wrap {
  position: relative;
  width: fit-content;
  min-width: 100%;
  padding: 28px;
  transform-origin: top center;
}

.svg-host {
  width: min(900px, 100%);
  margin: 0 auto;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.svg-host svg {
  display: block;
  width: 100%;
  height: auto;
  text-rendering: geometricPrecision;
  shape-rendering: geometricPrecision;
}

.cover-loading {
  display: none;
  place-items: center;
  width: min(900px, calc(100vw - 56px));
  min-height: min(820px, calc(100vh - 120px));
  margin: 0 auto;
}

.cover-loading-box {
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #171b22;
  box-shadow: var(--shadow);
  text-align: center;
}

.cover-loading-box strong {
  color: var(--text);
  font-size: 16px;
}

.cover-loading-box span {
  color: var(--muted);
  font-size: 13px;
}

body.university-loading .cover-loading {
  display: grid;
}

body.university-loading .svg-host {
  visibility: hidden;
  height: 0;
  min-height: 0;
  overflow: hidden;
  box-shadow: none;
}

.crop-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 12, 0.72);
}

.crop-dialog[hidden] {
  display: none;
}

.crop-panel {
  width: min(960px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: #171b22;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.crop-header,
.crop-footer,
.crop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crop-header h2 {
  margin: 0;
  font-size: 20px;
}

.crop-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#crop-cancel-top {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
}

.crop-preview {
  position: relative;
  min-height: 360px;
  height: min(62vh, 620px);
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.06) 75%, rgba(255, 255, 255, 0.06)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.06) 75%, rgba(255, 255, 255, 0.06));
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  touch-action: none;
}

.crop-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.crop-shade {
  position: absolute;
  background: rgba(2, 6, 13, 0.58);
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 0 0 9999px rgba(0, 0, 0, 0.08);
  cursor: move;
  outline: 0;
}

.crop-box::before,
.crop-box::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.crop-box::before {
  inset: 33.333% 0;
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  border-bottom: 1px solid rgba(255, 255, 255, 0.58);
}

.crop-box::after {
  inset: 0 33.333%;
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  border-right: 1px solid rgba(255, 255, 255, 0.58);
}

.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.crop-handle-nw {
  top: -10px;
  left: -10px;
  cursor: nwse-resize;
}

.crop-handle-ne {
  top: -10px;
  right: -10px;
  cursor: nesw-resize;
}

.crop-handle-se {
  right: -10px;
  bottom: -10px;
  cursor: nwse-resize;
}

.crop-handle-sw {
  left: -10px;
  bottom: -10px;
  cursor: nesw-resize;
}

body.crop-open {
  overflow: hidden;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 340px 1fr;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }
}

@media (max-width: 640px) {
  .crop-dialog {
    padding: 12px;
  }

  .crop-panel {
    max-height: calc(100vh - 24px);
    border-radius: 12px;
    padding: 12px;
  }

  .crop-preview {
    min-height: 300px;
    height: 56vh;
  }

  .crop-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .crop-actions,
  .crop-footer button {
    width: 100%;
  }

  .crop-actions button {
    flex: 1;
  }
}
