:root {
  color-scheme: dark;
  --ink: #eef5f2;
  --muted: #90a09a;
  --line: rgba(235, 246, 241, .13);
  --surface: rgba(16, 23, 25, .82);
  --accent: #d9ff70;
  --accent-dark: #24310b;
  --danger: #ff8a76;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: #080d0f; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 10% 8%, rgba(92, 118, 99, .18), transparent 30rem),
    radial-gradient(circle at 92% 40%, rgba(95, 126, 118, .11), transparent 26rem),
    #080d0f;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 42px 38px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: inherit; display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { width: 34px; height: 43px; border: 2px solid var(--ink); border-radius: 50% 50% 45% 45%; position: relative; transform: rotate(-8deg); }
.brand-mark::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); right: 3px; top: 5px; box-shadow: 0 0 16px var(--accent); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--serif); font-size: 21px; font-weight: 500; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: .32em; margin-top: 2px; }
.privacy-pill { border: 1px solid var(--line); border-radius: 999px; padding: 10px 15px; color: #b5c1bd; font-size: 12px; letter-spacing: .06em; background: rgba(255,255,255,.025); }
.privacy-pill span { color: var(--accent); margin-right: 6px; font-size: 8px; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: end; gap: 48px; padding: 58px 4px 34px; }
.eyebrow, .panel-kicker { color: var(--accent); letter-spacing: .22em; font-size: 10px; font-weight: 700; }
.intro .eyebrow { grid-column: 1 / -1; margin: 0 0 -28px; }
.intro h1 { margin: 0; font-family: var(--serif); font-size: clamp(52px, 7vw, 102px); font-weight: 400; line-height: .9; letter-spacing: -.055em; }
.intro h1 em { color: var(--accent); font-weight: 400; }
.lede { margin: 0 0 8px; max-width: 390px; color: #a5b1ad; font-size: 15px; line-height: 1.85; }

.mirror-card { border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: var(--surface); box-shadow: 0 40px 90px rgba(0,0,0,.34); }
.mirror-stage { position: relative; width: 100%; aspect-ratio: 16/8.6; max-height: 740px; min-height: 410px; overflow: hidden; isolation: isolate; background: #11191b; touch-action: none; }
#camera, #fog-canvas, #hand-canvas, .camera-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; }
#camera { object-fit: cover; transform: scaleX(-1); opacity: 0; transition: opacity .55s ease; filter: saturate(.86) contrast(1.03) brightness(.88); }
.camera-ready #camera { opacity: 1; }
.camera-placeholder { display: grid; place-content: center; text-align: center; background: radial-gradient(circle at 50% 48%, #263336, #111719 54%, #0d1214); color: #d7e1dd; transition: opacity .4s; }
.camera-ready .camera-placeholder { opacity: 0; pointer-events: none; }
.placeholder-orb { width: 96px; height: 96px; margin: 0 auto 17px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); box-shadow: inset 0 0 40px rgba(217,255,112,.1), 0 0 80px rgba(217,255,112,.06); }
.camera-placeholder p { margin: 0; font-family: var(--serif); font-size: 25px; }
.camera-placeholder small { max-width: 280px; margin-top: 8px; color: #84928e; line-height: 1.5; }
#fog-canvas { z-index: 2; cursor: crosshair; }
#hand-canvas { z-index: 3; pointer-events: none; }

.mirror-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; background: linear-gradient(115deg, rgba(255,255,255,.08), transparent 22%, transparent 72%, rgba(255,255,255,.035)); box-shadow: inset 0 0 110px rgba(0,0,0,.58); }
.focus-frame { position: absolute; inset: 64px 72px; z-index: 5; pointer-events: none; opacity: .55; }
.focus-frame i { position: absolute; width: 28px; height: 28px; border-color: rgba(235,246,241,.62); border-style: solid; }
.focus-frame i:nth-child(1){left:0;top:0;border-width:1px 0 0 1px}.focus-frame i:nth-child(2){right:0;top:0;border-width:1px 1px 0 0}.focus-frame i:nth-child(3){right:0;bottom:0;border-width:0 1px 1px 0}.focus-frame i:nth-child(4){left:0;bottom:0;border-width:0 0 1px 1px}
.stage-topline { position: absolute; z-index: 7; left: 28px; right: 28px; top: 24px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.live-status, .gesture-status, .brush-indicator { padding: 9px 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(8,13,15,.62); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 11px; letter-spacing: .08em; }
.live-status span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #9aa29f; }
.camera-ready .live-status span { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.gesture-status { color: #bdc8c4; }
.brush-indicator { position: absolute; z-index: 7; left: 50%; bottom: 25px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; opacity: 0; transition: opacity .2s, transform .2s; }
.brush-indicator.show { opacity: 1; transform: translate(-50%, -5px); }
.brush-dot { width: 11px; height: 11px; border: 2px solid var(--accent); border-radius: 50%; }
.brush-indicator.wide .brush-dot { width: 20px; height: 20px; }
.palm-progress { position: absolute; z-index: 8; left: 50%; top: 50%; translate: -50% -50%; width: 184px; text-align: center; opacity: 0; pointer-events: none; }
.palm-progress.visible { opacity: 1; }
.palm-progress span { display: block; height: 3px; background: linear-gradient(90deg, var(--accent) var(--progress, 0%), rgba(255,255,255,.18) 0); border-radius: 10px; margin-bottom: 11px; }
.palm-progress b { font-size: 11px; letter-spacing: .12em; }
.countdown { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; pointer-events: none; font-family: var(--serif); color: white; font-size: clamp(120px, 20vw, 280px); text-shadow: 0 16px 60px rgba(0,0,0,.55); }
.flash { position: absolute; inset: 0; z-index: 12; background: #fff; opacity: 0; pointer-events: none; }
.flash.fire { animation: flash .48s ease-out; }
@keyframes flash { 0%{opacity:0} 18%{opacity:.96} 100%{opacity:0} }

.permission-panel, .error-panel { position: absolute; z-index: 9; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(420px, calc(100% - 42px)); padding: 30px; text-align: center; border: 1px solid rgba(255,255,255,.16); border-radius: 22px; background: rgba(11,17,19,.82); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 22px 70px rgba(0,0,0,.34); }
.permission-panel h2, .error-panel h2 { font-family: var(--serif); font-size: 34px; font-weight: 400; margin: 8px 0 7px; }
.permission-panel p:not(.panel-kicker), .error-panel p:not(.panel-kicker) { color: #9eaaa6; font-size: 13px; line-height: 1.7; margin: 0 auto 20px; max-width: 320px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; border: 0; border-radius: 999px; background: var(--accent); color: #11170a; font-weight: 800; cursor: pointer; transition: transform .18s, filter .18s; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.04); }
.primary-button:disabled { opacity: .62; cursor: wait; }
.camera-icon { width: 17px; height: 13px; border: 2px solid currentColor; border-radius: 3px; position: relative; }
.camera-icon::after { content:""; position:absolute; right:-7px; top:1px; border:5px solid transparent; border-right:0; border-left:6px solid currentColor; }
.text-button { margin-top: 12px; padding: 7px 14px; border: 0; background: transparent; color: #aebbb6; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
[hidden] { display: none !important; }

.control-deck { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 20px 24px; border-top: 1px solid var(--line); }
.control-copy { display: flex; align-items: center; gap: 13px; }
.step-number { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-family: var(--serif); }
.control-copy b, .control-copy small { display: block; }
.control-copy b { font-size: 13px; }
.control-copy small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.action-row { display: flex; gap: 9px; }
.utility-button, .capture-button { min-height: 46px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 999px; cursor: pointer; }
.utility-button { color: var(--ink); background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.utility-button:disabled { opacity: .38; cursor: default; }
.utility-button .brush-preview { width: 10px; height: 10px; border: 2px solid var(--accent); border-radius: 50%; }
.utility-button.wide .brush-preview { width: 18px; height: 18px; }
.capture-button { border: 0; color: #11170a; background: var(--accent); padding-inline: 22px; }
.capture-button:disabled { opacity: .38; cursor: not-allowed; }
.shutter-icon { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 8px currentColor; }

.gesture-guide { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 56px; }
.gesture-guide article { min-height: 154px; padding: 30px 24px; display: flex; align-items: flex-start; gap: 17px; border-right: 1px solid var(--line); }
.gesture-guide article:last-child { border-right: 0; }
.gesture-glyph { font-size: 27px; filter: grayscale(1); }
.gesture-guide small, .gesture-guide b, .gesture-guide p { display: block; }
.gesture-guide small { color: var(--accent); font-size: 9px; letter-spacing: .22em; margin-bottom: 8px; }
.gesture-guide b { font-size: 13px; }
.gesture-guide p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 6px 0 0; }
footer { min-height: 95px; display: flex; align-items: center; justify-content: space-between; color: #697773; font-size: 10px; letter-spacing: .14em; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; translate: -50% 15px; max-width: calc(100% - 28px); padding: 12px 17px; border: 1px solid var(--line); border-radius: 999px; background: rgba(8,13,15,.92); color: #dce7e3; box-shadow: 0 18px 50px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: .25s ease; font-size: 12px; white-space: nowrap; }
.toast.show { opacity: 1; translate: -50% 0; }
.toast.error { color: #ffd0c8; border-color: rgba(255,138,118,.35); }

@media (max-width: 900px) {
  .app-shell { padding-inline: 20px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .intro .eyebrow { margin-bottom: -8px; }
  .intro h1 { font-size: clamp(54px, 12vw, 82px); }
  .lede { max-width: 560px; }
  .control-deck { grid-template-columns: 1fr; }
  .action-row { flex-wrap: wrap; }
  .capture-button { flex: 1; }
  .gesture-guide { grid-template-columns: repeat(2, 1fr); }
  .gesture-guide article:nth-child(2) { border-right: 0; }
  .gesture-guide article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .app-shell { padding: 0 12px 24px; }
  .topbar { height: 74px; }
  .privacy-pill { font-size: 0; padding: 9px 11px; }
  .privacy-pill::after { content: "本机生成"; font-size: 10px; }
  .intro { padding: 38px 4px 24px; }
  .intro h1 { font-size: 56px; line-height: .94; }
  .lede { font-size: 13px; }
  .mirror-card { border-radius: 22px; }
  .mirror-stage { aspect-ratio: 3/4; min-height: min(70vh, 620px); }
  .focus-frame { inset: 58px 28px; }
  .stage-topline { left: 16px; right: 16px; top: 16px; }
  .gesture-status { display: none; }
  .permission-panel, .error-panel { padding: 24px 20px; }
  .permission-panel h2, .error-panel h2 { font-size: 30px; }
  .control-deck { padding: 17px 14px; }
  .control-copy { display: none; }
  .action-row { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .utility-button { padding: 0 8px; font-size: 12px; }
  .capture-button { grid-column: 1/-1; }
  .gesture-guide { margin-top: 38px; grid-template-columns: 1fr; }
  .gesture-guide article { min-height: 116px; border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 18px; }
  .gesture-guide article:nth-child(3) { border-bottom: 1px solid var(--line); }
  .gesture-guide article:last-child { border-bottom: 0; }
  footer { align-items: flex-start; padding-top: 25px; gap: 12px; flex-direction: column; justify-content: flex-start; }
  .toast { white-space: normal; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
