@property --bg0 { syntax: '<color>'; inherits: true; initial-value: #fffdf3; }
@property --bg1 { syntax: '<color>'; inherits: true; initial-value: #f4e39a; }

:root {
  --butter: #fbf3c6; --cream: #fffdf3; --cherry: #b8322a; --cherry-d: #93231d; --ink: #3b1d17;
  --blush: #f7d9d2; --line: #ecdfa8; --muted: #8b6c5f; --card: #ffffff;
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --stage-h: 46svh;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cherry); outline-offset: 2px; }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
em { font-style: italic; color: var(--cherry); }

.app { display: grid; grid-template-columns: minmax(0, 1fr) clamp(390px, 34vw, 480px); height: 100dvh; }

/* ------------------------------------------------ stage */
.stage { position: relative; overflow: hidden; background: radial-gradient(120% 95% at 50% 42%, var(--bg0), var(--bg1)); transition: --bg0 .7s, --bg1 .7s; color: var(--ink); }
.stage.dark { color: #fff7ea; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage.ludicrous::before { content: ""; position: absolute; inset: -20%; background: conic-gradient(from 0deg, #ff4fa3, #7a5cff, #27d3ff, #b6f23c, #ffe14d, #ff4fa3); opacity: .28; filter: blur(60px); animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.brand { position: absolute; left: 20px; top: 18px; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.brand img { border-radius: 50%; box-shadow: 0 2px 10px rgba(59, 29, 23, .18); }
.brand b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.1; }
.brand span { font-size: 12px; opacity: .7; }

.stage-top { position: absolute; right: 18px; top: 20px; display: flex; gap: 8px; }
.pill, .views, .tools button { background: rgba(255, 253, 243, .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(59, 29, 23, .1); color: var(--ink); }
.dark .pill, .dark .views, .dark .tools button { background: rgba(30, 22, 34, .6); border-color: rgba(255, 255, 255, .16); color: #fff7ea; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 99px; font-weight: 600; font-size: 13px; transition: transform .15s; }
.pill:hover { transform: translateY(-1px); }
.stage svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stage svg .fill { fill: currentColor; stroke: none; }

.views { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; padding: 4px; border-radius: 99px; }
.views button { height: 34px; padding: 0 16px; border-radius: 99px; font-weight: 600; font-size: 13px; transition: background .2s, color .2s; }
.views button.on { background: var(--ink); color: var(--cream); }
.dark .views button.on { background: #fff7ea; color: #1c1420; }

.tools { position: absolute; right: 18px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.tools button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.tools button.on { background: var(--cherry); border-color: var(--cherry); color: #fff; }

.hint { position: absolute; left: 20px; bottom: 22px; margin: 0; font-size: 12px; opacity: .6; pointer-events: none; }

.ludi { position: absolute; left: 0; right: 0; top: 78px; overflow: hidden; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .4s; font-weight: 800; letter-spacing: .28em; font-size: 12px; }
.ludicrous .ludi { opacity: .85; }
.ludi span { display: inline-block; padding-left: 100%; animation: marquee 9s linear infinite; background: linear-gradient(90deg, #ff4fa3, #27d3ff, #b6f23c, #ffe14d, #ff4fa3); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes marquee { to { transform: translateX(-100%); } }

.labels { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; }
.labels.on { opacity: 1; }
.tierlabel { position: absolute; left: 0; top: 0; padding: 6px 10px; border-radius: 10px; background: rgba(255, 253, 243, .94); border: 1px solid var(--line); color: var(--ink); font-size: 12px; line-height: 1.3; white-space: nowrap; box-shadow: 0 4px 14px rgba(59, 29, 23, .1); will-change: transform; }
.tierlabel::after { content: ""; position: absolute; left: 100%; top: 50%; width: 14px; border-top: 1.5px solid var(--cherry); }
.tierlabel b { display: block; }
.tierlabel span { color: var(--muted); }

/* ------------------------------------------------ panel */
.panel { position: relative; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--cream); border-left: 1px solid var(--line); padding: 0 26px; scroll-behavior: smooth; }
.hero { padding: 30px 0 6px; text-align: center; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--cherry); }
h1 { font-size: 38px; line-height: 1.05; text-wrap: balance; }
.lede { margin: 10px auto 0; max-width: 34ch; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0 4px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }

.sec { padding: 26px 0 4px; scroll-margin-top: 8px; }
.sec > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h2 { font-size: 24px; }
.cur { font-size: 13px; color: var(--muted); text-align: right; }
.sub { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }

.field { margin: 0 0 16px; }
.lab { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.lab output { font-weight: 500; color: var(--muted); }

.opt { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 13.5px; text-align: left; transition: border-color .15s, background .15s, transform .1s; }
.opt:hover { border-color: #d9c66f; }
.opt:active { transform: scale(.98); }
.opt.on { border-color: var(--cherry); background: #fff4f0; box-shadow: inset 0 0 0 1px var(--cherry); }
.opt small { font-weight: 500; color: var(--muted); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg .opt { text-align: center; padding: 10px 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.field .chips { margin-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 99px; }
.chip small { font-size: 11.5px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid rgba(59, 29, 23, .18); }

.shapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.shape { display: grid; justify-items: center; gap: 5px; padding: 11px 2px 8px; font-size: 11.5px; text-align: center; }
.shape svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.shape.on svg { fill: var(--blush); stroke: var(--cherry); }

.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.row b { display: block; font-weight: 700; }
.row small { display: block; font-size: 12.5px; }
.bite { flex: none; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(var(--a) 0 30%, var(--b) 30% 40%, var(--a) 40% 60%, var(--b) 60% 70%, var(--a) 70%); border: 1px solid rgba(59, 29, 23, .18); }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.sw { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 1px solid rgba(59, 29, 23, .16); transition: transform .12s; }
.sw:hover { transform: scale(1.08); }
.sw.on { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--cherry); }
.sw.custom { background: conic-gradient(#ff5a6e, #ffb02e, #ffe14d, #57d977, #3fa9ff, #b56bff, #ff5a6e); cursor: pointer; overflow: hidden; }
.sw.custom.on { background: var(--pick); }
.sw.custom input { position: absolute; inset: -6px; width: 150%; height: 150%; opacity: 0; cursor: pointer; }
.sw.scene { width: 46px; height: 46px; background: radial-gradient(circle at 50% 40%, var(--a), var(--b)); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--cherry) var(--p, 0%), var(--line) var(--p, 0%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--cherry); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; border: 2px solid var(--cherry); box-shadow: 0 2px 6px rgba(59, 29, 23, .2); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--cherry); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font-size: 18px; line-height: 1; font-weight: 600; display: grid; place-items: center; }
.stepper button:hover { border-color: var(--cherry); color: var(--cherry); }
.stepper b { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper.big button { width: 40px; height: 40px; font-size: 20px; }
.stepper.big b { font-family: var(--serif); font-weight: 400; font-size: 28px; min-width: 44px; }

.tiertabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ttab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px 8px 9px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; }
.ttab i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 1px solid rgba(59, 29, 23, .18); }
.ttab small { font-weight: 500; color: var(--muted); }
.ttab.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.ttab.on small { color: #d9c9b6; }

.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.look { display: grid; gap: 8px; padding: 12px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); text-align: left; transition: transform .15s, border-color .15s; }
.look:hover { transform: translateY(-2px); border-color: var(--cherry); }
.look b { font-size: 13px; }
.dots { display: flex; }
.dots i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid var(--card); box-shadow: 0 0 0 1px rgba(59, 29, 23, .12); }
.dots i + i { margin-left: -7px; }

.drows { display: grid; gap: 6px; margin-bottom: 16px; }
.drow { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.drow.on { border-color: var(--cherry); background: #fff4f0; }
.drow .ico { font-size: 20px; width: 26px; text-align: center; }
.drow .nm { flex: 1; min-width: 0; }
.drow .nm b { display: block; font-size: 13.5px; }
.drow .nm small { color: var(--muted); font-size: 12px; }

.ghost { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--ink); font-weight: 700; font-size: 13px; margin-bottom: 16px; transition: background .15s, color .15s; }
.ghost:hover { background: var(--ink); color: var(--cream); }
.ghost.cherry { border-color: var(--cherry); color: var(--cherry); }
.ghost.cherry:hover { background: var(--cherry); color: #fff; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
#sprinkle-more { margin: -6px 0 16px; }

.text { width: 100%; height: 46px; padding: 0 14px; margin-bottom: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; }
.text:focus { outline: none; border-color: var(--cherry); }

.ludi-btn { width: 100%; display: grid; gap: 2px; padding: 16px 18px; border-radius: 16px; text-align: left; background: #1c1420; color: #fff7ea; position: relative; overflow: hidden; transition: transform .15s; }
.ludi-btn:hover { transform: translateY(-2px); }
.ludi-btn b { font-family: var(--serif); font-weight: 400; font-size: 22px; background: linear-gradient(90deg, #ff4fa3, #27d3ff, #b6f23c, #ffe14d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ludi-btn span { font-size: 12.5px; opacity: .75; }
.ludi-btn.on { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px #ff4fa3; }
.ludi-btn.on::after { content: "ON"; position: absolute; right: 16px; top: 16px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #b6f23c; }

.foot { padding: 26px 0 20px; font-size: 12px; color: var(--muted); }
.foot p { margin: 0 0 6px; }

.bar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 -26px; padding: 12px 26px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(255, 253, 243, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.price b { display: block; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.price span { font-size: 12px; color: var(--muted); }
.cta { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 24px; border-radius: 99px; background: var(--cherry); color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s; }
.cta:hover { background: var(--cherry-d); transform: translateY(-1px); }

/* ------------------------------------------------ order sheet */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(560px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(40, 20, 16, .5); backdrop-filter: blur(6px); }
.sheet { position: relative; background: var(--cream); border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.sheet .x { position: absolute; right: 12px; top: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 253, 243, .9); font-size: 22px; line-height: 1; }
.shot { display: block; width: 100%; height: 220px; object-fit: cover; object-position: 50% 40%; flex: none; }
.sheet-body { padding: 20px 22px 22px; overflow-y: auto; }
.sheet h2 { font-size: 30px; margin-bottom: 12px; }
.spec { margin: 0 0 14px; display: grid; gap: 7px; font-size: 13.5px; }
.spec div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; font-weight: 500; }
.lines { list-style: none; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 5px; font-size: 13.5px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; }
.lines b { font-weight: 600; font-variant-numeric: tabular-nums; }
.sum { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sum b { font-family: var(--serif); font-weight: 400; font-size: 30px; color: var(--ink); }
.fine { margin: 8px 0 16px; font-size: 12.5px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .cta { flex: 1 1 100%; }
.actions .ghost { flex: 1; margin: 0; height: 44px; }

.toast { position: fixed; left: 50%; bottom: 90px; z-index: 50; transform: translate(-50%, 16px); padding: 10px 18px; border-radius: 99px; background: var(--ink); color: var(--cream); font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------ small screens */
@media (max-width: 880px) {
  html, body { height: auto; }
  .app { display: block; height: auto; }
  .stage { position: sticky; top: 0; z-index: 5; height: var(--stage-h); border-bottom: 1px solid var(--line); }
  .panel { height: auto; overflow: visible; border-left: 0; padding: 0 16px 84px; }
  .sec { scroll-margin-top: calc(var(--stage-h) + 8px); }
  .bar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding-left: 16px; padding-right: 16px; }
  .brand { left: 12px; top: 10px; }
  .brand img { width: 36px; height: 36px; }
  .brand b { font-size: 16px; }
  .stage-top { right: 10px; top: 10px; }
  .pill { height: 34px; padding: 0 10px; }
  .pill span { display: none; }
  .hint { display: none; }
  .views { bottom: 10px; left: 10px; transform: none; }
  .views button { height: 30px; padding: 0 11px; font-size: 12px; }
  .tools { right: 10px; bottom: 10px; gap: 6px; }
  .tools button { width: 34px; height: 34px; }
  .ludi { top: 56px; }
  .hero { padding-top: 22px; }
  h1 { font-size: 32px; }
  .tierlabel { font-size: 11px; padding: 4px 8px; }
  .tierlabel span { display: none; }
  .toast { bottom: 84px; }
}
@media (max-width: 380px) {
  .looks { grid-template-columns: repeat(2, 1fr); }
  .seg .opt { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .panel { scroll-behavior: auto; }
}
