/* BL Bunker. Colours come from the room scheme (Art.applyScheme sets the --vars on <html>). */
:root {
  --wall: #f4cfae; --wall-dark: #e7b48c; --trim: #fff4e6; --floor: #b5835a; --floor-line: #9c6c46;
  --rug: #d9644a; --rug2: #f2a65a; --wood: #8a5a3b; --wood-dark: #6a4229; --fabric: #e9876b;
  --accent: #d0563c; --on-accent: #fff; --ui: #fff8f0; --ink: #3b2a20; --sub: #8a705e;
  --card: color-mix(in srgb, var(--wall) 22%, var(--ui));
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --r: 16px;
  --ease: cubic-bezier(.65, 0, .25, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--wall); color: var(--ink);
  font-family: Fredoka, ui-rounded, system-ui, sans-serif; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- the room ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; }
#room { width: 100%; height: 100%; display: block; transform-origin: 0 0;
  transition: transform .75s var(--ease), filter .6s ease; will-change: transform; user-select: none; }
body.zoomed #room { filter: blur(2.5px) brightness(.97); }
.hot { cursor: pointer; transition: filter .2s; }
.hot:hover, .hot:focus-visible { filter: brightness(1.07) drop-shadow(0 0 6px rgba(255, 255, 255, .6)); outline: none; }
#labels { transition: opacity .3s; }
#labels .lbl { animation: bob 3.2s ease-in-out infinite; }
#labels > g:nth-child(2) .lbl { animation-delay: -.8s; } #labels > g:nth-child(3) .lbl { animation-delay: -1.6s; } #labels > g:nth-child(4) .lbl { animation-delay: -2.4s; }
@keyframes bob { 50% { transform: translateY(-3px); } }
body.zoomed #labels, body.nolabels #labels { opacity: 0; }
#lampGlow, #dim { transition: opacity .5s; }
.paddle.pending { opacity: .75; }

#stage.wide { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
#stage.wide::-webkit-scrollbar { display: none; }
#stage { transition: opacity .2s ease; }
#stage.fade { opacity: 0; }
body.decorating #room { transition: transform .4s var(--ease); }
.dslot { cursor: pointer; }
.dslot rect[stroke-dasharray] { animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -24; } }

