/* 标题字体（自托管，SIL OFL 1.1）。中日韩、俄文没有对应字形，会自动用系统字体 */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url(fonts/bricolage-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url(fonts/bricolage-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #fff6e9;
  --dot: #f0dfc6;
  --ink: #17131f;
  --muted: #5f5868;
  --card: #ffffff;
  --violet: #7a5cff;
  --pink: #ff5ea8;
  --yellow: #ffd84a;
  --mint: #3fd99a;
  --red: #e5383b;
  --shadow-c: #17131f;
  --on-accent: #ffffff;
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Noto Sans', sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Noto Sans', sans-serif;
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15121c;
    --dot: #26212f;
    --ink: #f7f1e8;
    --muted: #b4abc0;
    --card: #211c2b;
    --shadow-c: #7a5cff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.6px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 16px/1.55 var(--body);
}
:lang(ko) body, body:lang(ko) { word-break: keep-all; } /* 韩文按词换行 */
:lang(ja) body { word-break: auto-phrase; } /* 日文按词组换行（Chrome 支持，其他浏览器忽略） */
.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; }

/* ---------- 顶栏 ---------- */
.nav {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand {
  display: flex; white-space: nowrap; min-width: 0; align-items: center; gap: 10px;
  color: inherit; text-decoration: none;
  font: 800 20px/1 var(--display); letter-spacing: -0.02em;
}
.brand img { border-radius: 9px; border: 2px solid var(--ink); }
.lang-pick {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card); box-shadow: 2px 2px 0 var(--shadow-c);
  font-size: 14px; font-weight: 600;
}
.lang-pick select {
  appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; cursor: pointer; padding-right: 2px;
}
.lang-pick select:focus { outline: none; }
.lang-pick:focus-within { outline: 3px solid var(--violet); outline-offset: 2px; }

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; flex: 1; }

/* ---------- 首屏 ---------- */
.hero { text-align: center; padding: 40px 0 36px; }
.hero h1 {
  margin: 0 auto; max-width: 15ch;
  font: 800 clamp(40px, 7.4vw, 84px)/1.02 var(--display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
:lang(zh-Hans) .hero h1, :lang(zh-Hant) .hero h1, :lang(ja) .hero h1, :lang(ko) .hero h1 { max-width: none; letter-spacing: -0.01em; line-height: 1.2; font-size: clamp(36px, 6.4vw, 76px); }
.hero mark {
  display: inline-block;
  margin: 0 0.06em;
  padding: 0 0.16em;
  background: var(--yellow);
  color: #17131f;
  border: 3px solid var(--ink);
  border-radius: 0.22em;
  box-shadow: 5px 5px 0 var(--shadow-c);
  transform: rotate(-2deg);
}
/* 隐私卖点：首屏最醒目的一句 */
.privacy {
  display: inline-flex; align-items: center; gap: 14px;
  margin: 30px auto 0; max-width: 100%;
  padding: 10px 24px 10px 10px;
  border: 3px solid var(--ink); border-radius: 999px;
  background: var(--mint); color: #17131f;
  box-shadow: 5px 5px 0 var(--shadow-c);
  font: 700 clamp(17px, 2.1vw, 22px)/1.3 var(--display); letter-spacing: -0.01em;
  text-align: left; text-wrap: balance;
}
.privacy .shield {
  display: grid; place-items: center; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%;
  background: #17131f; color: var(--mint);
}
.privacy .shield .icon { width: 24px; height: 24px; }
.privacy strong {
  font-weight: 800;
  background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%);
  padding: 0 2px;
}
.badges {
  list-style: none; padding: 0; margin: 20px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.badges li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card);
  font-size: 14px; font-weight: 700;
}

/* ---------- 工作区 ---------- */
.studio {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--shadow-c);
  padding: clamp(16px, 3vw, 28px);
}
.options { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-start; margin-bottom: 22px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend {
  padding: 0; margin-bottom: 10px;
  font: 800 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
:lang(zh-Hans) legend, :lang(zh-Hant) legend, :lang(ja) legend, :lang(ko) legend { font-size: 14px; letter-spacing: 0; }
fieldset input { position: absolute; opacity: 0; pointer-events: none; }

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label span {
  display: inline-block; white-space: nowrap; cursor: pointer; user-select: none;
  padding: 8px 16px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card);
  font-weight: 700; font-size: 15px;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.chips label:hover span { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-c); }
.chips input:checked + span { background: var(--violet); color: var(--on-accent); box-shadow: 3px 3px 0 var(--shadow-c); }

.segmented .row { gap: 0; flex-wrap: nowrap; }
.segmented label { flex: 1 1 auto; }
.segmented label:first-child span { border-radius: 999px 0 0 999px; }
.segmented label:last-child span { border-radius: 0 999px 999px 0; border-right-width: 2px; }
.segmented label span {
  display: block; text-align: center; white-space: nowrap; cursor: pointer; user-select: none;
  padding: 8px 16px;
  border: 2px solid var(--ink); border-right-width: 0;
  background: var(--card);
  font-weight: 700; font-size: 15px;
  transition: background-color .12s ease;
}
.segmented label:hover span { background: color-mix(in srgb, var(--yellow) 35%, var(--card)); }
.segmented input:checked + span { background: var(--yellow); color: #17131f; }
fieldset input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }

/* 上传区 */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  min-height: 300px; padding: 32px 20px;
  border: 3px dashed var(--ink); border-radius: var(--radius);
  background: color-mix(in srgb, var(--violet) 7%, var(--card));
  text-align: center; cursor: pointer;
  transition: background-color .15s ease;
}
.dropzone:hover { background: color-mix(in srgb, var(--violet) 14%, var(--card)); }
.dropzone:focus-within { outline: 3px solid var(--violet); outline-offset: 3px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon {
  display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: 22px;
  border: 3px solid var(--ink); background: var(--pink); color: #17131f;
  box-shadow: 4px 4px 0 var(--shadow-c);
  transform: rotate(-6deg);
}
.drop-icon .icon { width: 36px; height: 36px; }
.hint { color: var(--muted); font-size: 15px; }
.safe {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--mint); color: #17131f; font-size: 14px; font-weight: 700;
}

