:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #101722;
  --panel-2: #151e2a;
  --line: rgba(255, 255, 255, 0.13);
  --text: #f6f9fc;
  --muted: #9aa8b6;
  --cyan: #6ee7ff;
  --danger: #ff6b7d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  min-height: 42px;
  padding: 0 16px;
  background: var(--cyan);
  color: #061018;
  font-weight: 800;
  cursor: pointer;
}

.secondary,
.nav-button,
.nav-link {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 20%, rgba(110, 231, 255, 0.18), transparent 30rem),
    radial-gradient(circle at 70% 80%, rgba(255, 122, 182, 0.14), transparent 32rem);
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  background: rgba(16, 23, 34, 0.86);
  padding: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 24px;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: #dce6ef;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b111a;
  color: var(--text);
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

.hint,
#saveHint {
  color: var(--muted);
  margin: 0;
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #0b111a;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  margin-bottom: 20px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.login-logo {
  width: 148px;
  height: 148px;
  object-fit: contain;
  display: block;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
}

.nav-button,
.nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.nav-button.active {
  background: var(--cyan);
  color: #061018;
}

.nav-button.subtle {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.workspace-head h1 {
  margin: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.editor {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
}

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

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr 160px 180px;
  gap: 14px;
  align-items: stretch;
}

.file-box,
.color-box,
.toggle-box,
.slot-box {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 14px;
}

.file-box small,
.slot-box small {
  color: var(--muted);
}

.toggle-box {
  display: flex;
  align-items: center;
}

.toggle-box input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-progress {
  border: 1px solid rgba(110, 231, 255, 0.28);
  background: rgba(110, 231, 255, 0.06);
  padding: 14px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.progress-head span,
.progress-head strong {
  font-size: 13px;
  color: #dce6ef;
}

.progress-head strong {
  color: var(--cyan);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #8fffcb);
  transition: width 160ms ease;
}

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

.library-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
}

.library-item.is-landscape {
  grid-template-columns: 180px minmax(0, 1fr);
}

.thumb {
  width: 118px;
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.18), rgba(255, 122, 182, 0.16));
  object-fit: cover;
}

.library-item.is-landscape .thumb {
  width: 180px;
  aspect-ratio: 16 / 9;
}

.empty-admin {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
  color: var(--muted);
}

.library-item h3 {
  margin: 0 0 6px;
}

.library-item p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.library-item .slot-meta {
  color: var(--cyan);
  font-weight: 800;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 107, 125, 0.4);
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    width: 100%;
  }

  .form-grid,
  .upload-row,
  .library {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 24px;
  }

  .login-logo {
    width: 118px;
    height: 118px;
  }

  .sidebar {
    padding: 16px;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor {
    padding: 16px;
  }

  .library-item {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .library-item.is-landscape {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .thumb {
    width: 84px;
  }

  .library-item.is-landscape .thumb {
    width: 112px;
  }
}
