﻿:root {
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f6f9ff;
  --line: #d8e0ef;
  --line-strong: #c6d3ea;
  --text: #1e2a3d;
  --sub: #5f6f8e;
  --primary: #1f6fd1;
  --primary-strong: #1759aa;
  --error: #bd2f32;
  --ok: #117a52;
  --muted: #ebf1fb;
  --shadow: 0 16px 36px rgba(20, 34, 58, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #103252 0%, #1f4c72 42%, #3d5f77 60%, #65556c 74%, #9f556a 86%, #d55f75 100%),
    radial-gradient(980px 420px at 50% 94%, rgba(248, 106, 131, 0.56) 0%, rgba(248, 106, 131, 0.24) 34%, transparent 72%),
    radial-gradient(760px 360px at 12% 12%, rgba(131, 174, 216, 0.22) 0%, transparent 70%),
    var(--bg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI Variable", sans-serif;
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: -3vmax;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.95'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  background-repeat: repeat;
  animation: film-grain 0.7s steps(8) infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: -3vmax;
  pointer-events: none;
  z-index: 0;
  opacity: 0.84;
  background:
    radial-gradient(1300px 560px at 52% 100%, rgba(255, 112, 142, 0.32) 0%, transparent 70%),
    radial-gradient(820px 420px at 92% -8%, rgba(13, 26, 48, 0.7) 22%, transparent 74%),
    radial-gradient(760px 380px at -8% 34%, rgba(21, 38, 62, 0.62) 24%, transparent 72%),
    linear-gradient(120deg, transparent 0 66%, rgba(155, 131, 152, 0.24) 73%, rgba(58, 67, 91, 0.48) 88%, transparent 100%),
    radial-gradient(140% 120% at 50% 48%, transparent 60%, rgba(8, 16, 30, 0.36) 100%);
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 26px 16px 24px;
  animation: page-enter 0.45s ease-out both;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.head {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.head-main {
  min-width: 220px;
}

.title {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 30px);
  letter-spacing: 0.01em;
}

.sub {
  color: var(--sub);
  font-size: 13px;
}

.review-notice {
  margin-top: 4px;
  color: #946000;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #bfd1ec;
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.18s ease;
}

.admin-link:hover {
  border-color: #7fa8de;
}

.admin-link:focus-visible {
  outline: none;
  border-color: #7fa8de;
}

.body {
  padding: 20px;
}

.drop {
  border: 2px dashed #b8c8e3;
  border-radius: 16px;
  background: linear-gradient(180deg, #f9fbff 0%, #f3f8ff 100%);
  min-height: 192px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.drop:hover,
.drop:focus-within {
  border-color: #6f9adb;
}

.drop-inner {
  max-width: 480px;
}

.drop.drag {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f3f8ff 0%, #eaf3ff 100%);
  transform: translateY(-1px);
}

.drop p {
  margin: 6px 0;
  color: #3f5478;
}

.pick {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn.pick-upload-btn {
  width: 106px;
  height: 106px;
  min-width: 106px;
  min-height: 106px;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.upload-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
}

.upload-icon svg {
  width: 100%;
  height: 100%;
}

.upload-arrow {
  stroke: #fff;
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  will-change: transform, opacity;
  transform-box: fill-box;
  transform-origin: center;
}

.moving-arrow {
  animation: upload-arrow-rise 1.05s linear infinite;
}

.moving-arrow.second {
  animation-delay: 0.52s;
}

.upload-foot {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.upload-limit-wrap {
  grid-column: 2;
  justify-self: center;
}

.upload-limit {
  margin: 0;
  font-size: 12px;
  color: #627393;
  white-space: nowrap;
}

.btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid #cad8ef;
  background: #fff;
  padding: 0 12px;
  color: #334766;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  border-color: #a8bfe1;
  background: #f8fbff;
}

.btn.primary {
  border-color: var(--primary-strong);
  background: linear-gradient(180deg, #2a7ddd 0%, #1f6fd1 100%);
  color: #fff;
  font-weight: 600;
}

.btn.primary:hover {
  border-color: #114b95;
  background: linear-gradient(180deg, #2374d2 0%, #1a66c0 100%);
}

.btn.small {
  height: 30px;
  font-size: 12px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.meta {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
  color: #495a7a;
  font-size: 13px;
}

.msg {
  margin-top: 12px;
  font-size: 13px;
  display: none;
}

.msg.show {
  display: block;
}

.msg.error {
  color: var(--error);
}

.msg.ok {
  color: var(--ok);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #223455;
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.16s ease;
  z-index: 42;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.queue-card {
  margin-top: 20px;
}

.queue-card .section-title {
  margin-top: 0;
}

.section-title {
  margin: 20px 0 10px;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.list {
  display: grid;
  gap: 10px;
}

#queueList.queue-scroll {
  max-height: 720px;
  overflow-y: auto;
  padding-right: 4px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px rgba(20, 33, 57, 0.06);
}

#queueList .item {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.item-name {
  font-size: 13px;
  word-break: break-all;
}

.item-sub {
  font-size: 12px;
  color: #627393;
  font-variant-numeric: tabular-nums;
}

.queue-notice {
  margin-top: 4px;
  color: #8b6008;
}

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

.task-bar {
  margin-top: 8px;
  height: 8px;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}

.task-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1f6fd1, #4d95e9);
  transition: width 0.22s linear;
  will-change: width;
}

.task-fill.processing {
  background: linear-gradient(90deg, #1f6fd1, #5da2f1, #1f6fd1);
  background-size: 180% 100%;
  animation: queue-progress 1.2s linear infinite;
}

@keyframes queue-progress {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -80% 0;
  }
}

#historyList .item:hover {
  background: #f8fbff;
  border-color: #bbcff0;
}

.history-item {
  position: relative;
}

.history-item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.history-item:hover .history-item-actions,
.history-item:focus-within .history-item-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.history-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #c5d5f0;
  border-radius: 999px;
  background: #f7fbff;
  padding: 0;
  color: #185fc2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.history-icon-btn:hover {
  background: #eaf3ff;
  border-color: #9fc0f2;
}

.history-icon-btn.danger {
  color: #8f3040;
  border-color: #e3c7cd;
  background: #fff8f9;
  font-size: 20px;
  line-height: 1;
}

.history-icon-btn.danger:hover {
  border-color: #d8a0a8;
  background: #fff1f3;
}

.history-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.history-entry {
  margin-top: 0;
  grid-column: 3;
  justify-self: end;
  display: flex;
  justify-content: flex-end;
}

#openHistoryBtn:hover,
#openHistoryBtn:focus-visible {
  border-color: #7fa8de;
  background: #fff;
  color: #334766;
  outline: none;
}

#openHistoryBtn:active {
  transform: none;
}

body.history-drawer-open {
  overflow: hidden;
}

.history-drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 34, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 24;
}

.history-drawer-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 94vw);
  height: 100dvh;
  padding: 16px 14px 14px;
  border-left: 1px solid #ccd9ef;
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.97) 0%, rgba(243, 248, 255, 0.96) 100%);
  box-shadow: -20px 0 48px rgba(10, 18, 34, 0.26);
  backdrop-filter: blur(5px);
  transform: translateX(102%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s ease, visibility 0s linear 0.28s;
  pointer-events: none;
  overflow-y: auto;
  z-index: 25;
}