/* 按钮 */
.btn {
  display: inline-flex; white-space: nowrap; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border: 2.5px solid var(--ink); border-radius: 999px;
  background: var(--violet); color: var(--on-accent);
  font: 800 17px/1.2 var(--display); letter-spacing: -0.01em;
  text-decoration: none; cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-c);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-c); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow-c); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn[hidden] { display: none; }

/* 结果 */
.views { display: none; grid-template-columns: 1fr 1fr; gap: 18px; }
.has-photo .views { display: grid; }
.has-photo .dropzone { display: none; }
.card {
  position: relative; margin: 0;
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  background: var(--bg); overflow: hidden;
}
.card figcaption {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  padding: 4px 12px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card);
  font: 800 13px/1.3 var(--display); letter-spacing: 0.02em;
}
.card.result figcaption { background: var(--pink); color: #17131f; }
canvas { display: block; width: 100%; height: auto; min-height: 200px; max-height: min(72vh, 760px); object-fit: contain; }

.actions { display: none; margin-top: 18px; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.has-photo .actions, .actions:has(.status.error) { display: flex; }
.buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.status { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--muted); min-height: 1.5em; }
.status.busy::before {
  content: ''; width: 16px; height: 16px; flex-shrink: 0;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.status.error { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 拖放时的全屏提示 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 10;
  display: none; place-items: center;
  background: color-mix(in srgb, var(--violet) 88%, transparent);
  pointer-events: none;
}
.drop-overlay span {
  padding: 18px 32px;
  border: 3px dashed #fff; border-radius: 24px;
  color: #fff; font: 800 clamp(24px, 4vw, 40px)/1.2 var(--display);
}
.dragging .drop-overlay { display: grid; }

/* ---------- 使用方法 / 常见问题 ---------- */
.info { margin-top: 80px; }
.info h2 {
  margin: 0 0 24px; text-align: center;
  font: 800 clamp(30px, 4.4vw, 46px)/1.1 var(--display); letter-spacing: -0.03em;
}
.steps {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.steps li {
  counter-increment: step;
  padding: 24px;
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  background: var(--card); box-shadow: 5px 5px 0 var(--shadow-c);
}
.steps li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 48px; height: 48px; margin-bottom: 14px;
  border: 2.5px solid var(--ink); border-radius: 14px;
  font: 800 24px/1 var(--display); color: #17131f;
  background: var(--violet);
}
.steps li:nth-child(1)::before { background: var(--yellow); }
.steps li:nth-child(2)::before { background: var(--pink); }
.steps li:nth-child(3)::before { background: var(--mint); }
.steps h3 { margin: 0 0 6px; font: 800 21px/1.25 var(--display); letter-spacing: -0.01em; }
.steps p { margin: 0; color: var(--muted); }

.faq { max-width: 780px; margin-left: auto; margin-right: auto; }
.faq details {
  margin-bottom: 12px;
  border: 2.5px solid var(--ink); border-radius: 18px;
  background: var(--card);
  transition: box-shadow .15s ease;
}
.faq details[open] { box-shadow: 4px 4px 0 var(--shadow-c); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; flex-shrink: 0;
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 2px solid var(--ink); border-radius: 50%;
  font: 800 20px/1 var(--display);
  transition: transform .2s ease, background-color .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); background: var(--yellow); color: #17131f; }
.faq h3 { margin: 0; font: 700 18px/1.35 var(--display); }
.faq details p { margin: 0; padding: 0 20px 18px; color: var(--muted); }

footer {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 28px 20px 36px; color: var(--muted); font-size: 14px; text-align: center;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .hero { padding: 20px 0 28px; }
  .brand { font-size: 17px; }
  .privacy { border-radius: 22px; padding: 12px 16px 12px 12px; gap: 12px; }
  .privacy .shield { width: 40px; height: 40px; }
  .brand img { width: 28px; height: 28px; }
  .options { flex-direction: column; }
  .segmented { width: 100%; }
  .segmented label span { padding: 8px 10px; }
  .views { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .info { margin-top: 56px; }
  .studio { box-shadow: 5px 5px 0 var(--shadow-c); border-radius: 22px; }
  .dropzone { min-height: 240px; }
  .actions { flex-direction: column; align-items: stretch; }
  .buttons .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; }
  .status.busy::before { animation: spin 1.5s linear infinite !important; }
}
