:root {
  --navy: #14213d;
  --navy-2: #1f3057;
  --gold: #e3b866;
  --gold-2: #f6dc9c;
  --cream: #fdf8ef;
  --red: #c8102e;
  --text: #f4efe4;
  --muted: #a9b2c6;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(120% 70% at 50% 0%, #2b4170 0%, var(--navy) 55%, #0b1427 100%) fixed;
}
.app { max-width: 480px; margin: 0 auto; min-height: 100%; padding: env(safe-area-inset-top) 18px calc(20px + env(safe-area-inset-bottom)); }
.step { display: none; flex-direction: column; gap: 16px; min-height: 100vh; padding: 16px 0; animation: fade .3s ease; }
.step.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

.hero { text-align: center; padding: 40px 0 8px; }
.badge { display: inline-block; letter-spacing: .3em; font-size: 11px; color: var(--gold); border: 1px solid rgba(227,184,102,.5); border-radius: 99px; padding: 5px 12px 5px 16px; }
.hero h1 { font-family: Georgia, "Songti SC", "STSong", serif; font-size: 32px; margin: 18px 0 8px; color: var(--gold-2); letter-spacing: .04em; }
.slogan { font-family: Georgia, serif; font-style: italic; color: var(--text); opacity: .85; margin: 0; }
.date { color: var(--muted); font-size: 13px; margin: 6px 0 0; letter-spacing: .1em; }

.card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(6px); }
.card h2 { margin: 0; font-size: 18px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input { font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.2); color: var(--text); outline: none; }
input:focus { border-color: var(--gold); }

.btn { appearance: none; border: 0; border-radius: 99px; padding: 14px 18px; font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; flex: 1; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #3a2a08; box-shadow: 0 6px 20px rgba(227,184,102,.3); }
.btn.ghost { background: transparent; color: var(--gold-2); border: 1px solid rgba(227,184,102,.6); }
.btn.text { background: transparent; color: var(--muted); font-weight: 500; font-size: 14px; padding: 10px 6px; }
.btn.wide { width: 100%; flex: none; }
.row { display: flex; gap: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }

.bar { display: flex; justify-content: space-between; align-items: center; font-size: 15px; min-height: 32px; }
.bar > :first-child, .bar > :last-child { min-width: 64px; }
.bar > :last-child { text-align: right; }
.back { background: none; border: 0; color: var(--gold-2); font-size: 15px; padding: 0; text-align: left; }
.no { color: var(--gold); font-size: 13px; }

.viewer { aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: rgba(0,0,0,.25); border: 1px dashed rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; }
.viewer img { width: 100%; height: 100%; object-fit: cover; }
.placeholder { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ring { width: 120px; height: 150px; margin: 0 auto 16px; border: 2px dashed rgba(227,184,102,.5); border-radius: 50% 50% 46% 46%; }

.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.style { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 3/4; border: 2px solid transparent; cursor: pointer; background: #000; }
.style img { width: 100%; height: 100%; object-fit: cover; display: block; background: #1a1a1a; }
.style .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.style .lbl b { display: block; font-size: 15px; }
.style .lbl small { color: #ddd; font-size: 11px; }
.style.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227,184,102,.3); }
.style.on::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #3a2a08; font-weight: 700; display: grid; place-items: center; font-size: 14px; }

.loading { margin: auto; text-align: center; padding: 0 12px; }
.loading h2 { color: var(--gold-2); font-family: Georgia, "Songti SC", serif; }
.tip { color: var(--text); opacity: .85; min-height: 3em; line-height: 1.6; font-size: 14px; }
.timer { color: var(--muted); font-size: 12px; }
.brush { display: flex; gap: 10px; justify-content: center; height: 60px; align-items: flex-end; }
.brush span { width: 14px; border-radius: 7px; background: linear-gradient(var(--gold-2), var(--gold)); animation: bar 1s ease-in-out infinite; }
.brush span:nth-child(2) { animation-delay: .15s; background: linear-gradient(#ff8a8a, var(--red)); }
.brush span:nth-child(3) { animation-delay: .3s; background: linear-gradient(#9ecbff, #4a7fd1); }
@keyframes bar { 0%, 100% { height: 14px; } 50% { height: 60px; } }

.preview { border-radius: 12px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.45); align-self: center; width: 78%; }
.preview canvas, .preview img { display: block; width: 100%; height: auto; -webkit-touch-callout: default; }
.frames { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.frames::-webkit-scrollbar { display: none; }
.frame { flex: 0 0 auto; padding: 9px 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05); color: var(--text); font-size: 14px; white-space: nowrap; }
.frame i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.motto { width: 100%; box-sizing: border-box; margin: 2px 0 12px; }
.frame.on { border-color: var(--gold); color: var(--gold-2); background: rgba(227,184,102,.12); }
.longpress { text-align: center; color: var(--gold-2); font-size: 13px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 86%; text-align: center; z-index: 9; }
.toast.show { opacity: 1; }
