/**
 * 功能说明：定义壁纸超分工具站的视觉系统、响应式布局和上传队列状态样式。
 * 职责边界：只处理静态页面展示与状态样式，不负责业务请求、推理逻辑或部署配置。
 */

:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #eef4ee;
  --surface-tint: #edf7f3;
  --ink: #17211e;
  --ink-soft: rgba(23, 33, 30, 0.72);
  --ink-muted: rgba(23, 33, 30, 0.52);
  --line: rgba(23, 33, 30, 0.1);
  --line-strong: rgba(23, 33, 30, 0.18);
  --accent: #22715f;
  --accent-deep: #144f42;
  --accent-soft: #d6ebe4;
  --warning: #a55c17;
  --danger: #a33636;
  --ready: #376c9f;
  --shadow: 0 24px 70px rgba(24, 34, 31, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(246, 248, 245, 0.2) 42%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1240px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.brand strong {
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 680;
}

.brand small,
.header-links a {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: flex-end;
}

.header-links a:hover,
.header-links a:focus-visible {
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 0.78fr);
  gap: 22px;
  align-items: start;
  margin-top: 38px;
}

.tool-panel,
.queue-panel,
.notes-section article {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.tool-panel,
.queue-panel {
  border-radius: var(--radius-lg);
}

.tool-panel {
  overflow: hidden;
}

.tool-intro {
  padding: 34px 34px 30px;
  background:
    linear-gradient(120deg, rgba(214, 235, 228, 0.78), rgba(255, 255, 255, 0) 62%),
    var(--surface);
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.4;
  color: var(--accent);
}

.tool-intro h1 {
  font-family: system-ui, sans-serif;
  font-size: clamp(2.45rem, 5vw, 4.8rem);
  line-height: 1.04;
  font-weight: 650;
  letter-spacing: 0;
}

.tool-intro p:last-child {
  margin-top: 20px;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.upload-panel {
  display: grid;
  gap: 20px;
  padding: 24px;
}

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

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 220px;
  padding: 38px 24px;
  border: 1.5px dashed rgba(34, 113, 95, 0.38);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(237, 247, 243, 0.85), rgba(255, 255, 255, 0.78)),
    var(--surface-tint);
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.drop-zone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone-icon {
  display: grid;
  place-items: center;
  width: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #ffffff;
  font-size: 2rem;
  font-weight: 360;
  line-height: 1;
}

.drop-zone-title {
  font-size: 1.24rem;
  line-height: 1.32;
  font-weight: 680;
}

.drop-zone-meta {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

.options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.option-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.option-group legend {
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.4;
  color: var(--ink-muted);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 640;
  line-height: 1.2;
  color: var(--ink-soft);
  text-align: center;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segmented-control input:checked + span {
  background: var(--surface);
  color: var(--accent-deep);
  box-shadow: 0 8px 20px rgba(24, 34, 31, 0.08);
}

.queue-summary {
  display: grid;
  gap: 4px;
  min-width: 116px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.queue-summary span {
  font-size: 1.32rem;
  font-weight: 720;
  line-height: 1;
}

.queue-summary small {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.feedback-panel {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(163, 54, 54, 0.22);
  background: rgba(163, 54, 54, 0.07);
  color: var(--danger);
}

.feedback-panel[data-type="warning"] {
  border-color: rgba(165, 92, 23, 0.22);
  background: rgba(165, 92, 23, 0.08);
  color: var(--warning);
}

.feedback-panel strong {
  font-size: 0.92rem;
  line-height: 1.35;
}

.feedback-panel span {
  font-size: 0.88rem;
  line-height: 1.55;
  color: inherit;
}

.button,
.task-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  font-size: 0.94rem;
  font-weight: 680;
  line-height: 1;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.button {
  padding: 0 18px;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled),
.task-button:hover:not(:disabled),
.task-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  min-width: 132px;
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: #ffffff;
}

.button-secondary {
  background: var(--surface);
  color: var(--ink-soft);
}

.button:disabled,
.task-button:disabled {
  opacity: 0.48;
}

.queue-panel {
  min-height: 560px;
  padding: 24px;
}

.queue-panel[data-empty="true"] .panel-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 {
  margin-top: 4px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1;
  color: var(--accent-deep);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 400px;
  padding: 36px 20px;
  color: var(--ink-muted);
  text-align: center;
}

.empty-preview {
  position: relative;
  width: min(260px, 72vw);
  aspect-ratio: 16 / 10;
}

.empty-preview span {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(34, 113, 95, 0.08), rgba(55, 108, 159, 0.06)),
    var(--surface);
  box-shadow: 0 18px 42px rgba(24, 34, 31, 0.08);
}

.empty-preview span:nth-child(1) {
  transform: rotate(-5deg) translate(-14px, 8px);
}

.empty-preview span:nth-child(2) {
  transform: rotate(4deg) translate(16px, 0);
}

.empty-preview span:nth-child(3) {
  transform: translate(0, 18px);
}

.empty-state p {
  max-width: 28ch;
  font-size: 0.96rem;
  line-height: 1.75;
}

.task-list {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.task-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.thumb {
  width: 78px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-soft);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-body {
  min-width: 0;
}

.task-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-title-row h3 {
  min-width: 0;
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 680;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.4;
  color: var(--ready);
}

.task-card[data-status="processing"] .task-status {
  color: var(--warning);
}

.task-card[data-status="done"] .task-status {
  color: var(--accent-deep);
}

.task-card[data-status="failed"] .task-status {
  color: var(--danger);
}

.task-meta {
  margin-top: 5px;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-track span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

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

.task-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
}

.download-button:not(:disabled) {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: #ffffff;
}

.notes-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.notes-section article {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
}

.notes-section h2 {
  font-size: 1rem;
  line-height: 1.35;
}

.notes-section p {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .drop-zone,
  .button,
  .task-button,
  .segmented-control span,
  .progress-track span {
    transition: none;
  }
}

@media (max-width: 1040px) {
  .workspace,
  .notes-section {
    grid-template-columns: 1fr;
  }

  .queue-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 24px, 1240px);
    padding-top: 14px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }

  .header-links {
    justify-content: flex-start;
  }

  .workspace {
    margin-top: 28px;
  }

  .tool-intro {
    padding: 26px 22px 24px;
  }

  .tool-intro h1 {
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }

  .tool-intro p:last-child {
    line-height: 1.7;
  }

  .upload-panel,
  .queue-panel {
    padding: 16px;
  }

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

  .segmented-control {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .segmented-control::-webkit-scrollbar {
    display: none;
  }

  .segmented-control label {
    flex: 0 0 128px;
  }

  .queue-summary {
    min-width: 0;
  }

  .task-card {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .thumb {
    width: 70px;
  }

  .task-actions {
    grid-column: 1 / -1;
  }

  .task-button {
    flex: 1 1 0;
  }
}
