:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --card-bg: #e8e8ed;
  --btn-bg: #0a84ff;
  --btn-text: #ffffff;
  --dialog-bg: #ffffff;
  --dialog-cancel-bg: #e8e8ed;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --text: #f2f2f7;
    --text-dim: #98989f;
    --card-bg: #26262b;
    --dialog-bg: #2c2c30;
    --dialog-cancel-bg: #3a3a40;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 24px);
  -webkit-tap-highlight-color: transparent;
}

/* 固定宽度 + 整体居中 */
.page {
  width: min(480px, 100%);
  margin-inline: auto;
}

.topbar { text-align: center; }

.title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
}

.shoot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  font-size: 20px;
  font-weight: 600;
  color: var(--btn-text);
  background: var(--btn-bg);
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.shoot-btn:active { transform: scale(0.97); }
.shoot-btn.busy { opacity: 0.5; pointer-events: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.status {
  margin: 12px auto 0;
  min-height: 1.4em;
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}

main { margin-top: 12px; }

/* 三列照片网格：第1张在左、第2张在中、第3张在右，第4张换行回到左侧 */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-card {
  position: relative;
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  animation: drop-in 0.25s ease;
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.photo-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-time {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 4px 5px;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
  text-align: center;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

/* 删除确认：页面级居中弹窗，大字体大按钮，适合手机操作
   （display:flex 会覆盖 hidden 默认行为，需显式声明） */
.modal-mask {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.modal-mask[hidden] { display: none; }

.modal {
  width: min(320px, 100%);
  padding: 24px 20px 20px;
  border-radius: 16px;
  background: var(--dialog-bg);
  text-align: center;
}

.modal-text {
  margin: 0 0 20px;
  font-size: 16px;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.modal-delete { background: #ff453a; color: #fff; }
.modal-cancel { background: var(--dialog-cancel-bg); color: var(--text); }

.confirm-yes { background: #ff453a; color: #fff; }
.confirm-no { background: rgba(255, 255, 255, 0.9); color: #1d1d1f; }

.empty-tip {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 32px 0;
}
