/* 咕噜拾光 — a quiet white studio: off-white page, white cards, ink text and one warm orange. */
:root {
  color-scheme: light;
  --paper: #faf8f5;
  --paper-2: #f3efea;
  --kraft: #e8e2da;
  --kraft-deep: #d9d2c9;
  --card: #ffffff;
  --card-2: #f5f2ee;
  --ink: #1e1b18;
  --ink-2: #5f5952;
  --ink-3: #9a938a;
  --line: #ece7e0;
  --line-strong: #ddd6cd;
  --accent: #d9622b;
  --accent-hover: #c2531f;
  --accent-edge: #b04a1a;
  --accent-soft: #fbede5;
  --jade: #3f7a75;
  --jade-deep: #2f625e;
  --jade-soft: #e3efed;
  --mustard: #e2b655;
  --mustard-soft: #f8efd9;
  --on-dark: #f6f1ea;
  --on-dark-2: #b9b1a7;
  --danger: #c0432b;
  --warn: #a86a24;
  --warn-soft: #f8eedf;
  --dark: #1e1b18;
  --dark-2: #2c2824;
  --safelight: #d9622b;
  --go: #d9622b;
  --go-deep: #c2531f;
  --radius: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(30 27 24 / 5%), 0 4px 12px -6px rgb(30 27 24 / 12%);
  --shadow: 0 1px 2px rgb(30 27 24 / 4%), 0 12px 40px -12px rgb(30 27 24 / 14%);
  --shadow-lg: 0 2px 4px rgb(30 27 24 / 4%), 0 24px 60px -20px rgb(30 27 24 / 22%);
  /* Rounded type: 975 圆体 for headings, 寒蝉全圆体 for text. Both are OFL and subset to the characters this site uses. */
  --serif: 'Gulu Round Title', 'Gulu Round', ui-rounded, 'Yuanti SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --sans: 'Gulu Round', ui-rounded, 'Yuanti SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --fiber: none;
  --grain: none;
  --tooth: none;
}
@font-face { font-family: 'Gulu Round'; src: url(assets/fonts/round-body.woff2) format('woff2'); font-weight: 100 600; font-display: swap; }
@font-face { font-family: 'Gulu Round Title'; src: url(assets/fonts/round-title.woff2) format('woff2'); font-weight: 500 800; font-display: swap; }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }
.site-header { view-transition-name: site-header; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--accent-hover); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
p, h1, h2, h3, figure { margin: 0; }
img { display: block; max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; transition: background .3s var(--ease), box-shadow .3s var(--ease); }
.site-header.scrolled { background: rgb(250 248 245 / 86%); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); box-shadow: 0 1px 0 var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(1160px, 100% - 40px); height: 68px; margin: 0 auto; transition: height .3s var(--ease); }
.scrolled .header-inner { height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 18px var(--serif); letter-spacing: 1.5px; white-space: nowrap; }
.mark { width: 32px; height: 32px; border-radius: 10px; transform-origin: 50% 90%; transition: transform .6s var(--spring); }
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
.site-nav { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.site-nav > a:not(.chip) { padding: 7px 13px; border-radius: 999px; transition: color .2s, background .2s; }
.site-nav > a:not(.chip):hover, .site-nav > a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; padding: 6px 13px; border-radius: 999px; font-size: 13px; color: var(--ink-2); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, color .2s; }
.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #3aa675; }

