/* 设计稿的 latin 字形自托管；中文走系统字体，避免为几十个汉字拉一整套 CJK 字重。 */
@font-face { font-family:'Noto Sans SC'; src:url('./fonts/noto-sans-sc-latin.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Noto Sans SC'; src:url('./fonts/noto-sans-sc-latin.woff2') format('woff2'); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'Noto Sans SC'; src:url('./fonts/noto-sans-sc-latin.woff2') format('woff2'); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:'Noto Sans SC'; src:url('./fonts/noto-sans-sc-latin.woff2') format('woff2'); font-weight:900; font-style:normal; font-display:swap; }
@font-face { font-family:'Space Mono'; src:url('./fonts/space-mono-400-latin.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Space Mono'; src:url('./fonts/space-mono-700-latin.woff2') format('woff2'); font-weight:700; font-style:normal; font-display:swap; }

:root {
  --ink:        #F2F0FF;
  --ink-muted:  #8A85A8;
  --ink-dim:    #635E80;
  --screen-bg:  #07060F;
  --lime:       #9CFF3D;
  --lime-soft:  #CFFFA6;
  --cyan:       #35E8FF;
  --gold:       #FFC83D;
  --gold-soft:  #FFE9A8;
  --hairline:   rgba(154,150,190,.16);

  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --btn-size: 124px;
  --count-size: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0B0A14;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 80% at 50% 0%, #17122E 0%, #0B0A14 60%);
}

.screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--screen-bg);
  padding:
    calc(14px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
}

/* 桌面端收进一个 402×874 的机身，和设计稿的取景比例一致 */
@media (min-width: 560px) and (min-height: 720px) {
  .stage { padding: 24px; }
  .screen {
    width: 402px;
    height: min(874px, calc(100dvh - 48px));
    padding: 34px 18px 34px;
    border-radius: 44px;
    box-shadow: 0 40px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06);
  }
}

@media (max-height: 700px) {
  :root { --btn-size: 100px; --count-size: 42px; }
}

/* ── 顶栏 ───────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  color: var(--ink-muted);
}
.topbar__id { display: flex; align-items: center; gap: 7px; }
.topbar__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 8px var(--lime);
  animation: dotBlink 1.6s ease-in-out infinite;
}

/* ── 取景框 ─────────────────────────────────────────── */
.viewfinder {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 14px;
  border-radius: 26px;
  overflow: hidden;
  background: #0C0A1A;
  border: 1px solid var(--hairline);
}

.viewfinder__cam {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0;
  transition: opacity .35s ease;
}
.viewfinder.is-live .viewfinder__cam { opacity: 1; }

.viewfinder__fallback { position: absolute; inset: 0; }
.viewfinder__fallback svg { width: 100%; height: 100%; display: block; }
.viewfinder.is-live .viewfinder__fallback { opacity: 0; transition: opacity .35s ease; }

.viewfinder__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(7,6,15,.5) 0%, rgba(7,6,15,0) 28%, rgba(7,6,15,0) 70%, rgba(7,6,15,.72) 100%);
}

.viewfinder__reticle {
  position: absolute; left: 14%; top: 20%; right: 14%; bottom: 12%;
  border-radius: 20px; border: 1px dashed rgba(53,232,255,.3);
  pointer-events: none;
  animation: retpulse 2.4s ease-in-out infinite;
}

.scanfx { position: absolute; inset: 0; pointer-events: none; }
.scanfx__sweep {
  position: absolute; left: 0; right: 0; height: 120px; top: 6%;
  background: linear-gradient(180deg, rgba(53,232,255,0) 0%, rgba(53,232,255,.22) 70%, rgba(53,232,255,.9) 100%);
  animation: sweep 1.3s ease-in-out infinite alternate;
}
.scanfx__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(53,232,255,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,232,255,.09) 1px, transparent 1px);
  background-size: 34px 34px;
}

.germlayer {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

.taglayer {
  position: absolute; inset: 0; pointer-events: none;
  font-family: var(--font-mono);
}
.tag {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 6px;
  will-change: transform;
}
.tag__line { width: 22px; height: 1px; background: rgba(156,255,61,.7); flex-shrink: 0; }
.tag__chip {
  font-size: 10px; letter-spacing: .08em; color: var(--lime-soft);
  background: rgba(7,6,15,.72); border: 1px solid rgba(156,255,61,.35);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}

.cleanfx { position: absolute; inset: 0; pointer-events: none; }
.cleanfx__halo {
  position: absolute; left: 0; top: 0;
  width: 320px; height: 320px; margin: -160px 0 0 -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,200,61,.42) 0%, rgba(255,200,61,.1) 45%, rgba(255,200,61,0) 70%);
  animation: haloPulse 2s ease-in-out infinite;
  will-change: transform;
}
.cleanfx__stamp {
  position: absolute; right: 18px; bottom: 96px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  color: var(--gold-soft);
  border: 2px solid var(--gold); border-radius: 8px; padding: 8px 12px;
  animation: stampIn .45s cubic-bezier(.2,1.5,.4,1) both;
}
.cleanfx__stamp span { display: block; font-size: 9px; letter-spacing: .14em; color: var(--gold); }

