* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #667eea;
  --primary-deep: #5a67d8;
  --accent: #764ba2;
  --text: #1f2937;
  --text-muted: #6b7280;
  --warn-bg: #fff7e6;
  --warn-fg: #b7791f;
  --warn-border: #f6d19c;
  --success: #16a34a;
  --error: #dc2626;
  --pending: #cbd5e1;
  --active: #f59e0b;
  --card-bg: #ffffff;
  --page-bg: #f7f8fc;
  --border: #e5e7eb;
  --shadow: 0 12px 32px rgba(102, 126, 234, 0.12);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(102, 126, 234, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, rgba(118, 75, 162, 0.16), transparent 60%),
    var(--page-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
}

.page-home {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 64px;
}

.hero {
  width: 100%;
  max-width: 860px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 44px 52px;
  text-align: center;
  overflow: hidden;
}

/* 次醒目：黄条 */
.notice-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}
.notice-icon { font-size: 16px; line-height: 1; }

/* 主标题（醒目） */
.hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 14px;
  background: linear-gradient(90deg, var(--primary-deep), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 36px;
}
.tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-deep);
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0 2px;
}

/* ===== Upload Area ===== */
.upload-area {
  width: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 44px 24px;
  transition: all 0.2s ease;
  background: linear-gradient(180deg, #fbfbff 0%, #f4f6ff 100%);
  cursor: pointer;
  outline: none;
}
.upload-area:hover,
.upload-area:focus-visible,
.upload-area.dragover {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f3f6ff 0%, #eaf0ff 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.18);
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.upload-icon {
  color: var(--primary);
  opacity: 0.9;
  line-height: 0;
}

.btn-primary {
  appearance: none;
  border: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 14px 36px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(102, 126, 234, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-download { min-width: 260px; }
/* 关键：按钮类设置了 display，会覆盖浏览器默认的 [hidden]{display:none}，
   必须显式保证带 hidden 属性的元素始终不渲染 */
[hidden] { display: none !important; }

.btn-ghost {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-hint { font-size: 13px; color: var(--text-muted); }
.upload-status {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
  max-width: 720px;
  word-break: break-all;
}
.upload-status.warn {
  color: var(--warn-fg);
  background: var(--warn-bg);
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-block;
}

/* ===== Phase Indicator ===== */
.phase-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.phase-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pending);
  display: inline-block;
  position: relative;
}
.phase-dot[data-state="active"] {
  background: var(--active);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  animation: pulse 1.2s ease-in-out infinite;
}
.phase-dot[data-state="done"] {
  background: var(--success);
}
.phase-dot[data-state="error"] {
  background: var(--error);
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.phase-label { color: var(--text-muted); }
.phase-dot[data-state="active"] + .phase-label { color: var(--active); font-weight: 600; }
.phase-dot[data-state="done"] + .phase-label { color: var(--success); font-weight: 600; }
.phase-arrow { color: var(--border); }

/* ===== Progress ===== */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text);
}
.file-name {
  font-weight: 600;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size { color: var(--text-muted); font-size: 13px; }

.progress-wrap {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.progress-bar {
  flex: 1;
  height: 12px;
  background: #e8ecf6;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-text {
  min-width: 52px;
  font-weight: 600;
  color: var(--primary-deep);
  font-size: 14px;
  text-align: right;
}

/* 进度旋转图标 */
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    45deg,
    rgba(255,255,255,0.35) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255,255,255,0.35) 50%,
    rgba(255,255,255,0.35) 75%,
    transparent 75%
  );
  background-size: 24px 24px;
  animation: stripes 1s linear infinite;
  opacity: 0;
  pointer-events: none;
}
.uploading .progress-bar::after {
  opacity: 0.6;
}
@keyframes stripes {
  from { background-position: 0 0; }
  to { background-position: 24px 0; }
}

/* 耗时 & 状态行 */
.status-row {
  width: 100%;
  max-width: 560px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.elapsed b {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text);
}
.elapsed-icon { margin-right: 4px; }
.ws-status {
  max-width: 60%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-status.ok { color: var(--success); font-weight: 600; }
.ws-status.err { color: var(--error); font-weight: 600; }

/* ===== Done / Error ===== */
.done-icon, .error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}
.done-icon { background: var(--success); box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3); }
.error-icon { background: var(--error); box-shadow: 0 6px 18px rgba(220, 38, 38, 0.3); }
.done-title, .error-title { font-size: 22px; font-weight: 700; }
.done-title { color: var(--success); }
.error-title { color: var(--error); }
.done-detail {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 640px;
  line-height: 1.7;
  word-break: break-all;
}
.error-detail {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 640px;
  word-break: break-all;
  line-height: 1.6;
}
.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ===== Footer ===== */
.site-footer {
  padding: 22px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ===== Donate Modal（打赏浮窗） ===== */
.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: donateFadeIn 0.18s ease;
}
.donate-modal {
  position: relative;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3);
  padding: 32px 36px 28px;
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  animation: donatePopIn 0.22s ease;
}
/* 明显的关闭按钮：右上角圆形 ×，悬停变红并旋转 */
.donate-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #334155;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}
.donate-close:hover { background: #ef4444; color: #fff; transform: rotate(90deg); }
.donate-close:focus-visible { outline: 3px solid rgba(102, 126, 234, 0.5); outline-offset: 2px; }
.donate-title { font-size: 22px; font-weight: 700; margin: 0 0 20px; color: var(--text); }
.donate-qrs {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  margin-bottom: 20px;
}
.donate-qr {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.donate-qr img {
  width: 220px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}
.donate-qr figcaption { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.donate-text {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
}
.donate-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  display: inline-block;
}
@keyframes donateFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes donatePopIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .header-inner { padding: 14px 18px; }
  .page-home { padding: 24px 14px 48px; }
  .hero { padding: 28px 18px 36px; border-radius: 16px; }
  .notice-bar { font-size: 13px; padding: 8px 14px; margin-bottom: 22px; }
  .hero-title { font-size: 22px; }
  .upload-area { padding: 36px 16px; }
  .file-name { max-width: 200px; }
  .btn-primary { padding: 12px 26px; font-size: 16px; }
  .phase-indicator { font-size: 12px; gap: 6px; }
  .status-row { flex-direction: column; align-items: flex-start; }
  .ws-status { max-width: 100%; text-align: left; }
  .donate-modal { padding: 28px 18px 22px; }
  .donate-qr img { width: 150px; }
  .donate-qrs { gap: 14px; }
}
