:root {
  --ink: #2a1d4a;
  --glass: rgba(255, 255, 255, 0.16);
  --glass-line: rgba(255, 255, 255, 0.32);
  --gold: #ffd86b;
  --font: Nunito, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #1a1238;
  font-family: var(--font);
  color: #fff;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#sky, #stars, #game, #fade { position: fixed; inset: 0; }
#sky { background: linear-gradient(180deg, #86bfff, #eee3ff); transition: background 1.2s linear; }
#stars {
  width: 1px; height: 1px; inset: 0 auto auto 0;
  border-radius: 50%; opacity: 0; transition: opacity 1.5s;
  pointer-events: none;
}
#game { width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
#game.usable { cursor: pointer; }
#hoverTag {
  position: fixed; z-index: 5; pointer-events: none; transform: translate(0, -50%);
  background: rgba(20, 12, 50, 0.72); color: #fff; font: 800 13px var(--font);
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
#hoverTag.hidden { display: none; }

.gem {
  width: 13px; height: 13px; transform: rotate(45deg); border-radius: 3px;
  background: linear-gradient(135deg, #fff6c8, var(--gold) 55%, #ffab4a);
  box-shadow: 0 0 12px rgba(255, 216, 107, 0.9);
}
@keyframes bump { 50% { transform: scale(1.18); } }

/* Action button */
#action {
  position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 18px 15px 26px; border: 0; border-radius: 999px;
  background: #fff; color: var(--ink);
  font: 900 17px var(--font);
  box-shadow: 0 10px 40px rgba(40, 20, 90, 0.35), 0 0 0 6px rgba(255,255,255,.18);
  cursor: pointer;
  transition: transform .25s cubic-bezier(.3,1.6,.5,1), opacity .2s;
}
#action:active { transform: translateX(-50%) scale(0.95); }
#action.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(16px) scale(.9); }
#action kbd {
  font: 900 12px var(--font); color: #7a64c8;
  background: var(--jelly-2); border-radius: 8px; padding: 4px 8px;
}
@media (hover: none) { #action kbd { display: none; } #action { padding-right: 26px; } }

/* Speech */
#bubbles { position: fixed; inset: 0; pointer-events: none; }
.bubble {
  position: absolute; transform: translate(-50%, calc(-100% - 10px));
  width: max-content; max-width: min(280px, 72vw); padding: 11px 16px 12px; /* max-content: no cambia de forma junto al borde (src/ui/bocadillo.js) */
  background: #fff; color: var(--ink); border-radius: 18px;
  font-weight: 700; font-size: 15px; line-height: 1.35;
  box-shadow: 0 10px 30px rgba(40, 20, 90, 0.25);
  animation: pop .3s cubic-bezier(.3,1.7,.5,1);
}
.bubble::after {
  content: ""; position: absolute; left: calc(50% + var(--cola, 0px)); bottom: -7px; width: 14px; height: 14px;
  background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 3px;
}
.bubble b { display: block; font-weight: 900; font-size: 12px; color: #8a6fe0; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.bubble.out { opacity: 0; transition: opacity .25s; }
.bubble.lejos { visibility: hidden; }
.bubble.music { background: #7f96ff; color: #fff; font-size: 22px; padding: 8px 16px; }
.bubble.music::after { background: #7f96ff; }
.notes { display: inline-block; animation: sway 0.9s ease-in-out infinite; }
@keyframes pop { from { transform: translate(-50%, calc(-100% - 10px)) scale(.6); opacity: 0; } }
@keyframes sway { 50% { transform: translateY(-3px) rotate(-4deg); } }

/* Toast */
#toast {
  position: fixed; left: 50%; top: max(76px, calc(env(safe-area-inset-top) + 64px));
  transform: translate(-50%, -10px); opacity: 0;
  max-width: min(440px, calc(100vw - 32px)); text-align: center;
  padding: 12px 20px; border-radius: 16px;
  background: rgba(30, 20, 70, 0.72); color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-weight: 800; font-size: 15px; line-height: 1.35;
  transition: opacity .3s, transform .3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#avisosAmigos { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 9; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.aviso-amigo { display: flex; align-items: center; gap: 7px; padding: 7px 14px 7px 9px; border-radius: 999px; background: rgba(30, 20, 70, .72); color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font: 700 14px var(--font); white-space: nowrap; animation: avisoAmigo .35s cubic-bezier(.3,1.6,.5,1); transition: opacity .35s, transform .35s; }
.aviso-amigo i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #5BD18B; flex: none; }
.aviso-amigo.off i { border-color: rgba(255,255,255,.35); filter: grayscale(.6); }
.aviso-amigo b { font-weight: 900; }
.aviso-amigo.fuera { opacity: 0; transform: translateY(-8px); }
.aviso-gpu { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(30, 20, 70, .72); color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font: 700 13px/1.3 var(--font); animation: avisoGpu .35s cubic-bezier(.3,1.6,.5,1); transition: opacity .35s; }
.aviso-gpu button { flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font: 900 12px var(--font); cursor: pointer; }
.aviso-gpu.fuera { opacity: 0; }
@keyframes avisoGpu { from { opacity: 0; transform: translate(-50%, 12px) scale(.9); } }
@keyframes avisoAmigo { from { opacity: 0; transform: translateY(-12px) scale(.9); } }

/* Travel */
#fade { opacity: 0; pointer-events: none; transition: opacity .45s ease; background: #1a1238; }
#fade.on { opacity: 1; pointer-events: auto; }

/* Decorate button */
#casaBtns { position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: center; }
#decorBtn, #salirBtn {
  padding: 13px 22px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: var(--glass); color: #fff; font: 900 16px var(--font); cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#decorBtn.hidden, #salirBtn.hidden, #shop.hidden, #worldgate.hidden, #decor.hidden, #decorTools.hidden, #tabItems.hidden, #tabHouse.hidden, #tabSala.hidden, #tabAcabados.hidden, .tabs button.hidden { display: none; }
body.decorating #action, body.decorating #casaBtns { display: none; }

/* Shop */
#shop, #worldgate {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 12, 50, 0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s;
}
#worldgateGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.offer.world { cursor: pointer; border: 0; }
.world-dot { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(255,255,255,.6), 0 6px 18px rgba(80,50,140,.18); }
.shop-card {
  width: min(760px, 100%); max-height: min(86vh, 760px); overflow: auto;
  padding: 22px;
}
.shop-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.shop-card header > div:first-child { flex: 1; }
.shop-card h2 { margin: 0; font-size: 24px; font-weight: 900; }
.shop-card p { margin: 2px 0 0; font-weight: 700; opacity: .6; }
.wallet { display: flex; align-items: center; gap: 8px; background: var(--ink-strong); color: #fff; padding: 9px 16px; border-radius: 999px; font-weight: 900; font-size: 17px; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--jelly-2); color: var(--ink); font: 900 24px var(--font); cursor: pointer; line-height: 1; }
#shopGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.offer {
  position: relative; background: #fff; border-radius: 20px; padding: 12px 12px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 2px 0 var(--rim), 0 6px 18px rgba(80, 50, 140, 0.08);
}
.offer.basic { background: #f8f5ff; }
.offer.just { animation: bump .4s cubic-bezier(.3,1.8,.5,1); }
/* Rareza de los muebles de sede (docs/MUEBLES.md): como las skins */
.offer.r-rara { background: linear-gradient(#fff, #e8f0ff); }
.offer.r-muyrara { background: linear-gradient(#fff, #fff4d8); }
.offer.r-muyrara::after { content: ""; position: absolute; top: 10px; right: 12px; width: 10px; height: 10px; transform: rotate(45deg); background: var(--gold); box-shadow: 0 0 10px var(--gold); border-radius: 2px; }
.offer.r-rara::after { content: ""; position: absolute; top: 10px; right: 12px; width: 9px; height: 9px; transform: rotate(45deg); background: #6f93d8; border-radius: 2px; }
.offer img { width: 110px; height: 110px; object-fit: contain; }
.offer-name { font-weight: 900; font-size: 15px; text-align: center; }
.owned { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 900; color: #8a6fe0; background: var(--jelly-2); padding: 3px 8px; border-radius: 999px; }
.buy {
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 999px;
  padding: 9px 18px; background: var(--ink-strong); color: #fff; font: 900 15px var(--font); cursor: pointer;
}
.buy:disabled { background: #e6e0f2; color: #a89cc4; cursor: default; }
.buy:disabled .gem { box-shadow: none; filter: grayscale(1); opacity: .5; }
.buy .gem { width: 10px; height: 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(42,29,74,.15); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px #2a1d4a; }
.swatches.small .sw { width: 20px; height: 20px; border-width: 2px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px) scale(.97); opacity: 0; } }

/* Decorating */
#decor { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); pointer-events: none; }
#decor > * { pointer-events: auto; }
.decor-panel {
  max-width: 860px; margin: 0 auto; padding: 10px 16px 14px; border-radius: 32px;
  /* el mismo tamaño en Mis muebles y en Habitación: lo de dentro se desplaza */
  display: flex; flex-direction: column; height: min(42vh, 400px); box-sizing: border-box;
}
.decor-panel > .tabs { flex: none; }
.decor-panel > #tabItems, .decor-panel > #tabSala, .decor-panel > #tabHouse, .decor-panel > #tabAcabados { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-radius: 999px; font: 900 15px var(--font); color: var(--soft); cursor: pointer; }
.tabs button.on { background: var(--jelly-2); color: var(--ink); }
#decorDone { margin-left: auto; background: var(--ink-strong); color: #fff; padding: 9px 20px; }
#invStrip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 2px 2px 6px; } /* (en rejilla: el panel es más alto) */
.inv {
  position: relative; flex: 0 0 auto; width: 104px; border: 0; background: #fff; border-radius: 18px; padding: 8px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  box-shadow: 0 2px 0 var(--rim), 0 4px 14px rgba(80, 50, 140, 0.08); font: 800 12px var(--font); color: var(--ink);
}
.inv img { width: 72px; height: 72px; object-fit: contain; }
.inv b { position: absolute; top: 6px; right: 8px; background: var(--ink-strong); color: #fff; border-radius: 999px; padding: 2px 7px; font-size: 11px; }
.empty { margin: 14px 8px; font-weight: 700; opacity: .6; }
.row { display: flex; align-items: center; gap: 14px; padding: 6px 4px; }
.row > span { width: 78px; flex: 0 0 auto; font-weight: 900; font-size: 14px; }
.seg { display: flex; gap: 4px; background: var(--jelly-2); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font: 800 14px var(--font); color: var(--soft); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(80,50,140,.15); }
#decorTools { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
#decorTools button {
  border: 0; border-radius: 999px; padding: 12px 20px; background: #fff; color: var(--ink);
  font: 900 15px var(--font); cursor: pointer; box-shadow: 0 8px 24px rgba(20, 10, 60, 0.25);
}
#decorTools button:disabled { opacity: .4; }
#decorTools button[data-t="store"] { background: var(--ink-strong); color: #fff; }
@media (max-width: 520px) {
  .row { flex-direction: column; align-items: flex-start; gap: 6px; }
  #shopGrid { grid-template-columns: repeat(2, 1fr); }
  .offer img { width: 90px; height: 90px; }
}

/* Talking to a neighbour */
#talk {
  /* centrada sin transform: la animación de la gelatina pisa el transform y la hacía entrar desde la derecha */
  position: fixed; left: 0; right: 0; margin-inline: auto; bottom: max(22px, env(safe-area-inset-bottom));
  width: min(560px, calc(100vw - 24px)); padding: 12px 14px 14px;
}
#talk.hidden { display: none; }
.talk-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; }
.talk-head b { font-size: 18px; font-weight: 900; }
#talkHearts { display: flex; gap: 4px; margin-left: auto; }
.heart {
  width: 18px; height: 16px; display: inline-block;
  background: linear-gradient(to top, #ff6f9a var(--fill), #eadff5 var(--fill));
  clip-path: path('M9 16 C9 16 0 10 0 4.8 C0 2 2.2 0 4.8 0 C6.6 0 8.2 1 9 2.6 C9.8 1 11.4 0 13.2 0 C15.8 0 18 2 18 4.8 C18 10 9 16 9 16 Z');
}
.talk-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.talk-actions button {
  border: 0; border-radius: 16px; padding: 12px 8px; background: var(--jelly-2); color: var(--ink);
  font: 900 14px var(--font); cursor: pointer; line-height: 1.2;
}
.talk-actions button:active { transform: scale(.96); }
.talk-actions em { font-style: normal; opacity: .6; }
.talk-actions .bye { background: var(--ink-strong); color: #fff; }
body:has(#talk:not(.hidden)) #action { display: none; }
.bubble.mine { background: #7f96ff; color: #fff; }
.bubble.mine::after { background: #7f96ff; }
#talk.ocupado .talk-actions { pointer-events: none; opacity: .5; transition: opacity .2s; }

/* Shelves */
.shelves { display: flex; gap: 10px; height: 190px; }
.shelf {
  flex: 1; border: 0; border-radius: 18px; cursor: pointer; padding: 14px 10px; display: flex; flex-direction: column; justify-content: space-around;
  background: color-mix(in srgb, var(--c) 30%, #fff); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--c) 60%, #fff);
}
.shelf i { display: block; height: 8px; border-radius: 4px; background: var(--c); }
.shelf.good { animation: good .35s; }
.shelf.bad { animation: shake .3s; }
.crate-slot { height: 150px; display: grid; place-items: center; }
.crate { width: 86px; height: 70px; border-radius: 12px; background: var(--c); box-shadow: inset 0 -8px 0 rgba(0,0,0,.12), 0 10px 24px rgba(40,20,90,.2); position: relative; }
.crate::before, .crate::after { content: ""; position: absolute; left: 12px; right: 12px; height: 6px; top: 18px; background: rgba(255,255,255,.55); border-radius: 3px; }
.crate::after { top: 32px; left: 26px; right: 26px; }
.crate.pop { animation: pop2 .25s cubic-bezier(.3,1.7,.5,1); }
@keyframes good { 50% { transform: scale(1.06); filter: brightness(1.1); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pop2 { from { transform: scale(.4); opacity: 0; } }

/* Watering */
.beds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; height: 100%; }
.plant {
  position: relative; border: 0; border-radius: 18px; background: var(--jelly-2); cursor: pointer; overflow: hidden;
  box-shadow: inset 0 -5px 0 #e2d4ba;
}
.plant .pot { position: absolute; left: 50%; bottom: 18px; width: 44px; height: 30px; transform: translateX(-50%); background: #ff9e7a; border-radius: 4px 4px 12px 12px; }
.plant .stem { position: absolute; left: 50%; bottom: 46px; width: 4px; height: 26px; transform: translateX(-50%); background: #5fbf7f; transition: transform .3s; transform-origin: bottom; }
.plant .leaf { position: absolute; bottom: 62px; width: 22px; height: 12px; background: #6fd08a; border-radius: 50%; transition: transform .3s; }
.plant .l1 { left: calc(50% - 22px); transform: rotate(-25deg); transform-origin: right; }
.plant .l2 { left: 50%; transform: rotate(25deg); transform-origin: left; }
.plant .bar { position: absolute; left: 10px; right: 10px; bottom: 6px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.08); }
.plant .bar b { display: block; height: 100%; width: var(--w); background: #6fb8ff; border-radius: 3px; }
.plant.thirsty { background: #ffe6c8; }
.plant.thirsty .bar b { background: #ff9e5a; }
.plant.thirsty .l1 { transform: rotate(-60deg); }
.plant.thirsty .l2 { transform: rotate(60deg); }
.plant.wilted { background: #e8e0d4; }
.plant.wilted .stem { transform: translateX(-50%) rotate(50deg); background: #a8a07a; }
.plant.wilted .leaf { background: #b8a878; }
.plant.splash { animation: good .35s; }

/* Cheats */
#cheats { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(20, 12, 50, 0.45); animation: fadeIn .2s; }
#cheats.hidden { display: none; }
.cheats-card { width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 18px 20px 20px; }
.cheats-card header { display: flex; align-items: center; }
.cheats-card h2 { margin: 0; flex: 1; font-size: 22px; font-weight: 900; }
.cheats-card h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: #8a6fe0; }
.cheat-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cheat-row button { border: 0; border-radius: 999px; padding: 10px 14px; background: var(--jelly-2); color: var(--ink); font: 800 14px var(--font); cursor: pointer; }
.cheat-row button:active { transform: scale(.96); }
.cheat-row button.danger { background: #ffe0ea; color: #c0305a; }
.cheat-row button.on { background: #8a6fe0; color: #fff; }
.cheats-card h3 { display: flex; align-items: center; gap: 7px; }
.ch-ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ch-mundo { margin: 10px 0 4px; font: 900 14px var(--font); color: var(--ink); }
.ch-mundo:first-child { margin-top: 0; }
.ch-piso { margin: 8px 0 5px; font: 800 12px var(--font); color: var(--soft); }
.cheat-row button.sub { padding: 7px 11px; font-size: 13px; }
.ch-grupo { border-top: 1px solid rgba(138, 111, 224, .18); }
.ch-grupo:first-of-type { margin-top: 10px; }
.ch-grupo > summary { list-style: none; cursor: pointer; }
.ch-grupo > summary::-webkit-details-marker { display: none; }
.ch-grupo > summary h3 { margin: 0; padding: 12px 0; }
.ch-grupo > summary h3::after { content: ''; margin-left: auto; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); transition: transform .15s; }
.ch-grupo[open] > summary h3::after { transform: rotate(-135deg); }
.ch-grupo[open] { padding-bottom: 12px; }

/* Florece */
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; height: 100%; }
.card { position: relative; border: 0; padding: 0; border-radius: 14px; background: none; cursor: pointer; perspective: 600px; }
.card span { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; transition: transform .35s; display: grid; place-items: center; }
.card .back { background: repeating-linear-gradient(45deg, #7fe0a8 0 10px, #9ff0bc 10px 20px); box-shadow: inset 0 -5px 0 rgba(0,0,0,.08); }
.card .front { background: #fff6fa; transform: rotateY(180deg); box-shadow: inset 0 -5px 0 #f0e0ea; }
.card .front svg { width: 64%; height: 64%; }
.card.up .back { transform: rotateY(180deg); }
.card.up .front { transform: rotateY(360deg); }
.card.done .front { background: #e8fff0; }

/* Apila Bloquis */
.stack { position: relative; height: 100%; border-radius: 18px; overflow: hidden; background: linear-gradient(#cfe0ff, #f4f0ff); cursor: pointer; }
.tower { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transition: transform .3s; }
.block { position: absolute; height: 24px; border-radius: 6px; box-shadow: inset 0 -5px 0 rgba(0,0,0,.12); }
.block i { position: absolute; top: 7px; width: 5px; height: 7px; border-radius: 2px; background: var(--ink-strong); }
.block i:first-child { left: calc(50% - 10px); }
.block i:last-child { left: calc(50% + 5px); }
.block.fall { transition: transform .7s ease-in, opacity .7s; transform: translateY(260px) rotate(25deg); opacity: 0; }
.stack-note { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font-weight: 900; font-size: 20px; color: #2a1d4a; pointer-events: none; }

/* Lluvia de chispas */
.rain { width: 100%; height: 100%; border-radius: 18px; display: block; cursor: none; touch-action: none; }

/* Profile */
.world-group + .world-group { margin-top: 18px; }
.world-group h2 {
  margin: 0 0 8px; font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
  opacity: .5; border-bottom: 2px solid var(--rim); padding-bottom: 6px;
}
.skin-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 10px; }
.skin-race h3 { margin: 0 0 4px 4px; font-size: 14px; font-weight: 900; }
.skin-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.skin {
  position: relative; border: 0; border-radius: 18px; background: #fff; padding: 8px 6px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font: 800 13px var(--font); color: var(--ink);
  box-shadow: 0 2px 0 var(--rim), 0 4px 14px rgba(80, 50, 140, 0.08);
}
.skin { padding: 4px 2px 3px; border-radius: 14px; gap: 0; }
.skin img { width: 100%; max-width: 78px; height: auto; aspect-ratio: 1; }
.skin span { font-size: 11px; opacity: .55; }
.skin em { font-style: normal; font-size: 11px; color: #8a6fe0; margin-top: 2px; text-align: center; line-height: 1.2; }
.skin em.buy { display: inline-flex; gap: 5px; align-items: center; background: var(--ink-strong); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.skin.locked img { filter: brightness(0) opacity(.18); }
.skin.on { box-shadow: 0 0 0 3px #2a1d4a; }
.skin.r-normal { background: linear-gradient(#fff, #e6f4e6); }
.skin.r-rara { background: linear-gradient(#fff, #d6e4ff); }
.skin.r-muyrara { background: linear-gradient(#fff, #ffe6a8); }
@media (max-width: 700px) { .skin-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } }

/* Estela: siempre disponible, encabeza el perfil */


/* ═════════ HUD: src/ui/. La gelatina de Blopsi: blanca lechosa y translúcida, filo un tono más oscuro.
   src/ui/acento.js cambia --jelly, --panel, --rim, --rim-2, --soft, --ink-ui y --glow según el traje ═════════ */
:root {
  --jelly: #F4F1F8; --panel: color-mix(in srgb, #F4F1F8 78%, transparent);
  --rim: #DCD4E8; --rim-2: #C2B8D4; --text: #2B2A33; --soft: #7F7591; --ink-ui: #8C7FB0; --glow: transparent;
  --jelly-2: color-mix(in srgb, var(--rim) 45%, var(--jelly)); --ink-strong: color-mix(in srgb, var(--ink-ui) 60%, #1d1630);
  --tint: #C9634C; --tint-2: #F2B84B; --night: #2E3A4A; --mint: #4E8C6B; --neon: #7FB8C4;
  --gut: max(16px, env(safe-area-inset-left));
  --gut-r: max(16px, env(safe-area-inset-right));
  --gut-t: max(14px, env(safe-area-inset-top));
  --gut-b: max(14px, env(safe-area-inset-bottom));
  --me: 132px; --map: 140px;
}
svg .fill { fill: currentColor; }
svg .fill2 { fill: currentColor; opacity: .55; }
svg .hole { fill: var(--panel); }
svg .hole-line { stroke: var(--panel); stroke-width: 1.8; stroke-linecap: round; fill: none; }
svg .line, svg .strap { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.plate, .round, .money {
  border: 3px solid var(--rim); background: var(--panel); color: var(--text);
  box-shadow: 0 4px 0 var(--rim-2), 0 10px 22px rgba(30, 24, 40, 0.18);
  font: 900 16px var(--font); cursor: pointer; pointer-events: auto;
  transition: transform .12s, box-shadow .12s;
}
.plate:active, .round:active, button.money:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rim-2), 0 4px 10px rgba(30, 24, 40, 0.18); }
.round { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; padding: 0; flex: none; }
.round svg { width: 28px; height: 28px; color: var(--tint); }
.round.small { width: 40px; height: 40px; font-size: 22px; line-height: 1; color: var(--text); }
.round.hidden { display: none; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--gut-t) var(--gut-r) 0 var(--gut); pointer-events: none;
}
.hud-tl { position: relative; display: flex; gap: 10px; align-items: center; }
.plate.title {
  height: 56px; padding: 0 22px 0 18px; border-radius: 20px; display: flex; align-items: center; gap: 10px; cursor: default;
  font-size: 26px; letter-spacing: .01em; color: var(--night);
}
.plate.title:active { transform: none; box-shadow: 0 4px 0 var(--rim-2), 0 10px 22px rgba(30, 24, 40, 0.18); }
.plate.title i {
  width: 26px; height: 26px; flex: none; background: var(--tint-2);
  clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%);
}
.plate.icon { width: 56px; height: 56px; border-radius: 20px; padding: 0; display: grid; place-items: center; }
.plate.icon svg { width: 30px; height: 30px; color: var(--soft); }
.plate.icon[aria-expanded="true"] svg { color: var(--tint); transform: rotate(30deg); }
.plate.icon svg { transition: transform .3s, color .2s; }

/* Ajustes, dentro del menú compartido */
.set-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-weight: 900; font-size: 15px; }
.set-row > span:nth-child(2) { width: 64px; flex: none; }
.set-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--tint); height: 26px; }
.ico { width: 30px; height: 30px; border-radius: 10px; background: var(--jelly-2); flex: none; position: relative; }
.ico::after { content: ""; position: absolute; inset: 7px; background: var(--tint); }
.ico-music::after { clip-path: path('M5 0h11v4H8v10.5a3.5 3.5 0 1 1-3-3.4z'); inset: 7px 6px 5px 7px; }
.ico-sfx::after { clip-path: polygon(0 30%, 30% 30%, 62% 0, 62% 100%, 30% 70%, 0 70%); background: var(--mint); }
.ico-mute::after { border-radius: 50%; inset: 9px; background: var(--tint-2); }
.ico-eye::after { border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; inset: 9px 6px; background: var(--neon); }
.ico-idioma::after { clip-path: path('M0 3a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H8l-4 4v-4H3a3 3 0 0 1-3-3z'); inset: 7px; background: var(--tint-2); }
.toggle { margin-left: auto; width: 62px; height: 34px; border-radius: 999px; border: 3px solid var(--rim); background: var(--mint); position: relative; cursor: pointer; padding: 0; }
.toggle i { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: right .18s; }
.toggle.off { background: #D9CFC0; }
.toggle.off i { right: 31px; }
.set-tab .seg { margin-left: auto; background: var(--jelly-2); flex-wrap: nowrap; }
.set-tab .seg button { padding: 7px 9px; font-size: 13px; color: var(--soft); }
.set-tab .seg button.on { color: var(--text); }
.set-list { display: flex; flex-direction: column; margin-top: 6px; border-top: 2px dashed var(--rim); padding-top: 6px; }
.set-list button { border: 0; background: none; text-align: left; padding: 10px 8px; border-radius: 12px; font: 800 14px var(--font); color: var(--text); cursor: pointer; }
.set-list button:hover { background: var(--jelly-2); }
.set-list #openCheats { color: var(--tint); }

/* Tienda y monedas, arriba a la derecha */
.hud-tr { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.shop-btn { height: 70px; min-width: 116px; border-radius: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px 0 12px; font-size: 18px; background: var(--tint); border-color: #A94D39; color: #fff; box-shadow: 0 4px 0 #8C3E2E, 0 10px 22px rgba(30, 24, 40, 0.2); }
.shop-btn:active { box-shadow: 0 1px 0 #8C3E2E, 0 4px 10px rgba(30, 24, 40, 0.2); }
.shop-btn svg { width: 36px; height: 36px; color: #FFE7B0; }
.shop-btn svg .hole { fill: var(--tint); }
.shop-btn svg .strap { stroke: #FFE7B0; stroke-width: 2.6; }
.money {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 116px; padding: 0 14px 0 5px; border-radius: 999px;
  font-size: 18px; font-variant-numeric: tabular-nums; justify-content: flex-start; cursor: default;
}
button.money { cursor: pointer; }
.money span { margin-left: auto; }
.money.bump, #coins.bump { animation: bump 0.35s cubic-bezier(.3,1.8,.5,1); }
.spark-ico, .gem-ico { width: 28px; height: 28px; border-radius: 50%; flex: none; position: relative; display: inline-block; }
.spark-ico { background: url(assets/chispa.png) center / contain no-repeat; border-radius: 0; }
img.chispa-img, img.gema-img { object-fit: contain; }
.gem-ico { background: url(assets/gema.png) center / contain no-repeat; border-radius: 0; }
.wallet .gem-ico, .wallet .spark-ico { width: 22px; height: 22px; }

/* Perfil, abajo a la izquierda: el modelo de verdad en un círculo */
#meWrap { position: fixed; left: var(--gut); bottom: var(--gut-b); width: var(--me); height: var(--me); z-index: 3; }
#me {
  position: absolute; inset: 0; border-radius: 50%; padding: 0; cursor: pointer; overflow: hidden;
  border: 4px solid var(--rim); background: radial-gradient(circle at 50% 38%, #FFFFFF, var(--me-bg, #EFE6D6) 72%);
  box-shadow: 0 5px 0 var(--rim-2), 0 14px 30px rgba(30, 24, 40, 0.22);
  transition: transform .15s;
  -webkit-touch-callout: none;
}
#me:active { transform: scale(.97); }
#me img, #me canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#me img { object-fit: cover; transform: scale(1.05) translateY(4%); }
#me canvas { opacity: 0; transition: opacity .3s; }
#me.live canvas { opacity: 1; }
#me.live img { visibility: hidden; }
#favs { position: absolute; inset: 0; pointer-events: none; }
.fav {
  position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; padding: 0;
  border: 3px solid var(--rim); background: var(--panel); cursor: pointer; overflow: hidden;
  box-shadow: 0 3px 0 var(--rim-2), 0 8px 16px rgba(30, 24, 40, 0.2);
  transform: translate(0, 0) scale(.3); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.3,1.6,.5,1), opacity .18s;
}
.fav img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08) translateY(5%); }
.fav.on { border-color: var(--tint); }
.fav.empty { display: grid; place-items: center; background: var(--jelly-2); border-style: dashed; }
.fav.empty i { width: 22px; height: 22px; background: var(--tint-2); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
#meWrap.open #favs { pointer-events: auto; }
#meWrap.open .fav { opacity: 1; pointer-events: auto; transform: translate(var(--fx), var(--fy)) scale(1); }
.fav:hover { filter: brightness(1.05); }
#meWrap.open .fav:hover { transform: translate(var(--fx), var(--fy)) scale(1.12); }

/* Barra para escribir, abajo en el centro */
#chatbar {
  position: fixed; bottom: var(--gut-b); left: 50%; transform: translateX(-50%); z-index: 3;
  width: min(640px, calc(100vw - var(--me) - var(--map) - 120px));
  display: flex; align-items: center; gap: 10px;
}
#chatForm {
  flex: 1; min-width: 0; height: 56px; display: flex; align-items: center; gap: 6px; padding: 0 6px 0 14px;
  border: 3px solid var(--rim); background: var(--panel); border-radius: 999px;
  box-shadow: 0 4px 0 var(--rim-2), 0 10px 22px rgba(30, 24, 40, 0.18); transition: box-shadow .15s, border-color .15s;
}
#chatForm:focus-within { border-color: var(--tint-2); }
.chat-ico { width: 24px; height: 22px; flex: none; background: var(--rim-2); border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%; position: relative; }
.chat-ico::after { content: ""; position: absolute; left: 3px; bottom: -4px; width: 9px; height: 9px; background: inherit; clip-path: polygon(0 100%, 30% 0, 100% 0); }
.chat-ico { border: 0; padding: 0; cursor: pointer; transition: background .15s, transform .15s; }
.chat-ico:hover { background: var(--soft); transform: scale(1.1); }
.chat-ico.on { background: var(--tint-2); }

/* Lo que se ha dicho en la sala: baja desde arriba, encima del juego */
#chatLog {
  position: fixed; top: calc(var(--gut-t) + 68px); left: 0; right: 0; margin-inline: auto; z-index: 6;
  width: min(520px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 22px;
  border: 3px solid var(--rim); background: var(--panel); backdrop-filter: blur(8px);
  box-shadow: 0 4px 0 var(--rim-2), 0 10px 22px rgba(30, 24, 40, 0.18);
  animation: chatLogIn .22s cubic-bezier(.3,1.4,.5,1);
}
#chatLog.hidden { display: none; }
@keyframes chatLogIn { from { opacity: 0; transform: translateY(-24px); } }
#chatLog.out { animation: chatLogOut .18s ease-in forwards; pointer-events: none; }
@keyframes chatLogOut { to { opacity: 0; transform: translateY(-24px) scale(.97); } }
#chatLog ul { list-style: none; margin: 0; padding: 0 2px; max-height: min(42vh, 360px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
#chatLog li { font: 700 15px/1.35 var(--font); color: var(--text); overflow-wrap: anywhere; }
#chatLog li b { font-weight: 900; margin-right: 6px; }
#chatLog li b::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 5px; box-shadow: 0 0 0 1.5px #fff; }
#chatLog p { display: none; margin: 4px 2px; font: 800 15px var(--font); color: var(--soft); text-align: center; }
#chatLog.vacio p { display: block; }
body.decorating #chatLog { display: none; }
#chatInput { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font: 800 17px var(--font); color: var(--text); }
#chatInput::placeholder { color: #B9AC97; }
#chatSend {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--tint); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0;
  transform: scale(0); width: 0; margin-left: -6px; transition: transform .2s cubic-bezier(.3,1.6,.5,1), width .15s, margin .15s;
}
#chatSend svg { width: 22px; height: 22px; margin-left: 2px; }
#chatForm.typing #chatSend { transform: scale(1); width: 42px; margin-left: 0; }
#onlineBtn { position: relative; }
#onlineBtn svg { color: var(--soft); }
#onlineBtn .led { position: absolute; right: 4px; top: 4px; width: 13px; height: 13px; border-radius: 50%; background: #CFC4B2; border: 2px solid var(--panel); transition: background .2s; }
#onlineBtn.on .led { background: #5BD18B; box-shadow: 0 0 8px #5BD18B; }
#onlineBtn.on svg { color: var(--mint); }
/* Los iconos, en arcoíris por orden (solo el dibujo de dentro), y los mismos colores dentro del menú */
#missionsBtn svg, .b-missions svg { color: #E5574D; }
#friendsBtn svg, .b-friends svg { color: #EF8A2C; }
#itemsBtn svg, #itemsBtn svg .fill, .b-items svg { color: #E2B21B; }
#recetarioBtn svg, .b-recetario svg { color: #47A866; }
#mapBtn .map-ico { color: #3D8FDB; }

/* Mapa y misiones, abajo a la derecha */
#mapWrap { position: fixed; right: var(--gut-r); bottom: var(--gut-b); z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
#mapRow { display: flex; align-items: flex-end; gap: 10px; }
#zoomBtns { display: flex; flex-direction: column; gap: 8px; }
#zoomBtns.hidden, #zoomBtn.hidden { display: none; }
#zoomBtn text { font: 900 8.4px var(--font); fill: currentColor; stroke: none; }
.map-ico { display: none; }
#missionsCount { font-size: 12px; background: var(--night); color: #fff; border-radius: 999px; padding: 2px 7px; margin-left: 2px; }
#missionsCount:empty { display: none; }
#mapBtn {
  position: relative; width: var(--map); height: var(--map); border-radius: 50%; padding: 0; cursor: pointer; overflow: visible;
  border: 4px solid var(--rim); background: #CFE3D6; box-shadow: 0 5px 0 var(--rim-2), 0 14px 30px rgba(30, 24, 40, 0.22);
}
#mapBtn:active { transform: scale(.97); }
#miniMap { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; display: block; }
#where {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%); white-space: nowrap;
  display: flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--night); color: #fff; font: 900 12px var(--font); box-shadow: 0 3px 0 #1C2430;
}
#placeName { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
#clock { font-variant-numeric: tabular-nums; opacity: .75; }
#phase { display: none; }

/* Sitio para el botón de usar y para Decorar, encima de la barra */
#action { bottom: calc(var(--gut-b) + 76px); z-index: 4; }
#casaBtns { left: calc(var(--gut) + var(--me) + 18px); bottom: calc(var(--gut-b) + 76px); z-index: 4; }
#decorBtn, #salirBtn {
  background: var(--panel); color: var(--text); border: 3px solid var(--rim); box-shadow: 0 4px 0 var(--rim-2); backdrop-filter: none;
}
body.decorating #chatbar, body.decorating #meWrap, body.decorating #mapWrap { display: none; }
body:has(#talk:not(.hidden)) #chatbar { visibility: hidden; }
#talk { z-index: 4; }

/* Bocadillo de lo que escribes: cambia un poco con la raza que llevas */
.bubble.say { max-width: min(260px, 70vw); font-size: 16px; font-weight: 800; padding: 10px 16px 11px; border: 3px solid #E3DED6; }
.bubble.say::after { border: 3px solid #E3DED6; border-top: 0; border-left: 0; bottom: -9px; width: 14px; height: 14px; }
.bubble.say .deco { position: absolute; pointer-events: none; }
.bubble.say-estela { background: #FFFFFF; color: #3A3A48; border-radius: 22px; }
.bubble.say-sabueso { background: #FFF3E4; color: #5A2E1E; border-color: #E2A47E; border-radius: 16px 16px 16px 6px; }
.bubble.say-sabueso::after { background: #FFF3E4; border-color: #E2A47E; }
.bubble.say-sabueso .deco { right: -8px; top: -10px; width: 22px; height: 20px; background: #C9634C;
  clip-path: path('M11 9c4 0 7 4 7 7s-3 4-7 4-7-1-7-4 3-7 7-7zM3.5 4.5a2.5 3 0 1 1 0 6 2.5 3 0 1 1 0-6zM18.5 4.5a2.5 3 0 1 1 0 6 2.5 3 0 1 1 0-6zM8 0a2.4 3 0 1 1 0 6A2.4 3 0 1 1 8 0zM14 0a2.4 3 0 1 1 0 6 2.4 3 0 1 1 0-6z'); }
.bubble.say-brote { background: #F1FBEA; color: #24502F; border-color: #9CCB8B; border-radius: 26px 26px 26px 26px / 22px 22px 30px 30px; }
.bubble.say-brote::after { background: #F1FBEA; border-color: #9CCB8B; border-radius: 0 0 10px 0; }
.bubble.say-brote .deco { left: -10px; top: -12px; width: 26px; height: 18px; background: #6FBF5A; border-radius: 0 100% 0 100%; transform: rotate(-20deg); }
.bubble.say-androide { background: #1E2836; color: #9FF5FF; border-color: #3E8FA3; border-radius: 6px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 0 0 2px #1E2836, 0 0 18px rgba(127, 232, 255, 0.35), 0 10px 30px rgba(20, 20, 40, 0.3); }
.bubble.say-androide::after { background: #1E2836; border-color: #3E8FA3; border-radius: 0; }
.bubble.say-androide .deco { right: 8px; top: -9px; width: 26px; height: 8px; background: radial-gradient(circle, #FF5E7A 0 2.5px, transparent 3px) 0 0 / 9px 8px; }
.bubble.say-consteliano { background: #2B2350; color: #FFF1C9; border-color: #8A6FE0; border-radius: 22px; }
.bubble.say-consteliano::after { background: #2B2350; border-color: #8A6FE0; }
.bubble.say-consteliano .deco { right: -10px; top: -12px; width: 24px; height: 24px; background: #F2B84B; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); filter: drop-shadow(0 0 4px #F2B84B); }
.bubble.say-bufon { background: #F7EEFF; color: #4A2A6E; border-color: #B28CE6; border-radius: 18px; }
.bubble.say-bufon::after { background: #F7EEFF; border-color: #B28CE6; }
.bubble.say-bufon .deco { right: -7px; top: -9px; width: 16px; height: 20px; background: #8A4FD8; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.bubble.say-vaporista { background: #FFF1E2; color: #5B3415; border-color: #D08A4A; border-radius: 14px; }
.bubble.say-vaporista::after { background: #FFF1E2; border-color: #D08A4A; }
.bubble.say-vaporista .deco { right: -6px; top: -14px; width: 26px; height: 16px; background: radial-gradient(circle at 30% 60%, #fff 0 5px, transparent 5.5px), radial-gradient(circle at 70% 40%, #fff 0 7px, transparent 7.5px); filter: drop-shadow(0 0 1.5px #D08A4A); }
.bubble.say-colorista { background: #FFFFFF; color: #2B2A33; border-color: #FF7FB0; border-radius: 24px 18px 26px 16px; }
.bubble.say-colorista::after { background: #fff; border-color: #FF7FB0; }
.bubble.say-colorista .deco { left: -8px; bottom: -6px; width: 20px; height: 20px; border-radius: 50% 40% 55% 45%; background: #59C8F0; box-shadow: 14px -6px 0 -5px #FFD34E; }
.bubble.say-heraldo { background: #FFF7E0; color: #7A1E28; border-color: #E0473F; border-radius: 18px; }
.bubble.say-heraldo::after { background: #FFF7E0; border-color: #E0473F; }
.bubble.say-heraldo .deco { right: -10px; top: -10px; width: 22px; height: 18px; background: #F2B84B; clip-path: polygon(0 35%, 45% 35%, 100% 0, 100% 100%, 45% 65%, 0 65%); }

/* Paneles nuevos */
.overlay {
  position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px;
  background: rgba(30, 26, 44, 0.45); animation: fadeIn .2s;
}
.overlay.hidden, .hidden.cards, #friendGrid.hidden, #skinGrid.hidden { display: none; }
.panel {
  width: min(560px, 100%); max-height: min(88vh, 780px); overflow: auto; overscroll-behavior: contain;
  padding: 18px 20px 20px;
}
.panel.wide { width: min(760px, 100%); }
.panel header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel header > div:first-child, .panel header > div:nth-child(2):not(.wallet) { flex: 1; min-width: 0; }
.panel h2 { margin: 0; font-size: 26px; font-weight: 900; }
.panel header p { margin: 2px 0 0; font-weight: 700; color: var(--soft); font-size: 14px; }
.panel .close { width: 46px; height: 46px; background: var(--jelly-2); color: var(--text); flex: none; }
.panel .wallet { background: var(--night); padding: 7px 14px 7px 8px; }
.ptabs { display: flex; gap: 8px; margin-bottom: 14px; background: var(--jelly-2); padding: 5px; border-radius: 999px; }
.ptabs button {
  flex: 1; border: 0; background: none; padding: 11px 10px; border-radius: 999px; font: 900 16px var(--font); color: var(--soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.ptabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 2px 0 var(--rim-2); }
.ti { width: 22px; height: 22px; display: inline-block; flex: none; position: relative; }
.ti-suit { background: var(--tint); clip-path: polygon(30% 0, 70% 0, 100% 22%, 88% 42%, 80% 36%, 80% 100%, 20% 100%, 20% 36%, 12% 42%, 0 22%); }
.ti-heart { background: #FF6F9A; clip-path: path('M11 20C11 20 0 13 0 6C0 2.7 2.6 0 5.8 0C8 0 9.9 1.3 11 3.2C12.1 1.3 14 0 16.2 0C19.4 0 22 2.7 22 6C22 13 11 20 11 20Z'); }
.ti-globe { border-radius: 50%; background: radial-gradient(circle at 35% 35%, #9BE0F0, #3FA9C9); }
.ti-sofa { background: var(--tint-2); clip-path: polygon(10% 20%, 90% 20%, 90% 45%, 100% 45%, 100% 85%, 90% 85%, 90% 100%, 80% 100%, 80% 85%, 20% 85%, 20% 100%, 10% 100%, 10% 85%, 0 85%, 0 45%, 10% 45%); }
.ti-bow { background: #FF7FB0; clip-path: polygon(0 10%, 45% 40%, 55% 40%, 100% 10%, 100% 90%, 55% 60%, 45% 60%, 0 90%); }
.ptabs .gem-ico { width: 24px; height: 24px; }

/* Perfil */
.world-group h2 { opacity: 1; color: var(--soft); border-bottom-color: var(--rim); }
.skin { box-shadow: 0 3px 0 var(--rim); }
.skin.on { box-shadow: 0 0 0 3px var(--tint), 0 3px 0 var(--rim); }
.star {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; z-index: 1;
  display: grid; place-items: center;
}
.star i { width: 22px; height: 22px; background: #E3D8C6; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); transition: transform .2s, background .2s; }
.star.on i { background: var(--tint-2); transform: scale(1.12); filter: drop-shadow(0 0 3px rgba(242, 184, 75, .8)); }
.star:active i { transform: scale(.8); }
.fav-note { margin: -4px 2px 12px; font-weight: 800; font-size: 13px; color: var(--soft); display: flex; align-items: center; gap: 6px; }
.fav-note b { color: var(--text); }
.fav-note i { width: 16px; height: 16px; background: var(--tint-2); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }

/* Amigos y corazones */
.pal-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.pal { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 18px; padding: 8px 10px; box-shadow: 0 3px 0 var(--rim); }
.pal img { width: 56px; height: 56px; border-radius: 14px; background: var(--jelly-2); flex: none; }
.pal.unmet img { filter: brightness(0) opacity(.2); background: none; }
.pal.unmet b { color: var(--soft); }
.pal b { display: block; font-size: 15px; font-weight: 900; line-height: 1.15; }
.pal span { display: block; font-size: 12px; font-weight: 800; color: var(--soft); margin: 1px 0 4px; }
.pal .hearts { display: flex; gap: 2px; }
.pal .heart { width: 15px; height: 13px; clip-path: path('M7.5 13 C7.5 13 0 8.2 0 3.9 C0 1.6 1.8 0 3.9 0 C5.4 0 6.8 .8 7.5 2.1 C8.2 .8 9.6 0 11.1 0 C13.2 0 15 1.6 15 3.9 C15 8.2 7.5 13 7.5 13 Z'); }
.pal.special { box-shadow: 0 0 0 2px var(--tint-2), 0 3px 0 var(--rim); }
.online-slot { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 3px dashed var(--rim); color: var(--soft); font-weight: 800; }
.online-slot i { width: 40px; height: 40px; border-radius: 50%; background: var(--jelly-2); flex: none; }
.soon { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--night); color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .03em; }

/* Tienda de gemas y mundos */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card-o {
  position: relative; background: #fff; border-radius: 22px; padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 3px 0 var(--rim), 0 6px 16px rgba(60, 40, 20, 0.06); text-align: center;
}
.card-o b { font-size: 20px; font-weight: 900; }
.card-o small { font-size: 13px; font-weight: 800; color: var(--soft); line-height: 1.25; }
.card-o .soon { position: absolute; top: 10px; right: 10px; }
.card-o button { border: 0; border-radius: 999px; padding: 9px 18px; font: 900 14px var(--font); background: var(--jelly-2); color: #A99C88; cursor: default; }
.card-o button.go { background: var(--mint); color: #fff; cursor: pointer; }
.pile { position: relative; width: 96px; height: 80px; }
.pile i { position: absolute; width: 40px; height: 40px; background: url(assets/gema.png) center / contain no-repeat; }
.planet { width: 86px; height: 86px; border-radius: 50%; position: relative; box-shadow: inset -10px -12px 0 rgba(0,0,0,.12), 0 6px 0 rgba(0,0,0,.06); }
.planet::after { content: ""; position: absolute; left: -10px; right: -10px; top: 46%; height: 10px; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); transform: rotate(-14deg); }
.card-o.lockd .planet { filter: saturate(.75); }

/* Mapa grande */
.map-panel.panel { width: min(900px, 100%); }
.map-body { display: flex; gap: 16px; align-items: flex-start; }
.map-stage { position: relative; flex: 1 1 auto; min-width: 0; max-width: calc(100vh - 190px); aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: #CFE3D6; border: 3px solid var(--rim); }
#bigMap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mapLabels { position: absolute; inset: 0; pointer-events: none; }
.map-tag { position: absolute; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; background: var(--panel); color: var(--text); border: 2px solid var(--rim); border-radius: 999px; padding: 2px 9px; font: 900 12px var(--font); }
.map-tag.you { background: var(--tint); border-color: #A94D39; color: #fff; }
.map-tag.special { background: #FFF1C9; border-color: var(--tint-2); }
.map-tag.portal { background: #E6F5FF; border-color: #7FB8E6; }
.map-tag.friend { background: #E3F7EA; border-color: #5BD18B; }
#mapLegend li.amigo-fuera { font-size: 14px; padding: 7px 12px; min-width: 0; }
#mapLegend li.amigo-fuera b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mapLegend li.amigo-fuera em { white-space: nowrap; }
#mapLegend li.amigo-fuera.ir { cursor: pointer; }
#mapLegend { list-style: none; margin: 0; padding: 0; width: 190px; flex: none; display: flex; flex-direction: column; gap: 8px; }
#mapLegend li { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 15px; background: #fff; border-radius: 16px; padding: 9px 12px; box-shadow: 0 3px 0 var(--rim); }
#mapLegend li em { margin-left: auto; font-style: normal; color: var(--soft); font-size: 13px; }
.dot-l { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.12); }

/* Misiones */
#missionList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mission { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 22px; padding: 12px 14px; box-shadow: 0 3px 0 var(--rim); position: relative; }
.mission .badge { width: 58px; height: 58px; border-radius: 18px; flex: none; display: grid; place-items: center; background: var(--c); box-shadow: inset 0 -5px 0 rgba(0,0,0,.14); }
.mission .badge img { width: 64px; height: 64px; margin-top: 4px; }
.mission > div { flex: 1; min-width: 0; }
.mission b { display: block; font-size: 17px; font-weight: 900; line-height: 1.2; }
.mission span { display: block; font-size: 13px; font-weight: 800; color: var(--soft); margin-top: 2px; }
.mission .st { flex: none; font-size: 12px; font-weight: 900; padding: 5px 10px; border-radius: 999px; background: var(--jelly-2); color: #8A7F70; }
.mission .st.curso { background: #FFF1C9; color: #A56A00; }
.mission .st.hecha { background: #DDF3E3; color: #2E7A4A; }
.mission.final { background: linear-gradient(#FFFDF6, #FFF4D6); box-shadow: 0 0 0 2px var(--tint-2), 0 3px 0 var(--rim); margin-top: 6px; }
.mission.final .badge { background: var(--night); }
.mission.final .badge i { width: 34px; height: 34px; background: var(--tint-2); clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.mission.locked { filter: saturate(.3); opacity: .8; }
.mission.locked .badge i { background: #8A8FA0; clip-path: path('M10 15v-4a7 7 0 0 1 14 0v4h2v15H8V15zM13.5 15h7v-4a3.5 3.5 0 0 0-7 0z'); width: 34px; height: 34px; }
.progress4 { display: flex; gap: 4px; margin-top: 6px; }
.progress4 i { width: 22px; height: 6px; border-radius: 3px; background: var(--jelly-2); }
.progress4 i.on { background: var(--tint-2); }

/* Amigos online y objetos */
.add-friend { display: flex; gap: 8px; margin-bottom: 12px; }
.add-friend input { flex: 1; min-width: 0; height: 50px; border-radius: 999px; border: 3px solid var(--rim); background: #fff; padding: 0 16px; font: 800 16px var(--font); color: var(--text); outline: none; }
.add-friend input:focus { border-color: var(--tint-2); }
.add-friend button { border: 0; border-radius: 999px; padding: 0 20px; background: var(--mint); color: #fff; font: 900 16px var(--font); cursor: pointer; box-shadow: 0 3px 0 #356049; }
.online-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cards.items { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.item-o { position: relative; background: #fff; border-radius: 20px; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 3px 0 var(--rim); font: 800 13px var(--font); text-align: center; }
.item-o img { width: 84px; height: 84px; object-fit: contain; }
.item-o b { position: absolute; top: 6px; right: 8px; background: var(--night); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.item-o em { font-style: normal; font-size: 11px; color: var(--mint); font-weight: 900; }
.cards .empty-o { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px; color: var(--soft); font-weight: 800; }
.cards .empty-o i { width: 64px; height: 64px; border-radius: 22px; background: var(--jelly-2); }

/* Móvil */
@media (max-width: 700px) {
  :root { --me: 88px; --map: 92px; }
  .plate.title { height: 46px; font-size: 20px; padding: 0 14px 0 12px; border-radius: 16px; }
  .plate.title i { width: 20px; height: 20px; }
  .plate.icon { width: 46px; height: 46px; border-radius: 16px; }
  .plate.icon svg { width: 26px; height: 26px; }
  .shop-btn { height: 52px; min-width: 0; font-size: 15px; border-radius: 18px; padding: 0 12px 0 8px; }
  .shop-btn svg { width: 28px; height: 28px; }
  .money { height: 34px; min-width: 92px; font-size: 15px; padding-right: 11px; }
  .spark-ico, .gem-ico { width: 24px; height: 24px; }
  .hud-tr { gap: 8px; }
  #chatbar { width: auto; left: calc(var(--gut) + var(--me) + 8px); right: calc(var(--gut-r) + var(--map) + 8px); transform: none; gap: 6px; bottom: var(--gut-b); }
  #chatbar .round { width: 42px; height: 42px; }
  #chatbar .round svg { width: 23px; height: 23px; }
  #onlineBtn .led { width: 11px; height: 11px; right: 2px; top: 2px; }
  #chatForm { height: 46px; padding: 0 4px 0 10px; }
  #chatInput { font-size: 16px; }
  #chatbar .chat-ico { display: none; }
  /* Al escribir, la barra se estira de lado a lado */
  #chatbar.wide { left: var(--gut); right: var(--gut-r); bottom: calc(var(--gut-b) + var(--me) + 14px); z-index: 7; }
  #chatbar.wide .round { display: none; }
  #chatbar.wide #chatForm { height: 54px; }
  #chatbar.wide .chat-ico { display: block; }
  /* Dos pisos entre los círculos: los tres botones arriba y la barra debajo */
  #chatbar { flex-wrap: wrap; justify-content: space-between; row-gap: 6px; }
  #chatForm { order: 3; flex: 1 1 100%; }
  #meWrap .fav { width: 48px; height: 48px; margin: -24px; }
  #mapWrap { gap: 18px; }
  #zoomBtns { position: fixed; right: var(--gut-r); bottom: calc(var(--gut-b) + var(--map) + 70px); }
  .round.small { width: 38px; height: 38px; }
  #where { font-size: 11px; top: -12px; padding: 2px 8px; }
  #placeName { max-width: 72px; }
  #clock { display: none; }
  #action { bottom: calc(var(--gut-b) + var(--me) + 18px); }
  #casaBtns { left: var(--gut); bottom: calc(var(--gut-b) + var(--me) + 18px); }
  .panel { padding: 14px 14px 16px; border-radius: 24px; }
  .panel h2 { font-size: 22px; }
  .ptabs button { font-size: 15px; padding: 10px 6px; }
  .map-body { flex-direction: column; }
  #mapLegend { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards.items { grid-template-columns: repeat(3, 1fr); }
  .item-o img { width: 66px; height: 66px; }
}
@media (max-width: 380px) { .plate.title { font-size: 17px; } }
.panel .world-group h2 { font-size: 13px; letter-spacing: .08em; margin: 0 0 10px; }
.panel .world-group + .world-group { margin-top: 20px; }
@media (max-width: 700px) {
  .map-stage { flex: none; width: 100%; max-width: none; }
}
@media (max-width: 700px) { .map-tag { font-size: 10px; padding: 1px 6px; } }
/* Capas: el HUD (3) queda por debajo de cualquier panel */
#decor { z-index: 4; }
#shop, #worldgate { z-index: 6; }
#cheats { z-index: 7; }
#toast { z-index: 8; }
#fade { z-index: 9; }

/* Sesión 14: sin botones de zoom (rueda y pellizco siguen) y Misiones más discreta, sin contador */
#zoomBtns { display: none !important; }
#missionsCount { display: none !important; }


.mission-sep { list-style: none; margin: 6px 0 -2px; }
.mission-sep h2 { margin: 0; padding-bottom: 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); border-bottom: 2px solid var(--rim); }
.mission-empty { list-style: none; text-align: center; padding: 28px 12px; font-weight: 800; color: var(--soft); }

/* ───────── Minijuegos de plataforma (src/minijuegos/) ───────── */
.mg-entry {
  position: fixed; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none;
  padding: var(--gut-t) var(--gut-r) var(--gut-b) var(--gut);
}
.mg-entry .mg-card { pointer-events: auto; }
.mg-entry.hidden, .mg-play-screen.hidden, .mg-result.hidden, .mg-record.hidden, .mg-reward.hidden { display: none; }
.mg-card {
  --sq-r: 40px; --sq-drop: 6;
  position: relative; width: min(330px, 100%); padding: 22px 22px 18px; text-align: center;
  animation: mgPop .32s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes mgPop { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.mg-card p { margin: 0; }
.mg-x { position: absolute !important; z-index: 3; top: 14px; right: 14px; width: 40px; height: 40px; font-size: 22px; }
.mg-game { font-size: 15px; font-weight: 900; color: var(--soft); letter-spacing: .02em; }
.mg-portrait {
  position: relative; width: 136px; height: 136px; margin: 12px auto 8px; border-radius: 50%;
  background: var(--jelly-2); border: 3px solid var(--rim); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.05);
}
.mg-portrait img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.mg-portrait.small { width: 84px; height: 84px; margin-top: 0; }
.mg-tier {
  position: absolute; right: -4px; bottom: 4px; min-width: 44px; padding: 4px 9px; border-radius: 999px;
  font-size: 14px; font-weight: 900; color: #fff; border: 3px solid var(--panel);
}
.mg-tier.t0 { background: #A39A8C; }
.mg-tier.t1 { background: #3F8FD8; }
.mg-tier.t2 { background: #F2B84B; color: #5a3a00; box-shadow: 0 0 16px rgba(242, 184, 75, 0.9); }
.mg-who { font-size: 16px; font-weight: 900; }
.mg-next { margin-top: 12px !important; font-size: 13px; font-weight: 900; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; }
.mg-level { font-size: 46px; font-weight: 900; line-height: 1.05; color: var(--night); }
.mg-card .mg-play { margin-top: 14px; width: 100%; height: 60px; border-radius: 30px; font-size: 22px; }
.mg-best { margin-top: 10px !important; font-size: 13px; font-weight: 800; color: var(--soft); min-height: 1em; }

.mg-play-screen { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 8; background: #120c26; opacity: 0; transition: opacity .25s; }
.mg-play-screen.open { opacity: 1; }
.mg-host, .mg-host canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.mg-hud {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px;
  padding: var(--gut-t) var(--gut-r) 0 var(--gut); pointer-events: none;
}
.mg-hud > * { pointer-events: auto; }
.mg-chip {
  height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 5px; border-radius: 999px; flex: none;
  background: var(--panel); color: var(--text); border: 3px solid var(--rim); box-shadow: 0 4px 0 var(--rim-2); font-weight: 900; font-size: 16px;
}
.mg-chip img { width: 34px; height: 34px; border-radius: 50%; background: var(--jelly-2); }
/* el nivel de la partida: la palabra pequeña encima y el número grande */
.mg-me { height: 58px; padding-right: 16px; }
.mg-me img { width: 44px; height: 44px; }
.mg-me span { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.mg-me span.hidden { display: none; }
.mg-me small { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.mg-me b { font-size: 30px; color: var(--night); }
.mg-score { padding-left: 12px; }
.mg-bar {
  position: relative; flex: 1; max-width: 440px; margin: 0 auto; height: 34px; border-radius: 999px; overflow: hidden;
  background: var(--panel); border: 3px solid var(--rim); box-shadow: 0 4px 0 var(--rim-2);
}
.mg-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--tint-2); transition: width .2s; }
.mg-bar span { position: relative; display: block; text-align: center; line-height: 28px; font-weight: 900; font-size: 15px; color: var(--text); }
.mg-bar[data-icon="drop"] span::before { content: ""; display: inline-block; width: 12px; height: 10px; margin-right: 6px; background: var(--night); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.mg-ico { width: 18px; height: 18px; flex: none; background: var(--tint); }
.mg-ico.pts { clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); background: var(--tint-2); }
.mg-ico.bone { height: 10px; border-radius: 6px; background: var(--tint-2); box-shadow: -6px -3px 0 -2px var(--tint-2), -6px 3px 0 -2px var(--tint-2), 6px -3px 0 -2px var(--tint-2), 6px 3px 0 -2px var(--tint-2); width: 16px; }
.mg-ico.moves { border-radius: 4px 4px 9px 9px; background: var(--mint); clip-path: polygon(30% 0, 70% 0, 70% 30%, 100% 70%, 100% 100%, 0 100%, 0 70%, 30% 30%); }
.mg-result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(24, 16, 44, 0.45); padding: 16px; }
.mg-result h3 { margin: 4px 0 0; font-size: 22px; font-weight: 900; color: var(--night); }
.mg-big { font-size: 48px; font-weight: 900; line-height: 1.1; }
.mg-reward { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; font-size: 18px; color: var(--soft); }
.mg-record { color: var(--tint); font-weight: 900; margin-top: 4px !important; }
.mg-card.win h3 { color: var(--mint); }
@media (max-width: 520px) {
  .mg-chip { height: 40px; font-size: 14px; }
  .mg-chip img { width: 28px; height: 28px; }
  .mg-me { height: 50px; }
  .mg-me img { width: 36px; height: 36px; }
  .mg-me b { font-size: 26px; }
  .mg-level { font-size: 40px; }
  /* en el móvil la barra de progreso baja a su propia fila: entre los chips se quedaba en "0 /" */
  .mg-hud { flex-wrap: wrap; row-gap: 8px; }
  .mg-score { margin-left: auto; }
  .mg-bar { order: 9; flex-basis: 100%; max-width: none; height: 30px; }
  .mg-bar span { line-height: 24px; font-size: 14px; }
}
/* cómo se juega (src/minijuegos/tutorial.js): tres pasos en una pantalla */
.mg-play-screen { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mg-help { font-weight: 900; }
.mg-card-help { position: absolute !important; z-index: 3; top: 14px; left: 14px; }
.mg-help.hidden, .mg-tuto.hidden { display: none; }
.mg-tuto { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(24, 16, 44, 0.55); padding: var(--gut-t) var(--gut-r) var(--gut-b) var(--gut); overflow-y: auto; }
.mg-tuto .mg-card { width: min(720px, 100%); padding: 18px; }
.mg-tuto-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mg-tuto-steps li { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mg-tuto-steps p { font-size: 16px; font-weight: 900; line-height: 1.2; color: var(--night); }
.mg-tuto-pic { position: relative; width: 100%; aspect-ratio: 1; border-radius: 22px; overflow: hidden; border: 3px solid var(--rim); background: #120c26; }
.mg-tuto-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-tuto-pic em { position: absolute; left: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 15px; color: #fff; background: var(--tint); border: 3px solid #fff; }
.mg-tuto .mg-tuto-ok { margin-top: 16px; width: min(280px, 100%); height: 56px; border-radius: 28px; font-size: 20px; }
/* el dedo: un círculo blanco que repite el gesto */
.mg-g { position: absolute; left: 50%; top: 55%; width: 0; height: 0; pointer-events: none; }
.mg-g b { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); border: 3px solid var(--night); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.3); }
.mg-g::before, .mg-g::after { position: absolute; font: 900 30px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 2px 0 var(--night), 0 0 6px var(--night); }
.g-goal { display: none; }
.g-swipe-x b { animation: gX 1.6s ease-in-out infinite; }
.g-swipe-x::before { content: "‹"; left: -64px; top: -17px; } .g-swipe-x::after { content: "›"; left: 50px; top: -17px; }
@keyframes gX { 0%, 100% { transform: translateX(-34px); } 50% { transform: translateX(34px); } }
.g-swipe-y b { animation: gY 1.6s ease-in-out infinite; }
.g-swipe-y::before { content: "‹"; left: -8px; top: -70px; transform: rotate(90deg); } .g-swipe-y::after { content: "›"; left: -8px; top: 42px; transform: rotate(90deg); }
@keyframes gY { 0%, 100% { transform: translateY(-30px); } 50% { transform: translateY(30px); } }
.g-tap b, .g-tap-2 b { animation: gTap 1.2s ease-out infinite; }
@keyframes gTap { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); } 30% { transform: scale(0.8); } 60% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); } }
.g-tap-2 b { animation: gTap2 2s ease-in-out infinite; }
@keyframes gTap2 { 0%, 40% { transform: translateX(-30px) scale(1); } 15% { transform: translateX(-30px) scale(0.8); } 60%, 100% { transform: translateX(30px) scale(1); } 75% { transform: translateX(30px) scale(0.8); } }
.g-drag { top: 70%; } .g-drag b { animation: gDrag 2s ease-in-out infinite; }
@keyframes gDrag { 0%, 15% { transform: translate(20px, 30px) scale(0.85); } 75%, 100% { transform: translate(-20px, -55px) scale(0.85); opacity: 1; } 90% { opacity: 0; } }
.g-aim { top: 75%; } .g-aim b { animation: gAim 2s ease-in-out infinite; }
@keyframes gAim { 0%, 100% { transform: translateX(-36px) scale(0.85); } 50% { transform: translateX(36px) scale(0.85); } }
@media (max-width: 560px) {
  .mg-tuto .mg-card { padding: 14px; }
  .mg-tuto-steps { grid-template-columns: 1fr; gap: 8px; }
  .mg-tuto-steps li { flex-direction: row; gap: 12px; text-align: left; }
  .mg-tuto-pic { width: 34%; flex: none; border-radius: 16px; }
  .mg-g { transform: scale(0.6); }
  .mg-tuto .mg-tuto-ok { margin-top: 12px; }
}

/* ═════════ UI blandita (src/ui/squish.js): cada placa es un SVG con el borde vivo ═════════ */
.sq { isolation: isolate; background: none !important; border-color: transparent !important; box-shadow: none !important; }
.sq-back, .sq-front { position: absolute; overflow: visible; pointer-events: none; }
.sq-back { z-index: -1; filter: drop-shadow(0 8px 12px rgba(30, 24, 40, 0.16)); }
.sq-front { z-index: 2; }
.shop-btn { --sq-fill: var(--tint); --sq-rim: #A94D39; --sq-shadow: #8C3E2E; }
#where { --sq-fill: var(--night); --sq-rim: var(--night); --sq-shadow: #1C2430; --sq-drop: 3; z-index: 3; }
#where .sq-back { filter: none; }
#me, #mapBtn { overflow: visible; --sq-drop: 5; }
#me { --sq-fill: var(--me-bg, #EFE6D6); }
#me img, #me canvas { border-radius: 50%; background: radial-gradient(circle at 50% 38%, #FFFFFF, var(--me-bg, #EFE6D6) 72%); }
#mapBtn { --sq-fill: #CFE3D6; }

/* ═════════ Menú compartido (src/ui/hub.js): los tomos a la izquierda, el libro abierto a la derecha ═════════
   Cada sección es un tomo cuyo lomo asoma por debajo del panel; el elegido sale un poco y se funde con él.
   Las pestañas de la sección van dentro del panel, siempre arriba. */
.hub {
  --hub-w: min(1040px, calc(100vw - 280px)); --hub-h: min(640px, calc(100vh - 70px));
  position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center;
  padding: 24px var(--gut-r) 24px var(--gut); color: var(--text);
  background: rgba(30, 26, 44, 0); visibility: hidden; pointer-events: none; transition: background .25s;
}
.hub.open { visibility: visible; pointer-events: auto; background: rgba(30, 26, 44, 0.42); }
.hub.closing { visibility: visible; }

/* Los tomos: todos iguales y en fila, cada uno con su color; el lomo se mete bajo el panel */
.hub-nav { position: relative; z-index: 1; width: 210px; margin-right: -34px; flex: none; display: flex; flex-direction: column; gap: 10px; }
.hub-b {
  --tomo: #A39CB0; --sq-r: 22px; --sq-drop: 4;
  --sq-fill: color-mix(in srgb, var(--tomo) 34%, var(--jelly)); --sq-rim: color-mix(in srgb, var(--tomo) 55%, var(--jelly)); --sq-shadow: color-mix(in srgb, var(--tomo) 60%, var(--rim-2));
  position: relative; height: 66px; border: 3px solid transparent; border-radius: 22px; padding: 0 46px 0 24px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; font: 900 17px var(--font); color: var(--ink-strong); text-align: left;
  transform: translateX(14px); transition: transform .3s cubic-bezier(.3,1.6,.5,1), color .2s;
}
/* las cintas del lomo */
.hub-b::before { content: ""; position: absolute; left: 10px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--tomo) 60%, #fff); }
.hub-b svg { width: 28px; height: 28px; flex: none; color: color-mix(in srgb, var(--tomo) 75%, #000); }
.hub-b svg .hole { fill: var(--sq-fill); }
.hub-b svg .hole-line { stroke: var(--sq-fill); }
.hub-b img { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--jelly-2); }
.hub-b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-b:hover { transform: translateX(4px); }
.hub-b.on { --sq-fill: var(--jelly); --sq-rim: var(--rim); --sq-shadow: var(--rim-2); color: var(--text); transform: translateX(-12px); }
.b-me { --tomo: #9C8CD0; }
.b-chars { --tomo: #E77FA0; }
.b-friends { --tomo: #EF8A2C; }
.b-items { --tomo: #E2B21B; }
.b-missions { --tomo: #E5574D; }
.b-settings { --tomo: #A39CB0; }
.b-shop { --tomo: var(--tint); cursor: default; }
.b-wallet { --tomo: #5FC8E8; cursor: default; font-size: 20px; }
.hub-b.b-wallet:hover, .hub-b.b-shop:hover { transform: translateX(14px); }
.hub-b.b-shop.on:hover { transform: translateX(-12px); }

/* El panel: siempre del mismo tamaño; las pestañas, dentro y arriba */
.hub-main { position: relative; z-index: 2; width: var(--hub-w); height: var(--hub-h); flex: none; }
.hub-panel {
  --sq-r: 48px; --sq-drop: 6;
  position: absolute; inset: 0; border: 4px solid var(--rim); border-radius: 48px; background: var(--panel);
  display: flex; flex-direction: column; padding: 22px 28px 24px;
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
}
.hub-panel > .sq-back { filter: drop-shadow(0 0 22px var(--glow)) drop-shadow(0 26px 50px rgba(20, 16, 40, 0.35)); }
.hub-tabs { position: relative; z-index: 2; display: flex; gap: 10px; margin: 0 60px 16px 0; flex: none; }
.hub-t {
  --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-shadow: var(--rim-2); --sq-drop: 3;
  height: 48px; padding: 0 26px; border: 3px solid transparent; border-radius: 24px; cursor: pointer;
  font: 900 17px var(--font); color: var(--soft); transition: color .2s, transform .3s cubic-bezier(.3,1.6,.5,1);
}
.hub-t:hover { transform: translateY(-2px); }
.hub-t.on { --sq-fill: #fff; --sq-rim: var(--rim); color: var(--text); }
.hub-x {
  --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-drop: 0;
  position: absolute; z-index: 3; top: 22px; right: 24px; width: 46px; height: 46px; border: 3px solid transparent; border-radius: 50%;
  font: 900 24px var(--font); line-height: 1; color: var(--soft); cursor: pointer; padding: 0;
}
.hub-x .sq-back { filter: none; }
.hub-sec { display: none; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 6px 6px; scrollbar-width: thin; scrollbar-color: var(--rim) transparent; }
.hub-sec.on { display: block; }
.hub-tab { display: none; }
.hub-tab.on { display: block; }
.hub-tab.enter { animation: tabSwap .32s cubic-bezier(.3,1.3,.5,1); }
.me-head { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.me-head img { width: 66px; height: 66px; border-radius: 22px; background: var(--jelly-2); flex: none; }
.me-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.me-head p { margin: 2px 0 0; font-weight: 700; color: var(--soft); font-size: 14px; }
.hub-sec .world-group h2 { font-size: 13px; letter-spacing: .08em; margin: 0 0 10px; color: var(--soft); border-bottom-color: var(--rim); opacity: 1; }
.hub-sec .world-group + .world-group { margin-top: 20px; }
.skin-row.solo { grid-template-columns: minmax(0, 1fr); }
.skin-row.solo .skin { width: 130px; justify-self: start; padding: 8px 6px 10px; }
.skin-row.solo .skin img { max-width: 90px; }
.set-tab { max-width: 520px; margin: 0 auto; }
.set-tab .set-list { border-top: 0; margin-top: 0; padding-top: 0; }
.set-tab .set-list button { font-size: 16px; padding: 14px 12px; }
.set-tab .set-partida { border-top: 2px dashed var(--rim); margin-top: 10px; padding-top: 6px; }
.hub-sec .empty-o { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 10px; color: var(--soft); font-weight: 800; }
.hub-sec .empty-o i { width: 64px; height: 64px; border-radius: 22px; background: var(--jelly-2); }

/* Abrir: el libro hace "blop" y los tomos salen de debajo. Cerrar: se recoge y no vuelve a aparecer */
.hub.open .hub-main { animation: libro .42s cubic-bezier(.3, 1.4, .5, 1); }
.hub.open .hub-b { animation: tomo .45s cubic-bezier(.3, 1.5, .5, 1) backwards; animation-delay: calc(.08s + var(--i) * 40ms); }
.hub.closing .hub-main, .hub.closing .hub-nav { animation: recoge .2s ease-in forwards; }
@keyframes libro { 0% { opacity: 0; transform: scale(.94, .9); } 60% { opacity: 1; transform: scale(1.01, .995); } }
@keyframes tomo { from { opacity: 0; transform: translateX(90px); } }
@keyframes recoge { to { opacity: 0; transform: scale(.96); } }
@keyframes tabSwap { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .hub.open .hub-main, .hub.open .hub-b, .hub.closing .hub-main, .hub.closing .hub-nav, .hub-tab.enter { animation-duration: .01s; }
}

/* Pantallas bajas: los tomos encogen */
@media (max-height: 640px) {
  .hub-b { height: 54px; font-size: 15px; }
  .hub-nav { gap: 6px; }
}
@media (max-width: 700px) {
  #chatbar .round { width: 35px; height: 35px; }
  #chatbar { column-gap: 4px; }
  #chatbar .round svg { width: 20px; height: 20px; }
}

/* ═════════ personajes (src/ui/personajes_ui.js): Personajes, inventario, gestos, compañía y la mesa de mezcla ═════════ */
.gl { width: 26px; height: 26px; flex: none; }
.gl.big { width: 44px; height: 44px; }
.gl.s { width: 16px; height: 16px; }
.gl-mini { width: 14px; height: 14px; flex: none; }
img.gl.face { border-radius: 8px; background: var(--jelly-2); }
.ing { width: 30px; height: 30px; flex: none; }
.ing.big { width: 58px; height: 58px; }
.ing.s { width: 18px; height: 18px; }
.obj { width: 34px; height: 34px; flex: none; }
.obj.big { width: 64px; height: 64px; }
.obj.s { width: 22px; height: 22px; }

/* El corazón del perfil: solo aparece cuando un especial llega al nivel 1 */
.me-heart { display: none; align-items: center; gap: 6px; margin-left: auto; margin-right: 52px; font: 900 18px var(--font); color: #e0527f; }
.me-heart.on { display: inline-flex; }
.me-heart .heart { width: 26px; height: 23px; clip-path: path('M13 23 C13 23 0 14.6 0 7 C0 3 3.2 0 6.9 0 C9.4 0 11.8 1.4 13 3.6 C14.2 1.4 16.6 0 19.1 0 C22.8 0 26 3 26 7 C26 14.6 13 23 13 23 Z'); }
.me-heart.pop { animation: heartPop .9s cubic-bezier(.3,1.7,.5,1); }
.me-heart.hud { position: absolute; z-index: 4; right: -6px; top: -6px; margin: 0; padding: 4px 9px 4px 7px; border-radius: 999px; background: var(--panel); border: 3px solid var(--rim); box-shadow: 0 3px 0 var(--rim-2); font-size: 15px; pointer-events: none; }
.me-heart.hud .heart { width: 18px; height: 16px; clip-path: path('M9 16 C9 16 0 10 0 4.8 C0 2 2.2 0 4.8 0 C6.6 0 8.2 1 9 2.6 C9.8 1 11.4 0 13.2 0 C15.8 0 18 2 18 4.8 C18 10 9 16 9 16 Z'); }
@keyframes heartPop { from { transform: scale(.2) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.35) rotate(6deg); } }
body.decorating .me-heart.hud { display: none; }

/* Personajes: la lista */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding: 6px 2px; }
.pj-card { --sq-fill: #fff; --sq-rim: var(--rim); --sq-shadow: var(--rim); --sq-drop: 4; border: 3px solid transparent; border-radius: 30px; padding: 14px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font: 900 17px var(--font); color: var(--text); }
.pj-card img { width: 116px; height: 116px; border-radius: 24px; background: var(--jelly-2); }
.pj-card.unmet img { filter: brightness(0) opacity(.2); background: none; }
.pj-card.unmet b { color: var(--soft); }
.pj-card em { font-style: normal; font-size: 13px; color: var(--soft); min-height: 16px; }
.pj-hearts { display: inline-flex; gap: 3px; }
.pj-hearts .heart { width: 18px; height: 16px; }
.h3 { width: 22px; height: 22px; object-fit: contain; flex: none; vertical-align: middle; }
.h3.vacio { filter: grayscale(1) brightness(.85) opacity(.4); }
.pj-hearts .h3 { width: 20px; height: 20px; margin: 0 -1px; }
.cas .pr .gl.h3 { width: 28px; height: 28px; }

/* Personajes: la tarjeta */
/* La foto en grande a la izquierda; a la derecha, un solo corazón con su nivel y el nombre (como el panel de subir de nivel) */
.pj-top { position: relative; display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: center; gap: 24px; margin-bottom: 16px; }
.pj-top .pj-back { position: absolute; left: 8px; top: 8px; z-index: 2; }
.pj-top .pj-portrait { width: 100%; height: auto; aspect-ratio: 1; border-radius: 32px; place-items: center; overflow: hidden; }
.pj-top .pj-portrait img { width: 94%; height: 94%; object-fit: contain; }
.pj-top .pj-info { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 34px; row-gap: 12px; }
.pj-top .pj-info h2 { margin: 0; font-size: clamp(24px, 3.2vw, 32px); color: var(--ink-strong); overflow-wrap: anywhere; }
.pj-top .pj-lvl { margin-top: 2px; }
.pj-top .pj-bar { grid-column: 1 / -1; max-width: none; width: 100%; }
.pj-corazon { position: relative; flex: none; display: inline-grid; place-items: center; width: 84px; height: 84px; }
.pj-corazon .h3, .pj-corazon .heart { width: 100%; height: 100%; margin: 0; }
.pj-corazon b { position: absolute; right: -24px; bottom: 0; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center;
  background: #fff; color: #ff6f9a; font: 900 20px var(--font); box-shadow: 0 3px 0 var(--rim); }
.pj-corazon.s { width: 34px; height: 34px; }
.pj-corazon.s b { right: -14px; bottom: -4px; min-width: 24px; height: 24px; padding: 0 5px; font-size: 13px; box-shadow: 0 2px 0 var(--rim); }
.pj-card-info { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.pj-card-info b { text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.pj-card-info .pj-corazon.s { margin-right: 14px; }
.pj-back { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--jelly-2); color: var(--soft); font: 900 26px var(--font); cursor: pointer; line-height: 1; padding: 0 0 4px; flex: none; }
.pj-portrait { width: 104px; height: 104px; flex: none; border-radius: 28px; background: var(--jelly-2); display: grid; place-items: end center; overflow: visible; }
.pj-portrait img { width: 100px; height: 100px; transform-origin: 50% 92%; display: block; will-change: transform; }
.pj-portrait.unmet img { filter: brightness(0) opacity(.2); }
.pj-info { flex: 1; min-width: 180px; }
.pj-info h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.pj-lvl { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 15px; color: var(--soft); }
.pj-lvl .heart { width: 20px; height: 18px; clip-path: path('M10 18 C10 18 0 11.2 0 5.4 C0 2.4 2.4 0 5.4 0 C7.4 0 9.2 1.1 10 2.9 C10.8 1.1 12.6 0 14.6 0 C17.6 0 20 2.4 20 5.4 C20 11.2 10 18 10 18 Z'); }
.pj-bar { height: 12px; border-radius: 99px; background: #EFE4CF; margin-top: 8px; overflow: hidden; max-width: 320px; }
.pj-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(#ff8fb0, #ff6f9a); transition: width .5s; }
.dots { display: flex; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #E6DAC4; }
.dot.on { background: #ff6f9a; }
.pj-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 12px; margin-bottom: 12px; background: var(--jelly-2); border-radius: 24px; animation: tabSwap .25s; }
.pj-tray .it { position: relative; border: 0; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 var(--rim); padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font: 800 12px var(--font); color: var(--text); cursor: pointer; text-align: center; }
.pj-tray .it:hover { transform: translateY(-2px); }
.pj-tray .it b { position: absolute; top: 4px; right: 6px; background: var(--night); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; }
.pj-tray .it .obj { width: 46px; height: 46px; }
.pj-gustos { display: flex; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.gusto { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 99px; padding: 6px 14px 6px 8px; box-shadow: 0 3px 0 var(--rim); }
.gusto.nuevo { opacity: .65; }
.gusto .obj { width: 30px; height: 30px; }
.gusto .pips { display: flex; gap: 4px; align-items: center; min-width: 38px; }
.gusto .pips b { color: var(--soft); font-size: 16px; padding: 0 12px; }
.pip { width: 11px; height: 10px; background: #E6DAC4; clip-path: path('M5.5 10 C5.5 10 0 6.2 0 3 C0 1.2 1.3 0 3 0 C4.1 0 5 .6 5.5 1.5 C6 .6 6.9 0 8 0 C9.7 0 11 1.2 11 3 C11 6.2 5.5 10 5.5 10 Z'); }
.pip.on { background: #ff6f9a; }
/* Lo de hoy (regalos en Constelia; minijuego y show en el circo): delante de los gustos, con su bocadillo al tocarlo */
.gusto.hoy { position: relative; border: 0; font: inherit; cursor: pointer; color: var(--ink-ui); }
.gusto.hoy:hover { transform: translateY(-2px); }
.gusto.hoy .gl, .gusto.hoy .obj { width: 30px; height: 30px; }
.gusto.hoy .pips { min-width: 0; }
.gusto.hoy .pip { width: 13px; height: 12px; clip-path: path('M6.5 12 C6.5 12 0 7.4 0 3.6 C0 1.4 1.5 0 3.5 0 C4.8 0 5.9 .7 6.5 1.8 C7.1 .7 8.2 0 9.5 0 C11.5 0 13 1.4 13 3.6 C13 7.4 6.5 12 6.5 12 Z'); }
.gusto.hoy.lleno { background: #FFF0F5; }
.gusto.hoy .tip { position: absolute; left: 2px; bottom: calc(100% + 10px); transform: translateY(6px) scale(.9); transform-origin: 20px 100%; background: var(--night); color: #fff; font: 800 13px var(--font); white-space: nowrap; padding: 6px 12px; border-radius: 99px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5; }
.gusto.hoy .tip::after { content: ''; position: absolute; left: 17px; top: 100%; border: 6px solid transparent; border-top-color: var(--night); }
.gusto.hoy.abierto .tip { opacity: 1; transform: none; }
.pj-gustos .gusto.hoy + .gusto:not(.hoy) { margin-left: 10px; }
.pj-camino { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.cas { position: relative; border: 3px solid transparent; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 var(--rim); padding: 18px 2px 6px; min-height: 76px; cursor: pointer; font: inherit; color: var(--text); }
.cas > i { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font: 900 11px var(--font); font-style: normal; color: var(--soft); }
.cas .prs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 4px; }
.cas .pr { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }
.cas .pr .gl { width: 28px; height: 28px; }
.cas .pr.bloqueado .gl { filter: grayscale(1) opacity(.45); }
.cas .pr.pendiente .gl { animation: bob 1.4s ease-in-out infinite; }
.cas.entregada { background: #F1F8EC; }
.cas.entregada::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); }
.cas.pendiente { box-shadow: 0 0 0 3px var(--tint-2), 0 3px 0 var(--rim); }
.cas.bloqueada { background: #F6EFE2; box-shadow: none; }
.cas.sel { border-color: var(--night); }
.cas .q, .q-big { font: 900 24px var(--font); color: #b9ab94; font-style: normal; }
.cas .q { display: block; margin-top: 4px; }
.cas.oculta.entregada .q { color: var(--mint); }
.pj-cap { display: flex; gap: 14px; align-items: center; min-height: 64px; margin-top: 12px; background: var(--jelly-2); border-radius: 24px; padding: 10px 16px; }
.pj-cap:empty { display: none; }
.cap-n { width: 38px; height: 38px; border-radius: 50%; background: var(--night); color: #fff; display: grid; place-items: center; font: 900 16px var(--font); flex: none; }
.cls { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 800; font-size: 15px; }
.cl .gl { width: 30px; height: 30px; }
.cl.bloqueado, .cl.pendiente { color: var(--soft); }
.cl q { flex: 1 1 100%; font-weight: 800; font-size: 15px; line-height: 1.35; quotes: none; color: var(--text); background: #fff; border-radius: 16px; padding: 8px 14px; }
.cl small { color: var(--soft); font-weight: 800; }
.mini { border: 0; border-radius: 99px; padding: 6px 14px; background: var(--night); color: #fff; font: 900 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.mini.gem { background: #3FA9C9; }
.empty-o.small { padding: 18px 10px; }
.empty-o.small i { width: 40px; height: 40px; border-radius: 16px; background: var(--jelly-2); }
@keyframes bob { 50% { transform: translateY(-3px); } }
@media (max-width: 700px) { .pj-camino { grid-template-columns: repeat(5, 1fr); } .me-heart { margin-right: 44px; } }

/* Inventario, bailes y compañía */
#invGrid .cards.items, #bailGrid .cards.items, #cmpGrid .cards.items { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.item-o.bai { cursor: pointer; padding-top: 12px; }
.item-o.bai:hover { transform: translateY(-2px); }
.fav.baile { background: var(--jelly-2); }
.fav.baile img { object-fit: contain; transform: scale(.82); }
.item-o .ing.big, .item-o .obj.big { margin: 8px 0 2px; }
.item-o.ges, .item-o.cmp { border: 3px solid transparent; cursor: pointer; padding-top: 12px; }
.item-o.cmp.on { border-color: var(--night); }
.item-o.cmp em { font-style: normal; font-size: 11px; font-weight: 900; color: var(--mint); }
.item-o.lock { min-height: 108px; justify-content: center; cursor: default; background: #F6EFE2; box-shadow: none; }
.item-o .q { font: 900 28px var(--font); color: #b9ab94; font-style: normal; }
.item-o.ges:hover, .item-o.cmp:hover { transform: translateY(-2px); }

/* Misiones: Historia y tablón */
.mission-empty.vacio { padding: 12px; }
.mission-empty.vacio i { display: block; margin: 0 auto; width: 46px; height: 46px; border-radius: 16px; background: var(--jelly-2); }
.tab-lock { display: grid; place-items: center; padding: 18px; }
.tab-lock i { width: 72px; height: 72px; border-radius: 24px; background: var(--jelly-2); display: grid; place-items: center; }
.tablon { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.sec { position: relative; background: #fff; border-radius: 24px; padding: 14px 14px 14px; box-shadow: 0 3px 0 var(--rim); display: flex; flex-direction: column; gap: 10px; }
.sec.vacia { min-height: 110px; background: #F6EFE2; box-shadow: none; }
.sec .pide { display: flex; align-items: center; gap: 12px; }
.sec .pide b { display: block; font-size: 15px; font-weight: 900; line-height: 1.2; }
.sec .pide .n { display: block; font: 900 13px var(--font); color: var(--soft); margin-top: 2px; }
.sec .flecha { height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, #E6DAC4 0 8px, transparent 8px 14px); }
.sec .premio { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--jelly-2); border-radius: 99px; padding: 3px 10px 3px 7px; font: 900 13px var(--font); }
.sec .quien { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #5FB878; box-shadow: 0 0 0 3px #CFEBD7; font-style: normal; }
.sec .quien .gl { width: 18px; height: 18px; }
.sec.hecha { opacity: .6; }
.sec.hecha .quien { background: var(--mint); box-shadow: none; }
.sec.lista { box-shadow: 0 0 0 3px #5FB878, 0 3px 0 var(--rim); }

/* La mesa de mezcla */
#mesa { position: fixed; inset: 0; z-index: 7; display: grid; place-items: center; padding: 14px; background: rgba(20, 12, 50, 0.45); animation: fadeIn .2s; }
#mesa.hidden { display: none; }
.mesa-card { width: min(860px, 100%); max-height: 94vh; overflow: auto; padding: 18px 26px 22px; }
.mesa-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mesa-card h2 { margin: 0; flex: 1; font-size: 22px; font-weight: 900; }
.mesa-body { display: flex; gap: 22px; align-items: flex-start; }
.mesa-main { flex: 1 1 auto; min-width: 0; }
.mesa-reg { width: 250px; flex: none; background: var(--jelly-2); border-radius: 28px; padding: 12px 12px 14px; align-self: stretch; }
.mesa-reg h3 { margin: 0 0 8px; font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
#mesaLog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow: auto; }
#mesaLog li { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #fff; border-radius: 16px; padding: 5px 8px; cursor: pointer; box-shadow: 0 2px 0 var(--rim); }
#mesaLog li.mal { opacity: .6; }
#mesaLog li.vacio { height: 42px; background: transparent; box-shadow: none; cursor: default; }
#mesaLog .ings { display: inline-flex; gap: 1px; flex-wrap: wrap; }
#mesaLog .to { display: inline-flex; align-items: center; gap: 4px; font: 800 11px var(--font); text-align: right; }
#mesaLog .to em { font-style: normal; max-width: 84px; line-height: 1.1; }
#mesaSlots { display: flex; gap: 10px; justify-content: center; margin: 6px 0 12px; }
.slot { width: 62px; height: 62px; border-radius: 22px; border: 3px dashed var(--rim-2); background: var(--jelly-2); display: grid; place-items: center; padding: 0; }
.slot.need { border-color: #C9BA9C; }
.slot.full { border: 3px solid var(--rim); background: #fff; box-shadow: 0 3px 0 var(--rim); cursor: pointer; animation: slotIn .3s cubic-bezier(.3,1.7,.5,1); }
.slot .ing { width: 38px; height: 38px; }
@keyframes slotIn { from { transform: scale(.4); } }
.mesa-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.mesa-actions button { --sq-fill: var(--tint); --sq-rim: #A94D39; --sq-shadow: #8C3E2E; --sq-drop: 4; border: 3px solid transparent; border-radius: 26px; padding: 12px 30px; color: #fff; font: 900 18px var(--font); cursor: pointer; }
.mesa-actions button:disabled { --sq-fill: #D9CDB6; --sq-rim: #D9CDB6; --sq-shadow: #C4B79C; color: #fff; cursor: default; }
.mesa-actions button.locked { --sq-fill: #8A8FA0; --sq-rim: #8A8FA0; --sq-shadow: #6a6f80; }
#mesaClear { padding: 12px 18px; --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-shadow: var(--rim-2); color: var(--soft); }
#mesaClear:disabled { --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); color: #C4B79C; }
#mesaResult { display: flex; justify-content: center; min-height: 104px; margin-bottom: 10px; }
.res { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 28px; padding: 10px 24px; box-shadow: 0 3px 0 var(--rim); font-size: 18px; font-weight: 900; align-self: center; position: relative; }
.res.vacio { width: 84px; height: 84px; padding: 0; background: var(--jelly-2); box-shadow: none; border-radius: 28px; }
.res.fallo { background: #F1ECE2; color: #7a6d58; }
.res em { position: absolute; top: -9px; right: -6px; font-style: normal; background: var(--tint-2); color: #5a3d00; padding: 2px 10px; border-radius: 99px; font-size: 12px; }
#mesaInv { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ig { position: relative; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 var(--rim); padding: 6px 8px; font: 800 12px var(--font); color: var(--text); cursor: pointer; text-align: left; line-height: 1.1; }
.ig:hover { transform: translateY(-2px); }
.ig span { flex: 1; min-width: 0; }
.ig b { flex: none; background: var(--night); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 12px; }
.ig.off { opacity: .4; }
@media (max-width: 700px) { .mesa-body { flex-direction: column; } .mesa-reg { width: 100%; } #mesaLog { max-height: 150px; } .slot { width: 52px; height: 52px; } }

/* ═════════ personajes en el mundo (src/personajes_mundo.js): chips de recolección y entrega de secundarias ═════════ */
.pj-pop {
  position: fixed; z-index: 7; pointer-events: none; display: flex; align-items: center; gap: 4px;
  transform: translate(-50%, -50%); padding: 3px 11px 3px 6px; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--rim); box-shadow: 0 3px 0 var(--rim-2), 0 6px 14px rgba(40, 30, 70, .22);
  color: var(--text); font-weight: 800; font-size: 15px; animation: pjPop 1.3s cubic-bezier(.2, .8, .3, 1) forwards;
}
.pj-pop .ing { width: 24px; height: 24px; }
@keyframes pjPop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, -80%) scale(1.12); }
  32% { transform: translate(-50%, -90%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -230%) scale(1); }
}
.pj-entrega { position: fixed; z-index: 9; left: 50%; bottom: 112px; transform: translateX(-50%); pointer-events: none; }
.pj-ent-box { pointer-events: auto; --sq-fill: var(--panel); --sq-rim: var(--rim); --sq-shadow: var(--rim-2); --sq-drop: 5; display: flex; align-items: center; gap: 18px; padding: 14px 20px; border-radius: 34px; color: var(--text); font: 900 18px var(--font); }
.pj-ent-pide { display: flex; align-items: center; gap: 8px; }
.pj-ent-pide b.falta { color: #c0533d; }
.pj-ent-premios { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; border-left: 3px solid #EFE4CF; padding-left: 14px; }
.pj-ent-pr { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--soft); }
.pj-ent-btns { display: flex; align-items: center; gap: 10px; }
.pj-ent-dar { --sq-fill: #3fb36a; --sq-rim: #2e8a50; --sq-shadow: #236a3d; --sq-drop: 4; border: 3px solid transparent; border-radius: 26px; width: 66px; height: 52px; display: grid; place-items: center; color: #fff; cursor: pointer; }
.pj-ent-dar .gl { width: 30px; height: 30px; }
.pj-ent-dar.off { --sq-fill: #bdb3a2; --sq-rim: #a79d8c; --sq-shadow: #8f8576; }
.pj-ent-luego { border: 0; background: var(--jelly-2); color: var(--soft); width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font: 900 22px var(--font); }
.pj-ent-luego i::before { content: '\00d7'; font-style: normal; }
.pj-ent-luego .gl { display: none; }

/* ───── La gelatina del menú (src/ui/hub.js) fuera del menú: Hotel y minijuegos ─────
   .gel-card es el panel, .gel-tabs las pestañas, .gel-x la X y .gel-btn el botón (soft: el secundario).
   Cada pieza lleva squish() en su JS, como los tomos y las pestañas del menú. */
.gel-card {
  --sq-r: 44px; --sq-drop: 6;
  position: relative; border: 4px solid var(--rim); border-radius: 44px; background: var(--panel); color: var(--text);
  padding: 22px 26px 24px;
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
  animation: gelatina .5s cubic-bezier(.3, 1.45, .5, 1);
}
.gel-card > .sq-back, .mg-card > .sq-back { filter: drop-shadow(0 0 22px var(--glow)) drop-shadow(0 26px 50px rgba(20, 16, 40, 0.35)); }
.gel-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.gel-card header > div:first-child { flex: 1; min-width: 0; }
.gel-card h2 { margin: 0; font-size: 26px; font-weight: 900; color: var(--text); }
.gel-card header p { margin: 2px 0 0; font-weight: 800; font-size: 14px; color: var(--soft); }
.gel-tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.gel-tabs button {
  --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-shadow: var(--rim-2); --sq-drop: 3;
  height: 46px; padding: 0 22px; border: 3px solid transparent; border-radius: 23px; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font: 900 16px var(--font); color: var(--soft); transition: color .2s, transform .3s cubic-bezier(.3,1.6,.5,1);
}
.gel-tabs button:hover { transform: translateY(-2px); }
.gel-tabs button.on { --sq-fill: #fff; --sq-rim: var(--rim); color: var(--text); }
.gel-x {
  --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-drop: 0;
  width: 46px; height: 46px; flex: none; border: 3px solid transparent; border-radius: 50%; background: none; padding: 0;
  font: 900 24px var(--font); line-height: 1; color: var(--soft); cursor: pointer;
}
.gel-x .sq-back { filter: none; }
.gel-btn {
  --sq-fill: var(--tint); --sq-rim: #A94D39; --sq-shadow: #8C3E2E; --sq-drop: 4;
  border: 3px solid transparent; border-radius: 24px; background: none; padding: 11px 24px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 900 17px var(--font); color: #fff;
}
.gel-btn.soft { --sq-fill: var(--jelly-2); --sq-rim: var(--jelly-2); --sq-shadow: var(--rim-2); color: var(--soft); }
.gel-btn:disabled { --sq-fill: #D9CDB6; --sq-rim: #D9CDB6; --sq-shadow: #C4B79C; cursor: default; }

/* ───── Hotel: el ascensor (src/hotel/ascensor_ui.js) ───── */
#ascensor { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 6;
  background: rgba(30, 26, 44, 0.42); animation: fadeIn .2s; }
#ascensor.hidden, #ascensor .hidden { display: none !important; }
.asc-card { width: min(560px, 100%); }
.asc-tabs b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--tint-2); color: var(--text); font-size: 12px; }
.asc-tabs b:empty { display: none; }
.asc-rows { list-style: none; margin: 0; padding: 4px 6px 8px; display: grid; gap: 10px; max-height: min(46vh, 380px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--rim) transparent; }
.asc-row {
  --sq-fill: #fff; --sq-rim: var(--rim); --sq-shadow: var(--rim); --sq-drop: 3;
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 12px; padding: 12px 16px;
  border: 3px solid transparent; border-radius: 24px; background: #fff; cursor: pointer; color: var(--text);
  transition: transform .3s cubic-bezier(.3,1.6,.5,1);
}
.asc-row:hover { transform: translateY(-2px); }
.asc-row > .sq-back { filter: none; }
.asc-row.live { --sq-rim: #7FC98F; --sq-shadow: #7FC98F; }
.asc-row.here { --sq-rim: var(--tint-2); --sq-shadow: var(--tint-2); }
.asc-live { width: 12px; height: 12px; border-radius: 50%; background: var(--jelly-2); }
.asc-row.live .asc-live { background: var(--mint); }
.asc-main { display: flex; flex-direction: column; min-width: 0; }
.asc-main b { font-weight: 900; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asc-main small { font-weight: 800; font-size: 13px; color: var(--soft); }
.asc-size-tag { font-weight: 900; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--jelly-2); color: var(--soft); }
.asc-count { font-weight: 900; font-size: 13px; color: var(--soft); min-width: 82px; text-align: right; }
.asc-row.live .asc-count { color: var(--mint); }
.asc-empty { padding: 28px 8px; text-align: center; font-weight: 800; color: var(--soft); }
.asc-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.asc-name { display: flex; align-items: center; gap: 12px; font-weight: 900; margin-bottom: 14px; }
.asc-name input { flex: 1; min-width: 0; border: 3px solid var(--rim); border-radius: 20px; padding: 10px 14px; background: #fff; font: 800 16px var(--font); color: var(--text); outline: none; user-select: text; -webkit-user-select: text; }
.asc-name input:focus { border-color: var(--rim-2); }
.asc-presets { margin-bottom: 14px; }
.asc-presets button { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.asc-presets button small { font-weight: 800; opacity: .6; font-size: 11px; }
.asc-gridwrap { display: flex; align-items: flex-end; gap: 16px; }
.asc-grid { --n: 14; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; width: min(300px, 70vw); aspect-ratio: 1; touch-action: none; cursor: crosshair;
  padding: 6px; border-radius: 20px; background: var(--jelly-2); }
.asc-grid i { border-radius: 4px; background: #fff; }
.asc-grid i.min { background: color-mix(in srgb, var(--rim) 30%, #fff); }
.asc-grid i.on { background: var(--tint); }
.asc-grid i.on.hov { background: color-mix(in srgb, var(--tint) 55%, #fff); }
.asc-size { font-weight: 900; font-size: 28px; color: var(--text); white-space: nowrap; }

/* Hotel: el editor de sala (pestaña Sala de decor.js) */
.sala-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; color: var(--ink); font-weight: 900; flex-wrap: wrap; }
.sala-row > span:first-child { min-width: 70px; }
.sala-row input { border: 0; border-radius: 12px; padding: 7px 12px; background: #fff; font: 800 14px var(--font); color: var(--ink); box-shadow: inset 0 0 0 2px #EADBC0; user-select: text; -webkit-user-select: text; }
.sala-doors { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.sala-door { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 14px; padding: 6px 8px; font-weight: 800; font-size: 13px; }
.sala-door > span { flex: 1; }
.sala-door button, .sala-row > button, .sala-door select { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--jelly-2); color: var(--ink); font: 900 13px var(--font); cursor: pointer; }
.plano-fila { justify-content: center; }
.plano { position: relative; margin: 0 auto; flex: none; }
.plano > * { position: absolute; box-sizing: border-box; }
.plano-hab { border: 2px solid rgba(60, 40, 110, .35); border-radius: 6px; padding: 0; cursor: pointer; display: grid; place-items: center; font: 900 11px var(--font); color: var(--ink); }
.plano-hab b { background: rgba(255, 250, 240, .8); border-radius: 999px; padding: 1px 6px; }
.plano-hab.on { border: 3px solid var(--ink, #3a2a6a); box-shadow: 0 0 0 3px rgba(255, 216, 107, .9); cursor: default; z-index: 1; }
.plano-puerta { background: #fffaf0; border: 0; padding: 0; border-radius: 4px; z-index: 2; box-shadow: 0 0 0 1.5px rgba(60, 40, 110, .45); cursor: pointer; }
.plano-puerta:hover { background: var(--tint-2, #ffd86b); }
.plano-puerta.on { background: var(--tint-2, #ffd86b); box-shadow: 0 0 0 2.5px var(--ink, #3a2a6a); z-index: 4; }
.plano-puerta.cerrada { background: repeating-linear-gradient(45deg, rgba(60, 40, 110, .35) 0 3px, transparent 3px 6px); box-shadow: none; }
.plano-puerta.cerrada.on { box-shadow: 0 0 0 2.5px var(--ink, #3a2a6a); }
.sala-con { font: 900 13px var(--font); color: var(--soft); }
.plano-entrada { background: rgba(60, 40, 110, .25); border-radius: 0 0 6px 6px; }
.plano-nueva { border: 2px dashed rgba(60, 40, 110, .45); border-radius: 6px; background: rgba(255, 255, 255, .45); color: var(--ink); font: 900 22px var(--font); cursor: pointer; padding: 0; }
.plano-nueva:hover { background: rgba(255, 216, 107, .6); }

/* Misión final: mientras alguien sigue a Blopsi, el selector de traje se apaga */
#skinGrid.bloqueado { opacity: .45; filter: saturate(.4); pointer-events: none; }

/* ───────── Corazones 3D del HUD (src/ui/corazones_hud.js) y color por traje ───────── */
#heartsCanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9; pointer-events: none; }
#friendsBtn.llega { animation: friendsLlega .6s ease-out; }
@keyframes friendsLlega { 40% { transform: scale(1.3); } }

/* Los iconos siguen al traje (src/ui/acento.js) */
.round svg { color: var(--ink-ui); }
#action kbd { color: var(--ink-ui); }
.dlg-sig { border-top-color: var(--ink-ui); }

/* ═════════ La gelatina (docs/UI_AUDITORIA.md §5): un solo marco para todos los paneles ═════════ */
.shop-card, .decor-panel, #talk, .cheats-card, .panel, .mg-card, .mesa-card, .regalo-card {
  background: var(--panel); color: var(--text); border: 4px solid var(--rim); border-radius: 40px;
  box-shadow: 0 6px 0 var(--rim-2), 0 0 32px var(--glow), 0 30px 70px rgba(20, 16, 40, 0.35);
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
  animation: gelatina .5s cubic-bezier(.3, 1.45, .5, 1);
}
.shop-card .close .close, .cheats-card .close, .mesa-card .close { background: var(--jelly-2); color: var(--soft); }
.offer, .card-o, .item-o, .mission, .pal, .inv, .sec, .ig { background: rgba(255, 255, 255, 0.92); }
.decor-panel { overflow: hidden; }
/* Lo que se puede pulsar en el HUD también es gelatina: el corazón del perfil abre Personajes */
#meWrap .me-heart.on { cursor: pointer; pointer-events: auto; }

@keyframes gelatina { 0% { opacity: 0; transform: scale(.7, .5); } 55% { opacity: 1; transform: scale(1.03, .97); } 80% { transform: scale(.99, 1.01); } }

/* Lo que escribe Blopsi (sus notas de Misiones): aparece trazo a trazo */
.escrito { display: inline-block; font-style: normal; animation: escribe .9s steps(24, end) backwards; animation-delay: calc(.15s + var(--n, 0) * .25s); }
@keyframes escribe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) {
  .escrito,
  .shop-card, .decor-panel, #talk, .cheats-card, .panel, .mg-card, .mesa-card, .regalo-card { animation-duration: .01s; }
}
.skin em.como { display: inline-flex; align-items: center; gap: 3px; color: var(--soft); font-weight: 900; }
.skin span.nivel-mg { display: inline-flex; align-items: center; gap: 2px; font: 900 11px var(--font); opacity: 1; color: var(--soft); }
.skin .star { width: 24px; height: 24px; top: 1px; right: 1px; }
.skin .star i { width: 16px; height: 16px; }
#profileLevel .gl-mini { vertical-align: -2px; }
.buy .spark-ico { width: 20px; height: 20px; }

.buy .candado { width: 14px; height: 16px; flex: none; background: currentColor; clip-path: path('M3 7V5a4 4 0 0 1 8 0v2h1.5a1.5 1.5 0 0 1 1.5 1.5v6a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 0 14.5v-6A1.5 1.5 0 0 1 1.5 7zM5 7h4V5a2 2 0 0 0-4 0z'); }

/* Misiones: fijar una arriba (panels.js, #misionFijada) */
.mission .pin { flex: none; width: 34px; height: 34px; border: 0; border-radius: 12px; display: grid; place-items: center; background: var(--jelly-2); color: #B4A994; cursor: pointer; }
.mission .pin .gl { width: 18px; height: 18px; }
.mission .pin.on { background: var(--c); color: #fff; }
.mission.fijada { box-shadow: 0 0 0 3px var(--c), 0 3px 0 var(--rim); }
#misionFijada { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translate(-50%, -8px); opacity: 0; pointer-events: none; z-index: 7;
  display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 150px)); padding: 6px 16px 6px 6px; border-radius: 16px;
  background: rgba(30, 20, 70, 0.62); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .4s ease, transform .4s ease; }
#misionFijada.on { opacity: 1; transform: translate(-50%, 0); }
#misionFijada.cumplida, #misionFijada.cumplida.on { opacity: 0; transition: none; animation: none; } /* paso cumplido: fuera al momento (panels.js) */
#misionFijada img { width: 40px; height: 40px; border-radius: 12px; background: var(--c); flex: none; object-fit: cover; }
#misionFijada b { display: block; font-size: 12px; font-weight: 900; opacity: .75; }
#misionFijada span { display: block; font-size: 14px; font-weight: 800; line-height: 1.3; }
body.con-fijada #misionAviso { top: calc(max(12px, env(safe-area-inset-top)) + 62px); }
#misionFijada.pulso { animation: fijadaPulso .7s ease; }
/* Con el menú o un panel encima, la fijada se aparta (no se pisa con la UI) */
body.en-escena #misionFijada.on, /* (y mientras alguien habla: escenas y charlas) */
body:has(.hub.open, #chatLog:not(.hidden), #shop:not(.hidden), #worldgate:not(.hidden)) #misionFijada.on { opacity: 0; transform: translate(-50%, -8px); transition-duration: .2s; }
@keyframes fijadaPulso { 0% { transform: translate(-50%, 0) scale(1); } 35% { transform: translate(-50%, 0) scale(1.06); } 100% { transform: translate(-50%, 0) scale(1); } }

/* ═════════ Lugares: Recetario, tablón de favores y misiones de lugar (src/ui/recetario.js, tablon.js, panels.js) ═════════ */
.b-recetario { --tomo: #47A866; }
.rec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rec-head h2 { margin: 0; flex: 1; font-size: 20px; font-weight: 900; }
.rec-raza { width: 56px; height: 56px; border-radius: 18px; flex: none; display: grid; place-items: center; background: var(--c); box-shadow: inset 0 -5px 0 rgba(0,0,0,.14); }
.rec-raza img { width: 62px; height: 62px; margin-top: 4px; }
.rec-cuenta { font: 900 15px var(--font); background: var(--jelly-2); border-radius: 999px; padding: 4px 12px; color: var(--soft); }
.rec-cuenta b { color: var(--text); }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rec-card { position: relative; background: #fff; border: 0; border-radius: 20px; padding: 10px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 var(--rim), inset 0 4px 0 color-mix(in srgb, var(--c) 55%, #fff); font: 800 13px var(--font); text-align: center; cursor: pointer; color: var(--text); }
.rec-card b { font-weight: 900; line-height: 1.15; }
.rec-obj { position: relative; width: 64px; height: 64px; }
.rec-obj svg, .rec-obj img { width: 100%; height: 100%; }
.rec-ings { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.ri { display: inline-flex; align-items: center; gap: 2px; background: var(--jelly-2); border-radius: 99px; padding: 2px 7px 2px 3px; font: 900 11px var(--font); }
.ri i { font-style: normal; }
.ri.ok { background: #DDF3E3; color: #2E7A4A; }
.ri.no { color: #A0524A; }
.rec-n { position: absolute; top: 8px; right: 8px; background: var(--night); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-style: normal; font-weight: 900; }
.rec-card.oculta { background: #F6EFE2; box-shadow: none; cursor: default; min-height: 118px; justify-content: flex-start; }
.rec-obj.sil svg, .rec-obj.sil img { filter: brightness(0) opacity(.16); }
.rec-obj.sil .q { position: absolute; inset: 0; display: grid; place-items: center; font: 900 30px var(--font); color: #B9AB94; font-style: normal; }
.rec-card.oculta q { font: 700 11px/1.3 var(--font); color: var(--soft); quotes: none; }
.rec-card.oculta q::before { content: "“"; } .rec-card.oculta q::after { content: "”"; }

#tablonPanel { position: fixed; inset: 0; z-index: 7; display: grid; place-items: center; padding: 14px; background: rgba(20, 12, 50, 0.45); animation: fadeIn .2s; }
#tablonPanel.hidden { display: none; }
.tb-card { width: min(780px, 100%); max-height: 94vh; overflow: auto; padding: 18px 22px 22px; }
.tb-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tb-card h2 { margin: 0; flex: 1; }
.tb-ico .gl { color: var(--tint); }
.tb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.sec.favor { display: grid; grid-template-columns: 58px 1fr; gap: 8px 12px; align-items: center; padding-right: 58px; }
.sec.favor .fv-cara { grid-row: 1 / 4; width: 58px; height: 58px; border-radius: 18px; background: var(--c); padding-top: 4px; object-fit: contain; box-shadow: inset 0 -5px 0 rgba(0,0,0,.14); align-self: start; }
.sec.favor.raro { box-shadow: 0 0 0 3px var(--tint-2), 0 3px 0 var(--rim); }
.sec.favor .chip.raro { background: #FFE9A8; color: #A56A00; }
.sec.favor.curso.lista { box-shadow: 0 0 0 3px #5FB878, 0 3px 0 var(--rim); }
.sec.favor.curso .quien { background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, #fff); }
.fv-coger { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; display: grid; place-items: center; background: #5FB878; color: #fff; cursor: pointer; padding: 0; --sq-fill: #5FB878; --sq-rim: #4A9C62; --sq-shadow: #3D8250; }
.fv-coger .gl { width: 24px; height: 24px; }
.mission .badge.lugar { color: #fff; }
.mission .badge.lugar .gl { width: 34px; height: 34px; }
#misionFijada .lugar { width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--c); color: #fff; display: grid; place-items: center; }
#misionFijada .lugar .gl { width: 28px; height: 28px; }

/* ═════════ Trato con los especiales (src/trato.js): inventario de regalos y corazones sobre su cabeza ═════════ */
#regalo { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(40, 30, 70, .18); }
#regalo.hidden { display: none; }
.regalo-card { width: min(520px, calc(100vw - 24px)); max-height: 78vh; overflow: auto; overscroll-behavior: contain; padding: 14px 16px 16px; }
.regalo-head { display: flex; align-items: center; gap: 12px; margin: 0 2px 10px; }
.regalo-head img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 3px 0 var(--rim); }
.regalo-head .dots { display: flex; gap: 6px; }
.regalo-x { margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--jelly-2); color: var(--soft); font: 900 24px/1 var(--font); cursor: pointer; }
.regalo-grid { margin-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.regalo-grid .it .obj { width: 56px; height: 56px; }
.regalo-nada { display: grid; place-items: center; padding: 26px 0 30px; background: var(--jelly-2); border-radius: 24px; }
.regalo-vacio { width: 120px; height: 100px; animation: bob 2.4s ease-in-out infinite; }
.bubble.regalo-bub { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 26px; z-index: 5; }
.bubble.regalo-bub .heart { transform: scale(1.8); margin: 0 5px; animation: heartPop .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes heartPop { 0% { transform: scale(0); } 60% { transform: scale(2.3); } 100% { transform: scale(1.8); } }

/* Online: la lista de amigos (src/ui/panels.js, createFriends) */
.amigo-o { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: #fff; border: 3px solid var(--rim); color: var(--text); }
.amigo-o > i { width: 40px; height: 40px; border-radius: 50%; flex: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); opacity: .55; }
.amigo-o.on > i { opacity: 1; }
.amigo-o > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.amigo-o b { font: 900 16px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amigo-o span { font: 700 13px var(--font); color: var(--soft); }
.amigo-o button { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--mint); color: #fff; font: 900 14px var(--font); cursor: pointer; box-shadow: 0 3px 0 #356049; }
.amigo-o button.x { background: none; box-shadow: none; color: var(--soft); font-size: 20px; padding: 4px 6px; }
.amigo-o button.seguro { background: #ff8a8a; color: #fff; box-shadow: 0 3px 0 #d95f6a; font-size: 13px; padding: 4px 10px; white-space: nowrap; }
.amigo-o { cursor: pointer; }
.amigo-o.sel { border-color: var(--tint-2, #8a6fe0); }
.bloq-tit { list-style: none; padding: 8px 12px 2px; font: 900 14px var(--font); color: var(--soft); cursor: pointer; user-select: none; }
.bloq-tit::after { content: "▸"; display: inline-block; margin-left: 6px; transition: transform .15s; }
.bloq-tit.abierto::after { transform: rotate(90deg); }
.amigo-o.bloq { cursor: default; }
.amigo-o.bloq button { background: var(--jelly-2); color: var(--text); box-shadow: 0 3px 0 var(--rim); }

/* ═════════ Móvil vertical: todo aquí dentro, el escritorio no cambia ═════════
   Espaciado en pasos de 4 (--m1 4px, --m2 8px, --m3 12px, --m4 16px) y todo lo que se toca mide al menos 44px. */
@media (max-width: 700px) {
  :root { --m1: 4px; --m2: 8px; --m3: 12px; --m4: 16px; --tap: 44px; --barra: 52px; }
  html, body { max-width: 100vw; overflow-x: hidden; }

  /* HUD de arriba: solo las chispas (sin gemas ni tienda) */
  .hud-tl, .hud-tr { gap: var(--m2); }
  .money { height: var(--tap); }
  #gems, #shopBtn { display: none !important; }

  /* Abajo: tu retrato a la izquierda y, a su derecha, los iconos arriba (los de la barra y el mapa, del mismo tamaño
     y con el mismo hueco entre todos) y la barra de hablar debajo, hasta el borde. --nb cuenta los iconos de la fila
     (en el Reino entra el de casa); si no caben a 44px, encogen todos por igual */
  :root { --me: 96px; --nb: 5; --col: calc(var(--gut) + var(--me) + var(--m3)); --sitio: calc(100vw - var(--col) - var(--gut-r));
    --barra: min(var(--tap), calc((var(--sitio) - (var(--nb) - 1) * var(--m1)) / var(--nb)));
    --hueco: calc((var(--sitio) - var(--nb) * var(--barra)) / (var(--nb) - 1)); --fila: calc(var(--gut-b) + 44px + var(--m2)); }
  :root:has(#casaBtn:not(.hidden)) { --nb: 6; }
  #chatbar { left: var(--col); right: calc(var(--gut-r) + var(--barra) + var(--hueco)); width: auto; transform: none; bottom: var(--fila);
    display: flex; flex-wrap: nowrap; justify-content: space-between; gap: var(--m1); row-gap: 0; column-gap: var(--m1); }
  #chatbar .round { width: var(--barra); height: var(--barra); }
  #chatbar .round svg { width: 24px; height: 24px; }
  #chatForm { position: fixed; order: 0; flex: none; height: 44px; left: var(--col); right: var(--gut-r); bottom: var(--gut-b); }
  #chatbar.wide { left: var(--gut); right: var(--gut-r); bottom: calc(var(--gut-b) + var(--me) + var(--m3)); }
  #chatbar.wide #chatForm { position: static; flex: 1 1 100%; height: 54px; }
  #action, #casaBtns { bottom: calc(var(--gut-b) + var(--me) + var(--m4)); }
  #action, #decorBtn, #salirBtn { min-height: var(--tap); }

  /* El mapa: un botón como los demás, con su icono; el mapa pequeño no se ve mientras juegas */
  #mapWrap { bottom: var(--fila); right: var(--gut-r); gap: 0; }
  #mapRow { flex-direction: column; align-items: center; gap: var(--m1); }
  #mapBtn { width: var(--barra); height: var(--barra); border-width: 3px; background: var(--panel); --sq-fill: var(--panel); --sq-drop: 4; box-shadow: 0 4px 0 var(--rim-2), 0 10px 22px rgba(30, 24, 40, 0.18); }
  #mapBtn .sq-front { display: none; } /* sin minimapa no hace falta el marco encima: mismo borde y sombra que los demás (src/ui/squish.js) */
  #miniMap, #where { display: none; }
  #mapBtn .map-ico { display: block; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); }
  /* Encima, el zoom: un icono pequeño, sin burbuja, blancos con borde oscuro para verse en cualquier fondo */
  #zoomBtns { display: flex !important; position: static; flex-direction: column; gap: 0; }
  #zoomBtns .round.small { width: var(--barra); height: 40px; background: none !important; border: 0 !important; box-shadow: none !important; }
  #zoomBtns .sq-back, #zoomBtns .sq-front { display: none; }
  #zoomBtns svg { width: 32px; height: 32px; color: #fff; overflow: visible;
    filter: drop-shadow(0 0 1px rgba(30, 22, 50, .95)) drop-shadow(0 0 1px rgba(30, 22, 50, .95)) drop-shadow(0 2px 3px rgba(30, 22, 50, .6)); }
  #zoomBtns svg .line { stroke-width: 2.8; }
  #zoomBtn text { font-size: 9px; }
  #zoomBtns .hidden { display: none; }

  /* Favoritos: siempre a la vista, en burbujas hacia arriba desde el retrato (src/ui/hud.js, favSpotsMovil) */
  #meWrap .fav { width: 44px; height: 44px; margin: -22px; }

  /* El menú (hub): los tomos pasan a ser una fila de iconos arriba y el libro ocupa todo el ancho */
  .hub { --hub-w: 100%; --hub-h: auto; flex-direction: column; align-items: stretch; justify-content: flex-start;
    padding: calc(var(--gut-t) + var(--m1)) var(--gut-r) var(--gut-b) var(--gut); gap: 0; }
  .hub-nav { width: auto; margin: 0 0 -10px; flex-direction: row; gap: 2px; justify-content: space-between; padding: 0 var(--m1); }
  .hub-b { flex: 1 1 0; min-width: 0; height: 56px; padding: 0 0 10px; justify-content: center; gap: 0; border-radius: 18px; --sq-r: 18px;
    transform: translateY(0); }
  .hub-b span { display: none; }
  .hub-b::before { display: none; }
  .hub-b img { width: 34px; height: 34px; }
  .hub-b svg { width: 26px; height: 26px; }
  .hub-b:hover { transform: translateY(0); }
  .hub-b.on, .hub-b.b-shop.on:hover { transform: translateY(-6px); }
  .hub-b.b-wallet, .hub-b.b-shop { flex: 0 1 auto; padding: 0 var(--m3) 10px; gap: var(--m2); }
  .hub-b.b-wallet span, .hub-b.b-shop span { display: inline; }
  .hub-b.b-wallet:hover, .hub-b.b-shop:hover { transform: translateY(0); }
  .hub-main { flex: 1 1 auto; min-height: 0; width: 100%; height: auto; }
  .hub-panel { padding: var(--m4) var(--m3) var(--m3); border-radius: 30px; --sq-r: 30px;
    background: var(--jelly); backdrop-filter: none; -webkit-backdrop-filter: none; } /* sin desenfoque: en móvil es lo que más pesa */
  .hub.open { transition: none; }
  .hub-panel > .sq-back { filter: drop-shadow(0 12px 24px rgba(20, 16, 40, 0.3)); }
  .hub-tabs { margin: 0 52px var(--m3) 0; gap: var(--m2); flex-wrap: wrap; padding-bottom: 4px; }
  .hub-tabs::-webkit-scrollbar { display: none; }
  .hub-t { height: var(--tap); padding: 0 var(--m3); font-size: 15px; flex: none; }
  .hub-x { top: var(--m4); right: var(--m3); width: var(--tap); height: var(--tap); }
  .hub-sec { padding: var(--m1) 2px var(--m2); }
  @keyframes tomo { from { opacity: 0; transform: translateY(-40px); } }

  /* Contenido del menú a una o dos columnas */
  .cards { grid-template-columns: 1fr 1fr; gap: var(--m2); }
  .cards.items { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--m2); }
  .item-o img { width: 100%; max-width: 66px; height: auto; aspect-ratio: 1; }
  .friend-split { grid-template-columns: minmax(0, 1fr); }
  .add-friend input, .add-friend button { height: var(--tap); }
  .dm-input input, .dm-input button { height: var(--tap); }
  .dm-input button { width: var(--tap); }
  .mission { gap: var(--m3); padding: var(--m3); }
  .mission .badge { width: 48px; height: 48px; }
  .mission .badge img { width: 54px; height: 54px; }
  .set-row { min-height: var(--tap); flex-wrap: wrap; gap: var(--m2); }
  .set-row input[type="range"] { flex: 1 1 140px; min-width: 0; }
  .set-tab .set-list button { min-height: var(--tap); padding: var(--m3); }
  .seg button { min-height: var(--tap); }
  #sound.toggle { flex: none; height: var(--tap); width: 72px; }
  #sound.toggle i { top: 5px; width: 28px; height: 28px; }
  #sound.toggle.off i { right: 35px; }

  /* Personajes: foto y corazón siguen lado a lado, más pequeños */
  .pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--m3); }
  .pj-card { padding: var(--m3) var(--m2); }
  .pj-card img { width: 100%; max-width: 116px; height: auto; aspect-ratio: 1; }
  .pj-top { grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: var(--m4); }
  .pj-top .pj-back { width: var(--tap); height: var(--tap); left: 4px; top: 4px; }
  .pj-top .pj-info { grid-template-columns: minmax(0, 1fr); row-gap: var(--m2); }
  .pj-top .pj-info h2 { font-size: 22px; }
  .pj-corazon { width: 64px; height: 64px; }
  .pj-corazon b { right: -20px; min-width: 32px; height: 32px; font-size: 17px; }
  .pj-corazon.s { width: 30px; height: 30px; }
  .pj-corazon.s b { right: -14px; min-width: 22px; height: 22px; font-size: 12px; }
  .pj-camino .cas { min-height: var(--tap); }

  /* Online: la ficha de otro jugador sale abajo y centrada (junto a su nombre se saldría por los lados) */
  body .net-ficha { left: 50% !important; top: auto !important; bottom: calc(var(--gut-b) + var(--me) + var(--m4));
    transform: translateX(-50%); width: min(300px, calc(100vw - var(--gut) - var(--gut-r))); }
  body .net-ficha button, body .cmb button.b, body .cmb-pide button, body .opi button { min-height: var(--tap); }
  body .cmb .obj { min-height: var(--tap); }

  /* Ventanas sueltas (tienda, mapa, tareas...): caben en la pantalla y hacen scroll por dentro */
  .panel { max-width: 100%; max-height: calc(100dvh - var(--gut-t) - var(--gut-b)); overflow: auto; }
  .ptabs button { min-height: var(--tap); }
}

/* Hotel: suelos y paredes sin poner, con cuántos tienes (src/hotel/sala_ui.js) */
.sala-row .sw.rollo { position: relative; }
.sala-row .sw.rollo::after { content: attr(data-n); position: absolute; right: -6px; bottom: -6px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px; background: var(--ink-strong, #2a1d4a); color: #fff; font: 900 10px/16px var(--font); text-align: center; }

/* Móvil: la barra de hablar entra y sale animada (solo transform y opacidad) */
@media (max-width: 700px) {
  #chatbar.wide #chatForm { animation: barSale .24s cubic-bezier(.3,1.5,.5,1); transform-origin: 50% 100%; }
  #chatbar.wide.saliendo #chatForm { animation: barSePliega .14s ease-in forwards; }
  #chatbar.vuelve #chatForm, #chatbar.vuelve .round { animation: barVuelve .22s cubic-bezier(.3,1.5,.5,1) backwards; }
  #chatbar.vuelve .round:nth-of-type(2) { animation-delay: .03s; }
  #chatbar.vuelve .round:nth-of-type(3) { animation-delay: .06s; }
  #chatbar.vuelve .round:nth-of-type(4) { animation-delay: .09s; }
  #chatLog { backdrop-filter: none; }
  #chatLog ul { overscroll-behavior: contain; }
}
@keyframes barSale { from { opacity: .4; transform: translateY(16px) scale(.94); } }
@keyframes barSePliega { to { opacity: 0; transform: translateY(14px) scale(.94); } }
@keyframes barVuelve { from { opacity: 0; transform: translateY(10px) scale(.9); } }
@media (prefers-reduced-motion: reduce) {
  #chatbar #chatForm, #chatbar .round, #chatLog { animation-duration: .01s !important; }
}

/* ───── Privados (src/ui/privados.js): la consolita que se mueve y se redimensiona (en el móvil, fija) ───── */
#privados { position: fixed; z-index: 45; display: flex; flex-direction: column; min-width: 230px; min-height: 170px; resize: both; overflow: hidden;
  background: var(--panel); color: var(--text); border: 3px solid var(--rim); border-radius: 22px; box-shadow: 0 5px 0 var(--rim-2), 0 16px 40px rgba(20, 16, 40, .28); }
#privados.hidden { display: none; }
#privados.moviendo { user-select: none; opacity: .92; cursor: grabbing; }
#privados .pv-log { cursor: grab; }
#privados.moviendo .pv-log, #privados.moviendo header { cursor: grabbing; }
#privados header { display: flex; align-items: center; gap: 6px; padding: 6px 6px 0 6px; cursor: grab; background: var(--jelly-2); }
.pv-tabs { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pv-tabs::-webkit-scrollbar { display: none; }
.pv-tab { position: relative; flex: none; display: flex; align-items: center; gap: 5px; max-width: 130px; padding: 6px 10px 7px; border: 0; border-radius: 14px 14px 0 0;
  background: color-mix(in srgb, var(--panel) 55%, transparent); color: var(--soft); font: 900 13px var(--font); cursor: pointer; }
.pv-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-tab-x { flex: none; width: 18px; height: 18px; margin: 0 -4px 0 1px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--soft); font: 900 14px/1 var(--font); cursor: pointer; opacity: .55; }
.pv-tab-x:hover, .pv-tab.on .pv-tab-x { opacity: 1; }
.pv-tab-x:hover { background: var(--jelly-2); }
.pv-tab i { width: 12px; height: 12px; border-radius: 50%; flex: none; opacity: .5; box-shadow: 0 0 0 1.5px #fff; }
.pv-tab.conectado i { opacity: 1; }
.pv-tab.on { background: var(--panel); color: var(--text); }
.pv-tab.punto::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: #ff5f7f; box-shadow: 0 0 0 2px #fff; }
.pv-bar { display: flex; align-items: center; padding: 4px 6px 4px 8px; background: color-mix(in srgb, var(--c, #C2B8D4) 30%, transparent); border-bottom: 2px solid var(--rim); }
#privados.moviendo header { cursor: grabbing; }
.pv-quien { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 4px; cursor: pointer; text-align: left; color: var(--text); }
.pv-quien i { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px #fff, inset 0 -3px 0 rgba(0, 0, 0, .12); }
.pv-quien b { font: 900 15px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-quien span { font: 700 12px var(--font); color: var(--soft); white-space: nowrap; }
.pv-quien:hover b { text-decoration: underline; text-decoration-thickness: 2px; }
.pv-x { width: 30px; height: 30px; flex: none; margin-bottom: 4px; border: 0; border-radius: 50%; background: var(--jelly-2); color: var(--soft); font: 900 20px/1 var(--font); cursor: pointer; }
.pv-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 8px; overscroll-behavior: contain; }
.pv-log p { margin: 0; align-self: flex-start; max-width: 85%; padding: 5px 10px 4px; border-radius: 14px 14px 14px 4px; background: #fff; font: 700 14px/1.3 var(--font); overflow-wrap: anywhere; }
.pv-log p.mio { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--yo, var(--mint)); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.pv-log p small { display: block; font: 700 10px var(--font); opacity: .6; text-align: right; }
.pv-log em { align-self: center; font: 800 11px var(--font); color: var(--soft); font-style: normal; padding: 2px 8px; border-radius: 999px; background: var(--jelly-2); }
.pv-log em.pv-vacio { margin: auto; }
.pv-in { display: flex; gap: 6px; padding: 6px; border-top: 2px solid var(--rim); }
.pv-in input { flex: 1; min-width: 0; height: 38px; border-radius: 999px; border: 2px solid var(--rim); background: #fff; padding: 0 12px; font: 800 14px var(--font); color: var(--text); outline: none; user-select: text; -webkit-user-select: text; }
.pv-in input:focus { border-color: var(--tint-2); }
.pv-in button { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; background: var(--mint); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 0 #356049; }
.pv-in svg { width: 18px; height: 18px; }
@media (max-width: 700px) {
  #privados { left: var(--gut, 10px); right: var(--gut, 10px); top: calc(env(safe-area-inset-top) + 8px); height: 42vh; resize: none; min-width: 0; }
  #privados header { cursor: default; }
}

/* El puntito de un privado sin leer: en el botón de Amigos, en el del menú y en la fila del amigo */
#friendsBtn.punto, .hub-b.b-friends.punto, .amigo-o.punto > i { position: relative; }
#friendsBtn.punto::after, .hub-b.b-friends.punto::after, .amigo-o.punto > i::after { content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #ff5f7f; box-shadow: 0 0 0 2.5px #fff; animation: puntoLate 1.6s ease-in-out infinite; }
.amigo-o.punto > i { opacity: 1; }
@keyframes puntoLate { 50% { transform: scale(1.25); } }

/* La ficha de un jugador (src/ui/ficha.js) */
.ficha-capa { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(30, 20, 60, .25); padding: 16px; }
.ficha { width: min(320px, 100%); text-align: center; padding-top: 18px; }
.ficha .gel-x { position: absolute; top: 12px; right: 12px; }
.ficha-foto { width: 150px; height: 150px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 38%, #fff 0 30%, color-mix(in srgb, var(--c) 45%, #fff) 70%); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--c) 30%, transparent); }
.ficha-foto img { width: 132px; height: 132px; object-fit: contain; }
.ficha h2 { overflow-wrap: anywhere; }
.ficha-estado { margin: 2px 0 10px; font: 800 13px var(--font); color: var(--soft); }
.ficha blockquote { margin: 0 0 14px; padding: 10px 14px; border-radius: 18px; background: color-mix(in srgb, var(--c) 18%, #fff); font: 800 15px/1.35 var(--font); color: var(--text); overflow-wrap: anywhere; }
.ficha blockquote::before { content: "“"; } .ficha blockquote::after { content: "”"; }
.ficha-botones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Tu perfil: con el color de tu Blopsi y tu frase */
.me-head { padding: 10px 12px; border-radius: 24px; background: color-mix(in srgb, var(--c, var(--jelly-2)) 22%, transparent); }
.me-head img { cursor: pointer; background: color-mix(in srgb, var(--c, var(--jelly-2)) 45%, #fff); }
.me-head > div { flex: 1; min-width: 0; }
#profileFrase { display: block; width: 100%; margin-top: 6px; height: 36px; box-sizing: border-box; border-radius: 999px; border: 2px solid var(--rim); background: #fff; padding: 0 12px;
  font: 800 14px var(--font); color: var(--text); outline: none; user-select: text; -webkit-user-select: text; }
#profileFrase:focus { border-color: var(--tint-2); }
#profileFrase.hidden { display: none; }

/* El historial del chat: el nombre de cada lugar por el que has pasado */
#chatLog li.lugar { align-self: center; margin: 6px 0 2px; padding: 1px 10px; border-radius: 999px; background: var(--jelly-2); font: 900 12px var(--font); color: var(--soft); }

/* El menú sin pestañas arriba (Amigos) */
.hub-tabs.vacio { visibility: hidden; }
.hub-sec[data-sec="friends"] .add-friend { margin-right: 52px; }
/* La fila de un amigo: el nombre abre su ficha; seguir y mensaje, con icono; conectado o no */
.amigo-o { cursor: default; }
.amigo-o b.nombre { cursor: pointer; align-self: flex-start; max-width: 100%; }
.amigo-o b.nombre:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.amigo-o button.amigo-ico { width: 42px; height: 42px; padding: 0; flex: none; display: grid; place-items: center; }
.amigo-o button.amigo-ico svg { width: 22px; height: 22px; }
.amigo-o button.amigo-ico .fill { fill: #fff; }
.amigo-o button.amigo-ico:disabled { background: var(--jelly-2); box-shadow: 0 3px 0 var(--rim); cursor: default; }
.amigo-o button.amigo-ico:disabled .fill { fill: var(--rim-2); }
.amigo-o em.estado { font-style: normal; font-weight: 800; }
.amigo-o em.estado::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: #B8B0C6; }
.amigo-o em.estado.on { color: #3E8E5E; }
.amigo-o em.estado.on::before { background: #4CC77A; box-shadow: 0 0 0 2px rgba(76, 199, 122, .25); }

@media (max-width: 700px) {
  .decor-panel { height: 46vh; padding: 8px 10px 10px; border-radius: 26px; }
  #invStrip .inv { width: 92px; }
}

/* El plano de la casa, todo arrastrando (src/hotel/sala_ui.js) */
.plano-hab { touch-action: none; user-select: none; }
.plano-hab.movible { cursor: grab; }
.plano-hab.arrastrando { opacity: .8; z-index: 5; cursor: grabbing; box-shadow: 0 8px 18px rgba(40, 20, 80, .3); }
.plano-borde { position: absolute; z-index: 3; touch-action: none; }
.plano-borde.n, .plano-borde.s { left: 6px; right: 6px; height: 12px; cursor: ns-resize; }
.plano-borde.n { top: -6px; } .plano-borde.s { bottom: -6px; }
.plano-borde.o, .plano-borde.e { top: 6px; bottom: 6px; width: 12px; cursor: ew-resize; }
.plano-borde.o { left: -6px; } .plano-borde.e { right: -6px; }
.plano-hab.on .plano-borde::after { content: ""; position: absolute; inset: 4px; border-radius: 4px; background: var(--tint-2, #ffd86b); opacity: .8; }
.plano-borde.n::after, .plano-borde.s::after { inset: 4px 35% !important; }
.plano-borde.o::after, .plano-borde.e::after { inset: 35% 4px !important; }
.sala-mini { flex-wrap: wrap; gap: 8px; }
.sala-mini input { flex: 1; min-width: 140px; }

/* Paredes y suelos: el exterior que sigue al techo lleva una marquita */
.sw.sw-techo { position: relative; }
.sw.sw-techo::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; border: 2px dashed rgba(60, 40, 110, .45); }

/* Misiones: el mundo de cada una (Constelia o Fanfarria) encima del título */
.mission small.mundo, #misionFijada small.mundo { display: block; font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; color: var(--soft); line-height: 1.2; margin-bottom: 1px; }

