:root {
  --ink: #1b0d09;
  --ink-soft: #311a10;
  --paper: #fbf4e9;
  --panel: #fffaf3;
  --white: #fffefa;
  --ember: #f45121;
  --gold: #efbf62;
  --muted: #8d7769;
  --line: rgba(27, 13, 9, 0.1);
  --green: #378f68;
  --red: #b94725;
  --shadow: 0 20px 55px rgba(55, 26, 12, 0.08);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
  overflow-x: clip;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(244, 81, 33, 0.06), transparent 32rem),
    var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(244, 81, 33, 0.3);
  outline-offset: 2px;
}

.admin-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(145deg, #ffda91, var(--ember));
  box-shadow: 0 15px 30px rgba(244, 81, 33, 0.2);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 800;
}

.admin-mark.small {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  font-size: 20px;
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
  color: var(--paper);
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 90, 39, 0.24), transparent 28rem),
    var(--ink);
}

.login-card {
  width: min(390px, 100%);
  padding: 34px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: rgba(255, 249, 241, 0.045);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.login-card .admin-mark {
  margin-bottom: 27px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.login-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 43px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.055em;
}

.login-copy {
  margin: 18px 0 25px;
  color: rgba(255, 249, 241, 0.48);
  font-size: 11px;
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form label > span {
  color: rgba(255, 249, 241, 0.55);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.login-form input {
  width: 100%;
  height: 49px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  color: var(--paper);
  background: rgba(0, 0, 0, 0.18);
  font-size: 14px;
}

.login-form input::placeholder {
  color: rgba(255, 249, 241, 0.22);
}

.login-form button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: var(--gold);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.login-hint {
  margin: 20px 0 0;
  color: rgba(255, 249, 241, 0.26);
  font-size: 9px;
  line-height: 1.7;
}

.login-hint code {
  color: rgba(244, 197, 109, 0.6);
  font-size: 8px;
}

.admin-app {
  min-height: 100dvh;
}

.admin-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  padding: 14px max(16px, calc((100vw - 1200px) / 2));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--paper);
  background: rgba(27, 13, 9, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
}

.admin-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.admin-brand > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-brand strong {
  overflow: hidden;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-brand small {
  overflow: hidden;
  color: rgba(255, 249, 241, 0.37);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.ghost-button {
  min-height: 35px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  color: rgba(255, 249, 241, 0.55);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.install-button {
  border-color: rgba(244, 197, 109, 0.28);
  color: var(--gold);
}

.admin-main {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 55px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.queue-warning {
  display: flex;
  margin-top: 11px;
  padding: 12px 14px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(185, 71, 37, 0.2);
  border-radius: 11px;
  color: #7c2c15;
  background: rgba(244, 81, 33, 0.055);
  font-size: 9px;
  line-height: 1.6;
}

.queue-warning strong {
  flex: 0 0 auto;
}

.queue-warning span {
  color: #946653;
}

.stat-card {
  display: grid;
  min-height: 111px;
  padding: 17px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.72);
}

.stat-card span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.stat-card strong {
  margin: 3px 0;
  font-family: var(--serif);
  font-size: 35px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.stat-card small {
  color: rgba(141, 119, 105, 0.65);
  font-size: 8px;
}

.stat-card:nth-child(1) strong {
  color: var(--ember);
}

.stat-card:nth-child(2) strong {
  color: #b67d23;
}

.stat-card:nth-child(3) strong {
  color: var(--green);
}

.admin-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.82);
  box-shadow: 0 8px 35px rgba(65, 30, 13, 0.035);
}

.settings-panel,
.videos-panel {
  margin-top: 12px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-kicker {
  margin: 0 0 6px;
  color: var(--ember);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.045em;
}

.panel-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 8px;
}

.qr-layout {
  display: grid;
  gap: 20px;
}

.qr-box {
  display: grid;
  width: min(100%, 230px);
  margin: 0 auto;
  padding: 13px;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(27, 13, 9, 0.08);
}

#qrCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.qr-copy {
  align-self: center;
}

.qr-copy > strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.qr-copy > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.75;
}

.qr-warning {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(185, 71, 37, 0.2);
  border-radius: 9px;
  color: #8b351d;
  background: rgba(244, 81, 33, 0.055);
  font-size: 9px;
  line-height: 1.65;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.primary-small,
.secondary-small {
  min-height: 39px;
  padding: 0 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
}

.primary-small {
  border: 0;
  color: var(--paper);
  background: var(--ink);
}

.primary-small:hover {
  background: var(--ink-soft);
}

.secondary-small {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

.secondary-small:hover {
  border-color: rgba(244, 81, 33, 0.24);
  color: var(--ember);
}

.scan-link {
  display: block;
  margin-top: 12px;
  padding: 9px 10px;
  overflow: hidden;
  border-radius: 8px;
  color: #735747;
  background: rgba(27, 13, 9, 0.045);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-tip {
  margin: 10px 0 0;
  color: #9a7160;
  font-size: 8px;
  line-height: 1.65;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-zone {
  display: grid;
  min-height: 175px;
  padding: 20px 15px;
  place-content: center;
  justify-items: center;
  border: 1px dashed rgba(27, 13, 9, 0.2);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.choose-video-button {
  width: 100%;
  min-height: 47px;
  margin-bottom: 10px;
  border: 1px solid rgba(244, 81, 33, 0.25);
  border-radius: 11px;
  color: var(--ember);
  background: rgba(244, 81, 33, 0.055);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.choose-video-button:hover {
  color: var(--paper);
  background: var(--ember);
}

.selection-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
}

.upload-error {
  margin-top: 11px;
  padding: 10px 11px;
  border: 1px solid rgba(185, 71, 37, 0.2);
  border-radius: 9px;
  color: #8b351d;
  background: rgba(244, 81, 33, 0.055);
  font-size: 9px;
  line-height: 1.65;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: rgba(244, 81, 33, 0.5);
  background: rgba(244, 81, 33, 0.035);
}

.drop-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 13px;
  color: var(--ember);
  background: rgba(244, 81, 33, 0.08);
}

.drop-icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.drop-zone strong {
  margin-bottom: 6px;
  font-size: 12px;
}

.drop-zone small {
  max-width: 270px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.upload-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.upload-item {
  display: flex;
  padding: 10px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.file-type {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: var(--ember);
  background: rgba(244, 81, 33, 0.075);
  font-size: 8px;
  font-weight: 800;
}

.upload-item-main {
  min-width: 0;
  flex: 1;
}

.upload-item-main strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-main small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.upload-item button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(27, 13, 9, 0.05);
  cursor: pointer;
}

.upload-progress {
  margin-top: 13px;
}

.upload-progress > div {
  display: flex;
  margin-bottom: 7px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
}

.progress-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(27, 13, 9, 0.07);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ember), var(--gold));
  transition: width 180ms ease;
}

.upload-button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  color: var(--paper);
  background: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.upload-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.form-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.65;
}

.text-toggle {
  padding: 7px 0;
  border: 0;
  color: var(--ember);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: #6f5a4d;
  font-size: 9px;
  font-weight: 650;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

.field input {
  height: 43px;
}

.field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.settings-form > .primary-small {
  justify-self: start;
  min-height: 42px;
  padding: 0 17px;
}

.videos-head {
  align-items: center;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
}

.danger-text {
  color: var(--red);
}

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

.empty-list {
  padding: 34px 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.video-row {
  display: grid;
  padding: 12px;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.35);
}

.video-row-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.video-icon {
  display: grid;
  width: 44px;
  height: 55px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: var(--gold);
  background:
    linear-gradient(145deg, rgba(255, 90, 39, 0.23), transparent),
    var(--ink-soft);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 800;
}

.video-copy {
  min-width: 0;
  flex: 1;
}

.video-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.status-chip {
  display: inline-flex;
  margin-top: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 650;
}

.status-available {
  color: #a03e1f;
  background: rgba(244, 81, 33, 0.09);
}

.status-claimed {
  color: #8a641e;
  background: rgba(239, 191, 98, 0.2);
}

.status-published {
  color: var(--green);
  background: rgba(55, 143, 104, 0.1);
}

.status-archived {
  color: #7e7068;
  background: rgba(27, 13, 9, 0.06);
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #6f5a4d;
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.video-actions button:hover {
  border-color: rgba(244, 81, 33, 0.25);
  color: var(--ember);
}

.video-actions .approve {
  color: var(--green);
}

.video-actions .archive {
  color: var(--red);
}

.admin-footer {
  display: flex;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  justify-content: space-between;
  color: rgba(141, 119, 105, 0.55);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.preview-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 55px 18px 25px;
  place-items: center;
  background: rgba(12, 5, 2, 0.9);
  backdrop-filter: blur(15px);
}

.preview-modal video {
  width: min(100%, 390px);
  max-height: calc(100dvh - 100px);
  border-radius: 16px;
  background: #000;
}

.preview-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 50%;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.admin-toast {
  position: fixed;
  z-index: 120;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: auto;
  padding: 11px 15px;
  border-radius: 10px;
  color: var(--paper);
  background: rgba(27, 13, 9, 0.94);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  font-size: 9px;
  text-align: center;
}

.admin-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .qr-layout {
    grid-template-columns: 230px 1fr;
  }

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

  .video-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (min-width: 980px) {
  .admin-main {
    padding-top: 30px;
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 0.82fr);
  }

  .panel {
    padding: 24px;
  }
}

@media (max-width: 430px) {
  .admin-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .admin-brand strong {
    max-width: 155px;
  }

  .admin-brand small {
    max-width: 155px;
  }

  .install-button {
    display: none !important;
  }

  .admin-main,
  .admin-footer {
    width: calc(100% - 24px);
  }

  .panel {
    padding: 17px;
  }

  .panel-head h2 {
    font-size: 20px;
  }

  .videos-head {
    display: block;
  }

  .list-actions {
    margin-top: 13px;
    justify-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
