/* ============================================================
   视码 VideoQR · 移动端样式（深色主题 · 移动优先）
   ============================================================ */

:root {
  --bg: #0d0d1a;
  --bg-soft: #14142a;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #f5f5fa;
  --text-dim: #9aa0b4;
  --accent-1: #6366f1;
  --accent-2: #a855f7;
  --accent-3: #ec4899;
  --accent-4: #f97316;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 20px;
  --radius-sm: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 背景光晕 */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40% 30% at 15% 0%, rgba(99, 102, 241, 0.25), transparent 70%),
    radial-gradient(35% 30% at 90% 15%, rgba(236, 72, 153, 0.18), transparent 70%),
    radial-gradient(40% 35% at 50% 100%, rgba(168, 85, 247, 0.14), transparent 70%);
}

/* ---------------- Header ---------------- */
.app-header {
  padding: 28px 20px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.brand-logo.sm {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-en {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 2px;
  letter-spacing: 1px;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---------------- Layout ---------------- */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

.card-title.center {
  text-align: center;
}

.step-card {
  margin-bottom: 14px;
}

.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ---------------- Dropzone ---------------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 42px 20px;
  border: 2px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.02);
}

.dropzone.dragover {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.01);
}

.dz-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
}

.dz-title {
  font-size: 16px;
  font-weight: 700;
}

.dz-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------------- Buttons ---------------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  color: #fff;
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.field-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.field-row .btn {
  flex: 1;
}

#againBtn {
  margin-top: 12px;
}

/* ---------------- Form ---------------- */
.field {
  margin-top: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.field input:focus {
  border-color: var(--accent-1);
}

/* ---------------- Preview ---------------- */
.preview-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.preview-wrap video {
  width: 100%;
  display: block;
  max-height: 300px;
}

/* ---------------- Progress ---------------- */
.progress-wrap {
  margin-top: 14px;
}

.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-3), var(--accent-4));
  border-radius: 4px;
  transition: width 0.2s;
}

/* 进度满后进入"处理中"脉冲态，提示仍在生成 */
.progress-bar span.processing {
  background-image: linear-gradient(
    90deg,
    var(--accent-1),
    var(--accent-3),
    var(--accent-4),
    var(--accent-1)
  );
  background-size: 200% 100%;
  animation: progress-stripes 1.2s linear infinite;
}

@keyframes progress-stripes {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.progress-text {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  text-align: center;
}

/* ---------------- Result ---------------- */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.qr-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.qr-frame img {
  width: 100%;
  max-width: 240px;
  image-rendering: pixelated;
}

.qr-scan-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
}

/* ---------------- Watch page ---------------- */
.watch-body {
  background: var(--bg);
}

.watch-container {
  padding-top: 28px;
}

.watch-card {
  padding: 16px;
}

.watch-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.watch-brand {
  font-size: 14px;
  font-weight: 800;
}

.watch-brand em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-left: 2px;
}

.video-frame {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.video-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
  background: rgba(0, 0, 0, 0.4);
}

.watch-title {
  font-size: 18px;
  font-weight: 700;
  margin-top: 16px;
}

.watch-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

.watch-actions {
  margin-top: 16px;
}

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
}

.hint.center {
  text-align: center;
}

/* ---------------- 扫码统计 ---------------- */
/* ---------------- 后台管理页 ---------------- */
.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.admin-summary-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.admin-summary-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-1);
  line-height: 1.2;
}

.admin-summary-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.admin-toolbar {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.admin-toolbar input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

.admin-toolbar input:focus {
  border-color: var(--accent-1);
}

.admin-list {
  margin-top: 14px;
}

.admin-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 30px 0;
}

.admin-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.admin-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-row-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-id {
  font-size: 11px;
  color: var(--text-dim);
  font-family: monospace;
  flex-shrink: 0;
}

.admin-row-views {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.admin-row-views-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-1);
}

.admin-row-views-label {
  font-size: 12px;
  color: var(--text-dim);
}

.admin-row-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.admin-today {
  color: var(--success);
  margin-left: 6px;
  font-weight: 600;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 20, 42, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--card-border);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 99;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------- 桌面端小优化 ---------------- */
@media (min-width: 768px) {
  .app-header {
    padding-top: 48px;
  }
  .brand-logo {
    width: 60px;
    height: 60px;
  }
}
