:root {
  --bg: #F7EEE3; --card: #FFFBF5; --ink: #2E1F1A; --mute: #7A6558; --line: #E6D7C6;
  --accent: #B4234E; --accent-ink: #fff; --accent-soft: #F8E3E8; --gold: #B88A2C; --ok: #2F6B4A; --warn: #9A5B00;
  --r: 16px; --shadow: 0 10px 30px rgba(74, 38, 24, .10);
  --display: "Fraunces", Georgia, serif; --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--body); display: flex; flex-direction: column; min-height: 100dvh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -.01em; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; user-select: none; -webkit-touch-callout: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M14 44h36v6H14zM18 30h28v12H18zM24 20h16v9H24z' fill='%23FFF6E6'/%3E%3C/svg%3E") center/cover; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font: 600 18px var(--display); }
.brand-text small { color: var(--mute); font-size: 12px; }
.modes { display: flex; gap: 4px; margin-left: auto; background: #EFE2D3; padding: 4px; border-radius: 999px; }
.modes button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.modes button[aria-selected="true"] { background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.lang { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.demo-note { margin: 0 20px 8px; padding: 6px 12px; font-size: 12.5px; color: var(--warn); background: #FFF3D6; border: 1px solid #F0DCA8; border-radius: 10px; }

.builder { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; padding: 0 20px 16px; min-height: 0; }
.stage { position: relative; border-radius: var(--r); overflow: hidden; background: var(--bg); border: 1px solid var(--line); min-height: 420px; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.labels { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; }
.labels svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.labels polyline { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: .55; }
.labels circle { fill: var(--card); stroke: var(--ink); stroke-width: 1.5; }
.lbl { position: absolute; left: 0; top: 0; max-width: min(46%, 250px); background: rgba(255, 251, 245, .94); border: 1px solid var(--line); border-radius: 10px; padding: 5px 9px 5px 8px; box-shadow: 0 3px 10px rgba(0,0,0,.08); display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; font-size: 12.5px; line-height: 1.2; }
.lbl i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); grid-row: span 2; }
.lbl b { font-weight: 700; }
.lbl small { color: var(--mute); font-size: 11px; grid-column: 2; }
.stage-top { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.stage-top .cap { background: rgba(255,251,245,.92); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 500; font-size: 13px; }
.stage-tools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.tool { border: 1px solid var(--line); background: rgba(255,251,245,.95); border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 14px; box-shadow: 0 3px 10px rgba(0,0,0,.08); display: inline-flex; gap: 8px; align-items: center; }
.tool.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.panel { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-height: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 9px 11px 11px; font-weight: 500; color: var(--mute); border-bottom: 2.5px solid transparent; white-space: nowrap; font-size: 14px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); font-weight: 700; }
.tabs button span { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: #EFE2D3; font-size: 11px; margin-right: 5px; font-weight: 700; }
.tabs button[aria-selected="true"] span { background: var(--accent); color: #fff; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; min-height: 0; overscroll-behavior: contain; }
.panel-body h2 { font-size: 21px; margin-bottom: 2px; }
.panel-body .lead { color: var(--mute); margin: 0 0 14px; font-size: 13.5px; }
.group { margin: 0 0 18px; }
.group > h3 { font: 700 12px var(--body); text-transform: uppercase; letter-spacing: .07em; color: var(--mute); margin-bottom: 8px; }
.opts { display: grid; gap: 8px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 11px; transition: border-color .15s, box-shadow .15s; min-height: 52px; }
.opt:hover { border-color: #CDB8A2; }
.opt.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt.blocked { background: #F6EFE7; border-style: dashed; cursor: not-allowed; }
.opt.blocked .sw, .opt.blocked b { opacity: .5; }
.opt .sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.14); flex: none; box-shadow: inset 0 -3px 6px rgba(0,0,0,.12); }
.opt .sw.none { background: repeating-linear-gradient(45deg, #fff 0 4px, #EADBCB 4px 8px); }
.opt .txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.opt b { font-weight: 700; font-size: 14px; }
.opt small { color: var(--mute); font-size: 12px; }
.opt em { font-style: normal; color: var(--warn); font-size: 12px; margin-top: 2px; }
.opt .tick { margin-left: auto; color: var(--accent); font-weight: 700; visibility: hidden; }
.opt.sel .tick { visibility: visible; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); padding: 0; }
.swatches button.sel { box-shadow: 0 0 0 3px var(--accent); }
.tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.tpl:hover { border-color: #CDB8A2; }
.tpl.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl img { width: 100%; aspect-ratio: 1.25; object-fit: cover; background: var(--bg); display: block; }
.tpl div { padding: 8px 10px 10px; }
.tpl b { display: block; font: 600 15px var(--display); }
.tpl small { color: var(--mute); font-size: 12px; line-height: 1.3; display: block; }
.inside { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.inside li { display: grid; grid-template-columns: 16px 1fr; gap: 2px 9px; padding: 8px 11px; border-top: 1px solid var(--line); font-size: 13.5px; }
.inside li:first-child { border-top: 0; }
.inside i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.16); margin-top: 3px; grid-row: span 2; }
.inside small { color: var(--mute); grid-column: 2; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-weight: 500; font-size: 13.5px; }
.field input, .field select, .field textarea { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 15px; width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--mute); font-size: 12.5px; margin: 6px 0 0; }
.nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.btn { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn { color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }

.summary { border-top: 1px solid var(--line); padding: 12px 16px 14px; background: #FFF7EC; }
.sum-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sum-price { font: 600 28px var(--display); }
.sum-facts { color: var(--mute); font-size: 13.5px; }
.sum-meta { font-size: 13px; margin: 2px 0 8px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: var(--mute); margin-bottom: 10px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--ink); font-weight: 500; }
.chip.ok { border-color: #BFD9C9; color: var(--ok); background: #F0F8F3; }
.sum-actions { display: flex; gap: 8px; }
.sum-actions .btn { flex: 1; }

/* box builder */
.count { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.count .bar { flex: 1; height: 8px; background: #EFE2D3; border-radius: 99px; overflow: hidden; }
.count .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.seg { display: inline-flex; background: #EFE2D3; padding: 3px; border-radius: 999px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 700; }
.seg button.sel { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.rowchips { display: flex; flex-wrap: wrap; gap: 6px; }
.rowchips button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.rowchips button.sel { border-color: var(--accent); background: var(--accent-soft); }
.pastry { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.pastry.dim { opacity: .42; }
.pastry img { width: 64px; height: 64px; border-radius: 10px; background: var(--bg); object-fit: cover; }
.pastry b { font: 600 15px var(--display); display: block; }
.pastry small { color: var(--mute); font-size: 12px; display: block; line-height: 1.3; }
.pastry .see { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 12.5px; padding: 3px 0 0; text-decoration: underline; text-underline-offset: 2px; }
.step { display: flex; align-items: center; gap: 6px; }
.step button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 19px; font-weight: 700; line-height: 1; }
.step button.add { background: var(--accent); border-color: var(--accent); color: #fff; }
.step button:disabled { opacity: .35; cursor: not-allowed; }
.step span { min-width: 18px; text-align: center; font-weight: 700; }

/* gallery */
.gallery { flex: 1; padding: 6px 20px 30px; max-width: 1200px; width: 100%; margin: 0 auto; }
.gallery h2 { font-size: 26px; margin: 14px 0 4px; }
.gallery .lead { color: var(--mute); margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); display: block; }
.card div { padding: 10px 12px 12px; }
.card b { font: 600 16px var(--display); display: block; overflow-wrap: anywhere; }
.card small { color: var(--mute); font-size: 12.5px; display: block; overflow-wrap: anywhere; }
.card .go { color: var(--accent); font-weight: 700; font-size: 13px; margin-top: 6px; display: block; }
.empty { color: var(--mute); padding: 18px; border: 1.5px dashed var(--line); border-radius: 14px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(46, 31, 26, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.sheet { background: var(--card); border-radius: 20px; width: min(560px, 100%); max-height: min(92dvh, 860px); overflow-y: auto; padding: 20px 20px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); position: relative; }
.sheet h2 { font-size: 23px; margin-bottom: 4px; padding-right: 36px; }
.sheet .x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #EFE2D3; font-size: 18px; }
.sheet .lead { color: var(--mute); margin: 0 0 14px; font-size: 13.5px; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; font-size: 13px; }
.qr { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 14px; }
.qr svg { width: 128px; height: 128px; flex: none; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.bill { width: 100%; border-collapse: collapse; margin: 10px 0 12px; font-size: 14px; }
.bill td { padding: 5px 0; border-top: 1px solid var(--line); }
.bill td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bill tr.total td { font-weight: 700; font-size: 16px; border-top: 2px solid var(--ink); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.done { text-align: center; padding: 14px 4px; }
.done .big { font-size: 46px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; max-width: min(92vw, 460px); font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.foot { padding: 6px 20px 14px; color: var(--mute); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.foot a, .foot button { color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; font-size: 12px; }

.attract { position: fixed; inset: 0; z-index: 70; display: grid; place-items: end center; padding: 0 20px 9vh; background: linear-gradient(to top, rgba(46,31,26,.72), rgba(46,31,26,0) 55%); color: #fff; text-align: center; cursor: pointer; }
.attract h1 { font-size: clamp(34px, 6vw, 68px); text-shadow: 0 2px 20px rgba(0,0,0,.4); }
.attract p { font-size: clamp(16px, 2.2vw, 24px); margin: 8px 0 0; animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* tablet / shop mode: bigger touch targets, nothing that leaves the page */
body.kiosk { user-select: none; -webkit-user-select: none; font-size: 17px; }
body.kiosk .opt { min-height: 66px; padding: 13px 14px; }
body.kiosk .opt b { font-size: 16px; }
body.kiosk .tabs button { font-size: 16px; padding: 13px 14px; }
body.kiosk .btn, body.kiosk .tool { padding: 14px 22px; font-size: 16px; }
body.kiosk .builder { grid-template-columns: minmax(0, 1fr) 480px; }
body.kiosk .no-kiosk, body.kiosk .foot, body.kiosk .lang { display: none !important; }
body.kiosk .qr svg { width: 200px; height: 200px; }
body.attracting .top, body.attracting .demo-note, body.attracting .panel, body.attracting .stage-tools { visibility: hidden; }
body.attracting .builder { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  body { display: block; }
  .top { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand-text small { display: none; }
  .brand-text b { font-size: 16px; }
  .modes button { padding: 7px 11px; font-size: 13.5px; }
  .demo-note { margin: 0 12px 8px; font-size: 11.5px; }
  .builder { display: block; padding: 0 12px 12px; }
  .stage { position: sticky; top: 0; z-index: 5; height: 44dvh; min-height: 280px; border-radius: 14px; }
  .panel { margin-top: 10px; overflow: visible; }
  .panel-body { overflow: visible; }
  .summary { position: sticky; bottom: 0; z-index: 6; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 -8px 20px rgba(74,38,24,.10); padding: 9px 12px 10px; }
  .sum-price { font-size: 23px; }
  .chips { display: none; }
  .sum-meta { margin-bottom: 6px; font-size: 12px; }
  .tool { padding: 8px 12px; font-size: 13px; }
  .lbl { font-size: 11.5px; padding: 4px 7px; max-width: 44%; }
  .lbl small { display: none; }
  .gallery { padding: 6px 12px 24px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .two-col, .share-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
