/* ===== 设计变量 ===== */
:root {
  --primary: #3b5bff;
  --primary-2: #7c5cff;
  --accent: #12c48b;
  --warn: #ff9f43;
  --danger: #ff4d5e;

  --text: #141a2e;
  --text-2: #4a5470;
  --muted: #8a93ab;
  --line: #e9edf7;
  --bg: #f2f5fc;
  --card: #ffffff;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 14px 40px rgba(21, 32, 84, 0.09);
  --shadow-sm: 0 4px 16px rgba(21, 32, 84, 0.06);
  --shadow-btn: 0 8px 22px rgba(59, 91, 255, 0.32);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1000px 460px at 10% -12%, rgba(59, 91, 255, 0.16), transparent 62%),
    radial-gradient(820px 420px at 98% 2%, rgba(124, 92, 255, 0.14), transparent 64%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== 顶栏 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(233, 237, 247, 0.9);
}

.header-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 20px rgba(59, 91, 255, 0.36);
  flex: 0 0 auto;
}

.brand-logo svg {
  width: 21px;
  height: 21px;
}

.brand-text b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-text span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #5b647c;
  transition: all 0.18s ease;
}

.nav-link:hover {
  background: rgba(59, 91, 255, 0.08);
  color: var(--primary);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-btn);
}

.nav-link.icon {
  padding: 9px 13px;
}

.nav-link.icon svg {
  width: 18px;
  height: 18px;
}

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.26);
}

.nav-link:not(.active) .nav-badge {
  background: rgba(59, 91, 255, 0.14);
  color: var(--primary);
}

/* ===== 布局 ===== */
.main {
  max-width: 1020px;
  margin: 0 auto;
  padding: 30px 20px 44px;
}

.footer {
  text-align: center;
  color: #a8b0c4;
  font-size: 12px;
  padding: 8px 0 34px;
}

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

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.page-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ===== 首页 Hero ===== */
.hero {
  text-align: center;
  padding: 16px 0 6px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.25;
}

.hero .grad {
  background: linear-gradient(118deg, var(--primary), var(--primary-2) 52%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

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

/* ===== 上传区 ===== */
.dropzone {
  border: 2px dashed #d5ddf2;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfcff, #f5f8ff);
  padding: 56px 22px;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f6f9ff, #edf2ff);
  transform: translateY(-2px);
}

.dropzone .dz-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: rgba(59, 91, 255, 0.1);
}

.dropzone .dz-icon svg {
  width: 28px;
  height: 28px;
}

.dropzone .dz-title {
  font-size: 16px;
  font-weight: 700;
  color: #232b42;
}

.dropzone .dz-hint {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
}

.preview {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #f1f4fb;
  border: 1px solid var(--line);
}

.preview img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  margin: 0 auto;
}

.preview-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, transparent, rgba(14, 20, 45, 0.62));
}

.preview-size {
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}

/* ===== 按钮 ===== */
.actions {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1.7fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: #3a4359;
  transition: all 0.18s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn:hover:not(:disabled) {
  border-color: #c3cdf0;
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 28px rgba(59, 91, 255, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: #ced5e6;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 999px;
}

.btn-danger {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #ff6b7a, var(--danger));
  box-shadow: 0 8px 20px rgba(255, 77, 94, 0.3);
}

.btn-danger:hover:not(:disabled) {
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 77, 94, 0.4);
}

/* ===== 提示条 ===== */
.alert {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.6;
}

.alert svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.alert-warn {
  background: #fff8ec;
  border: 1px solid #ffe0b8;
  color: #8a5a12;
}

.alert-info {
  background: #eef4ff;
  border: 1px solid #d6e2ff;
  color: #2a4a99;
}

.alert-error {
  background: #fff0f2;
  border: 1px solid #ffd3d9;
  color: #a3212f;
}

.alert .grow {
  flex: 1;
}

/* ===== 功能卡片 ===== */
.features {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(233, 237, 247, 0.95);
  border-radius: 17px;
  padding: 17px;
}

.feature .fi {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: rgba(59, 91, 255, 0.1);
}

.feature .fi svg {
  width: 18px;
  height: 18px;
}

.feature b {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.feature span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ===== 列表 ===== */
.list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.16s ease;
}

.row:last-child {
  border-bottom: none;
}

.row:hover {
  background: #f7f9ff;
}

.thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  overflow: hidden;
  background: #eef1f9;
  display: grid;
  place-items: center;
  color: #b8c0d6;
  font-size: 17px;
  font-weight: 700;
}

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

