:root {
  color-scheme: light;
  --ink: #181716;
  --muted: #706d68;
  --line: #dedbd4;
  --paper: #fffefb;
  --bg: #f5f3ee;
  --accent: #ee5d3f;
  --accent-dark: #d84a2d;
  --green: #2d7a55;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 10; padding: 10px 14px; background: #fff; color: #000; }
.skip-link:focus { top: 12px; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: auto;
  padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: var(--ink); font-weight: 800; }
.brand span:last-child { display: grid; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.privacy-pill { padding: 8px 13px; border: 1px solid #c7dfd1; border-radius: 999px; color: var(--green); background: #eff8f2; font-size: 13px; font-weight: 650; }
.privacy-pill span { font-size: 9px; }

main { max-width: 1180px; margin: auto; padding: 35px 24px 64px; }
.intro { max-width: 690px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.intro h1 { margin: 0; font-size: clamp(38px, 6vw, 68px); line-height: 1.05; letter-spacing: -.055em; }
.intro > p:last-child { max-width: 590px; margin: 18px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(31, 26, 18, .08);
}
.preview-column { display: flex; flex-direction: column; align-items: center; padding: 34px; background: #e9e6df; }
.canvas-shell { position: relative; width: min(100%, 560px); overflow: hidden; border-radius: 15px; background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,.14); touch-action: none; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; cursor: grab; }
canvas:active { cursor: grabbing; }
.empty-tip { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; text-align: center; pointer-events: none; background: rgba(255,255,255,.74); backdrop-filter: blur(3px); }
.empty-tip span { display: grid; place-items: center; width: 54px; height: 54px; border: 1.5px dashed #999; border-radius: 50%; font-size: 26px; }
.empty-tip strong { margin-top: 8px; font-size: 17px; }
.empty-tip small, .drag-tip { color: var(--muted); }
.drag-tip { margin: 15px 0 18px; font-size: 12px; }
.primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 560px); }
#photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-button, .download-button { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 11px; font-weight: 750; cursor: pointer; }
.upload-button { gap: 8px; color: #fff; background: var(--ink); }
.download-button { border: 0; color: #fff; background: var(--accent); }
.download-button:hover:not(:disabled) { background: var(--accent-dark); }
.download-button:disabled { cursor: not-allowed; opacity: .42; }
.status { min-height: 20px; margin: 10px 0 0; color: #a03224; font-size: 12px; text-align: center; }

.controls { padding: 32px; }
fieldset { margin: 0; padding: 0 0 27px; border: 0; }
fieldset + fieldset { padding-top: 27px; border-top: 1px solid var(--line); }
legend { margin-bottom: 15px; padding: 0; font-size: 14px; font-weight: 800; }
.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.template-card { display: grid; gap: 7px; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.template-card:hover { border-color: #aaa69f; }
.template-card.is-active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.template-card > span:last-child { display: grid; gap: 2px; }
.template-card strong { font-size: 12px; }
.template-card small { color: var(--muted); font-size: 10px; }
.template-thumb { position: relative; display: block; height: 72px; overflow: hidden; border-radius: 8px; background: #f3f1ec; }
.template-thumb::before, .template-thumb::after { content: ""; position: absolute; width: 22px; height: 22px; top: 12px; border-radius: 50%; background: #111; }
.template-thumb::before { left: 16px; }
.template-thumb::after { right: 16px; }
.template-thumb i { position: absolute; left: 50%; bottom: 7px; width: 62px; height: 55px; transform: translateX(-50%); border: 2px solid #111; border-radius: 48% 48% 45% 45%; background: #fff; }
.template-thumb--bean::before, .template-thumb--bean::after { width: 28px; height: 3px; top: 11px; border-radius: 8px; transform: rotate(-45deg); }
.template-thumb--bean::after { transform: rotate(45deg); }
.template-thumb--bean i { width: 70px; height: 48px; border-radius: 50% 50% 35% 35%; }
.template-thumb--peek i { bottom: -9px; width: 66px; }

.range-row { margin-bottom: 15px; }
.range-row label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.range-row output { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row > span { display: grid; gap: 3px; }
.switch-row strong { font-size: 13px; }
.switch-row small { color: var(--muted); font-size: 11px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { position: relative; flex: 0 0 42px; height: 24px; border-radius: 999px; background: #c9c6bf; transition: .18s ease; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .18s ease; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch-row input:checked + i { background: var(--ink); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.text-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.caption-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.caption-row input { min-width: 0; flex: 1; padding: 12px; border: 0; outline: 0; background: transparent; font-weight: 650; }
.caption-row span { padding-right: 11px; color: var(--muted); font-size: 10px; }
.quick-captions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.quick-captions button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: #f8f7f4; cursor: pointer; font-size: 11px; }
.quick-captions button:hover { border-color: var(--ink); }
.reset-button { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; color: var(--muted); }
.reset-button:hover { color: var(--ink); border-color: #aaa; }

.notes { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 24px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.6); }
.notes div { display: grid; gap: 5px; padding: 22px 25px; }
.notes div + div { border-left: 1px solid var(--line); }
.notes strong { font-size: 13px; }
.notes span { color: var(--muted); font-size: 11px; }
footer { display: flex; justify-content: space-between; gap: 20px; max-width: 1180px; margin: auto; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer a { color: inherit; }

@media (max-width: 840px) {
  .editor { grid-template-columns: 1fr; }
  .preview-column { padding: 22px; }
  .controls { padding: 26px 22px; }
}
@media (max-width: 560px) {
  .topbar { height: 62px; padding: 0 16px; }
  .privacy-pill { padding: 7px 9px; font-size: 11px; }
  main { padding: 24px 14px 44px; }
  .intro h1 { font-size: 42px; }
  .intro > p:last-child { font-size: 14px; }
  .template-grid { gap: 6px; }
  .template-card { padding: 6px; }
  .template-card small { display: none; }
  .notes { grid-template-columns: 1fr; }
  .notes div + div { border-left: 0; border-top: 1px solid var(--line); }
  footer { padding: 22px 16px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
