:root {
  --ink: #2b2140;
  --ink-soft: #6b5f86;
  --paper: #fffdf7;
  --sun: #ffc93c;
  --coral: #ff6f61;
  --mint: #2ec4b6;
  --grape: #8e6cf0;
  --sky: #4cc9f0;
  --danger: #ff4d6d;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(43, 33, 64, .12), 0 18px 40px rgba(43, 33, 64, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 70% -10%, #fff1c9 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #d8f6f2 0%, transparent 55%),
              linear-gradient(160deg, #fef6ff 0%, #e6f4ff 100%);
}
canvas#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
h1, h2, .btn, .seg button { font-family: Fredoka, Nunito, sans-serif; }

.topbar, .bottombar { position: fixed; left: 16px; right: 16px; display: flex; gap: 12px; align-items: center; pointer-events: none; }
.topbar { top: 16px; }
.bottombar { bottom: 16px; }
.topbar > *, .bottombar > * { pointer-events: auto; }
.spacer { flex: 1; }

.brand { display: flex; align-items: center; gap: 10px; background: var(--paper); padding: 10px 18px 10px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.brand .dot { width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--coral), var(--sun), var(--mint), var(--sky), var(--grape), var(--coral)); display: grid; place-items: center; }
.brand .dot::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); }
.brand h1 { font-size: 19px; margin: 0; line-height: 1.05; }
.brand small { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }

.seg { display: flex; background: var(--paper); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.seg button:hover { transform: translateY(-1px); }
.seg button.on { background: var(--ink); color: #fff; }

.panel { position: fixed; top: 92px; bottom: 96px; width: 272px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; overflow-y: auto; }
.panel.left { left: 16px; }
.panel.right { right: 16px; width: 290px; display: flex; flex-direction: column; }
.panel h2 { font-size: 16px; margin: 4px 4px 12px; }

.card { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; padding: 10px; margin-bottom: 10px; border-radius: 18px; border: 3px solid transparent; background: #fff; cursor: grab; user-select: none; box-shadow: 0 3px 0 rgba(43, 33, 64, .08); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px) rotate(-.5deg); border-color: var(--c); }
.card:active { cursor: grabbing; }
.card img { width: 76px; height: 76px; object-fit: contain; border-radius: 12px; background: #fff; }
.card b { display: block; font-size: 14px; line-height: 1.2; }
.card span { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.card .price { color: var(--c); font-family: Fredoka, sans-serif; font-size: 15px; margin-top: 4px; }

.room { margin-top: 18px; padding: 12px; border-radius: 18px; background: #f6f1ff; }
.room label { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; margin: 6px 2px; }
.room input[type=range] { width: 100%; accent-color: var(--grape); }
.room .check { justify-content: flex-start; gap: 8px; align-items: center; }
.hint { font-size: 12px; color: var(--ink-soft); margin: 12px 4px 0; line-height: 1.5; }
kbd { font-family: Fredoka, sans-serif; background: #efeaf8; border-radius: 6px; padding: 1px 6px; font-size: 11px; }

#cart { flex: 1; overflow-y: auto; }
.line { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 2px dashed #efe9f7; }
.line img { width: 52px; height: 52px; object-fit: contain; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 rgba(43, 33, 64, .08); }
.line b { display: block; font-size: 13px; line-height: 1.2; }
.line a { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.line .variant { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.line .right { text-align: right; }
.line .amount { font-family: Fredoka, sans-serif; font-size: 15px; display: block; margin-bottom: 6px; }
.qty { display: inline-flex; align-items: center; gap: 2px; background: #f3eefb; border-radius: 999px; padding: 2px; }
.qty button { border: 0; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; }
.qty span { min-width: 22px; text-align: center; font-weight: 800; font-size: 13px; }
.empty { color: var(--ink-soft); font-weight: 700; font-size: 14px; text-align: center; padding: 30px 10px; }
.subtotal { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 4px 12px; font-weight: 800; }
.subtotal b { font-family: Fredoka, sans-serif; font-size: 24px; }

.stats { display: flex; gap: 6px; background: var(--paper); border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.stat { padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.stat em { font-style: normal; font-family: Fredoka, sans-serif; font-size: 17px; margin-right: 4px; }
.stat:nth-child(1) { background: #fff4d1; } .stat:nth-child(2) { background: #dcf7f4; }
.stat.warn { background: #ffe1e6; color: #b3123a; }

.btn { border: 0; border-radius: 999px; padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); transition: transform .15s; }
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--sun); }
.btn.wide { width: 100%; }

.toolbar { position: fixed; transform: translate(-50%, -100%); display: none; gap: 4px; align-items: center; background: var(--ink); color: #fff; padding: 6px 6px 6px 14px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap; font-weight: 800; font-size: 13px; }
.toolbar.show { display: flex; }
.toolbar button { border: 0; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; cursor: pointer; }
.toolbar button:hover { background: rgba(255,255,255,.28); }
.toolbar .name { margin-right: 6px; }

.loading { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); background: var(--paper); border-radius: 999px; padding: 10px 16px; box-shadow: var(--shadow); font-weight: 800; font-size: 13px; display: none; }
.loading.show { display: block; }
.error { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); max-width: 460px; background: #fff; border: 3px solid var(--danger); border-radius: 18px; padding: 14px 16px; font-weight: 700; display: none; }
.error.show { display: block; }

.panel.right[hidden] { display: none; }
.panel.right h2 { display: flex; justify-content: space-between; align-items: center; }
.close { border: 0; width: 28px; height: 28px; border-radius: 50%; background: #f3eefb; color: var(--ink); cursor: pointer; font-size: 13px; }
.cart-toggle { padding: 10px 16px; }
.cart-toggle.on { background: var(--ink); color: #fff; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 12px; }
#audioSeg button { font-size: 16px; padding: 6px 10px; filter: grayscale(1); opacity: .45; }
#audioSeg button.on { background: #f3eefb; color: var(--ink); filter: none; opacity: 1; }
@media (max-width: 760px) {
  .panel.left { top: auto; bottom: 84px; right: 16px; width: auto; height: 210px; }
  .brand small, .stat:nth-child(2) { display: none; }
  .topbar { flex-wrap: wrap; }
}

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.seg button, .btn, .stat { display: inline-flex; align-items: center; gap: 7px; }
.btn.wide { justify-content: center; }
.toolbar button, .close, .qty button { display: inline-grid; place-items: center; padding: 0; }
.toolbar .icon { width: 16px; height: 16px; }
.close .icon, .qty .icon { width: 14px; height: 14px; }
.line a { display: inline-flex; align-items: center; gap: 3px; }
.line a .icon { width: 12px; height: 12px; }
#audioSeg button { filter: none; color: var(--ink-soft); }
#audioSeg button .icon { width: 19px; height: 19px; }
.stat.warn .icon { width: 16px; height: 16px; }

[hidden] { display: none !important; }

.ar-btn { margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 5px 10px 5px 8px;
  background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--ink); font: 700 12px Nunito, sans-serif; cursor: pointer; transition: background .15s; }
.ar-btn:hover { background: color-mix(in srgb, var(--c) 30%, #fff); }
.ar-btn .icon { width: 14px; height: 14px; }

.ar-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(43, 33, 64, .45); backdrop-filter: blur(4px); }
.ar-sheet { position: relative; width: min(920px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-columns: 1.3fr 1fr; overflow: hidden;
  background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); }
.ar-sheet model-viewer { width: 100%; height: min(560px, 70vh); background: radial-gradient(circle at 50% 40%, #fff 0%, #f1ecfb 70%); --poster-color: transparent; }
.ar-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 34px; height: 34px; }
.ar-launch { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); }
.ar-info { padding: 28px 26px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.ar-info small { font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.ar-info h2 { margin: 0; font-size: 26px; line-height: 1.1; }
.ar-info p { margin: 0; color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.ar-qr { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 18px; background: #f6f1ff; }
.ar-qr img { width: 120px; height: 120px; border-radius: 12px; background: #fff; }
.ar-qr p { display: flex; gap: 8px; font-size: 13px; color: var(--ink); }
.ar-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.ar-actions .btn { text-decoration: none; }
.ar-link { color: var(--ink-soft); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.ar-link .icon { width: 13px; height: 13px; }
@media (max-width: 760px) {
  .ar-sheet { grid-template-columns: 1fr; }
  .ar-sheet model-viewer { height: 46vh; }
}
