/* Keyoocap custom keycap designer — step by step, preview always in view */
:root {
  color-scheme: light;
  --ink: #1D1919; --muted: #6E625A; --line: #EADFCC; --paper: #FFF8EC; --card: #FFFFFF;
  --orange: #F2672C; --orange-deep: #D94F17; --orange-soft: #FFEBDD; --green: #1F8A4C;
  --sans: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --display: "Fredoka", var(--sans);
  --bar-h: 76px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); min-width: 320px; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
body:not(.zh) .zh, body.zh .en { display: none; }
button:focus-visible, input:focus-visible, a:focus-visible, .dropzone:focus-visible, canvas:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; max-width: 1240px; margin: 0 auto; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-word { font: 700 22px/1 var(--display); letter-spacing: .02em; }
.brand-word b { color: var(--orange); font-weight: 700; }
.brand-by { font-size: 12px; font-weight: 600; color: var(--muted); }
.lang { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.lang button { background: none; border: 0; color: var(--muted); padding: 6px 11px; font-weight: 700; font-size: 13px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* layout: preview left, steps right; on phones the preview sits on top and stays there */
.flow { max-width: 1240px; margin: 0 auto; padding: 4px 20px calc(var(--bar-h) + 28px); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 28px; align-items: start; }
.stage-col { position: sticky; top: 12px; }
.stage-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 14px 40px rgba(90, 50, 20, .07); }
.stage-tabs { display: flex; align-items: center; gap: 6px; padding: 10px; border-bottom: 1.5px solid var(--line); }
.view-tab { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.view-tab.active { background: var(--ink); color: #fff; }
.stage-hint { margin-left: auto; font-size: 12px; color: var(--muted); padding-right: 6px; }
.render-stage { position: relative; height: min(72vh, 680px); background: #fff; }
.preview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.render-message { position: absolute; inset: auto 16px 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.94); font-size: 13px; text-align: center; }
.zoom-bar { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 2; }
.zoom-bar button { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; background: rgba(255,255,255,.94); font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
#zoomCap { background: var(--orange); color: #fff; border-color: var(--orange); font-size: 13px; }

/* steps */
.panel-col { min-width: 0; }
.stepper { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stepper button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 0; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
.stepper i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1.5px solid var(--line); font-size: 13px; }
.stepper button[aria-current="step"] { color: var(--ink); }
.stepper button[aria-current="step"] i { background: var(--orange); border-color: var(--orange); color: #fff; }
.stepper button.done i { background: var(--orange-soft); border-color: var(--orange-soft); color: var(--orange-deep); }
.stepper button:disabled { cursor: default; opacity: .5; }
.step h1 { font: 700 clamp(30px, 4vw, 42px)/1.12 var(--display); margin: 0 0 10px; letter-spacing: -.01em; }
.step h1 em, .step h2 em { font-style: normal; color: var(--orange); }
.step h2 { font: 700 28px/1.2 var(--display); margin: 0 0 14px; }
.lede { color: var(--muted); margin: 0 0 18px; }
.fine { color: var(--muted); font-size: 12px; margin: 14px 0 0; }

/* upload */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 18px; border: 2px dashed #E6C9A8; border-radius: 20px; background: #fff; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--orange); background: #FFF4EC; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--orange); }
.upload-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-weight: 800; font-size: 17px; }
.drop-subtitle { color: var(--muted); font-size: 13px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; }
.file-thumb { width: 52px; height: 52px; border-radius: 10px; background: #F5EFE6 center / contain no-repeat; flex: 0 0 auto; }
.file-meta { min-width: 0; flex: 1; display: grid; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-meta small { color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: none; color: var(--orange-deep); font-weight: 800; cursor: pointer; padding: 6px; }
.bg-row { margin-top: 12px; display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); }
.bg-toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; cursor: pointer; }
.bg-toggle input { width: 18px; height: 18px; accent-color: var(--orange); }
.bg-strength { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.bg-strength input { flex: 1; accent-color: var(--orange); }
.bg-auto { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--orange-soft); color: var(--orange-deep); font-weight: 800; }
.bg-tip { color: var(--muted); font-size: 12px; }
.bg-busy { color: var(--orange-deep); }
.samples { margin-top: 18px; }
.samples p { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.sample-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sample-row button { aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; padding: 0; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s; }
.sample-row button:hover { transform: translateY(-2px); border-color: var(--orange); }
.sample-row img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* design */
.group { background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 14px; }
.group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 15px; }
.art-edit { display: grid; grid-template-columns: 136px 1fr; gap: 16px; align-items: center; }
.face-editor { width: 136px; height: 136px; border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 6px 16px rgba(0,0,0,.08); cursor: move; touch-action: none; }
.art-controls { display: grid; gap: 8px; }
.art-size-row { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; }
.art-size-row output { color: var(--orange-deep); font-weight: 800; }
#artSize { width: 100%; accent-color: var(--orange); }
.art-controls small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.selected-color-chip { width: 28px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px; }
.swatch { aspect-ratio: 1; border: 0; background: none; padding: 3px; border-radius: 50%; cursor: pointer; }
.swatch-color { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch-code { display: none; }
.swatch.selected { box-shadow: 0 0 0 2.5px var(--orange); }
.swatch:disabled { cursor: default; opacity: .45; }

/* quantity */
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-step { width: 46px; height: 46px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: 20px; font-weight: 800; cursor: pointer; }
#qty { width: 96px; height: 46px; border: 1.5px solid var(--line); border-radius: 14px; text-align: center; font-weight: 800; font-size: 18px; background: #fff; }
.qty-unit { color: var(--muted); font-weight: 700; }
.qty-range { width: 100%; margin: 16px 0 12px; accent-color: var(--orange); }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tiers div { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; font-size: 11px; color: var(--muted); background: #fff; }
.tiers b { display: block; font-size: 16px; color: var(--ink); }
.tiers .on { border-color: var(--orange); background: var(--orange-soft); color: var(--orange-deep); }
.tiers .on b { color: var(--orange-deep); }
.upsell { margin: 12px 0 0; min-height: 20px; font-size: 14px; font-weight: 800; color: var(--orange-deep); }

/* check & pay */
.summary { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; }
.sum-face { width: 120px; height: 120px; border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.order-sum { margin: 0; }
.order-sum div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.order-sum dt { color: var(--muted); } .order-sum dd { margin: 0; font-weight: 800; }
.order-sum .free { color: var(--green); }
.order-sum .total { margin-top: 6px; padding-top: 10px; border-top: 1.5px solid var(--line); font-size: 17px; }
.order-sum .total dt { color: var(--ink); font-weight: 800; }
.pay-error { margin: 12px 0 0; color: #C0341D; font-weight: 800; font-size: 14px; }
.link-button { margin-top: 12px; border: 0; background: none; padding: 0; color: var(--orange-deep); font-weight: 800; text-decoration: underline; cursor: pointer; }
.link-button:disabled { opacity: .4; cursor: default; }

/* bottom bar */
.flow-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px max(20px, calc((100vw - 1240px) / 2 + 20px)) calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1.5px solid var(--line); box-shadow: 0 -10px 30px rgba(90,50,20,.08); }
.bar-back { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; height: 50px; padding: 0 16px; font-weight: 800; cursor: pointer; }
.bar-total { flex: 1; display: grid; line-height: 1.2; }
.bar-total b { font-size: 20px; }
.bar-total small { color: var(--muted); font-size: 12px; font-weight: 700; }
.bar-next { border: 0; background: var(--orange); color: #fff; border-radius: 14px; height: 50px; padding: 0 26px; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: 0 8px 20px rgba(242,103,44,.3); }
.bar-next:hover { background: var(--orange-deep); }
.bar-next:disabled { opacity: .45; cursor: default; box-shadow: none; }
.bar-next[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* phones: preview on top (kept in view), steps underneath */
@media (max-width: 900px) {
  .flow { grid-template-columns: 1fr; gap: 14px; padding: 0 12px calc(var(--bar-h) + 24px); }
  .stage-col { top: 0; z-index: 5; margin: 0 -12px; padding: 0 12px 8px; background: var(--paper); }
  .stage-card { border-radius: 18px; }
  .stage-tabs { padding: 6px 8px; }
  .render-stage { height: 38vh; min-height: 250px; }
  .zoom-bar { top: 8px; right: 8px; }
  .zoom-bar button { min-width: 32px; height: 32px; }
  .top { padding: 10px 14px; }
  .brand-by { display: none; }
  .step h1 { font-size: 28px; }
  .step h2 { font-size: 24px; }
  .dropzone { padding: 22px 14px; }
  .bar-back { padding: 0 12px; }
  .bar-next { padding: 0 18px; }
}
@media (max-width: 380px) {
  .art-edit { grid-template-columns: 110px 1fr; }
  .face-editor { width: 110px; height: 110px; }
  .tiers b { font-size: 14px; }
}
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.group.bg-row { margin-top: 0; }

/* ---- friendlier flow (mobile first) ---- */
.top-right { display: flex; align-items: center; gap: 10px; }
.help { color: var(--orange-deep); font-weight: 800; font-size: 13px; text-decoration: none; }
/* step 1 is a welcome: no preview, no price bar, just the picture button */
body[data-step="1"] .stage-col, body[data-step="1"] .flow-bar { display: none; }
body[data-step="1"] .flow { grid-template-columns: 1fr; max-width: 560px; padding-bottom: 40px; }
.hero-demo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 22px; display: block; margin: 4px 0 18px; box-shadow: 0 14px 34px rgba(90,50,20,.14); }
.step[data-step="1"] h1 { text-align: center; }
.step[data-step="1"] .lede { text-align: center; }
.step[data-step="1"] .dropzone { flex-direction: row; justify-content: center; gap: 14px; padding: 18px; border: 0; background: var(--orange); color: #fff; border-radius: 18px; box-shadow: 0 10px 24px rgba(242,103,44,.32); text-align: left; }
.step[data-step="1"] .dropzone:hover { background: var(--orange-deep); }
.step[data-step="1"] .dropzone .upload-icon { background: rgba(255,255,255,.22); }
.step[data-step="1"] .drop-title { font-size: 19px; display: block; }
.step[data-step="1"] .drop-subtitle { color: rgba(255,255,255,.88); display: block; }
.step[data-step="1"] .dropzone > span:not(.upload-icon) { display: block; }
.dropzone .drop-text { display: grid; }
.samples p { text-align: center; color: var(--muted); font-weight: 700; }
.promises { list-style: none; margin: 20px 0 0; padding: 14px 16px; display: grid; gap: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; }
.promises li { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; }
.promises li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange-deep); font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.step[data-step="1"] .fine { text-align: center; }
/* "step 2 of 4" instead of four circles */
.progress { margin: 2px 0 14px; display: grid; gap: 6px; }
.progress span { font-size: 13px; font-weight: 800; color: var(--muted); }
.progress-track { height: 6px; border-radius: 99px; background: #F1E4D2; overflow: hidden; }
.progress-track i { display: block; height: 100%; width: 25%; background: var(--orange); border-radius: 99px; transition: width .3s; }
.stage-tabs { justify-content: center; }
@media (max-width: 900px) {
  .step h2 { font-size: 22px; }
  .hero-demo { border-radius: 18px; margin-top: 0; }
  .top-right { gap: 8px; }
  .help { font-size: 12px; }
}

/* bottom bar never wraps on small phones */
.bar-back b { font-size: 22px; line-height: 1; margin-right: 4px; }
.bar-total { min-width: 0; }
.bar-total b, .bar-total small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-next { white-space: nowrap; }
@media (max-width: 480px) {
  .flow-bar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .bar-back { width: 46px; padding: 0; }
  .bar-back b { margin: 0; }
  .bar-back-text { display: none; }
  .bar-total b { font-size: 18px; }
  .bar-next { padding: 0 16px; font-size: 15px; }
}

/* group focus, FAQ, share */
.eyebrow { text-align: center; margin: 0 0 6px; color: var(--orange-deep); font-weight: 800; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.uses { list-style: none; margin: -4px 0 18px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.uses li { padding: 5px 11px; border-radius: 99px; background: #fff; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700; }
.faq { margin-top: 22px; display: none; }
body[data-step="1"] .faq, body[data-step="4"] .faq { display: block; }
.faq h3 { font: 700 18px/1.3 var(--display); margin: 0 0 8px; }
.faq details { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 800; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--orange-deep); font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.share-button { width: 100%; margin: 0 0 14px; display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 14px; border: 1.5px solid #25D366; background: #F2FFF6; color: #128C4B; font-weight: 800; cursor: pointer; }
.share-button::before { content: ""; width: 18px; height: 18px; background: #25D366; border-radius: 50%; box-shadow: inset 0 0 0 4px #F2FFF6; }
.step[data-step="4"] .share-button { margin-top: 14px; }