/* Buttons */
.primary, .secondary, .ghost { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border-radius: 999px; font: 500 15px var(--serif); letter-spacing: .5px; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s, transform .15s var(--ease), opacity .2s; cursor: pointer; }
.primary { background: var(--ink); color: #fff; }
.primary:hover { background: #34302b; }
.primary.accent { background: var(--accent); box-shadow: 0 8px 18px -8px rgb(217 98 43 / 60%); }
.primary.accent:hover { background: var(--accent-hover); }
.primary.jade { background: var(--accent); box-shadow: 0 8px 18px -8px rgb(217 98 43 / 60%); }
.primary:active, .secondary:active, .ghost:active { transform: scale(.98); }
.primary:disabled { opacity: .35; box-shadow: none; transform: none; }
.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.secondary:hover { background: var(--paper-2); }
.ghost { min-height: 40px; padding: 0 16px; color: var(--ink-2); }
.ghost:hover { color: var(--ink); background: var(--paper-2); }
.wide { width: 100%; }
.text-button { padding: 4px 0; color: var(--accent); font-size: 14px; font-weight: 500; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-button:disabled { color: var(--ink-3); text-decoration: none; }
.primary svg, .secondary svg { width: 18px; height: 18px; }
.paper { background: var(--card); box-shadow: var(--shadow); }

/* Layout */
main { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; padding: 0 24px 40px; }

/* Footer: quiet, two lines of links */
.site-footer { width: min(1160px, 100% - 40px); margin: 88px auto 0; padding: 26px 0 max(28px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.footer-card { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; }
.footer-brand { display: flex; gap: 16px; align-items: flex-start; }
.footer-logo { flex-shrink: 0; display: block; width: 52px; height: 52px; border-radius: 14px; overflow: hidden; }
.footer-logo img { width: 100%; height: 100%; object-fit: cover; }
.footer-brand p { line-height: 1.8; }
.footer-name { font: 500 15px var(--serif); letter-spacing: 1px; color: var(--ink); }
.footer-name span { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font: 12px var(--sans); letter-spacing: 0; }
.footer-brand a { color: var(--ink-2); }
.footer-links { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; }
.footer-links div { display: flex; flex-direction: column; gap: 6px; }
.footer-links b { margin-bottom: 2px; font-weight: 500; color: var(--ink-2); }
.footer-links a { width: fit-content; transition: color .2s; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding-top: 22px; font-size: 12px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 2px; color: var(--ink-3); }
.section-title { font: 500 clamp(22px, 3.2vw, 30px)/1.35 var(--serif); letter-spacing: 1px; }
.section-sub { margin-top: 10px; color: var(--ink-2); }

/* Motion: page entrance and scroll reveal */
.rise { animation: rise .7s var(--ease) both; animation-delay: calc(var(--d, 0) * 80ms + 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
[data-reveal].in { opacity: 1; transform: none; }
.view { animation: view-in .5s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* Hero */
.hero { width: min(760px, 100%); padding: 9vh 0 0; text-align: center; }
.hero-title { font: 500 clamp(28px, 4.4vw, 42px)/1.25 var(--serif); letter-spacing: 2px; }
.hero-sub { margin: 12px auto 0; font-size: 15px; color: var(--ink-3); }
body[data-view=working] .hero, body[data-view=done] .hero, body[data-view=failed] .hero, body[data-view=working] .welcome-gift, body[data-view=done] .welcome-gift, body[data-view=failed] .welcome-gift { display: none !important; }

/* Sign-up gift: one quiet line under the title */
.welcome-gift { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; margin: 20px auto 0; padding: 8px 10px 8px 16px; border-radius: 999px; background: var(--accent-soft); animation: rise .6s var(--ease) .3s both; }
.gift-stamp { display: none; }
.gift-text { min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); text-align: left; }
.gift-text b { margin-right: 6px; font-weight: 600; color: var(--accent); }
.gift-text strong { color: var(--accent); font-weight: 600; }
.welcome-gift .text-button { flex-shrink: 0; padding: 4px 12px; border-radius: 999px; background: var(--card); font-size: 13px; white-space: nowrap; }
.welcome-gift .text-button:hover { text-decoration: none; background: #fff6f1; }
.welcome-gift .text-button:empty { display: none; }

/* Studio: the composer, then the stage once work starts */
.studio { position: relative; width: min(760px, 100%); margin-top: 28px; scroll-margin-top: 84px; }
body[data-view=working] .studio, body[data-view=done] .studio, body[data-view=failed] .studio { width: min(1040px, 100%); margin-top: 4vh; }
#empty-state { display: none !important; }
.studio[data-view=confirm] #photo-state, .studio[data-view=empty] #photo-state { display: none !important; }

.composer { position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: 26px; box-shadow: inset 0 0 0 1px var(--line), var(--shadow); text-align: left; transition: box-shadow .2s; }
.composer:focus-within { box-shadow: inset 0 0 0 1px #e3c8b8, 0 0 0 4px rgb(217 98 43 / 7%), var(--shadow); }
.drop-hint { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; border-radius: inherit; background: rgb(251 237 229 / 94%); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); font: 500 16px var(--serif); pointer-events: none; }
#drop-zone.dragging .drop-hint { display: grid; }
.attachments { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 18px 18px 0; }
.attach-thumb { position: relative; width: 76px; height: 76px; }
.attach-thumb img { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; background: var(--paper-2); }
.attach-thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgb(30 27 24 / 62%); color: #fff; font-size: 14px; line-height: 22px; }
.same-style { display: inline-flex; align-items: center; gap: 6px; padding: 4px 5px 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hover); font-size: 12.5px; }
.same-style button { width: 22px; height: 22px; border-radius: 50%; }
.same-style button:hover { background: rgb(255 255 255 / 70%); }
.composer textarea { field-sizing: content; display: block; width: 100%; min-height: 96px; max-height: 320px; resize: none; border: 0; outline: 0; background: transparent; padding: 20px 22px 8px; font: 16px/1.65 var(--sans); color: var(--ink); }
.composer textarea::placeholder { color: #b4ada4; }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 12px; }
.pick { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; color: var(--ink-2); transition: background .2s; }
.pick:hover { background: var(--paper-2); }
.pick svg { width: 17px; height: 17px; }
.mode-pill { padding: 3px 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-pill.restore, .mode-pill.edit, .mode-pill.generate, .mode-pill.need { padding: 3px 10px; border-radius: 999px; font-weight: 500; }
.mode-pill.restore { background: var(--accent-soft); color: var(--accent-hover); }
.mode-pill.edit { background: var(--jade-soft); color: var(--jade-deep); }
.mode-pill.generate { background: var(--mustard-soft); color: #86621a; }
.mode-pill.need { background: var(--accent-soft); color: var(--accent-hover); }
.mode-pill.flip { animation: flip .4s var(--spring); }
@keyframes flip { 40% { transform: scale(1.06); } }
.composer-bar .spacer { flex: 1; }
.prompt-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.prompt-count.over-limit { color: var(--danger); }
.quota-line { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.quota-line:empty { display: none; }
.send { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff; transition: opacity .2s, transform .15s, background .2s; }
.send:not(:disabled):hover { background: var(--accent); }
.send:active { transform: scale(.94); }
.send:disabled { opacity: .16; }
.send svg { width: 19px; height: 19px; stroke-width: 2.2; }

#status { margin-top: 14px; padding: 10px 16px; border-radius: var(--radius-md); font-size: 14px; line-height: 1.7; background: var(--jade-soft); color: var(--jade-deep); animation: view-in .4s var(--ease) both; }
#status.error { background: var(--warn-soft); color: var(--warn); }
.studio #status:not(.error) { position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 60; width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); margin: 0; padding: 9px 16px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: var(--shadow); text-align: center; font-size: 13px; animation: toast-in .3s var(--ease) both; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Collections: real uses people can start from */
.sets { width: min(980px, 100%); margin-top: 64px; scroll-margin-top: 84px; }
.sets-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sets-head h2 { font: 500 16px var(--serif); letter-spacing: 1px; }
.sets-head span { font-size: 13px; color: var(--ink-3); }
.set-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.set { text-align: left; padding: 8px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: transform .25s var(--ease), box-shadow .25s; }
.set:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.set-pic { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.set-pic .main { width: 100%; height: 100%; object-fit: cover; }
.set-pic .inset { position: absolute; left: 8px; bottom: 8px; width: 34%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 7px; border: 2px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 18%); }
.set-pic .inset.wide { width: 44%; aspect-ratio: 4 / 3; }
.set-meta { padding: 10px 6px 4px; }
.set-meta b { display: block; font: 500 15px var(--serif); letter-spacing: .5px; }
.set-meta small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }

/* Collection panel: a side sheet on desktop, a bottom sheet on phones */
.set-sheet { position: fixed; inset: 0 0 0 auto; width: min(520px, 100%); max-width: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); box-shadow: -20px 0 60px -20px rgb(30 27 24 / 25%); outline: none; flex-direction: column; }
.set-sheet[open] { display: flex; animation: sheet-in .32s var(--ease) both; }
.set-sheet::backdrop { background: rgb(30 27 24 / 32%); }
@keyframes sheet-in { from { transform: translateX(100%); } }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 24px 24px 12px; }
.sheet-head h3 { font: 500 22px var(--serif); letter-spacing: 1px; }
.sheet-head p { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--ink-3); }
.sheet-close { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-left: auto; border-radius: 50%; background: var(--paper-2); color: var(--ink-2); }
.sheet-close svg { width: 18px; height: 18px; }
.sheet-tabs { display: flex; gap: 6px; padding: 0 24px 14px; overflow-x: auto; scrollbar-width: none; }
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tab { flex: none; height: 32px; padding: 0 13px; border-radius: 999px; font-size: 13px; color: var(--ink-2); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.sheet-tab[aria-pressed=true] { background: var(--ink); color: #fff; box-shadow: none; }
.cases { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 2px 24px 28px; overscroll-behavior: contain; }
.case { padding: 10px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ba.single { grid-template-columns: 1fr; }
.ba figure { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.ba.wide figure { aspect-ratio: 4 / 3; }
.ba.single figure { aspect-ratio: 16 / 11; }
.ba img { width: 100%; height: 100%; object-fit: cover; }
.ba figcaption { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; color: #fff; background: rgb(30 27 24 / 55%); }
.case-foot { display: flex; align-items: center; gap: 12px; padding: 10px 4px 2px; }
.case-foot p { flex: 1; min-width: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.case-foot p small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--ink-3); }
.case-foot .primary { flex: none; min-height: 36px; padding: 0 16px; font-size: 13px; }

/* Stage: the photo on the left, progress or result on the right */
#photo-state { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.frame { --pos: 50%; --develop: 0; position: relative; display: grid; place-items: center; min-height: 0; height: min(66vh, 620px); padding: 12px; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); user-select: none; -webkit-user-select: none; }
.frame-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: filter 1.4s var(--ease), opacity .6s var(--ease); }
img:not([src]), img[src=""] { display: none !important; }
.photo-print { position: absolute; inset: 12px; border-radius: 12px; overflow: hidden; }
.studio[data-view=done] .photo-print { --print-height: min(596px, calc(66vh - 24px)); --photo-ratio: var(--result-ratio, var(--original-ratio, .75)); position: relative; inset: auto; width: min(100%, calc(var(--print-height) * var(--photo-ratio))); aspect-ratio: var(--photo-ratio); }
.studio[data-view=done] .frame-img { object-fit: cover; }
.photo-print:not(:has(img[src]:not([hidden]))) { visibility: hidden; }
#photo-preview { animation: place .7s var(--ease) both; }
@keyframes place { from { opacity: 0; transform: scale(.97); } }
.no-preview { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; color: var(--ink-3); }
.stage-tag { position: absolute; z-index: 8; top: 22px; left: 22px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: rgb(30 27 24 / 55%); color: #fff; backdrop-filter: blur(6px); }
.shot-tools { display: none; }

/* Waiting: the print fades to a soft halftone and develops back as work advances */
.scan, .grain { position: absolute; inset: 12px; border-radius: 12px; pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); overflow: hidden; }
.frame[data-mode="working"] .scan { opacity: 1; }
.scan::before { content: ''; position: absolute; left: 0; right: 0; top: -40%; height: 40%; background: linear-gradient(180deg, transparent, rgb(255 236 214 / 0%) 10%, rgb(255 236 214 / 55%) 70%, rgb(255 255 255 / 0%)); animation: sweep 3s var(--ease) infinite; }
.frame[data-mode="working"] #photo-preview { filter: grayscale(calc(1 - var(--develop))) contrast(calc(.85 + .15 * var(--develop))) brightness(calc(1.08 - .08 * var(--develop))) blur(calc(1.5px * (1 - var(--develop)))); opacity: calc(.55 + .45 * var(--develop)); transition: filter 1.6s var(--ease), opacity 1.6s var(--ease); }
.frame[data-stage="queued"] .scan::before { animation-duration: 4.5s; }
.frame[data-phase="finishing"] .scan::before, .frame[data-phase="uploading"] .scan::before { animation-duration: 2s; }
@keyframes sweep { to { transform: translateY(350%); } }
.grains { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); z-index: 1; border-radius: 12px; pointer-events: none; opacity: 0; transition: opacity .7s var(--ease); }
.frame.grains-on .grains { opacity: 1; }
.frame.grains-on #photo-preview { opacity: 0; transition: opacity 1.6s var(--ease); }
.frame.grains-on .scan { opacity: 0 !important; }
.flow-canvas { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); z-index: 2; border-radius: 12px; }
body.processing::after { content: none; }
.start-ripple { position: fixed; z-index: 60; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgb(217 98 43 / 14%), rgb(217 98 43 / 4%) 60%, transparent 70%); animation: start-ripple 1.6s var(--ease) forwards; }
@keyframes start-ripple { to { transform: scale(60); opacity: 0; } }

/* Result: a soft flash, then the result slides in over the original */
.flash { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(circle at 50% 50%, #fff, rgb(255 255 255 / 0%) 70%); opacity: 0; }
.frame.lights .flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 15% { opacity: .9; } }
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles i { position: absolute; left: var(--x); top: var(--y); width: 6px; height: 6px; border-radius: 50%; background: #fff3e6; box-shadow: 0 0 10px 2px rgb(255 190 150 / 80%); opacity: 0; animation: spark 1.4s var(--ease) both; animation-delay: var(--t); }
@keyframes spark { 20% { opacity: 1; } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); } }
.compare-ui { display: none; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.frame[data-mode="compare"] { cursor: ew-resize; touch-action: pan-y; }
.frame[data-mode="compare"] .compare-ui { display: block; }
.frame[data-mode="compare"] #photo-preview { z-index: 1; clip-path: inset(0 calc(100% - var(--pos)) 0 0); filter: none; opacity: 1; animation: none; }
.frame[data-mode="compare"] #result-image { animation: reveal 1s var(--ease) both; }
@keyframes reveal { from { opacity: 0; filter: blur(8px) saturate(0); } }
.compare-ui .cmp-line { left: var(--pos); }
.compare-range { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; touch-action: pan-y; }
.frame[data-mode="compare"].solo #photo-preview, .frame[data-mode="compare"].solo .compare-ui { display: none; }
.frame[data-mode="compare"].solo #result-image.print-in { animation: print-in .8s var(--spring) both; }
@keyframes print-in { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.studio[data-view=done] .frame.solo .frame-img { clip-path: none; }
.studio[data-view=done] .frame.solo .compare-ui { display: none; }

/* Before / after comparison (shared with the records page) */
.cmp { --pos: 50%; position: relative; overflow: hidden; background: var(--paper-2); cursor: ew-resize; user-select: none; -webkit-user-select: none; touch-action: pan-y; outline-offset: 4px; }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.cmp.contain img { object-fit: contain; }
.cmp-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: rgb(255 255 255 / 95%); box-shadow: 0 0 8px rgb(0 0 0 / 22%); pointer-events: none; }
.cmp-knob { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: #fff; color: var(--ink); box-shadow: 0 3px 12px rgb(0 0 0 / 20%); transition: transform .3s var(--spring); }
.cmp-knob svg { width: 17px; height: 17px; stroke-width: 2; }
.cmp:active .cmp-knob, .cmp.dragging .cmp-knob { transform: scale(1.1); }
.cmp.small .cmp-knob { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.cmp.small .cmp-knob svg { width: 13px; height: 13px; }
.cmp-tag { position: absolute; top: 10px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; line-height: 1.5; color: #fff; background: rgb(30 27 24 / 50%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; transition: opacity .3s; }
.cmp-tag.l { left: 10px; }
.cmp-tag.r { right: 10px; }
.cmp.small .cmp-tag { top: 8px; padding: 1px 7px; font-size: 11px; }
.cmp.small .cmp-tag.l { left: 8px; }
.cmp.small .cmp-tag.r { right: 8px; }
.cmp[style*="--pos: 0"] .cmp-tag.l, .cmp[style*="--pos: 100"] .cmp-tag.r { opacity: 0; }
.cmp.side { cursor: default; }
.cmp.side .cmp-line { display: none; }
.cmp.side .cmp-before { clip-path: none; width: 50%; right: auto; }
.cmp.side .cmp-after { left: 50%; width: 50%; }
.cmp.side::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: var(--dark); }

/* Side panels */
.panel { display: flex; flex-direction: column; padding: 8px 0 0; animation: view-in .5s var(--ease) .1s both; }
.panel-kicker { font-size: 12px; letter-spacing: 2px; color: var(--ink-3); }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; }
#stage-title, .result-title { font: 500 28px/1.35 var(--serif); letter-spacing: 1px; color: var(--ink); }
.result-title { margin-top: 8px; }
.elapsed { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.prompt-echo { display: flex; flex-direction: column; margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.prompt-echo small { margin-bottom: 2px; font-size: 12px; color: var(--ink-3); }
.prompt-echo p { white-space: pre-wrap; }
#progress-panel .prompt-echo { order: -1; }
#progress-panel .panel-kicker { order: -3; }
#progress-panel .progress-head { order: -2; }
.stage-list { display: grid; gap: 2px; margin: 20px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--ink-3); }
.stage-list li { display: flex; align-items: center; gap: 12px; padding: 5px 0; transition: color .4s var(--ease); }
.node { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: background .4s var(--ease), box-shadow .4s var(--ease), transform .5s var(--spring); }
.node svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.6; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .5s var(--ease) .1s; }
.stage-list li.done { color: var(--ink-2); }
.stage-list li.done .node { background: var(--ink); box-shadow: none; animation: node-pop .5s var(--spring); }
.stage-list li.done .node svg { stroke-dashoffset: 0; }
.stage-list li.active { color: var(--ink); }
.stage-list li.active .node { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px rgb(217 98 43 / 12%); }
.stage-list li.active .node::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes node-pop { 40% { transform: scale(1.2); } }
@keyframes dot-pulse { 50% { transform: scale(.5); opacity: .5; } }
.bar { position: relative; height: 8px; margin: 22px 0 0; border-radius: 8px; background: var(--paper-2); overflow: hidden; }
#bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--accent); transition: width 1.4s var(--ease); }
#bar-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%), transparent); transform: translateX(-100%); animation: shimmer 1.8s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.progress-meta:not(:has(> :not(:empty))) { display: none; }
.phase-note { transition: opacity .26s, transform .26s var(--ease); }
.phase-note.swap { opacity: 0; transform: translateY(4px); }
.eta { font-variant-numeric: tabular-nums; }
.eta:empty, .phase-note:empty { display: none; }
.notify-button { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; color: var(--ink-2); }
.notify-button:hover { text-decoration: none; background: var(--paper-2); }
.notify-button svg { width: 15px; height: 15px; }
.notify-button:disabled { color: var(--ink-3); background: none; }
.hint { margin-top: 14px; font-size: 13px; color: var(--ink-3); line-height: 1.75; }
.hint a { color: var(--accent); }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions > * { flex: 1; }
.result-panel .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
.result-panel .actions .primary { grid-column: 1 / -1; min-height: 50px; font-size: 16px; }
.result-panel .actions .secondary { padding-inline: 10px; font-size: 14px; }
.again-line { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.again-line button { margin-left: auto; white-space: nowrap; }

/* Failed */
.progress-panel-failed .stage-list, .progress-panel-failed .elapsed, .progress-panel-failed .bar, .progress-panel-failed .progress-meta { display: none; }
#bar-fill { will-change: width; }
.fail-card { display: flex; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: var(--paper-2); color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.fail-card svg { flex: none; width: 19px; height: 19px; color: var(--accent); margin-top: 2px; }
.fail-card b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.refund { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: #2f8a5f; }
.refund svg { flex: none; width: 16px; height: 16px; }
#failed-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; }
#failed-actions > :first-child:not([hidden]) { grid-column: 1 / -1; }
#failed-actions #failure-edit { grid-column: 1 / -1; order: -1; }
.failed-art { position: absolute; inset: 12px; display: grid; place-items: center; align-content: center; gap: 14px; border-radius: 12px; background: var(--paper-2); color: var(--ink-2); font: 500 16px var(--serif); text-align: center; }
.failed-art .torn { width: 120px; height: 150px; border-radius: 10px; background: var(--card); box-shadow: var(--shadow-sm); clip-path: polygon(0 0, 100% 0, 100% 58%, 86% 63%, 74% 56%, 60% 64%, 46% 57%, 30% 65%, 16% 58%, 0 63%); }

/* Login sheet: phone browsers hand off to the Alipay app and wait here for the person to come back. */
.login-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: none; margin: 0; padding: 14px 28px calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 26px 26px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px -12px rgb(30 27 24 / 25%); text-align: center; outline: none; }
.login-sheet::before { content: ''; display: block; width: 38px; height: 5px; margin: 0 auto 22px; border-radius: 3px; background: var(--line-strong); }
.login-sheet[open] { animation: sheet-up .34s var(--ease) both; }
.login-sheet::backdrop { background: rgb(30 27 24 / 40%); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.login-sheet-mark { display: block; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; }
.login-sheet h2 { margin: 0 0 8px; font: 500 22px var(--serif); letter-spacing: 1px; }
.login-sheet p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.login-sheet .login-sheet-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 5px 14px; border-radius: 999px; background: var(--jade-soft); color: var(--jade-deep); font-size: 13px; }
.login-sheet .login-sheet-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: sheet-pulse 1.4s ease-in-out infinite; }
.login-sheet .login-sheet-status.error { background: var(--accent-soft); color: var(--accent); }
.login-sheet .login-sheet-status.error::before { animation: none; }
.login-sheet .login-sheet-status[hidden] { display: none; }
.login-sheet-actions { margin-top: 24px; }
.login-sheet-actions .primary { min-height: 52px; font-size: 16px; }
.login-sheet-links { display: flex; justify-content: center; align-items: center; margin-top: 10px; font-size: 14px; }
.login-sheet-links > * { padding: 10px 14px; color: var(--ink-3); }
.login-sheet-links > * + *::before { content: ''; display: inline-block; width: 1px; height: 12px; margin: 0 14px 0 -14px; vertical-align: -1px; background: var(--line-strong); }
.login-sheet-links a { color: var(--ink-2); }
@media (min-width: 601px) { .login-sheet { inset: 0; width: min(420px, calc(100% - 32px)); margin: auto; padding-bottom: 22px; border-radius: var(--radius); } .login-sheet::before { display: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-pulse { 50% { opacity: .3; } }

/* Share sheet: the generated before/after card, ready to save for WeChat Moments. */
html.locked { overflow: hidden; }
.share-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: 94dvh; margin: 0; padding: 10px 20px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 26px 26px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px -12px rgb(30 27 24 / 25%); outline: none; display: flex; flex-direction: column; }
.share-sheet:not([open]) { display: none; }
.share-sheet[open] { animation: sheet-up .34s var(--ease) both; }
.share-sheet::backdrop { background: rgb(30 27 24 / 44%); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.share-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 10px; }
.share-head h2 { margin: 0; font: 500 20px var(--serif); letter-spacing: 1px; }
.share-close { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink-2); }
.share-close:hover { background: var(--paper-2); color: var(--ink); }
.share-close svg { width: 19px; height: 19px; stroke-width: 2; }
.share-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 0 4px; }
.share-img { display: block; max-width: 100%; max-height: calc(94dvh - 190px); border-radius: 12px; box-shadow: var(--shadow); -webkit-touch-callout: default; user-select: auto; animation: share-in .45s var(--ease) both; }
.share-img[hidden], .share-wait[hidden], .share-hint[hidden], .share-save[hidden] { display: none; }
.share-wait { display: grid; justify-items: center; gap: 14px; width: 100%; aspect-ratio: 3 / 4; max-height: 52dvh; place-content: center; border-radius: 12px; background: var(--paper-2); color: var(--ink-2); font-size: 14px; }
.share-wait p { margin: 0; }
.share-wait.error { color: var(--accent); }
.share-wait.error .share-spinner { display: none; }
.share-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: share-spin .9s linear infinite; }
.share-hint { margin: 10px 0 0; text-align: center; color: var(--ink-2); font-size: 14px; }
.share-actions { display: flex; margin-top: 14px; }
.share-actions .primary { flex: 1; min-height: 50px; font-size: 16px; }
@media (min-width: 601px) { .share-sheet { inset: 0; width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 14px 24px 22px; border-radius: var(--radius); } .share-img { max-height: calc(100dvh - 220px); } }
@keyframes share-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes share-spin { to { transform: rotate(360deg); } }

/* Tablets */
@media (max-width: 860px) {
  #photo-state { grid-template-columns: 1fr; gap: 20px; }
  .frame { height: min(56vh, 520px); }
  .studio[data-view=done] .photo-print { --print-height: min(496px, calc(56vh - 24px)); }
  .set-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-card { grid-template-columns: 1fr; gap: 22px; }
}
/* Phones */
@media (max-width: 600px) {
  .header-inner { width: calc(100% - 28px); height: 58px; }
  .brand { font-size: 16px; gap: 9px; letter-spacing: 1px; }
  .mark { width: 30px; height: 30px; }
  .site-nav { font-size: 13px; gap: 0; }
  .site-nav > a:not(.chip) { padding: 6px 9px; }
  .chip { margin-left: 4px; padding: 5px 10px; font-size: 12px; }
  main { padding: 0 16px 32px; }
  .hero { padding-top: 6vh; }
  .hero-title { font-size: 28px; letter-spacing: 1px; }
  .hero-sub { font-size: 14px; margin-top: 8px; }
  .welcome-gift { margin-top: 16px; border-radius: 18px; padding: 8px 8px 8px 14px; }
  .gift-text { font-size: 12.5px; }
  .gift-text b { display: none; }
  .studio { margin-top: 22px; }
  body[data-view=working] .studio, body[data-view=done] .studio, body[data-view=failed] .studio { margin-top: 8px; }
  .composer { border-radius: 22px; }
  .composer textarea { min-height: 84px; padding: 18px 16px 6px; }
  .attachments { padding: 14px 14px 0; }
  .composer-bar { padding: 6px 10px 10px; }
  .pick { height: 34px; padding: 0 12px; }
  .quota-line { display: none; }
  .sets { margin-top: 40px; }
  .set-row { display: flex; gap: 10px; margin: 0 -16px; padding: 2px 16px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .set-row::-webkit-scrollbar { display: none; }
  .set { flex: 0 0 42%; scroll-snap-align: start; }
  .set:hover { transform: none; }
  .set-meta small { display: none; }
  .set-sheet { inset: auto 0 0; width: 100%; height: 86dvh; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px -12px rgb(30 27 24 / 25%); }
  .set-sheet[open] { animation: sheet-up .32s var(--ease) both; }
  .set-sheet::before { content: ''; flex: none; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 4px; background: var(--line-strong); }
  .sheet-head { padding: 14px 18px 10px; }
  .sheet-head h3 { font-size: 20px; }
  .sheet-tabs { padding: 0 18px 12px; }
  .cases { padding: 2px 18px calc(20px + env(safe-area-inset-bottom)); }
  .frame { height: auto; aspect-ratio: 4 / 5; padding: 10px; border-radius: 20px; }
  .studio[data-view=done] .frame { aspect-ratio: auto; }
  .studio[data-view=done] .photo-print { --print-height: 60vh; }
  .photo-print, .scan, .grains, .flow-canvas, .failed-art { inset: 10px; }
  .grains, .flow-canvas { width: calc(100% - 20px); height: calc(100% - 20px); }
  .stage-tag { top: 18px; left: 18px; }
  .studio[data-view=failed] .frame { aspect-ratio: 16 / 9; }
  .failed-art .torn { width: 64px; height: 80px; }
  #stage-title, .result-title { font-size: 24px; }
  .stage-list { margin-top: 14px; font-size: 14px; }
  .result-panel .actions .secondary { min-height: 42px; font-size: 13.5px; }
  .site-footer { margin-top: 56px; width: calc(100% - 32px); }
  .footer-brand { gap: 12px; }
  .footer-logo { width: 44px; height: 44px; border-radius: 12px; }
}
@media (max-width: 380px) { .site-nav > a[href="services.html"] { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
