:root {
  --ink: #2b2140;
  --muted: #6d6383;
  --bg: #fff7ea;
  --card: #ffffff;
  --accent: #ff5c8a;
  --accent-dark: #d9386a;
  --good: #2fb36b;
  --warn: #ffb020;
  --bad: #e5484d;
  --radius: 16px;
  --shadow: 0 3px 0 rgba(43, 33, 64, 0.12), 0 8px 24px rgba(43, 33, 64, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg) radial-gradient(circle at 20% 0%, #ffe3ef 0, transparent 40%) fixed;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.15; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.6em; }
small { color: var(--muted); }
.loading { padding: 2rem; text-align: center; }

button {
  font: inherit; color: inherit; cursor: pointer;
  border: 2px solid var(--ink); background: #fff; border-radius: 12px;
  padding: 0.45em 0.9em; box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.05s;
}
button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.big:disabled { background: #e6e0ee; color: var(--muted); border-color: #b9aecb; box-shadow: none; opacity: 1; font-weight: 600; font-size: 0.95rem; }
button.on { background: #ffe066; }
button.big { background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; padding: 0.6em 1.2em; }
button.big:hover:not(:disabled) { background: var(--accent-dark); }
button.danger { color: var(--bad); }
input, select {
  font: inherit; padding: 0.45em 0.6em; border: 2px solid #cfc6dd; border-radius: 10px; background: #fff; color: inherit;
}
input:focus, select:focus { outline: 3px solid #ffd1df; border-color: var(--accent); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ---------- flash message ---------- */
.flash {
  position: fixed; left: 50%; top: -80px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 0.7em 1.2em; border-radius: 12px; font-weight: 600;
  transition: top 0.25s; max-width: 90vw;
}
.flash.show { top: 12px; }
.flash.ok { background: var(--good); }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.6rem 1rem; background: var(--ink); color: #fff;
}
.top .brand { font-weight: 800; font-size: 1.3rem; cursor: pointer; letter-spacing: 0.02em; }
.top nav { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.top nav button { background: transparent; color: #fff; border-color: #fff; box-shadow: none; padding: 0.3em 0.7em; }
.top nav button.on { background: #fff; color: var(--ink); }
.top .me { font-weight: 700; margin: 0 0.4rem; }
main { max-width: 1150px; margin: 0 auto; padding: 1rem; }

/* ---------- login ---------- */
.login { max-width: 560px; margin: 8vh auto; text-align: center; padding: 2rem; }
.title { font-size: clamp(2rem, 7vw, 3.2rem); margin-bottom: 0.1em; }
.title span { display: inline-block; animation: wobble 2.4s ease-in-out infinite; }
.sub { color: var(--muted); font-size: 1.1rem; }
.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 1rem 0; }
.who-btn { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.7rem; font-weight: 700; }
.who-btn span { font-size: 2.6rem; }
.pin { display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.pin input { font-size: 1.6rem; text-align: center; letter-spacing: 0.4em; width: 10em; }

/* ---------- home ---------- */
.status { font-size: 1.15rem; padding: 0.8rem 1rem; border-radius: var(--radius); background: #e8f8ee; margin-bottom: 1rem; }
.status.bad { background: #ffe3e3; }
.call { background: #fff2b3; text-align: center; }
.warn { background: #fff0d1; border: 2px dashed var(--warn); border-radius: 12px; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }
.alert { background: #ffe3e3; border: 2px solid var(--bad); }
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.target { text-align: center; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.target .av { font-size: 3rem; }
.target .nm { font-weight: 800; font-size: 1.15rem; }
.target button { margin-top: 0.4rem; width: 100%; }
.tiny { font-size: 0.8rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.board { width: 100%; border-collapse: collapse; }
.board td { padding: 0.35rem 0.3rem; border-bottom: 1px solid #f0eaf6; }
.board td.n { font-weight: 800; font-size: 1.2rem; text-align: right; }
.events { list-style: none; padding: 0; margin: 0; max-height: 340px; overflow: auto; }
.events li { padding: 0.4rem 0; border-bottom: 1px solid #f0eaf6; }
.events .when { color: var(--muted); font-size: 0.8rem; display: block; }
.rules summary { font-weight: 800; cursor: pointer; font-size: 1.1rem; }
.rules ul { padding-left: 1.2rem; line-height: 1.5; }

/* ---------- room ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.room {
  position: relative; width: 100%; container-type: inline-size;
  border: 6px solid #5b4a78; border-radius: 10px; overflow: hidden; cursor: pointer; user-select: none;
  background-color: var(--floor);
  /* faint squares to help place furniture, on top of the floor texture */
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px),
    var(--tex, none);
  background-size: 10% 12.5%, 10% 12.5%, auto;
  box-shadow: var(--shadow);
}
.room .wall-top { position: absolute; inset: 0 0 auto 0; height: 4px; background: rgba(0, 0, 0, 0.08); pointer-events: none; }
.furn {
  position: absolute; padding: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--cat); border: 2px solid rgba(43, 33, 64, 0.55); border-radius: 8px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.15);
  overflow: hidden; transition: transform 0.1s, box-shadow 0.1s;
  background-clip: content-box;
}
.furn:hover { transform: scale(1.03); z-index: 2; }
.furn.sel { outline: 4px solid var(--accent); outline-offset: -2px; z-index: 3; }
.furn .f-emoji { line-height: 1; filter: drop-shadow(0 2px 1px rgba(0,0,0,0.2)); }
.furn .f-label { font-size: max(8px, 1.25cqw); font-weight: 700; text-align: center; line-height: 1.05; margin-top: 0.15em; }
.furn .badge {
  position: absolute; top: 3px; right: 3px; background: var(--ink); color: #fff;
  font-size: max(9px, 1.3cqw); border-radius: 999px; padding: 0 0.45em; font-weight: 800;
}
.furn .badge.searched { background: rgba(255, 255, 255, 0.9); color: inherit; }
.room.raid .furn { cursor: zoom-in; }
.ghost { position: absolute; background: rgba(47, 179, 107, 0.35); border: 3px dashed var(--good); border-radius: 8px; pointer-events: none; z-index: 5; }
.ghost.bad { background: rgba(229, 72, 77, 0.3); border-color: var(--bad); }
.hint { color: var(--muted); margin: 0.5rem 0 1rem; }

.side .tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; }
.side .tabs button { padding: 0.25em 0.6em; font-size: 0.9rem; }
.cat-list { display: grid; gap: 0.4rem; max-height: 52vh; overflow: auto; padding: 2px; }
.cat-item { display: flex; gap: 0.6rem; align-items: center; text-align: left; background: var(--cat); }
.cat-item .e { font-size: 1.8rem; }
.cat-item.on { outline: 3px solid var(--accent); }
.spot { border-top: 1px solid #f0eaf6; padding: 0.5rem 0; display: grid; gap: 0.3rem; }
.spot .in { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.spot select { width: 100%; }
.fits { font-size: 0.8rem; color: var(--muted); }
.chip { display: inline-block; background: #f3eefb; border-radius: 999px; padding: 0.1em 0.6em; margin: 0.15em; }
.chip i { color: var(--muted); font-style: normal; font-size: 0.85em; }

/* ---------- treasure picker ---------- */
.picker { max-width: 900px; margin: 0 auto; }
.picked { display: grid; gap: 0.4rem; margin: 0.8rem 0; }
.pick { display: flex; gap: 0.5rem; align-items: center; background: #fff7d6; border-radius: 12px; padding: 0.4rem 0.6rem; }
.pick .e { font-size: 1.8rem; }
.pick input { flex: 1; min-width: 0; }
.pick.empty { justify-content: center; color: var(--muted); background: #f6f2fb; border: 2px dashed #d8cfe8; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.tbtn { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.5rem 0.3rem; }
.tbtn .e { font-size: 2.2rem; }

/* ---------- raid ---------- */
.raid-top {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between;
  background: #1d1530; color: #fff; padding: 0.8rem 1rem;
}
.raid-top .who { display: block; margin: 0; font-size: 1.1rem; }
.raid-stats { display: flex; gap: 1rem; font-size: 1.2rem; flex-wrap: wrap; }
.raid-wrap .room { filter: brightness(0.92) saturate(0.9); }
.spot-btn { display: block; width: 100%; text-align: left; margin-bottom: 0.4rem; }
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 0.25rem 0; }

/* ---------- overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(29, 21, 48, 0.6); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fade 0.15s;
}
.pop { background: #fff; border-radius: 24px; padding: 1.6rem 2rem; text-align: center; max-width: 420px; box-shadow: var(--shadow); animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1); }
.pop-icon { font-size: 5rem; line-height: 1.1; }
.overlay.boom .pop { animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1), shake 0.5s 0.3s; background: #fff1e6; }
.overlay.boom { background: rgba(255, 120, 40, 0.55); }
.overlay.caught .pop { animation: pop 0.35s, shake 0.4s 0.3s; }
.overlay.win .pop { background: #fffbe0; }

@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-12px) rotate(-2deg); } 40%, 80% { transform: translateX(12px) rotate(2deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* ---------- settings ---------- */
.settings label { display: grid; grid-template-columns: 1fr 90px; gap: 0.8rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid #f0eaf6; }
.settings label.check { grid-template-columns: 1fr auto; }

/* ---------- gallery ---------- */
.gallery h2 { margin-top: 1.4rem; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.8rem; }
.g-card { margin: 0; }
.g-card .mini { position: relative; width: 100%; aspect-ratio: 10 / 8; }
.g-card .room { cursor: default; border-width: 4px; }
.g-card ul { padding-left: 1.1rem; margin: 0.5rem 0 0; font-size: 0.9rem; }
.g-treasure { display: flex; align-items: center; gap: 0.6rem; }
.g-treasure .e { font-size: 2.4rem; }
.dots { letter-spacing: 0.1em; color: var(--accent); }
.board td:first-child { width: 2em; }

/* ---------- floor-plan drawings ---------- */
.furn.art { background: none; border: none; box-shadow: none; padding: 0; overflow: visible; }
.furn.art .art { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 3px 2px rgba(43, 33, 64, 0.3)); }
.furn.art .f-label {
  position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); white-space: nowrap;
  background: rgba(255, 255, 255, 0.88); border-radius: 6px; padding: 0 0.35em; margin: 0;
  opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.furn.art:hover .f-label, .furn.art.sel .f-label, .room.labels .furn.art .f-label { opacity: 1; }
.furn.art.sel { outline: 4px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.thumb { display: inline-flex; width: 48px; height: 48px; flex: none; align-items: center; justify-content: center; font-size: 1.8rem; }
.thumb svg { width: 100%; height: 100%; }
.with-thumb { display: flex; align-items: center; gap: 0.4rem; }
.cat-item { background: #fff; border-left: 8px solid var(--cat); }

/* ---------- coins, deals, raids ---------- */
.coins { color: #ffd166; }
.status.row { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.deal { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.5rem 0; border-top: 1px solid #f0eaf6; }
.deal.in { background: #fff6d6; border-radius: 10px; padding: 0.6rem; border: 2px solid #ffd166; margin-bottom: 0.4rem; }
.price { width: 5em; }
.stuck { margin: 0 0 1rem; }
.board td.n { white-space: nowrap; }
.where { list-style: none; padding: 0; margin: 0; }
.where li { padding: 0.25rem 0.3rem; border-radius: 6px; cursor: pointer; }
.where li:hover { background: #f6f2fb; }
.furn .badge.hidden-things { background: rgba(255, 255, 255, 0.92); color: inherit; border: 2px solid var(--ink); letter-spacing: 0.05em; }
.set-group { margin: 1rem 0 0.2rem; }
.overlay.monster .pop { background: #f3e8ff; }

/* ---------- monster mini game ---------- */
.monster-pop { max-width: 460px; width: 100%; user-select: none; -webkit-user-select: none; }
.mg-stats { display: flex; justify-content: space-between; font-size: 1.2rem; margin-bottom: 0.6rem; }
.mg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; touch-action: manipulation; }
.mg-hole {
  position: relative; aspect-ratio: 1; padding: 0; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 70%, #3d2b1f 0 45%, #7f5539 46% 60%, #b08968 61%);
  box-shadow: inset 0 6px 10px rgba(0,0,0,0.35); border: 3px solid var(--ink);
}
.mg-hole .mg-monster { position: absolute; inset: 8% 10% 0; animation: popup 0.15s ease-out; }
.mg-hole .mg-monster svg { width: 100%; height: 100%; }
.mg-hole.bonk { background: radial-gradient(circle, #ffe066 0 40%, #ff922b 41%); }
.mg-hole.bonk .mg-monster { transform: scale(0.8) rotate(-10deg); }
.mg-hole.miss { box-shadow: inset 0 0 0 6px rgba(229,72,77,0.6); }
.mg-msg { font-size: 1.3rem; font-weight: 800; margin-top: 0.8rem; min-height: 1.6em; }
@keyframes popup { from { transform: translateY(70%); } to { transform: translateY(0); } }

/* ---------- choosing your face ---------- */
.top .me { background: transparent; color: #fff; border: 2px dashed rgba(255,255,255,0.5); box-shadow: none; font-weight: 700; }
.avatar-pop { max-width: 520px; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 0.6rem 0 1rem; }
.avatars button { font-size: 1.9rem; padding: 0.15em; box-shadow: none; border-color: #e3dcef; }
.avatars button.on { background: #ffe066; border-color: var(--ink); }
@media (max-width: 500px) { .avatars { grid-template-columns: repeat(6, 1fr); } }

/* ---------- outline on the furniture you're hiding things in ---------- */
.room.edit:has(.furn.sel) .furn:not(.sel) { opacity: 0.45; filter: grayscale(0.4); }
.room.edit .furn:hover { outline: 3px dashed rgba(255, 92, 138, 0.8); outline-offset: 2px; border-radius: 6px; }
.room .furn.sel {
  outline: 5px solid var(--accent); outline-offset: 3px; border-radius: 8px; z-index: 4;
  box-shadow: 0 0 0 9px rgba(255, 92, 138, 0.25), 0 0 26px 8px rgba(255, 92, 138, 0.55);
  animation: glow 1.4s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: 0 0 0 5px rgba(255, 92, 138, 0.15), 0 0 14px 4px rgba(255, 92, 138, 0.35); } }

/* ---------- mini games: shared ---------- */
.monster-pop { max-width: 480px; width: 100%; user-select: none; -webkit-user-select: none; padding: 1.2rem 1.2rem 1.4rem; }
.mg-area { touch-action: none; }
.mg-count { font-size: 2.6rem; }
.mg-foot { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.monster-pop svg { display: block; }

/* Monster says */
.says { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; aspect-ratio: 1; max-width: 340px; margin: 0 auto; }
.says-pad { background: var(--c); opacity: 0.55; border-radius: 22px; border: 4px solid var(--ink); box-shadow: none; }
.says-pad.p0 { border-top-left-radius: 120px; } .says-pad.p1 { border-top-right-radius: 120px; }
.says-pad.p2 { border-bottom-left-radius: 120px; } .says-pad.p3 { border-bottom-right-radius: 120px; }
.says-pad.lit { opacity: 1; filter: brightness(1.25); transform: scale(1.04); box-shadow: 0 0 24px var(--c); }
.says-monster { position: absolute; left: 50%; top: 50%; width: 30%; transform: translate(-50%, -50%); pointer-events: none; background: #fff; border-radius: 50%; padding: 6%; border: 4px solid var(--ink); }

/* Shoot the target */
.range { position: relative; height: 330px; border-radius: 16px; overflow: hidden; background: linear-gradient(#bde0fe, #e6f4ff 60%, #b7e4a0 60%); border: 3px solid var(--ink); }
.target-btn { position: absolute; padding: 0; border-radius: 50%; border: 3px solid var(--ink); box-shadow: none;
  background: radial-gradient(circle, #fff 0 18%, #e63946 19% 36%, #fff 37% 54%, #e63946 55% 72%, #fff 73%);
  animation: tpop 0.15s ease-out, tlife var(--life) linear forwards; }
.target-btn.drift { animation: tpop 0.15s ease-out, tlife var(--life) linear forwards, drift var(--life) ease-in-out forwards; }
.target-face { position: absolute; inset: 30%; }
.target-btn.hit { background: #ffe066; transform: scale(1.3); opacity: 0; transition: 0.25s; }
.target-btn.gone { opacity: 0; transition: 0.2s; }
@keyframes tpop { from { transform: scale(0); } }
@keyframes tlife { 80% { opacity: 1; } to { opacity: 0.35; } }
@keyframes drift { to { translate: var(--dx) 0; } }

/* Glass bridge */
.bridge { display: grid; gap: 6px; max-width: 300px; margin: 0 auto; padding: 8px; border-radius: 16px; background: linear-gradient(#1d3557, #0b132b); }
.bridge-end { text-align: center; color: #fff; font-weight: 800; padding: 4px; }
.bridge-row { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.glass { height: 40px; padding: 0; border-radius: 6px; border: 3px solid #a8dadc; box-shadow: none; background: rgba(168, 218, 220, 0.35); font-size: 1.3rem; position: relative; }
.bridge-row.next .glass { border-color: #ffe066; background: rgba(255, 224, 102, 0.35); animation: pulse 0.8s infinite; }
.glass.stood { background: rgba(168, 218, 220, 0.8); }
.glass.broken { background: repeating-linear-gradient(35deg, transparent 0 8px, rgba(255, 255, 255, 0.5) 8px 10px); border-style: dashed; opacity: 0.6; }
.glass .hopper { position: absolute; inset: -8px 30%; }
@keyframes pulse { 50% { transform: scale(1.05); } }

/* Cookie cutter */
.cookie { width: 100%; max-width: 340px; display: block; margin: 0 auto; touch-action: none; cursor: crosshair; }
.cookie.shake { animation: shake 0.3s; }

/* Memory */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card { aspect-ratio: 3 / 4; padding: 0; border-radius: 12px; box-shadow: none; position: relative; background: #9b5de5; overflow: hidden; }
.mem-card .mem-back { position: absolute; inset: 14%; }
.mem-card .mem-face { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 2.2rem; background: #fff; }
.mem-card.up .mem-face { display: flex; }
.mem-card.matched { border-color: var(--good); }
.mem-card.matched .mem-face { background: #d3f9d8; }

/* Monster maths */
.maths .sum { font-size: 2.6rem; font-weight: 900; margin: 0.5rem 0 1rem; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ans { font-size: 1.8rem; font-weight: 800; padding: 0.5em; }
.ans.wrong { background: #ffc9c9; } .ans.right { background: #b2f2bb; }

/* Which cup */
.cups { position: relative; height: 230px; }
.cup-shuffler { width: 70px; margin: 0 auto; }
.cup { position: absolute; bottom: 0; width: 30%; height: 130px; padding: 0; background: none; border: none; box-shadow: none; transition: left 400ms ease-in-out; }
.cup .gem { position: absolute; bottom: 4px; left: 0; right: 0; font-size: 2.2rem; visibility: hidden; }
.cup.has-gem .gem { visibility: visible; }
.cup .cup-body { position: absolute; inset: 0 8% 0; background: linear-gradient(90deg, #d62828, #f77f00 60%, #d62828); border: 4px solid var(--ink);
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); border-radius: 8px 8px 4px 4px; transition: transform 0.3s; }
.cup.lift .cup-body { transform: translateY(-70px); }

/* Catch the coins */
.catch { position: relative; height: 360px; border-radius: 16px; overflow: hidden; background: linear-gradient(#caf0f8, #ade8f4); border: 3px solid var(--ink); }
.catch-monster { position: absolute; top: 4px; width: 60px; transform: translateX(-50%); }
.bucket { position: absolute; bottom: 4px; font-size: 3rem; transform: translateX(-50%); transition: left 0.05s linear; }
.bucket.ouch { filter: drop-shadow(0 0 8px red); } .bucket.yum { transform: translateX(-50%) scale(1.15); }
.falling { position: absolute; font-size: 1.9rem; transform: translate(-50%, -50%); pointer-events: none; }

/* Monster sneeze */
.sneeze { width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; display: block; border-radius: 50%; background: #f1f3f5; position: relative; box-shadow: none; }
.sneeze-monster { position: absolute; inset: 15% 20% 25%; transition: transform 0.4s; }
.sneeze-word { position: absolute; bottom: 8%; left: 0; right: 0; font-size: 1.8rem; font-weight: 900; }
.sneeze.breathing .sneeze-monster { animation: breathe 1.2s ease-in-out infinite; }
.sneeze.achoo { background: #ffe066; } .sneeze.achoo .sneeze-monster { transform: scale(1.2) rotate(-8deg); }
.sneeze.slimed { background: #8ce99a; }
@keyframes breathe { 50% { transform: scale(1.12, 0.92); } }

/* Odd one out */
.odd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.odd-cell { aspect-ratio: 1; padding: 6px; box-shadow: none; border-color: #e3dcef; background: #fff; }
.odd-cell.found { background: #b2f2bb; border-color: var(--good); }
.odd-cell.nope { background: #ffc9c9; }

/* ---------- furniture colours ---------- */
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.swatch { padding: 2px; box-shadow: none; border-color: #e3dcef; display: flex; justify-content: center; }
.swatch .thumb { width: 40px; height: 40px; }
.swatch.on { border-color: var(--accent); background: #ffe3ec; outline: 2px solid var(--accent); }

/* ---------- coins in your colour ---------- */
svg.coin { width: 1.05em; height: 1.05em; vertical-align: -0.18em; display: inline-block; }
.coin-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 0.4rem 0 1rem; }
.coin-big svg.coin { width: 2.6rem; height: 2.6rem; }
.coin-pick input[type=color] { width: 3rem; height: 2.6rem; padding: 2px; border-radius: 10px; cursor: pointer; }
.coin-swatch { padding: 4px; box-shadow: none; border-color: #e3dcef; }
.coin-swatch svg.coin { width: 1.8rem; height: 1.8rem; }

/* ---------- the Furniture / Hide / Raid switch ---------- */
.modes { display: flex; background: rgba(255,255,255,0.12); border-radius: 999px; padding: 4px; gap: 4px; }
.modes .mode { border: none; box-shadow: none; background: transparent; color: #fff; font-weight: 800; font-size: 1.05rem; border-radius: 999px; padding: 0.45em 1.1em; position: relative; }
.modes .mode.on { background: #ffe066; color: var(--ink); }
.modes .mode:hover:not(.on) { background: rgba(255,255,255,0.18); }
.modes .dot { position: absolute; top: -4px; right: -2px; background: var(--accent); color: #fff; font-size: 0.75rem; min-width: 1.4em; height: 1.4em; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ink); }
.top { gap: 0.6rem; }
@media (max-width: 760px) { .modes { order: 3; width: 100%; justify-content: space-between; } .modes .mode { flex: 1; padding: 0.5em 0.4em; font-size: 0.98rem; } }
.top-hint { margin: 0 0 0.6rem; background: #fff; border-radius: 12px; padding: 0.5rem 0.8rem; box-shadow: var(--shadow); color: var(--ink); }
/* In hide mode, furniture with free spots gently invites a tap. */
.room.hiding .furn:not(.sel) { cursor: pointer; }
.editor > .below { grid-column: 1 / -1; }

/* Clothes lie on top of furniture. */
.room .furn.cat-clothes { z-index: 2; }
.room .furn.cat-clothes .art { filter: drop-shadow(0 3px 2px rgba(43, 33, 64, 0.45)); }

/* ---------- coins shown clearly ---------- */
.purse { display: grid; gap: 2px; font-size: 1.02rem; }
.board tr.heads th { font-size: 0.8rem; color: var(--muted); text-align: right; font-weight: 700; padding-bottom: 0.2rem; }
.raid-top .their-coins { display: block; color: #ffd166; font-size: 0.85rem; }
.raid-stats small { color: #bbb; font-size: 0.75rem; }
.deal .has { flex-basis: 100%; color: var(--muted); }

/* ---------- treasure powers ---------- */
.t-power { display: block; font-size: 0.78rem; color: #7b3fd1; font-weight: 600; line-height: 1.2; margin-top: 0.2rem; }
.power-list { list-style: none; padding: 0; margin: 0.4rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem; }
.power-list li { display: flex; gap: 0.6rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: 12px; background: #f3fbf5; border: 2px solid #b2f2bb; }
.power-list li.off { background: #f6f2fb; border-color: #e3dcef; }
.power-list .p-icon { font-size: 1.8rem; }
.raid-powers { margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; font-weight: 700; }
.raid-powers .chip { font-weight: 500; background: #fff; border: 2px solid #d0bfff; }
.raid-powers .warn-chip { border-color: #ffa8a8; background: #fff5f5; }
.spot-line { display: flex; gap: 0.4rem; align-items: stretch; margin-bottom: 0.4rem; }
.spot-line .spot-btn { margin: 0; flex: 1; }
.peek-btn { padding: 0.3em 0.6em; background: #f3e8ff; }
.peeked { background: #f3e8ff; border-radius: 8px; padding: 0 0.3em; }
.furn .badge.mapped { background: #fff3bf; border: 2px solid #f59f00; }

/* ---------- hidden-item icons, floor treasures, PIN lock, shop ---------- */
.furn .badge.items { background: rgba(255,255,255,0.95); border: 2px solid var(--ink); padding: 1px 2px; display: flex; gap: 2px; z-index: 6; }
.item-icon { padding: 0 2px; border: none; box-shadow: none; background: transparent; font-size: max(13px, 1.9cqw); line-height: 1.1; border-radius: 6px; }
.item-icon:hover, .item-icon.carrying { background: #ffe066; }
.floor-item { position: absolute; padding: 0; border: none; box-shadow: none; background: transparent; display: flex; align-items: center; justify-content: center; z-index: 3; }
.floor-item span { font-size: 4.6cqw; filter: drop-shadow(0 3px 2px rgba(0,0,0,0.35)); animation: bob 1.6s ease-in-out infinite; }
.floor-item::before { content: ''; position: absolute; inset: 14%; border-radius: 50%; background: rgba(255, 224, 102, 0.55); box-shadow: 0 0 14px 4px rgba(255, 224, 102, 0.7); }
.floor-item.carrying::before { background: rgba(255, 92, 138, 0.6); }
@keyframes bob { 50% { transform: translateY(-8%); } }
.pin-gate { border: 3px solid var(--accent); }
.pin-small { width: 7em; font-size: 1.3rem; letter-spacing: 0.3em; text-align: center; }
.shop-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.35rem 0; border-top: 1px solid #f0eaf6; flex-wrap: wrap; }
.where li[data-act] { cursor: pointer; }

/* ---------- the theft alert ---------- */
#alert-banner { position: fixed; left: 0; right: 0; top: 0; z-index: 60; background: repeating-linear-gradient(-45deg, #e5484d 0 22px, #c92a2a 22px 44px); color: #fff;
  border-bottom: 4px solid var(--ink); display: flex; align-items: center; overflow: hidden; padding-top: env(safe-area-inset-top, 0px); animation: alert-in 0.4s ease-out; }
#alert-banner .alert-track { flex: 1; white-space: nowrap; overflow: hidden; font-weight: 900; font-size: 1.25rem; padding: 0.7rem 0; }
#alert-banner .alert-track span { display: inline-block; padding-left: 100%; animation: ticker 11s linear infinite; text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
#alert-banner button { background: #fff; color: var(--ink); margin: 0 0.6rem; font-weight: 900; }
@keyframes ticker { to { transform: translateX(-100%); } }
@keyframes alert-in { from { transform: translateY(-100%); } }

/* ---------- the door lock ---------- */
.top nav button.door { border-style: solid; font-weight: 800; }
.top nav button.door.locked { background: #ffe066; color: var(--ink); border-color: #ffe066; }
.status.locked-status { background: #fff3bf; display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }

/* ---------- houses, invites, feedback ---------- */
.login.party { background: linear-gradient(160deg, #fff 0%, #fff4e0 100%); border: 4px solid var(--ink); position: relative; overflow: hidden; }
.login.party::before { content: '🎈🎉🎊'; position: absolute; top: 10px; right: 14px; font-size: 1.6rem; }
.party-top { font-weight: 900; color: var(--accent); letter-spacing: 0.02em; font-size: 1.1rem; }
.feedback-pop { max-width: 480px; width: 100%; text-align: left; }
.feedback-pop textarea { width: 100%; font: inherit; padding: 0.6rem; border: 2px solid #cfc6dd; border-radius: 12px; }
.kinds label { display: inline-flex; gap: 0.3rem; align-items: center; margin-right: 0.6rem; }
.invite-card { border: 3px solid var(--accent); }
.invite-msg { background: #fff7d6; border-radius: 12px; padding: 0.7rem; font-size: 0.95rem; overflow-wrap: anywhere; }
a.btn { display: inline-block; border: 2px solid var(--ink); border-radius: 12px; padding: 0.45em 0.9em; box-shadow: 0 2px 0 var(--ink); color: inherit; text-decoration: none; background: #fff; }
.player-list { list-style: none; padding: 0; columns: 2; }
.player-list li { padding: 0.2rem 0; }
.feedback-list { list-style: none; padding: 0; margin: 0; }
.feedback-list li { border-top: 1px solid #f0eaf6; padding: 0.6rem 0; }
.feedback-list .when { color: var(--muted); font-size: 0.8rem; }
.feedback-list p { margin: 0.2rem 0 0.4rem; white-space: pre-wrap; }

/* ---------- getting friends into a house ---------- */
.party-code { margin-top: 1.4rem; padding-top: 1rem; border-top: 2px dashed #e3dcef; }
.party-code input { font-size: 1.4rem; letter-spacing: 0.25em; text-transform: uppercase; width: 8em; text-align: center; }
.party-code .row { justify-content: center; margin-top: 0.4rem; }
.share-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.6rem 0 1rem; text-align: center; }
.share-ways .qr { width: 170px; height: 170px; margin: 0 auto; border: 3px solid var(--ink); border-radius: 12px; padding: 4px; background: #fff; }
.share-ways .qr svg { width: 100%; height: 100%; display: block; }
.party-code-big { font-size: 2.4rem; font-weight: 900; letter-spacing: 0.2em; border: 3px dashed var(--accent); border-radius: 14px; padding: 0.3em; background: #fff7d6; }
@media (max-width: 560px) { .share-ways { grid-template-columns: 1fr; } }

/* ---------- raiders in my room ---------- */
.intruders ul { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.intruders li { padding: 0.35rem 0; border-top: 1px solid #ffc9c9; }
.intruders li:first-child { border-top: none; }
.intruder-hint { background: #ffe3e3; border: 2px solid var(--bad); }
.raider { position: absolute; z-index: 7; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: rgba(255, 255, 255, 0.85); border: 3px solid var(--warn); border-radius: 18%; box-shadow: 0 0 14px 4px rgba(255, 176, 32, 0.75); animation: sneak 1.2s ease-in-out infinite; }
.raider .r-face { font-size: 6.4cqw; line-height: 1; }
.raider .r-what { position: absolute; right: -8%; bottom: -10%; font-size: 3cqw; line-height: 1; background: #fff; border-radius: 50%; padding: 1px; }
.raider.stuck { border-color: var(--bad); box-shadow: 0 0 14px 4px rgba(229, 72, 77, 0.75); animation: wiggle 0.6s ease-in-out infinite; }
@keyframes sneak { 50% { transform: translateY(-6%) rotate(-4deg); } }
@keyframes wiggle { 50% { transform: rotate(-8deg); } }
.tiny-btn { font-size: 0.8rem; padding: 0.15em 0.5em; box-shadow: none; margin-left: 0.3rem; }
.player-list { columns: 1; }
h3 small.full { color: var(--bad); }
svg.padlock { width: 1.05em; height: 1.2em; vertical-align: -0.25em; margin-right: 0.15em; overflow: visible; }
.deal .counter { flex-basis: 100%; gap: 0.4rem; font-size: 0.95rem; }

/* Basketball */
.court { position: relative; height: 380px; border-radius: 16px; overflow: hidden; touch-action: none; cursor: grab;
  background: linear-gradient(#ffe8cc, #ffd8a8 70%, #e8a56a 70%, #d98c4a); border: 3px solid var(--ink); }
.court::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 46%; height: 26%; transform: translateX(-50%); border: 3px solid rgba(255,255,255,0.7); border-bottom: none; border-radius: 50% 50% 0 0; pointer-events: none; }
.hoop { position: absolute; top: 24%; width: 17%; transform: translateX(-50%); pointer-events: none; }
.hoop .board { position: absolute; left: 10%; right: 10%; bottom: 0; height: 52px; background: #fff; border: 3px solid var(--ink); border-radius: 6px; box-shadow: inset 0 0 0 10px #fff, inset 0 0 0 13px #e63946; }
.hoop .rim { position: absolute; left: 0; right: 0; top: -3px; height: 6px; background: #f76707; border-radius: 3px; border: 2px solid var(--ink); }
.hoop .net { position: absolute; left: 8%; right: 8%; top: 3px; height: 30px; background: repeating-linear-gradient(60deg, transparent 0 6px, #fff 6px 8px), repeating-linear-gradient(-60deg, transparent 0 6px, #fff 6px 8px); clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%); }
.hoop .hoop-monster { position: absolute; left: 50%; bottom: 46px; width: 54px; transform: translateX(-50%); }
.hoop.swish .rim { background: #51cf66; }
.court .ball { position: absolute; font-size: 2.4rem; line-height: 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 2; }
.court .aim { position: absolute; display: none; height: 4px; background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 14px); transform-origin: 0 50%; pointer-events: none; }

/* ---------- morning podium ---------- */
.podium { background: linear-gradient(160deg, #fff8d6, #fff); border: 3px solid #ffd43b; text-align: center; }
.podium-row { display: flex; justify-content: center; align-items: flex-end; gap: 0.8rem; flex-wrap: wrap; }
.podium .step { display: flex; flex-direction: column; align-items: center; min-width: 6.5rem; padding: 0.5rem; border-radius: 14px; background: #fff; border: 2px solid #f1e3a6; }
.podium .step.p1 { order: 2; transform: translateY(-10px); border-color: #fcc419; box-shadow: 0 0 18px rgba(252, 196, 25, 0.5); }
.podium .step.p2 { order: 1; } .podium .step.p3 { order: 3; }
.podium .pm { font-size: 2rem; } .podium .pa { font-size: 2.4rem; }
