@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Sans+SC:wght@400;600;800;900&display=swap');

:root {
  --ink: #33231e;
  --paper: #fff3d2;
  --paper-deep: #f3d79d;
  --tomato: #e96853;
  --leaf: #79a955;
  --yellow: #f3c84b;
  --blue: #79bfd0;
  --pink: #f2aaa9;
  --shadow: 6px 7px 0 #33231e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle, rgba(51,35,30,.15) 0 1.2px, transparent 1.6px) 0 0/8px 8px,
    linear-gradient(135deg, rgba(243,200,75,.18) 0 25%, transparent 25% 50%, rgba(121,191,208,.12) 50% 75%, transparent 75%),
    var(--paper);
  font-family: "Noto Sans SC", system-ui, sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }

.site-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 76px);
  border-bottom: 3px solid var(--ink);
  background: var(--yellow);
  box-shadow:0 5px 0 rgba(51,35,30,.12);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display:grid; place-items:center; width:42px; height:42px; border:3px solid; border-radius:50% 46% 52% 44%; background:#fff4cd; font-family:"Ma Shan Zheng"; font-size:25px; transform:rotate(-6deg); box-shadow:2px 2px 0 var(--ink); }
.brand b { display:block; font-weight:900; letter-spacing:.06em; }
.brand small { display:block; font-size:9px; letter-spacing:.18em; margin-top:2px; }
.proof { border:2px solid; border-radius:8px; padding:6px 10px; font-size:12px; transform:rotate(2deg); background:#fff4cd; box-shadow:2px 2px 0 var(--ink); }

.preview-section { min-height: calc(100vh - 78px); display:grid; grid-template-columns:minmax(240px, .75fr) minmax(380px, 650px); gap:clamp(28px,5vw,82px); align-items:center; padding:70px clamp(20px,6vw,100px) 50px; position:relative; overflow:hidden; }
.preview-section::before { content:"★"; position:absolute; width:260px; height:260px; color:rgba(233,104,83,.14); font-size:250px; line-height:1; left:-70px; top:90px; transform:rotate(-14deg); }
.intro { max-width:480px; position:relative; z-index:1; }
.eyebrow { display:inline-block; border-bottom:5px solid var(--yellow); margin:0 0 16px; font-size:14px; font-weight:800; letter-spacing:.1em; }
h1 { margin:0; font-family:"Ma Shan Zheng", cursive; font-size:clamp(54px,7vw,96px); line-height:.98; font-weight:400; }
.intro > p:last-child { max-width:410px; margin-top:26px; line-height:1.9; color:#65564c; }
.preview-shell { position:relative; width:min(100%, 620px); justify-self:center; }
.avatar-frame { aspect-ratio:1; overflow:hidden; border:4px solid var(--ink); background:#fff7df; box-shadow:var(--shadow); }
#avatarSvg { display:block; width:100%; height:100%; }
.tape { position:absolute; width:110px; height:30px; z-index:3; background:rgba(238,188,72,.7); border-left:1px dashed rgba(43,33,29,.4); border-right:1px dashed rgba(43,33,29,.4); }
.tape-a { left:-28px; top:22px; transform:rotate(-36deg); }
.tape-b { right:-25px; bottom:40px; transform:rotate(-34deg); }
.preview-caption { display:flex; justify-content:space-between; margin-top:16px; padding:0 2px; font-size:12px; letter-spacing:.08em; }
.quick-actions { grid-column:1/-1; display:flex; justify-content:center; flex-wrap:wrap; gap:12px; }
.action { min-height:46px; padding:10px 18px; border:2px solid var(--ink); border-radius:12px 9px 13px 8px; background:#fff8e8; cursor:pointer; font-weight:900; box-shadow:3px 3px 0 var(--ink); transition:.15s; }
.action:hover { transform:translate(-1px,-2px); box-shadow:5px 6px 0 var(--ink); }
.action:active { transform:translate(2px,2px); box-shadow:1px 1px 0 var(--ink); }
.action.primary { background:var(--yellow); }
.action.dark { background:var(--ink); color:#fff8e8; }

.maker-section { border-top:3px solid var(--ink); padding:64px clamp(20px,6vw,100px) 74px; background:radial-gradient(circle,rgba(51,35,30,.12) 0 1px,transparent 1.5px) 0 0/8px 8px,#f7d9cd; }
.section-heading { display:flex; justify-content:space-between; align-items:end; gap:30px; max-width:1120px; margin:0 auto 32px; }
.section-heading span { font-size:11px; letter-spacing:.18em; color:var(--tomato); font-weight:900; }
h2 { margin:5px 0 0; font-family:"Ma Shan Zheng"; font-size:clamp(40px,5vw,62px); font-weight:400; }
.section-heading p { max-width:340px; color:#6a5b50; line-height:1.7; font-size:14px; }
.control-card { max-width:1120px; margin:auto; display:grid; grid-template-columns:128px minmax(0,1fr); gap:14px; border:3px solid var(--ink); border-radius:28px 22px 30px 20px; background:#f4b7b1; padding:18px; box-shadow:7px 8px 0 rgba(51,35,30,.22); }
.control-main { min-width:0; }
.tabs { display:flex; flex-direction:column; gap:6px; padding:3px 14px 3px 0; border-right:1.5px dashed rgba(43,33,29,.35); }
.tab { border:0; border-radius:999px; background:transparent; min-height:42px; cursor:pointer; font-weight:800; }
.tab:hover { background:rgba(255,248,231,.55); }
.tab[aria-selected="true"] { background:#e96853; color:#fff9e9; border:2px solid var(--ink); box-shadow:2px 3px 0 var(--ink); }
.tab small { opacity:.6; margin-right:5px; font-size:9px; }
.option-panel { padding:4px 8px 12px; }
.sub-tabs { display:flex; gap:7px; margin:-3px 0 12px; }
.sub-tabs.empty { display:none; }
.sub-tab { min-width:76px; min-height:30px; padding:4px 15px; border:2px solid var(--ink); border-radius:999px; background:#fff5d8; cursor:pointer; font-size:12px; font-weight:900; box-shadow:2px 2px 0 rgba(51,35,30,.25); }
.sub-tab[aria-selected="true"] { background:var(--ink); color:#fff8e7; }
.face-nudge { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:-4px 0 10px; padding:6px 9px; border:1px dashed rgba(43,33,29,.45); border-radius:10px; background:rgba(255,248,231,.45); }
.face-nudge[hidden] { display:none; }
.face-nudge > span { font-size:11px; font-weight:800; }
.nudge-buttons { display:flex; gap:5px; }
.nudge-buttons button { width:30px; height:26px; padding:0; border:1.5px solid var(--ink); border-radius:6px; background:#fff8e7; cursor:pointer; font-weight:900; }
.nudge-buttons button:active { background:var(--yellow); transform:translateY(1px); }
.panel-topline { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.panel-topline b { display:block; font-size:18px; }
.panel-topline span:not(.selection-count) { color:#7a6a5e; font-size:12px; }
.selection-count { font-size:12px; border:1.5px solid; padding:5px 9px; }
.option-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; max-height:332px; overflow-y:auto; overflow-x:hidden; padding:1px 6px 6px 1px; scrollbar-width:thin; scrollbar-color:#9f7770 transparent; }
.option-card { position:relative; min-height:104px; border:2px solid #8e665d; border-radius:17px 13px 18px 12px; background:#fff3d8; cursor:pointer; padding:8px; display:flex; flex-direction:column; justify-content:center; align-items:center; overflow:hidden; box-shadow:2px 3px 0 rgba(51,35,30,.16); }
.option-card::before { content:""; position:absolute; inset:0; background-image:radial-gradient(rgba(43,33,29,.18) .8px,transparent .8px); background-size:5px 5px; opacity:.32; pointer-events:none; }
.option-card:hover { background:#fffdf6; border-color:var(--ink); }
.option-card.selected { border:3px solid var(--ink); background:#f6cf5d; box-shadow:3px 4px 0 var(--ink); transform:rotate(-1deg); }
.option-card.selected::after { content:"✓"; position:absolute; right:6px; top:5px; width:20px; height:20px; display:grid; place-items:center; border-radius:50%; background:var(--ink); color:#fff8e7; font-size:11px; font-weight:900; z-index:2; }
.option-card.is-background { padding:0; background:transparent; }
.option-card.is-background::before { display:none; }
.option-card.is-background .option-icon { height:100%; }
.option-icon { position:relative; width:100%; height:90px; overflow:hidden; line-height:1; z-index:1; }
.option-icon svg { position:absolute; inset:0; display:block; width:100%; height:100%; overflow:hidden; }
.option-label { display:none; }
.option-card.is-body { padding:5px 8px 7px; }
.option-card.is-body .option-icon { height:70px; }
.option-card.is-body .option-label { display:block; position:relative; z-index:1; margin-top:2px; font-size:11px; line-height:1.15; font-weight:800; color:var(--ink); }
.color-row { display:flex; align-items:center; gap:14px; border-top:1.5px dashed rgba(43,33,29,.35); padding:14px 8px 2px; }
.color-copy { margin-right:auto; }
.color-copy b,.color-copy span { display:block; }
.color-copy span { font-size:11px; margin-top:3px; }
.color-row label { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:800; }
input[type="color"] { width:44px; height:36px; padding:2px; border:2px solid var(--ink); background:var(--paper); cursor:pointer; }
.palette { display:flex; gap:7px; }
.palette button { width:34px; height:34px; padding:0; border:2px solid #fff8e8; outline:1.5px solid var(--ink); border-radius:50%; cursor:pointer; background:linear-gradient(135deg,var(--c1) 0 50%,var(--c2) 50%); }
.palette button:hover { transform:translateY(-2px); }
.toggle-label input { position:absolute; opacity:0; }
.toggle-label > span { width:43px; height:24px; border:2px solid var(--ink); background:var(--paper); position:relative; }
.toggle-label > span::after { content:""; position:absolute; width:14px; height:14px; background:var(--ink); left:3px; top:3px; transition:.2s; }
.toggle-label input:checked + span::after { left:22px; background:var(--tomato); }

.note-strip { display:flex; justify-content:space-between; gap:30px; align-items:center; padding:28px clamp(20px,6vw,100px); background:var(--tomato); color:#fff7e8; border-top:3px solid var(--ink); border-bottom:3px solid var(--ink); }
.note-strip p { margin:0; }
.note-strip > span { white-space:nowrap; font-family:"Ma Shan Zheng"; font-size:22px; }
footer { min-height:95px; padding:0 clamp(20px,6vw,100px); display:flex; align-items:center; justify-content:space-between; font-size:12px; }

@media (max-width: 820px) {
  .preview-section { grid-template-columns:1fr; padding-top:44px; }
  .intro { text-align:center; justify-self:center; }
  .preview-shell { width:min(88vw,560px); }
  .quick-actions { grid-column:auto; }
  .section-heading { display:block; }
  .color-row { flex-wrap:wrap; }
  .color-copy { width:100%; }
}
@media (max-width: 700px) {
  .site-header { height:50px; padding:0 14px; }
  .brand-mark { width:32px; height:32px; font-size:19px; }
  .brand b { font-size:13px; }
  .brand small { display:none; }
  .proof { font-size:9px; padding:4px 7px; }
  .preview-section { min-height:0; display:flex; flex-direction:column; gap:5px; padding:8px 12px 7px; }
  .intro { display:none; }
  .preview-shell { width:clamp(190px, 32vh, 278px); }
  .avatar-frame { border-width:2px; box-shadow:4px 4px 0 var(--ink); }
  .preview-caption { margin-top:6px; font-size:9px; }
  .tape { width:66px; height:18px; }
  .tape-a { left:-15px; top:12px; }
  .tape-b { right:-14px; bottom:24px; }
  .quick-actions { display:grid; grid-template-columns:1.25fr 1fr 1fr; gap:6px; width:100%; margin-top:2px; }
  .action { min-height:36px; padding:5px 4px; font-size:11px; box-shadow:2px 2px 0 var(--ink); }
  .maker-section { padding:7px 10px 12px; border-top-width:2px; }
  .section-heading { display:none; }
  .control-card { grid-template-columns:64px minmax(0,1fr); gap:6px; padding:7px; border-width:1.5px; border-radius:15px; box-shadow:3px 3px 0 rgba(43,33,29,.2); }
  .tabs { gap:2px; margin:0; padding:1px 6px 1px 0; }
  .tab { min-height:27px; padding:2px 1px; border-radius:999px; font-size:9px; }
  .tab small { display:none; }
  .option-panel { padding:7px 3px 5px; }
  .sub-tabs { gap:5px; margin:-1px 0 6px; }
  .sub-tab { min-width:62px; min-height:24px; padding:2px 10px; font-size:9px; border-width:1px; }
  .face-nudge { margin:-2px 0 5px; padding:3px 5px; }
  .face-nudge > span { font-size:9px; }
  .nudge-buttons { gap:3px; }
  .nudge-buttons button { width:25px; height:22px; border-width:1px; border-radius:4px; font-size:11px; }
  .panel-topline { margin-bottom:7px; }
  .panel-topline b { font-size:13px; display:inline; margin-right:8px; }
  .panel-topline span:not(.selection-count) { font-size:9px; }
  .selection-count { font-size:9px; padding:3px 5px; }
  .option-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; max-height:214px; padding-right:4px; }
  .option-card { min-height:68px; padding:4px; border-radius:7px; box-shadow:none; }
  .option-card.selected { border-width:2px; box-shadow:none; }
  .option-card.selected::after { width:14px; height:14px; right:3px; top:3px; font-size:8px; }
  .option-icon { min-height:0; height:60px; }
  .color-row { margin-top:2px; padding:7px 3px 1px; gap:6px; flex-wrap:nowrap; }
  .color-copy { display:block; margin-right:1px; }
  .color-copy b { font-size:10px; white-space:nowrap; }
  .color-copy span { display:none; }
  .color-row label { font-size:0; gap:0; }
  input[type="color"] { width:27px; height:27px; padding:1px; border-radius:50%; }
  .palette { gap:4px; }
  .palette button { width:24px; height:24px; border-width:1px; outline-width:1px; }
  .toggle-label { margin-left:auto; }
  .toggle-label > span { width:32px; height:19px; }
  .toggle-label > span::after { width:9px; height:9px; }
  .toggle-label input:checked + span::after { left:17px; }
  .note-strip, footer { display:none; }
}

@media (max-width: 370px) {
  .preview-shell { width:clamp(175px, 29vh, 225px); }
  .tab { font-size:9px; }
  .palette button:nth-child(n+5) { display:none; }
}

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