.row-meta {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.icon-btn {
  flex: 0 0 auto;
  padding: 9px;
  border-radius: 11px;
  color: #c2c9da;
  transition: all 0.16s ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.icon-btn:hover {
  color: var(--danger);
  background: rgba(255, 77, 94, 0.1);
}

/* ===== 空状态 ===== */
.empty {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 60px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty svg {
  width: 52px;
  height: 52px;
  color: #c6cde0;
  margin-bottom: 8px;
}

.empty b {
  font-size: 15px;
}

.empty span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== 结果页 ===== */
.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #4a5268;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.16s ease;
}

.back svg {
  width: 16px;
  height: 16px;
}

.back:hover {
  color: var(--primary);
  transform: translateX(-3px);
}

.tag {
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #0b7a58;
  background: rgba(18, 196, 139, 0.15);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 18px;
}

.card-head svg {
  width: 19px;
  height: 19px;
  color: var(--primary);
}

.q {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 19px;
  background: #fcfdff;
}

.q + .q {
  margin-top: 16px;
}

.q-head {
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 14.5px;
}

.block + .block {
  margin-top: 15px;
}

.label {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: #6a7390;
  background: #eef1f9;
  padding: 3px 11px;
  border-radius: 999px;
  margin-bottom: 9px;
}

.label.answer {
  color: #0b7a58;
  background: rgba(18, 196, 139, 0.15);
}

.text {
  line-height: 1.85;
  word-break: break-word;
  color: #2a3040;
  font-size: 15px;
}

.text img {
  margin: 8px 0;
  border-radius: 10px;
}

.question-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 14px;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(14, 20, 45, 0.55);
  backdrop-filter: blur(4px);
}

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

.modal {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(10, 16, 40, 0.34);
  animation: pop 0.22s ease;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head b {
  font-size: 16.5px;
}

.modal-body {
  padding: 22px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 22px 22px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all 0.16s ease;
}

.close-btn svg {
  width: 17px;
  height: 17px;
}

.close-btn:hover {
  background: #f1f4fb;
  color: var(--text);
}

.field + .field {
  margin-top: 20px;
}

.field-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 11px;
}

.field-head svg {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--primary);
  flex: 0 0 auto;
}

.field-head b {
  display: block;
  font-size: 14.5px;
}

.field-head span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

textarea,
input[type='text'] {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fbfcff;
  resize: vertical;
  transition: all 0.16s ease;
  line-height: 1.7;
}

textarea:focus,
input[type='text']:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 91, 255, 0.12);
}

.tip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.75;
  background: #f7f9ff;
  border-radius: 12px;
  padding: 12px 14px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d5dbea;
  transition: 0.2s;
}

.switch .slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ===== 相机 ===== */
.cam-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0a0e1a;
  border-radius: 16px;
  overflow: hidden;
}

.cam-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ===== 加载遮罩 ===== */
.loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(242, 245, 252, 0.78);
  backdrop-filter: blur(3px);
}

.loading.open {
  display: flex;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(59, 91, 255, 0.18);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading p {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

/* ===== 轻提示 ===== */
.toast-wrap {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 32px rgba(21, 32, 84, 0.16);
  animation: toastIn 0.24s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.toast svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.toast.ok svg {
  color: var(--accent);
}

.toast.err svg {
  color: var(--danger);
}

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .hero h1 {
    font-size: 27px;
  }

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

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

  .btn-search {
    grid-column: 1 / -1;
  }

  .main {
    padding: 22px 15px 36px;
  }

  .card {
    padding: 18px;
    border-radius: 17px;
  }

  .brand-text span {
    display: none;
  }

  .nav-link {
    padding: 9px 14px;
  }

  .page-title {
    font-size: 21px;
  }
}