/* ========== 基础 ========== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0a0a0a;
  color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ========== 顶部 ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  font-size: 14px;
}
.brand { font-weight: 600; }
.tag {
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(0, 182, 182, 0.85);
  color: #fff;
  border-radius: 4px;
}

.topbar { display: none; }

/* ========== 相机区 ========== */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.camera-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* HUD 状态提示 */
.hud {
  position: absolute;
  top: max(60px, calc(env(safe-area-inset-top) + 50px));
  right: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  border-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s;
}
.hud { display: none; }
.hud.ok    { background: rgba(0, 182, 182, 0.85); }
.hud.error { background: rgba(220, 80, 80, 0.85); }

/* ========== 拍照按钮 ========== */
.shot-bar {
  padding: 24px 0 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.7), transparent);
  position: relative;
  z-index: 10;
}

.snap-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.1s;
}
.snap-btn:active { transform: scale(0.92); }

.snap-btn .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid #fff;
}

.snap-btn .dot {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 1px;
}

/* ========== 结果弹层 ========== */
.result {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.result.hidden { display: none; }

.result-card {
  width: 100%;
  max-width: 480px;
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.result-card canvas {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
  display: block;
}

.result-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }
.btn.primary {
  background: #00B6B6;
  color: #fff;
}
.btn.ghost {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.result-hint {
  margin: 0;
  padding: 0 16px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 14px;
  border-radius: 6px;
  z-index: 200;
  animation: toastIn 0.2s ease;
}
.toast.hidden { display: none; }

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
