@charset "UTF-8";
/* ============================================================
   二维码批量识别 —— Apple/iOS 风格
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --accent: #0a84ff;
  --accent-strong: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --glass-blur: blur(22px) saturate(180%);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-strong: 0 18px 48px rgba(0, 0, 0, 0.16);
}

@media (prefers-color-scheme: light) {
  body {
    color-scheme: light;
    --bg-start: #f2f2f7;
    --bg-end: #e5e5ea;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.86);
    --text: #1c1c1e;
    --sub: rgba(60, 60, 67, 0.62);
    --hairline: rgba(60, 60, 67, 0.14);
    --card-bg: rgba(255, 255, 255, 0.66);
    --field-bg: rgba(255, 255, 255, 0.9);
    --newflash: rgba(52, 199, 89, 0.14);
  }
}

@media (prefers-color-scheme: dark) {
  body {
    color-scheme: dark;
    --bg-start: #000000;
    --bg-end: #1c1c1e;
    --glass: rgba(44, 44, 46, 0.62);
    --glass-strong: rgba(60, 60, 66, 0.82);
    --text: #f2f2f7;
    --sub: rgba(235, 235, 245, 0.58);
    --hairline: rgba(84, 84, 88, 0.55);
    --card-bg: rgba(44, 44, 46, 0.5);
    --field-bg: rgba(28, 28, 30, 0.9);
    --newflash: rgba(52, 199, 89, 0.22);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-start), var(--bg-end));
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景光斑，营造 iOS 氛围 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}
body::before {
  width: 340px;
  height: 340px;
  top: -120px;
  right: -100px;
  background: rgba(10, 132, 255, 0.35);
}
body::after {
  width: 300px;
  height: 300px;
  bottom: -110px;
  left: -90px;
  background: rgba(52, 199, 89, 0.28);
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
  padding-top: env(safe-area-inset-top);
  display: flex;
  flex-direction: column;
}

/* ---------------- 通用毛玻璃 ---------------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

/* ---------------- 视图切换 ---------------- */
.view {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 16px;
}
.view.active {
  display: flex;
}

/* ---------------- 导航栏 ---------------- */
.nav {
  position: sticky;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: 26px;
}
.nav-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.nav-spacer {
  width: 64px;
}

.nav-btn {
  min-width: 64px;
  padding: 9px 16px;
  border: none;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
}
.nav-btn:hover:not(:disabled) {
  background: var(--accent-strong);
}
.nav-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------------- 内容区 ---------------- */
.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------------- 摄像头取景 ---------------- */
.scanner {
  position: relative;
  width: 100%;
  height: clamp(300px, 46vh, 420px);
  overflow: hidden;
  border-radius: 24px;
  background: #000;
}
.scanner #video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
}

/* 取景框 */
.scan-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scan-frame::before {
  content: "";
  position: absolute;
  width: min(72vw, 300px);
  height: min(72vw, 300px);
  max-height: 78%;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
}
.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 0 solid var(--accent);
  z-index: 2;
}
.corner-tl {
  top: calc(50% - min(36vw, 150px) - 1px);
  left: calc(50% - min(36vw, 150px) - 1px);
  border-top-width: 3.5px;
  border-left-width: 3.5px;
  border-top-left-radius: 12px;
}
.corner-tr {
  top: calc(50% - min(36vw, 150px) - 1px);
  right: calc(50% - min(36vw, 150px) - 1px);
  border-top-width: 3.5px;
  border-right-width: 3.5px;
  border-top-right-radius: 12px;
}
.corner-bl {
  bottom: calc(50% - min(36vw, 150px) - 1px);
  left: calc(50% - min(36vw, 150px) - 1px);
  border-bottom-width: 3.5px;
  border-left-width: 3.5px;
  border-bottom-left-radius: 12px;
}
.corner-br {
  bottom: calc(50% - min(36vw, 150px) - 1px);
  right: calc(50% - min(36vw, 150px) - 1px);
  border-bottom-width: 3.5px;
  border-right-width: 3.5px;
  border-bottom-right-radius: 12px;
}

/* 扫描线 */
.scan-line {
  position: absolute;
  z-index: 2;
  left: calc(50% - min(36vw, 150px) + 12px);
  right: calc(50% - min(36vw, 150px) + 12px);
  height: 2.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 14px var(--accent);
  animation: scanline 2.4s ease-in-out infinite;
}
@keyframes scanline {
  0% {
    top: calc(50% - min(36vw, 150px) + 14px);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  50% {
    top: calc(50% + min(36vw, 150px) - 20px);
  }
  88% {
    opacity: 1;
  }
  100% {
    top: calc(50% - min(36vw, 150px) + 14px);
    opacity: 0;
  }
}

.scan-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------------- 统计 ---------------- */
.stats,
.result-summary {
  display: flex;
  justify-content: center;
  padding: 18px 20px;
}
.stats-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.count-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.count-label {
  font-size: 13px;
  color: var(--sub);
  font-weight: 500;
}

/* ---------------- 识别列表 ---------------- */
.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}
.list-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  border: 1px dashed var(--hairline);
  border-radius: 18px;
  background: var(--card-bg);
}
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  animation: popIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.list-item.new {
  animation: newFlash 1s ease-out, popIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes newFlash {
  0% {
    background: var(--newflash);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.4);
  }
  100% {
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
  }
}
.list-index {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.list-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.list-content {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-all;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-time {
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(24px);
  max-width: 82vw;
  padding: 12px 20px;
  border-radius: 100px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------- 结果页 ---------------- */
.result-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.result-toolbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
}
.copy-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.copy-btn:active {
  transform: scale(0.96);
}
.copy-btn.copied {
  background: var(--green);
}
.result-text {
  width: 100%;
  min-height: 46vh;
  resize: vertical;
  border: none;
  outline: none;
  padding: 16px;
  background: var(--field-bg);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.result-note {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
  margin-top: -6px;
}

/* ---------------- 覆盖层（错误提示） ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.overlay.show {
  opacity: 1;
  visibility: visible;
}
.overlay-card {
  width: min(88vw, 340px);
  padding: 28px 24px;
  text-align: center;
  background: var(--glass-strong);
  box-shadow: var(--shadow-strong);
  transform: translateY(12px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.overlay.show .overlay-card {
  transform: translateY(0) scale(1);
}
.overlay-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(255, 59, 48, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
}
.overlay-icon svg {
  width: 30px;
  height: 30px;
}
.overlay-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.overlay-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--sub);
  margin-bottom: 22px;
}
.primary-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.primary-btn:active {
  transform: scale(0.98);
}
.ghost-btn {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.hidden {
  display: none !important;
}

/* ---------------- 响应式 ---------------- */
@media (min-width: 640px) {
  .app {
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: 40px;
  }
  .scanner {
    height: clamp(360px, 52vh, 480px);
  }
  .nav {
    top: calc(16px + env(safe-area-inset-top));
  }
}

@media (max-width: 370px) {
  .nav-title {
    font-size: 14px;
  }
  .count-value {
    font-size: 34px;
  }
}