:root {
  --page:#f8f6f1; --paper:#fffefa; --ink:#332e29; --muted:#71695f;
  --line:#e4ddd0; --pine:#324f43; --berry:#844053; --wine:#663245;
}
body {letter-spacing:-.022em}
.wrap {width:min(1240px,calc(100% - 72px))}
.top {background:#fffdf8}
.bar {min-height:72px}
.brand {gap:10px;color:#42362b;font-size:24px;letter-spacing:-.075em}
.brand-mark {display:grid;place-items:center;width:35px;height:35px;background:#f4d981;color:#56422c;border-radius:12px;font:29px/1 Georgia,serif}
.bar nav {gap:3px}
.bar nav>* {padding:8px 13px;border-radius:8px}
.bar nav .current {background:#f0ede4;color:#403b34}
.hero {position:relative;isolation:isolate;display:grid;grid-template-columns:1.2fr 1fr;min-height:200px;margin:24px 0;overflow:hidden;border:1px solid #dbd7bf;border-radius:22px;background:#f0eedf;box-shadow:none}
.hero-copy {align-self:center;padding:25px clamp(24px,3.6vw,50px);z-index:1}
.hero h1 {font-size:clamp(30px,3.1vw,46px);font-weight:800;letter-spacing:-.085em;line-height:1.16;color:#30392f}
.hero p {margin:8px 0 0;color:#535a4f;font-size:15px;line-height:1.55}
.hero-photo {min-height:100%;background-position:center 55%;background-size:cover;position:relative}
.hero-photo::before {content:"";position:absolute;inset:0;background:linear-gradient(90deg,#f0eedf,transparent 24%)}
.hero-actions {display:flex;align-items:center;gap:9px;margin-top:16px}
.hero-actions button {font-weight:700;font-size:14px;border-radius:8px;padding:8px 13px;line-height:1.4;min-height:36px;white-space:nowrap}
.hero-actions .primary,.actions .primary {background:var(--pine);color:white}
.hero-actions .primary:hover,.actions .primary:hover {background:#233e33}
.hero-actions button+button {color:#424a3f;border:1px solid #c6c9b8;background:#f9f8ef}
.workspace {display:grid;grid-template-columns:minmax(0,1.6fr) minmax(330px,.88fr);grid-template-areas:"result controls";gap:20px;align-items:start}
.result {grid-area:result}
.controls {grid-area:controls}
.panel {border:1px solid var(--line);border-radius:18px;background:var(--paper);box-shadow:0 3px 14px #51453609;overflow:hidden}
.panel-head {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:57px;padding:12px 20px}
.panel h2 {font-size:19px;letter-spacing:-.065em;color:#3b352e}
.panel-head .seg,.style-picker .seg,.source-toggle {background:#f1eee7;border:1px solid #e7e1d5;border-radius:9px}
.seg button {font-size:13px;padding:5px 10px;min-height:30px}
.seg button[aria-pressed=true] {color:#334c3f;box-shadow:0 1px 4px #473c2724}
.style-picker {padding:9px 20px;border-color:var(--line);justify-content:space-between}
.style-picker strong {font-size:13px}
.mat {position:relative;min-height:360px;padding:30px 18px 17px;background-color:#eae6db;background-image:linear-gradient(135deg,#f8f5eb77,#c4bbab38),repeating-linear-gradient(0deg,transparent 0 21px,#9086741c 21px 22px),repeating-linear-gradient(90deg,transparent 0 21px,#9086741c 21px 22px)}
.mat #cake {width:min(83%,410px);height:auto;filter:drop-shadow(1px 8px 6px #594a3529)}
[data-view=line] .mat {background-color:#eeeee9}
.mat-label {top:12px;left:14px;font-size:11px;letter-spacing:.01em;font-weight:650;border-radius:20px;padding:3px 9px}
.measure {font-size:12px;margin-top:0;width:min(67%,330px)}
#compareBoard {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;width:100%;align-items:center;margin:18px 0}
#compareBoard.with-photo {grid-template-columns:repeat(3,minmax(0,1fr))}
#compareBoard figure {background:#fffdf7;border:1px solid #ddd5c7;border-radius:12px;margin:0;padding:8px;min-width:0;overflow:hidden}
#compareBoard canvas,#compareBoard img {width:100%;height:auto;aspect-ratio:1;object-fit:contain;display:block;filter:none}
#compareBoard img {background:#f3efe7;border-radius:7px}
#compareBoard figcaption {font-size:12px;font-weight:700;color:#554c42;text-align:center;padding:6px 0 1px}
.preview-tools,.actions {padding:12px 20px}
.actions {gap:8px;padding-bottom:0}
.actions button {min-height:40px}
.print-tip {padding:0 20px 14px;margin-top:9px;font-size:12px}
.controls fieldset {margin:14px 18px 0;padding:0 0 13px}
.controls legend {font-size:14px;margin-bottom:7px}
.controls .small-fields {grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.small-fields select {padding:7px 16px 7px 6px;font-size:13px;background-position:right 4px center}
.patterns {gap:6px}
.pattern {border-radius:9px}
.pattern[aria-pressed=true] {border:1px solid #385647;color:#2e483a;background:#ecf1e8}
.diameters {gap:6px}
.footer {margin-top:32px}
.mobile-jump {display:none}
@media(min-width:950px) and (min-height:880px) {.result{position:sticky;top:12px}}
@media(max-width:920px) {
  .wrap{width:calc(100% - 32px)}.workspace{grid-template-columns:minmax(0,1.3fr) minmax(300px,.9fr);gap:12px}
  .panel-head,.style-picker,.actions,.preview-tools {padding-inline:12px}
  .preview-head {flex-wrap:wrap}.preview-tools small {display:none}.controls fieldset{margin-inline:12px}
}
@media(max-width:710px) {
  .wrap{width:calc(100% - 24px)}.bar{min-height:52px;justify-content:space-between;gap:4px}.brand{font-size:19px;gap:5px}.brand-mark{width:26px;height:26px;font-size:22px;border-radius:8px}
  .bar nav{gap:0}.bar nav>*{font-size:12px;padding:6px}.bar nav .current{display:none}
  .hero{margin:12px 0 14px;min-height:145px;grid-template-columns:1.38fr .85fr;border-radius:16px}
  .hero-copy{padding:16px 0 16px 15px}.hero h1{font-size:clamp(23px,5.4vw,34px)}.hero p{font-size:12px;margin-top:6px}.hero-actions{gap:5px;margin-top:11px}
  .hero-actions button{font-size:12px;min-height:32px;padding:6px 8px}.hero-photo{background-position:51% 55%}
  .workspace{grid-template-columns:100%;grid-template-areas:"result" "controls";gap:13px}.panel{border-radius:14px}
  .panel-head{min-height:49px;padding:8px 12px}.panel h2{font-size:17px}.preview-head .seg button{font-size:12px;padding:4px 7px}
  .style-picker{padding:6px 12px}.mat{min-height:0;padding:25px 9px 8px}.mat #cake{width:min(74%,320px)}
  .preview-tools{padding:8px 12px}.actions{padding:9px 10px 0;gap:5px}.actions button{font-size:12px;min-height:36px;padding:7px 8px}.print-tip{padding:0 10px 10px}
  .mobile-jump{display:inline-block;font-size:12px;font-weight:750;color:var(--pine);text-decoration:underline;text-underline-offset:3px}
  .print-tip .mobile-jump{margin-left:4px}#compareBoard{gap:4px}#compareBoard figure{padding:4px;border-radius:8px}#compareBoard figcaption{font-size:11px}
  .controls fieldset{margin:14px 14px 0}.controls .small-fields{gap:7px}.mat-label{left:8px;top:6px}.measure{font-size:11px}
}
@media(max-width:365px){.hero{grid-template-columns:1.8fr 1fr}.bar nav>*{padding:5px 4px}.actions button{font-size:11px}.preview-head .seg button{padding:4px}.preview-head{gap:2px}}
@media(max-width:1000px){
  #compareBoard.with-photo{grid-template-columns:repeat(2,minmax(0,1fr))}
  #compareBoard.with-photo #originalTile{grid-column:1/-1;display:flex;align-items:center;gap:9px;width:fit-content;padding:3px 10px 3px 3px}
  #compareBoard.with-photo #originalTile img{width:38px;height:38px;object-fit:cover}
  #compareBoard.with-photo #originalTile figcaption{padding:0}
}
@media print {.hero,.mobile-jump{display:none!important}}
.example-title{margin:13px 0 6px;font-size:14px;font-weight:750}
#exampleChoices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;scroll-margin:10px}
.sample-choice{display:grid;justify-items:center;gap:3px;min-width:0;padding:4px 4px 5px;border:1px solid var(--line);border-radius:8px;background:white;font-size:12px;line-height:1.4}
.sample-choice img{width:100%;height:48px;object-fit:contain;border-radius:4px;background:#f6f3ec}
.sample-choice:hover,.sample-choice[aria-pressed=true]{border-color:var(--berry)}
.sample-choice[aria-pressed=true]{background:var(--tint);color:var(--wine);font-weight:700}
.sample-credit{margin:8px 0 12px;font-size:12px;color:var(--muted)}
.sample-credit summary{cursor:pointer}
.sample-credit p{margin:5px 0}
.sample-credit a{text-decoration:underline;text-underline-offset:2px}
.photo-tools{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:8px 20px 10px;border-bottom:1px solid var(--line)}
.photo-tools button{padding:5px 10px;background:#f8f3e8;border:1px solid var(--line);border-radius:7px;font-size:13px;font-weight:700}
.photo-tools button:hover{background:#ede7d8}
.photo-tools small{font-size:12px;color:var(--muted)}
.photo-editor{width:min(660px,calc(100% - 22px));max-height:94dvh;padding:18px 20px}
.edit-help{margin:5px 0 10px;color:var(--muted);font-size:13px}
.edit-stage{display:grid;justify-items:center;padding:8px;background:#ebe5da;border-radius:10px}
.edit-stage canvas{display:block;width:auto;height:auto;max-width:100%;max-height:46dvh;touch-action:none;background:#fff;cursor:crosshair}
.brush-stage{position:relative;max-width:100%}
#eraserCursor{position:absolute;transform:translate(-50%,-50%);border:1.5px solid #386045;box-shadow:0 0 0 1px #ffffffc9;border-radius:50%;pointer-events:none}
.crop-ranges{display:grid;grid-template-columns:1fr 1fr;gap:4px 15px;margin-top:10px}
.crop-ranges label,.brush-size{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--ink);white-space:nowrap}
.crop-ranges input,.brush-size input{flex:1;min-width:0;accent-color:var(--pine)}
.brush-size{margin:10px 0 5px}
.brush-size output{min-width:3ch;text-align:end}
.edit-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.edit-actions .primary{margin-left:auto}
.edit-actions button:disabled{opacity:.48;cursor:default}
@media(max-width:700px){.photo-tools{padding:7px 12px}.photo-editor{padding:12px}.edit-help{font-size:12px}.edit-stage canvas{max-height:39dvh}.edit-actions button{font-size:13px;padding-inline:9px}}
