:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --line: rgba(255, 255, 255, 0.1);
  --ink: #f4f5f7;
  --ink-2: #8b919c;
  --accent: #f4f5f7;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
}

.app { min-height: 100%; display: flex; flex-direction: column; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 28px 22px calc(28px + var(--safe-b));
}
.screen[hidden] { display: none; }

/* 首页 */
.hero {
  width: min(78vw, 300px);
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 36px;
  background: linear-gradient(160deg, #2a2f3a, #171a20);
  color: var(--ink);
  display: grid;
  place-content: center;
  gap: 14px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  transition: transform .12s ease;
}
.hero:active { transform: scale(0.98); }
.hero svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin: 0 auto; }

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}
.ghost svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 预览 / 结果 */
video, #source, #resultImg {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 18px;
  background: #000;
}
#resultImg { background: #fff; }

/* 底部操作条 */
.bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  width: 100%;
}

.round {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.round svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round.solid { background: var(--accent); color: #0f1115; border-color: transparent; }
.round:disabled { opacity: .45; }

.shutter {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.shutter:active { background: rgba(255, 255, 255, 0.5); }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + var(--safe-b));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 14px;
  pointer-events: none;
}
.toast[hidden] { display: none; }