.trackpill {
  position: absolute; left: 14px; top: 14px;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  color: var(--cyan);
  background: rgba(7,6,15,.6); border: 1px solid rgba(53,232,255,.3);
  border-radius: 999px; padding: 4px 9px;
}
.trackpill__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }

.readout {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
}
.readout__caption {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--ink-muted);
}
.readout__value { display: flex; align-items: baseline; gap: 6px; }
.readout__value span {
  font-size: var(--count-size); font-weight: 900; line-height: 1;
  color: var(--ink-dim);
  text-shadow: 0 0 22px rgba(0,0,0,.6);
  font-variant-numeric: tabular-nums;
  transition: color .3s ease;
}
.readout__value em {
  font-family: var(--font-mono); font-size: 12px; font-style: normal; color: var(--ink-muted);
}
.readout__meta {
  text-align: right;
  font-family: var(--font-mono); font-size: 10px; line-height: 1.7; letter-spacing: .08em;
  color: var(--ink-muted);
}

/* ── 语音条 ─────────────────────────────────────────── */
.voicebar {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  margin-top: 12px; padding: 5px 13px 5px 7px;
  border-radius: 14px; background: #120F26; border: 1px solid rgba(154,150,190,.14);
}
.voicebar__mute {
  flex-shrink: 0;
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--lime);
  border-radius: 10px;
}
.voicebar__mute .voicebar__slash { opacity: 0; }
.voicebar__mute[aria-pressed="true"] { color: var(--ink-dim); }
.voicebar__mute[aria-pressed="true"] .voicebar__waves { opacity: 0; }
.voicebar__mute[aria-pressed="true"] .voicebar__slash { opacity: 1; }
.voicebar__line { font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--ink); }

/* ── 主按钮 ─────────────────────────────────────────── */
.mainaction { display: flex; justify-content: center; margin: 16px 0 12px; flex-shrink: 0; }
.bigbtn {
  width: var(--btn-size); height: var(--btn-size);
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--lime); color: var(--screen-bg);
  font-family: var(--font-sans); font-size: 22px; font-weight: 900; letter-spacing: .06em;
  box-shadow: 0 0 0 8px rgba(156,255,61,.1), 0 14px 34px rgba(156,255,61,.28);
  transition: transform .12s ease, background-color .25s ease;
}
.bigbtn:active { transform: scale(.94); }
.bigbtn.is-busy { background: #4A5B2E; }

/* ── 家长开关 ───────────────────────────────────────── */
.parentbar {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  padding: 9px 10px; border-radius: 14px;
  background: #0F0D1E; border: 1px solid rgba(154,150,190,.12);
}
.parentbar__caption {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; color: var(--ink-dim);
  writing-mode: vertical-rl; text-orientation: mixed; line-height: 1;
}
.parentbar__group { display: flex; flex: 1; gap: 6px; }
.modebtn {
  flex: 1; padding: 9px 4px;
  border-radius: 10px; border: 1px solid rgba(154,150,190,.2); background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans); font-size: 13px; font-weight: 700; line-height: 1.3;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.modebtn span {
  display: block;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; opacity: .75;
}
.modebtn.is-dirty.is-on {
  background: rgba(156,255,61,.14); border-color: rgba(156,255,61,.55); color: var(--lime-soft);
}
.modebtn.is-clean.is-on {
  background: rgba(255,200,61,.14); border-color: rgba(255,200,61,.55); color: var(--gold-soft);
}

/* ── 动画 ───────────────────────────────────────────── */
@keyframes sweep     { 0% { top: 6% }  100% { top: 92% } }
@keyframes retpulse  { 0%,100% { opacity: .35; transform: scale(1) } 50% { opacity: 1; transform: scale(1.04) } }
/* --halo-alpha 由主循环写入：手丢了要跟着淡出，同时保留呼吸感。 */
@keyframes haloPulse { 0%,100% { opacity: calc(var(--halo-alpha, 1) * .45) } 50% { opacity: calc(var(--halo-alpha, 1) * .9) } }
@keyframes stampIn   { 0% { opacity: 0; transform: scale(1.6) rotate(-14deg) } 100% { opacity: 1; transform: scale(1) rotate(-9deg) } }
@keyframes dotBlink  { 0%,100% { opacity: .25 } 50% { opacity: 1 } }
@keyframes rise      { 0% { opacity: 0 } 100% { opacity: 1 } }

@media (prefers-reduced-motion: reduce) {
  .topbar__dot, .viewfinder__reticle, .scanfx__sweep, .cleanfx__halo { animation: none; }
}
