:root {
  --ink:#244340; --muted:#5b685f; --surface:#fffdf8; --line:#d8d0c1;
  --accent:#176266; --soft:#f2eee5; --radius:4px; --orange:#9c461f;
  --body-font:'Jost',Arial,sans-serif; --display-font:'DM Serif Display',Georgia,serif;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; scroll-padding-top:24px; }
body { margin:0; background:#fbf6ec; color:var(--ink); font:400 16px/1.5 var(--body-font); }
button,input,select,textarea { font:inherit; }
button,a,input,select,textarea,summary { touch-action:manipulation; }
h1,h2,h3,p { margin:0; }
h1,h2,h3 { font-family:var(--display-font); }
h1 { font-weight:400; font-size:clamp(36px,3.7vw,58px); line-height:1.08; letter-spacing:-.7px; max-width:800px; }
h2 { font-size:26px; font-weight:400; line-height:1.2; }
h3 { font-size:24px; font-weight:400; line-height:1.2; }
button { border:1px solid var(--line); border-radius:4px; background:var(--surface); color:var(--ink); min-height:44px; padding:10px 16px; cursor:pointer; transition:background-color .18s,border-color .18s,color .18s; }
button:hover { background:var(--soft); border-color:var(--accent); }
button:disabled { cursor:default; }
:where(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--orange); outline-offset:4px; }
a { color:inherit; text-underline-offset:4px; }
.skip-link { position:fixed; z-index:20; left:12px; top:12px; padding:12px 20px; background:var(--ink); color:white; transform:translateY(-180%); }
.skip-link:focus { transform:none; }
.workbench-header { padding:12px 4vw; background:var(--surface); border-top:3px solid #b85b2d; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:28px; min-height:104px; }
.brand { flex:none; }
.brand img { display:block; width:116px; height:auto; }
.workbench-header nav { margin-left:auto; display:flex; align-items:center; gap:24px; font-size:15px; }
.workbench-header nav a { text-decoration:none; padding:10px 0; }
.workbench-header nav a:hover { text-decoration:underline; }
.workbench-header .keep-button { background:var(--accent); border-color:var(--accent); color:white; padding:12px 24px; border-radius:4px; font-size:14px; }
.workbench-header .keep-button:hover { background:#124f52; }
main { max-width:1540px; margin:0 auto; padding:0 4vw; }
.workbench-intro { display:flex; align-items:center; justify-content:space-between; gap:32px; padding:32px 0 28px; }
.workbench-intro p { font-size:18px; line-height:1.4; margin-top:12px; color:var(--muted); }
.preview-notice { font-size:13px; background:transparent; border:1px solid var(--line); border-radius:4px; padding:10px 16px; white-space:nowrap; color:var(--muted); }
.worktable { display:grid; grid-template-columns:190px minmax(0,1fr) 242px; gap:24px; align-items:center; }
.recipe-shelf { min-width:0; padding:12px 0; }
.recipe-shelf h2 { font-size:24px; }
.recipe-shelf>p { font-size:14px; color:var(--muted); line-height:1.4; margin:8px 0 16px; }
.recipe-shelf .preset-list { display:grid; grid-template-columns:1fr; gap:8px; max-height:382px; overflow:auto; padding:2px 8px 8px 2px; scrollbar-color:#9aada3 #f3eee4; scrollbar-width:thin; }
.recipe-shelf .preset-choice { display:flex; flex-direction:column; align-items:flex-start; gap:4px; width:100%; min-height:80px; text-align:left; border:1px solid var(--line); border-radius:4px; padding:12px; background:var(--surface); box-shadow:none; }
.recipe-shelf .preset-choice:hover { border-color:var(--accent); background:var(--soft); }
.recipe-shelf .preset-choice strong { font-size:14px; font-weight:600; }
.recipe-shelf .preset-choice>span:last-child { font-size:12px; line-height:1.3; color:var(--muted); }
.preset-colors { display:flex; gap:4px; }
.preset-colors i { display:block; width:14px; height:14px; border:1px solid #bfb59f; border-radius:3px; margin:0; }
.mixing-stage { min-width:0; background:#f5f0e6; border:1px solid var(--line); border-radius:6px; overflow:hidden; position:relative; }
.stage-top { position:absolute; z-index:1; top:20px; left:22px; right:22px; display:flex; justify-content:space-between; align-items:center; gap:20px; pointer-events:none; }
.stage-top h2 { font-family:var(--body-font); font-size:15px; font-weight:500; }
.render-mode { font-size:12px; padding:4px 9px; border-radius:3px; border:1px solid var(--line); background:var(--surface); color:var(--muted); }
#cake-stage { position:relative; height:400px; min-height:360px; width:100%; overflow:hidden; background:#f5f0e6; }
#cake-stage canvas { width:100%; height:100%; display:block; }
.cake-stage:focus-within { outline:3px solid var(--orange); outline-offset:-5px; }
.cake-stage canvas:focus-visible { outline:none; }
.loading-message { position:absolute; inset:0; display:grid; place-content:center; color:var(--muted); }
.stage-bottom { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:8px 12px; padding:12px 16px; border-top:1px solid var(--line); background:#f8f4eb; }
.view-controls { gap:5px; justify-content:center; }
.view-controls button { padding:8px 10px; min-height:44px; font-size:12px; border-radius:4px; border-color:var(--line); background:var(--surface); }
.view-controls input { max-width:72px; }
.stage-history { display:flex; gap:8px; }
.stage-history button { font-size:12px; padding:8px; min-height:44px; border:0; background:transparent; text-decoration:underline; text-underline-offset:3px; }
.stage-history button:disabled { text-decoration:none; }
.stage-hint { padding:0 16px 12px; background:#f8f4eb; text-align:center; font-size:12px; color:var(--muted); }
.recipe-card { height:514px; padding:22px 19px; background:var(--surface); border:1px solid var(--line); border-radius:6px; box-shadow:none; transform:none; display:flex; flex-direction:column; gap:14px; min-width:0; }
.recipe-card-title { display:flex; justify-content:space-between; align-items:center; gap:12px; border-bottom:1px solid var(--line); padding-bottom:14px; }
.recipe-card-title h2 { font-size:24px; }
.paper-hole { display:none; }
.cake-description { font-size:14px; line-height:1.5; font-weight:500; }
.recipe-card>[data-controls="summary"] { flex:1; min-height:0; overflow:auto; padding-right:4px; }
.recipe-card .summary-list { font-size:12px; gap:9px; margin:0; }
.recipe-card .summary-list>div { border-bottom:1px solid #ede3d1; padding-bottom:8px; display:block; }
.recipe-card .summary-list dt { color:#546659; font-weight:500; }
.recipe-card .summary-list dd { margin:0; font-size:12px; }
.recipe-card .recipe-save { margin-top:auto; font-size:13px; background:#f6eee2; border-color:#c9b79d; padding:10px; }
.recipe-help { font-size:12px; line-height:1.45; color:var(--muted); }
.workbench-status { min-height:24px; font-size:13px; margin:16px 0 0; color:var(--muted); }
.ingredient-bench { margin-top:28px; }
.ingredient-heading { display:flex; align-items:center; justify-content:space-between; gap:24px; padding-bottom:20px; }
.ingredient-heading h2 { font-size:28px; letter-spacing:-.5px; }
.ingredient-heading p { font-size:14px; color:var(--muted); margin-top:6px; }
.preview-return { font-size:14px; flex:none; }
.tray-tabs { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; position:relative; z-index:1; }
.tray-tabs button { display:grid; grid-template-columns:1fr; gap:0; text-align:left; align-items:center; border:1px solid var(--line); border-bottom:0; border-radius:4px 4px 0 0; padding:16px 12px; background:#f3eee4; box-shadow:none; min-height:76px; }
.tray-tabs button:hover { background:#eee8db; border-color:var(--accent); }
.tray-tabs button[aria-selected=true] { background:var(--surface); border-color:var(--accent); color:var(--accent); box-shadow:none; }
.tray-tabs button>span:nth-child(2) { font-weight:600; font-size:16px; line-height:1.25; }
.tray-tabs small { font-size:12px; color:var(--muted); grid-column:1; margin-top:4px; }
.tray-symbol { display:none; }
.shape-symbol { height:24px; border:2px solid #3c8581; border-radius:50%/22%; background:#acd6c9; }
.shape-symbol:after { content:''; position:absolute; width:100%; height:8px; left:-2px; top:-2px; border-radius:50%; border:2px solid #3c8581; background:#d0e8d6; }
.icing-symbol { border-radius:50%; background:#f4bbbd; border:2px solid #c38381; box-shadow:inset -6px 0 0 #e89b9e; }
.topping-symbol { border-radius:50%; width:20px; height:22px; background:#edba72; border:2px solid #aa632c; transform:rotate(-12deg); margin-left:4px; }
.topping-symbol:after { content:''; position:absolute; width:7px; height:13px; left:10px; top:-8px; border:2px solid #5e7d4d; border-left:0; border-bottom:0; border-radius:0 60% 0 0; }
.message-symbol { font-family:Georgia,serif; font-size:24px; font-weight:700; color:#557066; width:auto; }
.photo-symbol { border:2px solid #977082; background:#fff5f0; border-radius:4px; box-shadow:inset 0 -10px #d7aaba; }
.photo-symbol:after { content:''; position:absolute; width:6px; height:6px; border-radius:50%; background:#ca956d; top:4px; right:4px; }
.notes-symbol { border:2px solid #788760; border-radius:3px; background:repeating-linear-gradient(#fffdf5 0px,#fffdf5 5px,#b4c49e 5px,#b4c49e 6px); height:29px; width:23px; margin-left:2px; }
.tray-panels { background:var(--surface); border:1px solid var(--line); border-radius:0 0 6px 6px; box-shadow:none; min-height:230px; }
.ingredient-tray { padding:28px; display:grid; grid-template-columns:190px minmax(0,1fr); gap:32px; }
.ingredient-tray[hidden] { display:none; }
.tray-description h3 { font-size:24px; letter-spacing:-.4px; }
.tray-description p { font-size:14px; color:var(--muted); line-height:1.55; margin-top:12px; }
.ingredient-tray .control-group { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 28px; align-items:start; }
.ingredient-tray .control-group>.field-row { grid-column:1/-1; display:grid; grid-template-columns:1fr 1fr; gap:28px; }
.ingredient-tray .control-group>.choices,.ingredient-tray .control-group>.control-help,.ingredient-tray .control-group>.action-row { grid-column:1/-1; }
.ingredient-tray .tier-list { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.ingredient-tray .tier-row { background:#faf7f0; border:1px solid var(--line); border-radius:4px; padding:16px; }
.tier-row h3 { font-family:var(--body-font); font-weight:600; font-size:14px; margin-bottom:8px; }
.field { font-size:14px; font-weight:500; }
.field input:not([type=checkbox]):not([type=range]):not([type=color]),.field select,.field textarea { border-radius:4px; border-color:#c7cbbd; background:#fffdf8; min-height:44px; }
.field input[type=range] { height:36px; }
.field input[type=file] { padding:12px; }
.choices { gap:8px; }
.choice { border-radius:4px; min-height:44px; font-size:14px; border-color:var(--line); background:var(--surface); }
.choice[aria-pressed=true] { background:var(--accent); border:2px solid var(--accent); color:#fffdf8; padding:8px 15px; }
.color-input-row { gap:10px; }
.swatches { grid-template-columns:repeat(8,minmax(0,1fr)); gap:8px; }
.swatch { border-radius:4px; width:36px; height:36px; min-height:36px; padding:0; }
.control-help { font-size:12px; font-weight:400; line-height:1.5; color:var(--muted); }
.placed-decoration { margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.placed-decoration summary { cursor:pointer; font-weight:600; margin-bottom:20px; }
.photo-preview { width:120px; max-height:120px; object-fit:contain; background:#fff; border:1px solid var(--line); border-radius:4px; }
.photo-upload,.photo-source,.photo-preview-row { grid-column:1/-1; min-width:0; }
[data-photo-name] { overflow-wrap:anywhere; }
.file-button { display:flex; gap:12px; align-items:center; flex-wrap:wrap; border:1px solid var(--line); padding:16px; border-radius:4px; background:#faf7f0; min-width:0; }
.ingredient-tray .control-group>.placement-controls,.ingredient-tray .control-group>.photo-file-button,.ingredient-tray .control-group>.photo-preview-wrap { grid-column:1/-1; }
.placement-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 28px; padding-top:20px; border-top:1px solid var(--line); min-width:0; }
.placement-controls>.action-row,.placement-controls>.field-row,.placement-controls>.control-help { grid-column:1/-1; }
.photo-file-button { display:grid; gap:12px; padding:20px; background:#faf7f0; border:1px solid var(--line); border-radius:4px; min-width:0; font-weight:600; }
.photo-file-button input { max-width:100%; min-width:0; font-size:14px; }
.photo-file-button input::file-selector-button { min-height:44px; border:1px solid var(--accent); border-radius:4px; background:var(--accent); color:#fffdf8; padding:10px 16px; margin-right:12px; font:inherit; cursor:pointer; }
.photo-preview-wrap { display:flex; align-items:center; gap:20px; padding:16px; border:1px solid var(--line); border-radius:4px; min-width:0; }
.photo-preview-wrap img { width:112px; height:90px; object-fit:contain; background:#fff; border-radius:4px; }
.photo-preview-wrap p { overflow-wrap:anywhere; min-width:0; font-size:14px; }
.workbench-bottom { display:grid; grid-template-columns:1fr 1fr; gap:40px; padding:36px 0; }
.recipe-keeping summary { font-size:17px; font-weight:600; cursor:pointer; }
.recipe-keeping .action-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:20px; }
.recipe-keeping .action-row button { font-size:13px; padding:10px 12px; min-height:44px; }
.recipe-review { margin-top:24px; min-width:0; max-width:100%; overflow-wrap:anywhere; }
.recipe-review[hidden] { display:none; }
.recipe-review h2 { font-size:23px; margin-bottom:16px; }
.saving-help { margin-top:16px; }
.demo-disclaimer { border-left:1px solid #c59b78; padding-left:20px; }
.demo-disclaimer h2 { font-size:20px; margin-bottom:8px; }
.demo-disclaimer p { font-size:13px; color:var(--muted); line-height:1.6; }
.workbench-footer { padding:24px 4vw; background:#f3eee4; border-top:1px solid var(--line); display:flex; justify-content:space-between; flex-wrap:wrap; gap:20px; font-size:13px; }
.workbench-footer>a:first-child { font-size:16px; font-weight:600; }
.noscript-note { padding:20px; border:1px solid var(--line); margin:20px 0; }
@media(min-width:1600px) { main { padding:0 48px; } }
@media(max-width:1150px) {
  .worktable { grid-template-columns:170px minmax(0,1fr); gap:20px; }
  .recipe-card { display:none; }
  .ingredient-tray { grid-template-columns:160px 1fr; gap:24px; }
  .tray-tabs button { display:flex; flex-direction:column; text-align:center; justify-content:center; gap:8px; padding:14px 8px; }
  .tray-tabs button>span:nth-child(2) { font-size:14px; }
  .tray-tabs small { display:none; }
  .preview-notice { display:none; }
  .workbench-header nav { gap:16px; }
}
@media(max-width:800px) {
  .workbench-header { padding:10px 24px; min-height:92px; gap:20px; }
  .brand img { width:100px; }
  .workbench-header nav { font-size:13px; gap:16px; }
  .keep-button { display:none; }
  main { padding:0 24px; }
  .workbench-intro { padding:28px 0 24px; }
  .workbench-intro h1 { font-size:43px; letter-spacing:-1px; }
  .workbench-intro p { font-size:17px; }
  .worktable { grid-template-columns:1fr; gap:0; }
  .mixing-stage { grid-row:1; border-radius:6px; }
  #cake-stage { height:390px; min-height:280px; }
  .stage-top { left:18px; right:18px; top:16px; }
  .recipe-shelf { padding:24px 0 0; }
  .recipe-shelf h2 { font-size:22px; }
  .recipe-shelf>p { margin:6px 0 14px; }
  .recipe-shelf .preset-list { grid-template-columns:none; grid-template-rows:repeat(2,auto); grid-auto-flow:column; grid-auto-columns:minmax(160px,28%); max-height:none; overflow-x:auto; padding:4px 4px 8px; gap:12px; }
  .recipe-shelf .preset-choice { min-height:94px; }
  .ingredient-heading h2 { font-size:25px; }
  .ingredient-tray { display:block; padding:24px; }
  .tray-description { margin-bottom:24px; max-width:500px; }
  .tray-description h3 { font-size:24px; }
  .tray-description p { margin-top:8px; }
  .ingredient-tray .control-group { gap:20px; }
  .ingredient-tray .control-group>.field-row { gap:20px; }
  .workbench-bottom { grid-template-columns:1fr; gap:24px; }
  .workbench-footer { padding:24px; gap:16px; }
}
@media(max-width:600px) {
  .tray-tabs { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding-bottom:6px; }
  .tray-tabs button { border:1px solid var(--line); border-radius:4px; min-height:64px; }
  .tray-panels { border-radius:6px; }
  .swatches { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
  .swatch { width:42px; height:42px; min-height:42px; }
  .ingredient-tray .control-group { grid-template-columns:1fr; }
  .placement-controls { grid-template-columns:1fr; gap:20px; }
  .placement-controls>.field-row { grid-template-columns:1fr; gap:20px; }
  .ingredient-tray .control-group>.field-row { grid-template-columns:1fr; gap:16px; }
  .ingredient-tray .tier-list { grid-template-columns:1fr; }
  .ingredient-tray .control-group>.choices,.ingredient-tray .control-group>.field-row,.ingredient-tray .tier-list,.ingredient-tray .control-group>.control-help,.ingredient-tray .control-group>.action-row { grid-column:auto; }
}
@media(max-width:480px) {
  .workbench-header { padding:10px 18px; gap:16px; }
  .brand img { width:86px; }
  .workbench-header nav { gap:4px 12px; justify-content:flex-end; flex-wrap:wrap; font-size:12px; max-width:180px; }
  .workbench-header nav a { padding:6px 0; }
  main { padding:0 18px; }
  .workbench-intro { padding:24px 0 20px; }
  .workbench-intro h1 { font-size:36px; line-height:1.08; }
  .workbench-intro p { font-size:16px; }
  #cake-stage { height:340px; }
  .stage-top h2 { font-size:13px; max-width:130px; }
  .render-mode { font-size:11px; padding:3px 7px; }
  .stage-bottom { padding:10px; }
  .view-controls { gap:4px; }
  .view-controls button { font-size:11px; padding:8px; }
  .view-controls input { max-width:62px; }
  .ingredient-heading { align-items:flex-start; gap:12px; }
  .ingredient-heading h2 { font-size:24px; }
  .ingredient-heading p { font-size:13px; }
  .preview-return { font-size:12px; padding:8px 10px; max-width:88px; }
  .ingredient-tray { padding:22px 18px; }
  .workbench-footer { padding:24px 18px; }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  *,*:before,*:after { animation:none!important; transition:none!important; }
  .recipe-shelf button:hover,.workbench-header .keep-button:hover,.tray-tabs button:hover { transform:none; }
}


/* Spacious preview controls and responsive cake composition. */
#cake-stage { height:500px; }
.stage-bottom { gap:18px 24px; padding:20px 22px; }
.stage-bottom>[data-view-controls] { min-width:0; flex:1 1 620px; }
.view-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; width:100%; align-items:start; }
.camera-slider { display:grid; grid-template-rows:auto 44px auto; gap:0; min-width:0; width:100%; color:var(--ink); font:500 14px/1.4 var(--body-font); }
.camera-slider-label { display:flex; align-items:baseline; justify-content:space-between; gap:12px; min-width:0; }
.camera-slider output { font-size:13px; font-weight:400; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.view-controls .camera-slider input { width:100%; min-width:0; max-width:none; min-height:44px; height:44px; margin:0; padding:0; accent-color:var(--accent); cursor:pointer; }
.view-controls .camera-slider input:disabled { cursor:default; }
.camera-slider-endpoints { display:flex; justify-content:space-between; gap:12px; font-size:12px; font-weight:400; line-height:1.4; color:var(--muted); }
.camera-note { margin-top:12px; font-size:12px; line-height:1.5; color:var(--muted); text-align:center; }
.camera-note[hidden] { display:none; }
.stage-history { flex-wrap:wrap; justify-content:center; gap:14px 18px; }
.stage-history button { min-width:88px; min-height:48px; padding:12px 16px; font-size:14px; }
.stage-history [data-action="export-png"] { min-width:136px; }
@media(max-width:900px) {
  #cake-stage { height:490px; }
  .stage-bottom>[data-view-controls],.stage-history { flex-basis:100%; }
}
@media(max-width:480px) {
  main { padding-inline:10px; }
  #cake-stage { height:425px; }
  .stage-bottom { padding:18px 14px; gap:20px; }
  .view-controls { grid-template-columns:1fr; gap:20px; }
  .stage-history { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .stage-history button { min-width:0; width:100%; }
  .stage-history [data-action="export-png"] { grid-column:1/-1; }
}
@media(min-width:481px) and (max-width:600px) {
  .view-controls { grid-template-columns:1fr; gap:20px; }
}