.pill { border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 600; font-size: 15px; background: rgba(0, 0, 0, .42); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pill.main { background: var(--accent); color: var(--on-accent); }
.pill[hidden] { display: none; }
#nav, #decobar { position: fixed; left: 0; right: 0; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 10px; padding: 0 12px; z-index: 20; transition: opacity .3s; }
#decobar { align-items: center; }
#decobar span { color: #fff; background: rgba(0, 0, 0, .42); padding: 10px 14px; border-radius: 999px; font-size: 14px; }
#decobar[hidden] { display: none; }
body.zoomed #nav, body.decorating #nav { opacity: 0; pointer-events: none; }
#visitbar { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 21; background: var(--accent); color: var(--on-accent); padding: 6px 6px 6px 14px; border-radius: 999px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
#visitbar[hidden] { display: none; }
#visitbar button { border: 0; border-radius: 999px; padding: 5px 12px; background: rgba(255, 255, 255, .9); color: #222; font-weight: 600; }
body.zoomed #visitbar { opacity: 0; pointer-events: none; }

#deco { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 48vh; overflow: auto; background: var(--ui); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); animation: up .3s var(--ease); max-width: 680px; margin: 0 auto; }
#deco[hidden] { display: none; }
.dhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dhead b { font-size: 18px; font-weight: 600; }
.dhead .pill { background: var(--card); color: var(--ink); padding: 7px 14px; font-size: 14px; }
#deco h3 { margin: 14px 0 8px; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.opt { border: 0; background: var(--card); border-radius: 14px; padding: 6px 4px 6px; display: grid; gap: 2px; justify-items: center; font-size: 12px; box-shadow: inset 0 0 0 2px transparent; }
.opt.on { box-shadow: inset 0 0 0 3px var(--accent); }
.opt svg { width: 100%; height: 62px; }
.opt .none { height: 62px; display: grid; place-items: center; color: var(--sub); font-size: 13px; }
.swatch.auto { position: relative; }
.swatch.auto::after { content: "A"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.schemes.mini { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.schemes.mini .pv { height: 52px; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.chars .item { position: relative; }
.charpick { width: 100%; aspect-ratio: 2 / 3; border: 0; border-radius: 12px; padding: 4px; background: repeating-conic-gradient(#0001 0 25%, transparent 0 50%) 0 0 / 14px 14px, var(--card); box-shadow: inset 0 0 0 2px transparent; }
.charpick.on { box-shadow: inset 0 0 0 3px var(--accent); }
.charpick img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.charpick.add { font-size: 30px; color: var(--sub); border: 2px dashed var(--line); background: none; }
.thumb { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.note { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: var(--r); padding: 12px; margin-top: 10px; }
.note svg { width: 48px; height: 52px; flex: none; }
.note p { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .pin { width: 48px; height: 52px; flex: none; background: #fff4b0; border-radius: 3px; transform: rotate(-4deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.x.rel { position: static; flex: none; }
.gifts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.gift { border: 0; background: var(--card); border-radius: 14px; padding: 6px 2px; display: grid; justify-items: center; font-size: 11px; box-shadow: inset 0 0 0 2px transparent; }
.gift.on { box-shadow: inset 0 0 0 3px var(--accent); }
.gift svg { width: 44px; height: 46px; }
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--ui); font: inherit; font-size: 16px; color: inherit; resize: vertical; outline: none; }
textarea:focus { border-color: var(--accent); }

#brand { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 16px; padding: 6px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, .28); color: #fff; font-size: 15px; letter-spacing: .3px; pointer-events: none; transition: opacity .3s; }
body.zoomed #brand { opacity: 0; }

/* ---------- views (whoosh target) ---------- */
.view { position: fixed; inset: 0; display: flex; flex-direction: column; opacity: 0; transform: scale(.96);
  transition: opacity .3s ease, transform .35s var(--ease); pointer-events: none;
  background: color-mix(in srgb, var(--ui) 86%, transparent); }
.view.show { opacity: 1; transform: none; pointer-events: auto; }
.view header { display: flex; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 16px 8px; max-width: 680px; width: 100%; margin: 0 auto; }
.view h2 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); display: grid; place-items: center; flex: none;
  box-shadow: 0 1px 0 var(--line); }
.view .body { flex: 1; overflow: auto; padding: 4px 16px calc(40px + env(safe-area-inset-bottom)); max-width: 680px; width: 100%; margin: 0 auto; }
.body.swap { animation: swap .32s var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateX(14px); } }

h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--sub); font-weight: 600; margin: 22px 0 10px; }
.sub { color: var(--sub); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.btn { border: 0; border-radius: 999px; padding: 11px 18px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.big { width: 100%; padding: 15px; font-size: 17px; }
.btn.danger { background: transparent; color: #c0392b; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn:disabled { opacity: .5; }
.btn:active { transform: scale(.97); }

input[type=text] { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--ui); font-size: 16px; outline: none; }
input[type=text]:focus { border-color: var(--accent); }
.title-input { font-size: 20px; font-weight: 600; background: transparent; border-color: transparent; padding: 8px 10px; }
.title-input:hover { border-color: var(--line); }

.card { background: var(--card); border-radius: var(--r); padding: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.chip.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .15); flex: none; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12); }
.swatch.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap; }
.badge.soft { background: var(--line); color: var(--ink); }

/* posters */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.slot { border: 0; background: var(--card); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; justify-items: center; box-shadow: inset 0 0 0 2px transparent; }
.slot.on { box-shadow: inset 0 0 0 3px var(--accent); }
.slot svg { width: 100%; max-width: 150px; aspect-ratio: 3 / 4; border-radius: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.lib .item { position: relative; border: 0; padding: 0; background: none; display: grid; gap: 4px; font-size: 12px; text-align: center; color: var(--sub); }
.lib .item svg { width: 100%; aspect-ratio: 3 / 4; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.lib .item.on svg { outline: 3px solid var(--accent); outline-offset: 2px; }
.lib .add { aspect-ratio: 3 / 4; border-radius: 6px; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 30px; color: var(--sub); }
.x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #c0392b; color: #fff; font-size: 14px; line-height: 1; }

/* schemes */
.schemes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.scheme { border: 0; padding: 0; border-radius: var(--r); overflow: hidden; background: var(--card); text-align: left; box-shadow: inset 0 0 0 2px transparent; }
.scheme.on { box-shadow: 0 0 0 3px var(--accent); }
.scheme .pv { height: 74px; position: relative; }
.scheme .pv i { position: absolute; display: block; }
.scheme span { display: block; padding: 8px 12px; font-weight: 600; }

/* bakery */
.cakes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cakecard { border: 0; background: var(--card); border-radius: var(--r); padding: 10px 10px 12px; text-align: left; display: grid; gap: 4px; }
.cakecard svg { width: 100%; aspect-ratio: 300 / 340; }
.cakecard b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 30px 10px; color: var(--sub); }
.bigcake { width: 100%; max-width: 420px; display: block; margin: 0 auto; aspect-ratio: 300 / 340; }
.bigcake .paddle { cursor: pointer; }
.code { font-size: 34px; letter-spacing: 6px; font-weight: 700; text-align: center; padding: 6px 0; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 3px rgba(46, 204, 113, .25); }
.live.off i { background: #aaa; box-shadow: none; }
.stack > * + * { margin-top: 10px; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--ui); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .3s var(--ease); max-height: 90vh; overflow: auto; }
.sheet h4 { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.paddle-big { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; display: block; margin: 4px auto 14px; border: 5px solid #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .2); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #222; color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; opacity: 0; transition: .3s; z-index: 99; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#update { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 60; background: #222; color: #fff; padding: 6px 6px 6px 14px; border-radius: 999px; font-size: 14px; }
#update button { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 5px 12px; margin-left: 6px; }

@media (prefers-reduced-motion: reduce) { #room, .view { transition-duration: .01s; } #labels .lbl { animation: none; } }
