/* 资产拍摄 - 拍摄端样式（移动端优先，深色相机 UI） */
:root {
  --bg: #0b1220;
  --surface: #121a2b;
  --surface-2: #1a2438;
  --border: #243350;
  --text: #e8eef8;
  --text-dim: #93a4c3;
  --accent: #38bdf8;
  --accent-deep: #0ea5e9;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100dvh; }

/* ===== 上半部分：相机区 ===== */
#cameraArea {
  position: relative; flex: 0 0 55dvh; min-height: 320px;
  background: #000; overflow: hidden;
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }

.cam-error {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: #0b1220; color: var(--text-dim); z-index: 5; padding: 20px; text-align: center;
}
.cam-error-icon { font-size: 40px; }

.cam-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(10, 16, 28, .55); backdrop-filter: blur(8px);
  font-size: 22px; color: #fff; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.14);
}
.save-btn {
  height: 44px; padding: 0 16px; border-radius: 22px;
  background: var(--ok); color: #04240f; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 4px 14px rgba(34,197,94,.35);
}
.save-btn:disabled { opacity: .45; box-shadow: none; }
.badge {
  background: rgba(4, 36, 15, .85); color: #7cf2a6; border-radius: 10px;
  min-width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; padding: 0 5px;
}

#recBar {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 62px); left: 50%; transform: translateX(-50%);
  background: rgba(10,16,28,.6); backdrop-filter: blur(8px);
  padding: 5px 14px; border-radius: 14px; font-size: 14px; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 7px; z-index: 4; border: 1px solid rgba(255,255,255,.14);
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.cam-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.mode-seg {
  display: flex; background: rgba(10,16,28,.55); backdrop-filter: blur(8px);
  border-radius: 18px; padding: 3px; border: 1px solid rgba(255,255,255,.14);
}
.mode-seg button {
  padding: 7px 22px; border-radius: 15px; font-size: 14px; color: var(--text-dim); font-weight: 600;
}
.mode-seg button.active { background: #fff; color: #0b1220; }

#shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
.shutter-core { width: 52px; height: 52px; border-radius: 50%; background: #fff; transition: all .15s; }
#shutter.recording .shutter-core { width: 24px; height: 24px; border-radius: 6px; background: var(--danger); }
#shutter:active .shutter-core { transform: scale(.88); }

.cam-hint { font-size: 12px; color: rgba(255,255,255,.75); text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* ===== 下半部分：功能区 ===== */
#funcArea {
  flex: 1; overflow-y: auto; background: var(--bg);
  padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex; flex-direction: column; gap: 12px;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.field-label { font-size: 13px; color: var(--text-dim); display: block; margin-bottom: 7px; }
#assetName {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 12px; font-size: 16px; outline: none;
}
#assetName:focus { border-color: var(--accent); }

.wm-toggles { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.chip-toggle { position: relative; }
.chip-toggle input { position: absolute; opacity: 0; }
.chip-toggle span {
  display: inline-block; padding: 7px 13px; border-radius: 16px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.chip-toggle input:checked + span { background: rgba(56,189,248,.16); border-color: var(--accent); color: var(--accent); }

.loc-line { margin-top: 10px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.loc-line.ok { color: var(--ok); }
.loc-line.err { color: #f59e0b; }
.wm-tip { margin-top: 9px; font-size: 12px; color: #6b7a97; }

.strip-head { font-size: 14px; margin-bottom: 10px; }
.strip-sub { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.strip { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; min-height: 84px; align-items: center; }
.strip-empty { color: #55648a; font-size: 13px; }
.shot {
  position: relative; flex: 0 0 auto; width: 84px; height: 84px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2);
}
.shot img, .shot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .tag {
  position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
}
.shot .dur { position: absolute; right: 4px; top: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 8px; }

/* ===== 预览弹层 ===== */
#preview {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#previewBody { max-width: 100vw; max-height: 82dvh; display: flex; align-items: center; justify-content: center; }
#previewBody img, #previewBody video { max-width: 100vw; max-height: 82dvh; object-fit: contain; }
.preview-actions { display: flex; gap: 14px; margin-top: 16px; }
.btn { padding: 11px 26px; border-radius: 12px; font-size: 15px; font-weight: 600; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }

/* ===== 上传进度 ===== */
#uploadOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 60;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.upload-box {
  width: min(320px, 84vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; text-align: center;
}
.upload-title { font-size: 15px; margin-bottom: 16px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); transition: width .2s; border-radius: 4px; }
#progressText { margin-top: 10px; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ===== Toast ===== */
#toast {
  position: fixed; left: 50%; bottom: 18dvh; transform: translateX(-50%);
  background: rgba(20, 28, 46, .95); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; border-radius: 12px; font-size: 14px; z-index: 70; max-width: 86vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); text-align: center;
}
#toast.ok { border-color: var(--ok); }
#toast.err { border-color: var(--danger); }

/* 稍宽屏（平板/桌面）双栏 */
@media (min-width: 768px) {
  #app { flex-direction: row; height: 100dvh; }
  #cameraArea { flex: 1 1 62%; min-height: 0; height: auto; }
  #funcArea { flex: 1 1 38%; max-width: 480px; border-left: 1px solid var(--border); }
}