.history-drawer.show {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s ease, visibility 0s linear 0s;
  pointer-events: auto;
}

.history-drawer .section-title {
  margin: 0;
}

.history-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.history-drawer .history-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -4px -2px 10px;
  padding: 4px 2px 10px;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98) 0%, rgba(247, 251, 255, 0.86) 80%, rgba(247, 251, 255, 0) 100%);
}

.history-drawer .history-search {
  margin-left: 0;
  min-width: 0;
  width: min(240px, 58vw);
}

.history-drawer #historyList {
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  padding-right: 4px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-head .section-title {
  margin: 20px 0 10px;
}

.history-drawer .history-head .section-title {
  margin: 0;
}

.history-toolbar {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.history-search {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 220px;
  margin-left: auto;
}

.history-search input {
  height: 34px;
  border: 1px solid #ccd9ef;
  border-radius: 9px;
  padding: 0 10px;
  min-width: 220px;
  max-width: 360px;
  width: 100%;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}

.history-search input:focus-visible {
  outline: 2px solid #bcd3f3;
  border-color: #8db3e8;
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-pager {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.history-page-info {
  font-size: 12px;
  color: #627393;
  min-width: 90px;
  text-align: center;
}

.history-page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-file-link {
  display: block;
  max-width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.history-file-link:hover {
  color: var(--primary);
}

.history-item-main {
  min-width: 0;
  flex: 1;
  padding-right: 76px;
}

.history-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
  margin-top: 3px;
  font-size: 11px;
  color: #7f8eaa;
}

.history-meta-row span {
  white-space: nowrap;
}

.history-meta-key {
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 0;
  max-width: 220px;
  font-size: inherit;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.history-meta-key:hover {
  color: inherit;
  text-decoration: none;
  opacity: 0.9;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 27, 44, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 28;
}

.modal-mask.show {
  display: flex;
}

.modal-card {
  min-width: 240px;
  max-width: 320px;
  background: #fff;
  border: 1px solid #d9e1f0;
  border-radius: 14px;
  box-shadow: 0 20px 36px rgba(9, 20, 40, 0.2);
  padding: 18px;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 15px;
}

.modal-sub {
  margin: 0;
  color: #60708f;
  font-size: 13px;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@keyframes film-grain {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-1.5%, 1.2%);
  }
  40% {
    transform: translate(1.4%, -1.3%);
  }
  60% {
    transform: translate(-1.2%, 1%);
  }
  80% {
    transform: translate(1.1%, -1.1%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes upload-arrow-rise {
  0% {
    transform: translateY(14px);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(-14px);
    opacity: 0;
  }
}

@keyframes page-enter {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .body {
    padding: 16px;
  }

  .head {
    padding: 18px 16px 16px;
  }
}

@media (max-width: 720px) {
  .page {
    margin: 0 auto;
    padding: 14px 10px 18px;
  }

  .card {
    border-radius: 16px;
  }

  .drop {
    min-height: 168px;
  }

  .btn.pick-upload-btn {
    width: 96px;
    height: 96px;
    min-width: 96px;
    min-height: 96px;
  }

  .upload-foot {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .upload-foot-spacer {
    display: none;
  }

  .upload-limit-wrap {
    grid-column: auto;
  }

  .history-entry {
    grid-column: auto;
    justify-self: center;
  }

  .history-head {
    flex-wrap: wrap;
  }

  .history-toolbar {
    align-items: stretch;
  }

  .history-search {
    width: 100%;
  }

  .history-drawer {
    width: 100vw;
    padding: 14px 10px 12px;
    border-left: 0;
  }

  .history-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .history-actions {
    justify-content: flex-start;
  }

  .history-pager {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .history-meta-row {
    flex-wrap: wrap;
  }

  body::before {
    opacity: 0.22;
  }

  body::after {
    opacity: 0.7;
  }
}

@media (hover: none) {
  .history-item-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body::before {
    animation: none;
  }

  .moving-arrow {
    animation-duration: 1.05s !important;
    animation-iteration-count: infinite !important;
  }

  .moving-arrow.second {
    animation-delay: 0.52s !important;
  }
}
