/* Farolia — interfaz «papel de farol». Reglas en docs/ART_DIRECTION.md §10.
   HUD sobre la escena = laca nocturna (oscuro translúcido); ventanas = papel cálido.
   Solo el contenedor exterior lleva borde de tinta grueso; dentro, líneas suaves. */

@font-face { font-family: "Pixelify Sans"; src: url(fonts/pixelify-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(fonts/pixelify-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(fonts/pixelify-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito-latin-900-normal.woff2) format("woff2"); font-weight: 900; font-display: swap; }

:root {
  /* tinta y papel */
  --ink: #22183a;
  --ink-soft: #62568a;
  --ink-faint: #9a8fb8;
  --paper: #fff6e6;
  --paper2: #f7ebd5;
  --paper3: #ecdcbf;
  --line: #e3d2b4;
  --line-strong: #cdb894;
  /* laca nocturna del HUD */
  --night: #1b1640;
  --lacquer: rgba(30, 22, 58, .9);
  --lacquer-2: rgba(52, 40, 92, .95);
  --lacquer-line: rgba(255, 236, 200, .14);
  --on-lacquer: #fff1d6;
  --on-lacquer-soft: #b9acd9;
  /* acentos */
  --amber: #ffbe55;
  --amber-hi: #ffd68a;
  --amber-d: #c9821c;
  --teal: #45b9a8;
  --teal-d: #23857a;
  --rose: #ee7392;
  --rose-d: #c04a69;
  --violet: #7b66d6;
  --violet-d: #5442ab;
  --ok: #4fa86c;
  --err: #d9534f;
  /* forma */
  --r-frame: 12px;
  --r-ctl: 8px;
  --drop: 0 4px 0 var(--ink);
  --shadow: 0 4px 0 var(--ink), 0 14px 34px rgba(8, 4, 26, .45);
  --f-ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  --f-px: "Pixelify Sans", "Nunito", system-ui, sans-serif;
  font-family: var(--f-ui);
  font-weight: 600;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
input, textarea { user-select: text; -webkit-user-select: text; font: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

#scene {
  touch-action: none;
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block;
}
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pxicon { image-rendering: pixelated; display: block; flex: none; }

/* ---------- Botones ---------- */
.btn {
  border: 2px solid var(--ink); border-radius: var(--r-ctl); background: var(--paper);
  color: var(--ink); font-family: var(--f-px); font-weight: 600; font-size: 15px; letter-spacing: .02em;
  padding: 6px 14px; box-shadow: 0 3px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .08s ease-out, box-shadow .08s ease-out, background-color .12s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); background-color: #fffaf0; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled, .btn:disabled:hover {
  cursor: default; transform: none; box-shadow: none; color: var(--ink-soft); border-color: var(--ink-faint);
  background: repeating-linear-gradient(-45deg, var(--paper2) 0 6px, var(--paper3) 6px 12px);
}
.btn.amber { background-color: var(--amber); }
.btn.amber:hover { background-color: var(--amber-hi); }
.btn.teal { background-color: var(--teal); color: #fff; }
.btn.rose { background-color: var(--rose); color: #fff; }
.btn.violet { background-color: var(--violet); color: #fff; }
.btn.teal:hover, .btn.rose:hover, .btn.violet:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding: 4px 6px; font-family: var(--f-ui); font-weight: 800; }
.btn.ghost:hover { transform: none; box-shadow: none; color: var(--violet-d); }
.btn.small { padding: 3px 10px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
.btn.small:hover { box-shadow: 0 3px 0 var(--ink); }
.btn.big { font-size: 19px; padding: 10px 20px; width: 100%; box-shadow: 0 4px 0 var(--ink); }
.icon-btn { border: none; background: transparent; font-size: 20px; padding: 4px 6px; border-radius: var(--r-ctl); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(34, 24, 58, .08); }

/* ---------- Pantalla de entrada ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
#landing { background: radial-gradient(ellipse at 50% 120%, rgba(255, 190, 85, .16), transparent 60%), linear-gradient(rgba(16, 10, 40, .35), rgba(16, 10, 40, .6)); }
.landing-card {
  width: min(380px, 100%); background: var(--paper); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: var(--shadow); padding: 0 0 14px; text-align: center; position: relative; overflow: hidden;
}
.landing-hero {
  position: relative; background: var(--night); padding: 16px 18px 14px; border-bottom: 3px solid var(--ink);
  background-image: radial-gradient(circle at 50% 110%, rgba(255, 190, 85, .35), transparent 55%);
}
.landing-hero canvas { image-rendering: pixelated; display: block; margin: 0 auto; }
.hero-lamp { display: inline-block; filter: drop-shadow(0 0 10px rgba(255, 190, 85, .9)); animation: lampSway 4s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes lampSway { 50% { transform: rotate(4deg); } }
.logo {
  font-family: var(--f-px); font-weight: 700; font-size: 44px; line-height: 1; margin: 4px 0 6px; letter-spacing: .02em;
  color: var(--on-lacquer); text-shadow: 0 3px 0 var(--amber-d), 0 0 24px rgba(255, 190, 85, .35);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.tagline { margin: 0; color: var(--on-lacquer-soft); font-weight: 700; font-size: 14px; line-height: 1.4; }
.landing-body { padding: 12px 20px 0; }
@media (max-height: 640px) { .features { display: none; } .tagline { font-size: 13px; } }
.features { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.features li { font-size: 12px; font-weight: 800; color: var(--ink-soft); background: var(--paper2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.tabs { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 2px solid var(--line); }
.tab {
  flex: 1; border: none; background: transparent; font-family: var(--f-px); font-weight: 600; font-size: 16px; color: var(--ink-soft);
  padding: 8px 4px 9px; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--amber); }
#authForm { display: flex; flex-direction: column; gap: 10px; text-align: left; }
label { font-weight: 800; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
input, textarea, select {
  border: 2px solid var(--line-strong); border-radius: var(--r-ctl); padding: 8px 10px; background: #fff; color: var(--ink); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, textarea:hover, select:hover { border-color: var(--ink-faint); }
input:focus, textarea:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123, 102, 214, .2); }
.form-error { color: var(--err); min-height: 18px; margin: 0; font-weight: 800; font-size: 13px; }
.fineprint { font-size: 12px; color: var(--ink-soft); margin: 12px 20px 0; }
.online-count { font-size: 13px; margin: 6px 0 0; font-weight: 800; color: var(--teal-d); min-height: 16px; }
.online-count:not(:empty)::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--teal); box-shadow: 0 0 0 2px rgba(69, 185, 168, .25); vertical-align: 1px; }

/* ---------- HUD (laca nocturna) ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.panel-chip {
  position: absolute; background: var(--lacquer); color: var(--on-lacquer); border: 2px solid var(--ink); border-radius: var(--r-frame);
  box-shadow: inset 0 0 0 1px var(--lacquer-line), 0 3px 0 rgba(10, 6, 26, .55); padding: 6px 12px;
  backdrop-filter: blur(3px);
}
#roomBadge { top: 12px; left: 12px; max-width: min(360px, 60vw); cursor: pointer; transition: background-color .12s; }
#roomBadge:hover { background: var(--lacquer-2); }
#roomBadge .rname { font-family: var(--f-px); font-weight: 600; font-size: 17px; line-height: 1.2; }
#roomBadge .rmeta { font-size: 12px; color: var(--on-lacquer-soft); font-weight: 700; }
#roomBadge .rparty { font-size: 12px; font-weight: 900; color: var(--amber-hi); }
#wallet { top: 12px; right: 12px; display: flex; gap: 14px; align-items: center; font-weight: 900; font-family: var(--f-px); }
#wallet .chispas { color: var(--amber); font-size: 18px; }
#wallet .lvl { display: flex; flex-direction: column; gap: 3px; min-width: 92px; font-size: 12px; font-weight: 600; color: var(--on-lacquer-soft); }
.xpbar { height: 8px; border: 2px solid var(--ink); border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.xpbar > div { height: 100%; background: var(--teal); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35); }
#wallet .luces { color: var(--amber-hi); font-size: 16px; }

#bottomBar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(760px, calc(100vw - 24px));
}
#chatBox {
  display: flex; align-items: center; gap: 2px; width: min(540px, 100%);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 6px 3px 4px;
  box-shadow: 0 3px 0 rgba(10, 6, 26, .55);
}
#chatBox:focus-within { box-shadow: 0 3px 0 rgba(10, 6, 26, .55), 0 0 0 3px rgba(255, 190, 85, .45); }
#chatBox .icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 999px; }
#chatInput { flex: 1; border: none; padding: 6px 4px; background: transparent; min-width: 0; box-shadow: none; font-weight: 700; }
#chatInput:focus { box-shadow: none; }
#toolbar {
  display: flex; gap: 2px; background: var(--lacquer); border: 2px solid var(--ink); border-radius: 14px;
  padding: 4px; box-shadow: inset 0 0 0 1px var(--lacquer-line), 0 3px 0 rgba(10, 6, 26, .55); flex-wrap: wrap; justify-content: center;
  backdrop-filter: blur(3px);
}
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px; border: none; background: transparent;
  border-radius: 10px; padding: 5px 7px 4px; font-size: 11px; font-weight: 800; color: var(--on-lacquer-soft); position: relative; min-width: 58px;
  transition: background-color .12s, color .12s, transform .08s;
}
.tool .ic { display: flex; align-items: center; justify-content: center; height: 26px; font-size: 22px; line-height: 1.1; transition: transform .12s ease-out; }
.tool:hover { background: rgba(255, 241, 214, .1); color: var(--on-lacquer); }
.tool:hover .ic { transform: translateY(-2px); }
.tool:active .ic { transform: translateY(1px); }
.tool.active { background: var(--amber); color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber-d); }
.tool .dot {
  position: absolute; top: 1px; right: 7px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--rose); color: #fff;
  font-size: 10px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink); padding: 0 3px;
}
.tool .dot.online { background: var(--teal); right: auto; left: 7px; }
.tool.pulse .ic { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-3px) rotate(-6deg); } 90% { transform: translateY(-1px) rotate(4deg); } }
@keyframes pulse { 50% { transform: scale(1.06); } }

#emoteMenu {
  position: absolute; bottom: 124px; left: 50%; transform: translateX(-50%);
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r-frame); padding: 6px; display: flex; gap: 2px;
  box-shadow: var(--shadow); animation: rise .14s ease-out;
}
#emoteMenu button { font-size: 12px; font-weight: 800; border: none; background: transparent; border-radius: var(--r-ctl); padding: 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
#emoteMenu button span { font-size: 22px; }
#emoteMenu button:hover { background: var(--paper2); }

#chatLog {
  position: absolute; right: 12px; top: 72px; width: 300px; max-height: 45vh; overflow-y: auto;
  background: var(--lacquer); color: var(--on-lacquer); border: 2px solid var(--ink); border-radius: var(--r-frame); padding: 8px 10px;
  font-size: 13px; box-shadow: inset 0 0 0 1px var(--lacquer-line), 0 3px 0 rgba(10, 6, 26, .55); backdrop-filter: blur(3px);
}
#chatLog.collapsed { display: none; }
#chatLog .line { margin: 2px 0; line-height: 1.4; user-select: text; }
#chatLog .line b { cursor: pointer; color: var(--amber-hi); }
#chatLog .line.whisper { color: #cdbcff; font-style: italic; }
#chatLog .line.system { color: #8fe0d2; font-weight: 700; }

#eventBtn, #fishBtn {
  position: absolute; bottom: 132px; left: 50%; transform: translateX(-50%); font-size: 16px;
}
#eventBtn { box-shadow: 0 3px 0 var(--ink), 0 0 0 4px rgba(255, 190, 85, .25), 0 0 26px rgba(255, 190, 85, .7); animation: glowPulse 1.8s ease-in-out infinite; }
#eventBtn:hover, #fishBtn:hover { transform: translateX(-50%) translateY(-1px); }
#eventBtn:active, #fishBtn:active { transform: translateX(-50%) translateY(2px); }
@keyframes glowPulse { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 6px rgba(255, 190, 85, .18), 0 0 34px rgba(255, 190, 85, .9); } }
.toast .btn { pointer-events: auto; margin-left: 8px; }
#fishBtn.bite { background: var(--rose); color: #fff; animation: pulse .35s infinite; }
#chairsCard, #triviaCard { top: 70px; left: 50%; transform: translateX(-50%); text-align: center; }
#chairsCard { min-width: 240px; }
#chairsCard.stop { background: rgba(150, 40, 70, .92); animation: pulse .4s infinite; }
#triviaCard { max-width: min(440px, 90vw); }
#triviaCard .dm-label, #danceMeter .dm-label { font-size: 12px; font-weight: 900; color: var(--amber-hi); font-family: var(--f-px); letter-spacing: .03em; }
#danceMeter { top: 70px; left: 12px; width: 190px; padding: 6px 10px; }
#danceMeter .dm-label { margin-bottom: 4px; }
#danceMeter .xpbar > div { background: var(--rose); transition: width .4s; }
#danceMeter.fever { animation: pulse .5s infinite; }
#danceMeter.fever .xpbar > div { background: var(--amber); }
.board-post { border: 1px solid var(--line-strong); border-radius: 4px; padding: 8px 10px; background: #fff8dc; box-shadow: 0 2px 0 rgba(34, 24, 58, .18); }
.board-post:nth-child(3n+2) { background: #ffeaf1; transform: rotate(-.6deg); }
.board-post:nth-child(3n) { background: #e9f3ff; transform: rotate(.5deg); }
#editBar { position: absolute; top: 62px; right: 12px; display: flex; gap: 6px; align-items: center; }
#editBar .btn.active { background: var(--amber); }
#editTools { display: inline-flex; gap: 6px; }
#camBar { position: absolute; right: 12px; bottom: 120px; display: flex; flex-direction: column; gap: 0; background: var(--lacquer); border: 2px solid var(--ink); border-radius: var(--r-frame); padding: 3px; box-shadow: inset 0 0 0 1px var(--lacquer-line), 0 3px 0 rgba(10, 6, 26, .55); }
.cam { width: 36px; height: 36px; background: transparent; border: none; border-radius: var(--r-ctl); color: var(--on-lacquer); font-weight: 900; font-size: 18px; }
.cam:hover { background: rgba(255, 241, 214, .12); }
#placeHint {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--lacquer); color: var(--on-lacquer); border: 2px solid var(--ink); padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
}

/* ---------- Burbujas y placas sobre la escena ---------- */
.bubble-stack { position: absolute; width: 240px; display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translate(-50%, -100%); padding-bottom: 6px; }
.bubble {
  position: relative; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px 5px; font-size: 13px; font-weight: 700; line-height: 1.3;
  max-width: 240px; box-shadow: 0 2px 0 var(--ink); animation: pop .16s ease-out; transition: opacity .6s;
  white-space: normal; overflow-wrap: anywhere; text-align: left;
}
.bubble:last-child::after {
  content: ''; position: absolute; left: 50%; bottom: -8px; width: 8px; height: 8px; margin-left: -4px;
  background: inherit; border: 2px solid var(--ink); border-top: none; border-left: none; transform: rotate(45deg) translate(-2px, -2px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.bubble b { color: var(--violet-d); margin-right: 4px; font-weight: 900; }
.bubble.me { background: #fff0cc; }
.bubble.whisper { background: #efe9ff; font-style: italic; }
.bubble.fade { opacity: 0; }
@keyframes pop { from { transform: translateY(4px) scale(.9); opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 6px); opacity: 0; } }
.nametag {
  position: absolute; transform: translate(-50%, -100%); background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  font-family: var(--f-px); font-size: 12px; font-weight: 600; padding: 0 6px 1px; border-radius: 4px; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(10, 6, 26, .5);
}
.nametag .lv { color: var(--amber-d); margin-left: 4px; }

/* ---------- Ventanas (papel) ---------- */
.win {
  position: fixed; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r-frame); box-shadow: var(--shadow);
  display: flex; flex-direction: column; max-height: calc(100vh - 140px); min-width: 280px; max-width: calc(100vw - 16px);
  animation: winIn .16s ease-out; overflow: hidden;
}
@keyframes winIn { from { transform: translateY(6px); opacity: 0; } }
.win-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 14px; min-height: 40px;
  background: var(--night); color: var(--on-lacquer); font-family: var(--f-px); font-weight: 600; font-size: 17px; letter-spacing: .02em;
  cursor: grab; border-bottom: 3px solid var(--ink);
  background-image: linear-gradient(90deg, rgba(255, 190, 85, .16), transparent 60%);
}
.win-head::before { content: ''; width: 6px; height: 10px; background: var(--amber); box-shadow: 0 0 8px rgba(255, 190, 85, .8); margin-right: 2px; flex: none; }
.win-head.has-icon::before { display: none; }
.win-head .win-icon { filter: drop-shadow(0 0 6px rgba(255, 190, 85, .45)); }
.win-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-head .x {
  background: transparent; color: var(--on-lacquer-soft); border: 2px solid transparent; border-radius: var(--r-ctl); width: 30px; height: 28px;
  font-weight: 900; font-size: 16px; line-height: 1; font-family: var(--f-ui);
}
.win-head .x:hover { background: var(--rose); color: #fff; border-color: var(--ink); }
.win-body { padding: 14px; overflow-y: auto; overflow-x: hidden; }
.win-tabs { display: flex; gap: 2px; margin: -4px -2px 12px; border-bottom: 2px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.win-tabs::-webkit-scrollbar { display: none; }
.win-tabs button {
  border: none; background: transparent; font-weight: 800; font-size: 13px; padding: 6px 10px 7px; color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; border-radius: 6px 6px 0 0;
}
.win-tabs button:hover { color: var(--ink); background: var(--paper2); }
.win-tabs button.active { color: var(--ink); border-bottom-color: var(--amber); }

.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .12s, background-color .12s;
}
.row.click { cursor: pointer; }
.row.click:hover { background: #fffaf0; border-color: var(--line-strong); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-pill { font-size: 12px; font-weight: 900; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line-strong); background: var(--paper2); white-space: nowrap; }
.users-pill.live { background: var(--teal); border-color: var(--teal-d); color: #fff; }
.muted { color: var(--ink-soft); font-size: 13px; }
.empty { text-align: center; color: var(--ink-soft); padding: 18px 14px; font-weight: 700; border: 2px dashed var(--line); border-radius: 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card {
  border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 6px 7px; display: flex; flex-direction: column; align-items: center;
  gap: 2px; cursor: pointer; position: relative; text-align: center; transition: transform .08s ease-out, border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--ink-faint); transform: translateY(-2px); box-shadow: 0 3px 0 var(--line-strong); }
.card.sel, .card[aria-selected="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--amber), 0 3px 0 var(--ink); }
.card.locked { opacity: .55; }
.card.locked:hover { transform: none; }
.card canvas { image-rendering: pixelated; width: 72px; height: 72px; }
.card .nm { font-size: 12px; font-weight: 800; line-height: 1.15; }
.card .pr { font-size: 13px; font-weight: 600; color: var(--amber-d); font-family: var(--f-px); }
.card .pr s { color: var(--ink-faint); font-weight: 400; margin-right: 3px; }
.card .qty { position: absolute; top: 4px; right: 4px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 900; border-radius: 4px; padding: 0 5px; }
.card .tag { position: absolute; top: 4px; left: 4px; background: var(--rose); color: #fff; font-size: 10px; font-weight: 900; border-radius: 4px; padding: 1px 5px; }
.card.equipped { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); background: #f1fbf8; }

.detail { display: flex; gap: 12px; align-items: center; margin-top: 10px; padding: 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper2); }
.detail.sticky { position: sticky; bottom: -14px; margin: 12px -14px -14px; border-radius: 0; border-width: 2px 0 0; border-color: var(--ink); background: var(--paper2); box-shadow: 0 -6px 14px rgba(34, 24, 58, .12); padding: 10px 14px 12px; animation: rise2 .14s ease-out; }
@keyframes rise2 { from { transform: translateY(8px); opacity: 0; } }
.promos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.promo { display: flex; align-items: center; gap: 8px; text-align: left; border: 2px solid var(--line-strong); border-radius: 10px; padding: 4px 10px 4px 4px; background: #fff3d6; transition: transform .08s, border-color .12s; min-width: 0; }
.promo.season { background: #ffe6d9; }
.promo:hover { border-color: var(--ink-soft); transform: translateY(-1px); }
.promo canvas { width: 40px; height: 40px; image-rendering: pixelated; flex: none; }
.promo .grow { display: flex; flex-direction: column; min-width: 0; }
.promo .kicker { font-size: 11px; font-weight: 900; color: var(--amber-d); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.promo.season .kicker { color: var(--rose-d); }
.promo .ptitle { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail canvas { image-rendering: pixelated; width: 96px; height: 96px; }
.detail .title { font-family: var(--f-px); font-weight: 600; font-size: 17px; }

.quest { display: flex; flex-direction: column; gap: 4px; }
.quest .bar { height: 10px; border: 2px solid var(--ink); border-radius: 3px; overflow: hidden; background: var(--paper3); }
.quest .bar > div { height: 100%; background: var(--amber); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4); }
.quest.done { opacity: .75; }
.quest.done .bar > div { background: var(--ok); }
.row.quest { align-items: stretch; flex-direction: column; }
.row.quest .bar { width: 100%; }

.streak { display: flex; gap: 6px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.streak .day { width: 46px; height: 58px; border: 2px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.streak .day.got { background: var(--amber); border-color: var(--ink); color: var(--ink); }
.streak .day.today { outline: 3px solid var(--violet); outline-offset: 2px; }
.streak .day .ic { font-size: 20px; }

.avatar-card { display: flex; gap: 12px; align-items: center; }
.avatar-card canvas { image-rendering: pixelated; width: 64px; height: 96px; background: radial-gradient(ellipse at 50% 88%, var(--paper3) 0 30%, transparent 31%), var(--paper2); border-radius: 10px; border: 2px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Creador de avatar */
.creator { display: flex; gap: 16px; flex-wrap: wrap; }
.creator .preview { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.creator .preview canvas { width: 160px; height: 240px; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 92%, rgba(255, 190, 85, .35) 0 22%, transparent 23%), linear-gradient(#2c2260, #1b1640); border: 3px solid var(--ink); border-radius: var(--r-frame); }
.creator .opts { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.opt-group .lbl { font-size: 12px; font-weight: 900; margin-bottom: 4px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 6px; cursor: pointer; transition: transform .08s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.sel { outline: 3px solid var(--amber); outline-offset: 2px; }
.chip { border: 2px solid var(--line-strong); border-radius: var(--r-ctl); background: #fff; padding: 4px 9px; font-size: 12px; font-weight: 800; transition: border-color .12s, background-color .12s; }
.chip:hover { border-color: var(--ink-soft); }
.chip.sel { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.locked { opacity: .5; background: var(--paper2); }

/* Avisos */
#toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 100000; }
.toast {
  background: var(--lacquer-2); color: var(--on-lacquer); border: 2px solid var(--ink); border-left: 6px solid var(--violet); border-radius: 8px;
  padding: 7px 14px; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 rgba(10, 6, 26, .55), 0 10px 24px rgba(8, 4, 26, .35);
  animation: pop .18s ease-out; transition: opacity .5s, transform .5s; max-width: 90vw; text-align: center;
}
.toast.error { border-left-color: var(--rose); }
.toast.success { border-left-color: var(--teal); }
.toast.reward { border-left-color: var(--amber); }
.toast.out { opacity: 0; transform: translateY(-10px); }

/* Modal */
#modal { position: fixed; inset: 0; background: rgba(15, 10, 35, .6); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
#modal .win { position: relative; max-height: calc(100vh - 32px); }

#reconnect { position: fixed; inset: 0; background: rgba(15, 10, 35, .75); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--on-lacquer); font-weight: 800; z-index: 80; font-family: var(--f-px); }
.spinner-lamp { width: 24px; height: 32px; border: 3px solid var(--ink); border-radius: 6px; background: var(--amber); animation: lampGlow 1.2s ease-in-out infinite; }
@keyframes lampGlow { 50% { box-shadow: 0 0 0 4px rgba(255, 190, 85, .25), 0 0 26px rgba(255, 190, 85, .9); } }

.levelup {
  position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 70; pointer-events: none;
  font-family: var(--f-px); font-size: 46px; font-weight: 700; color: var(--on-lacquer); text-shadow: 0 4px 0 var(--ink), 0 0 30px var(--amber); animation: lvl 2.6s ease-out forwards;
}
@keyframes lvl { 0% { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.04); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -70%) scale(1); opacity: 0; } }

.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { font-size: 20px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line-strong); border-radius: 8px; background: #fff8e6; cursor: help; }
.badge.locked { filter: grayscale(1); opacity: .35; background: var(--paper2); }

/* Intercambio */
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trade-col { border: 2px solid var(--line); border-radius: 10px; padding: 6px; background: var(--paper2); min-height: 120px; }
.trade-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 6px; }
.trade-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 5px; }
.trade-grid .card canvas { width: 48px; height: 48px; }
.trade-grid .card.static { cursor: default; }
.trade-inv { max-height: 190px; overflow-y: auto; border: 2px dashed var(--line-strong); border-radius: 10px; padding: 6px; }
.trade-warning { margin-top: 8px; padding: 10px; border: 2px solid var(--amber-d); border-left-width: 6px; border-radius: 8px; background: #fff3d6; display: flex; flex-direction: column; gap: 3px; }

.thumb canvas { width: 44px; height: 44px; display: block; }
.thumb { flex: none; border-radius: 8px; background: radial-gradient(circle, #2b2058, #1b1640); padding: 2px; border: 2px solid var(--ink); }

/* ---------- Móvil y táctil ---------- */
@media (max-width: 640px) {
  .tool { min-width: 40px; padding: 4px 3px; }
  .tool .ic { font-size: 19px; }
  #toolbar { gap: 0; padding: 3px; flex-wrap: nowrap; max-width: calc(100vw - 16px); overflow-x: auto; justify-content: flex-start; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 24px), rgba(0, 0, 0, .35)); }
  #toolbar::-webkit-scrollbar { display: none; }
  .tool .lbl { display: none; }
  #wallet { gap: 8px; padding: 4px 8px; font-size: 13px; }
  #wallet .lvl { min-width: 60px; }
  #roomBadge { max-width: 45vw; padding: 5px 10px; }
  #roomBadge .rname { font-size: 15px; }
  #chatLog { width: calc(100vw - 24px); }
  #camBar { bottom: 124px; right: 8px; }
  .trade-cols { grid-template-columns: 1fr; }
  .logo { font-size: 40px; }
}

/* Teclado, zonas seguras y controles táctiles compartidos por web y Android. */
#hud { top: env(safe-area-inset-top, 0px); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--keyboard-inset, 0px)); }
.screen { bottom: var(--keyboard-inset, 0px); overflow-y: auto; }
.landing-card { max-height: 100%; overflow-y: auto; flex-shrink: 0; }
#chairsCard { max-width: calc(100vw - 24px); max-height: 28vh; overflow-y: auto; overflow-wrap: anywhere; }
.keyboard-open #toolbar, .keyboard-open #camBar { display: none; }
@media (pointer: coarse) {
  .btn, .icon-btn, .tool, .tab, #emoteMenu button { min-height: 44px; min-width: 44px; }
  .cam { width: 44px; height: 44px; }
  input, textarea, select { font-size: 16px; }
  #toolbar { touch-action: pan-x; }
  .win-body, .landing-card, #chatLog { touch-action: pan-y; }
  .win-head { touch-action: none; }
  .win-head .x { width: 44px; height: 40px; }
}
@media (max-width: 420px) {
  #wallet .lvl { display: none; }
  #roomBadge { max-width: 52vw; }
}
@media (max-height: 500px) {
  #windows .win { top: 8px !important; }
  .win { max-height: calc(100dvh - var(--keyboard-inset, 0px) - 16px) !important; }
  #hud:has(#chatInput:focus) #toolbar, #hud:has(#chatInput:focus) #camBar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   Formas pixel (pasada 2): esquinas escalonadas en lugar de redondeos web,
   labio inferior sólido en lugar de sombras difusas y bisel interior.
   Unidad de píxel de la interfaz: 2px (los marcos grandes usan 3px).
   ===================================================================== */
:root {
  --n2: polygon(2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px), 0 2px, 2px 2px);
  --n4: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 2px, calc(100% - 2px) 2px, calc(100% - 2px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 2px) calc(100% - 4px), calc(100% - 2px) calc(100% - 2px), calc(100% - 4px) calc(100% - 2px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 2px), 2px calc(100% - 2px), 2px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 2px 4px, 2px 2px, 4px 2px);
  --bevel-paper: inset 0 2px 0 #ffffff, inset 2px 0 0 #ffffff, inset 0 -2px 0 var(--paper3);
  --bevel-lacquer: inset 0 2px 0 #3d3470, inset 2px 0 0 #322a5e, inset 0 -2px 0 #181232;
}

/* Botones: cuerpo + labio de tinta; al pulsar, el labio se hunde */
.btn {
  border-radius: 0; clip-path: var(--n2); border: 2px solid var(--ink); border-bottom-width: 5px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(34, 24, 58, .16);
  padding: 4px 14px 3px; transition: filter .1s;
}
.btn:hover { transform: none; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(34, 24, 58, .16); filter: brightness(1.05); }
.btn:active { transform: none; border-bottom-width: 2px; margin-top: 3px; box-shadow: inset 0 2px 0 rgba(34, 24, 58, .18); }
.btn.small { padding: 2px 9px 1px; border-bottom-width: 4px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55); }
.btn.small:hover { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7); }
.btn.small:active { border-bottom-width: 2px; margin-top: 2px; }
.btn.big { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -3px 0 rgba(34, 24, 58, .14); border-bottom-width: 6px; }
.btn:disabled, .btn:disabled:hover { border-bottom-width: 2px; margin-top: 3px; filter: none; box-shadow: none; }
.btn.small:disabled { margin-top: 2px; }
.btn.ghost, .btn.ghost:hover, .btn.ghost:active { clip-path: none; border: none; box-shadow: none; margin-top: 0; filter: none; }
#eventBtn, #fishBtn { clip-path: var(--n2); }
#eventBtn { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6); animation: none; outline: 3px solid rgba(255, 190, 85, .35); outline-offset: 2px; }

/* Marcos grandes: ventanas y portada */
.win, .landing-card {
  border-radius: 0; clip-path: var(--n4); border: 3px solid var(--ink); border-bottom-width: 7px;
  box-shadow: var(--bevel-paper);
}
.win-head { border-radius: 0; }
.landing-hero { box-shadow: inset 0 -2px 0 #2c2458; }
#modal .win { box-shadow: var(--bevel-paper); }

/* HUD de laca: esquinas escalonadas y labio oscuro */
.panel-chip, #toolbar, #camBar, #chatLog, .toast, #placeHint {
  border-radius: 0; clip-path: var(--n2); border: 2px solid var(--ink); border-bottom-width: 5px;
  background: #262046; box-shadow: var(--bevel-lacquer); backdrop-filter: none;
}
.toast { border-left-width: 2px; padding-left: 12px; position: relative; }
.toast::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 4px; background: var(--violet); }
.toast.error::before { background: var(--rose); }
.toast.success::before { background: var(--teal); }
.toast.reward::before { background: var(--amber); }
#chatBox, #emoteMenu {
  border-radius: 0; clip-path: var(--n2); border: 2px solid var(--ink); border-bottom-width: 5px; box-shadow: var(--bevel-paper);
}
#chatBox:focus-within { box-shadow: var(--bevel-paper); border-color: var(--ink); background: #fffaf0; }
#chatBox .icon-btn, .icon-btn, .cam { border-radius: 0; clip-path: var(--n2); }
.tool { border-radius: 0; clip-path: var(--n2); }
.tool.active { box-shadow: inset 0 2px 0 var(--amber-hi), inset 0 -3px 0 var(--amber-d); }
.tool .dot { border-radius: 0; clip-path: var(--n2); }

/* Piezas interiores: mismas esquinas escalonadas, sin sombras difusas */
.row, .card, .chip, .users-pill, .promo, .detail, .swatch, .badge, .streak .day, .trade-col, .trade-inv, .empty,
input, textarea, select, .thumb, .avatar-card canvas, .creator .preview canvas, .xpbar, .quest .bar, .features li, .board-post, .trade-warning {
  border-radius: 0; clip-path: var(--n2);
}
.card:hover { box-shadow: inset 0 -3px 0 var(--paper3); }
.card.sel, .card[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--amber), inset 0 -4px 0 var(--amber); }
.card.equipped { box-shadow: inset 0 0 0 2px var(--teal); }
.detail.sticky { clip-path: none; }
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 2px rgba(123, 102, 214, .25); }
.win-tabs button, .win-tabs { border-radius: 0; }
.nametag { border-radius: 0; clip-path: var(--n2); box-shadow: inset 0 -2px 0 var(--paper3); }
.bubble { border-radius: 3px; box-shadow: inset 0 -2px 0 var(--paper3), 0 2px 0 var(--ink); }
.spinner-lamp { border-radius: 0; clip-path: var(--n2); }
@media (max-height: 720px) {
  .detail.sticky { padding: 6px 12px 8px; gap: 8px; }
  .detail.sticky canvas { width: 64px; height: 64px; }
  .detail.sticky .muted:nth-of-type(2) { display: none; }
  .detail.sticky .actions { margin-top: 6px; }
}

/* Creador de avatar: miniaturas visuales de cada opción */
.creator .opts { gap: 12px; }
.creator .opts .win-tabs { margin: 0 0 2px; }
.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.look-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 3px; background: #fff;
  border: 2px solid var(--line); clip-path: var(--n2); font-size: 11px; font-weight: 800; color: var(--ink-soft); line-height: 1.1;
}
.look-opt canvas { image-rendering: pixelated; height: 52px; width: auto; }
.look-opt:hover { border-color: var(--ink-faint); color: var(--ink); }
.look-opt.sel { border-color: var(--ink); background: #fff3d6; color: var(--ink); box-shadow: inset 0 -3px 0 var(--amber); }
.look-opt.locked { opacity: .5; }
.look-opt.locked canvas { filter: grayscale(1); }
button.swatch { padding: 0; }
.creator .preview canvas { background: radial-gradient(ellipse at 50% 88%, rgba(255, 190, 85, .4) 0 18%, transparent 19%), linear-gradient(#2c2260, #1b1640); }

/* Muestra artística v3: únicamente navegación y Explorador. */
#toolbar { gap: 3px; padding: 6px; border-top: 2px solid #9586b4; background: #302645; max-width: 100%; }
#toolbar .tool { min-width: 62px; min-height: 62px; padding: 4px 5px; flex: 0 0 auto; gap: 3px; border: 1px solid transparent; }
#toolbar .tool:hover, #toolbar .tool:focus-visible { background: #4c3c63; border-color: #ffd58a; outline: none; }
#toolbar .tool .ic { display: flex; justify-content: center; align-items: center; height: 32px; }
#toolbar .tool .lbl { display: block; font-family: 'Nunito', sans-serif; font-size: 11px; line-height: 14px; font-weight: 800; color: #fff6e6; }
#toolbar .tool .dot { top: 0; right: 0; min-width: 15px; font-family: 'Nunito', sans-serif; }
.atlas .win-head { min-height: 52px; background: #40345e; color: #fff6e6; border-bottom: 3px solid #b78359; }
.atlas .win-head .x { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.atlas .win-body { background: #fff6e6; padding: 14px; }
.atlas { max-height: calc(100dvh - 250px) !important; }
.atlas .win-body { scrollbar-color: #9586b4 #eee4d4; scrollbar-width: thin; }
#wallet .chispas, #wallet .luces { display: flex; align-items: center; gap: 4px; }
.atlas-intro { display: flex; gap: 12px; align-items: center; padding: 4px 0 16px; }
.atlas-kicker { color: #654659; font: 800 10px/1.5 'Nunito', sans-serif; letter-spacing: 1px; }
.atlas-title { color: #40345e; font: 600 24px/1.25 'Pixelify Sans', monospace; }
.atlas-presence { font: 600 12px/1.5 'Nunito', sans-serif; color: #654659; }
.presence-light { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #436b62; box-shadow: 0 -2px #719879; }
.atlas .win-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid #d8c9b4; margin-bottom: 12px; }
.atlas .win-tabs button { flex: 0 0 auto; min-height: 44px; padding: 8px; font: 800 12px 'Nunito', sans-serif; }
.atlas .win-tabs button.active { background: #40345e; color: #fff6e6; box-shadow: inset 0 -3px #ffd58a; }
.atlas .list { gap: 8px; }
.atlas .room-destination { width: 100%; min-height: 84px; text-align: left; padding: 8px; border: 1px solid #d8c9b4; border-bottom: 3px solid #d8c9b4; background: #f6eddc; color: #22183a; }
.atlas .room-destination:hover, .atlas .room-destination:focus-visible { background: #eee4d4; border-color: #9586b4; outline: 2px solid #9586b4; outline-offset: -2px; }
.atlas .room-destination .title { font: 800 15px/1.3 'Nunito', sans-serif; }
.atlas .room-destination .sub { font: 600 12px/1.4 'Nunito', sans-serif; color: #654659; }
.atlas .thumb { background: #40345e; border: 2px solid #9586b4; flex-shrink: 0; }
.atlas .users-pill { display: flex; align-items: center; gap: 3px; font: 800 12px 'Nunito', sans-serif; padding: 4px; }
.room-access { font: 800 11px 'Nunito', sans-serif; color: #654659; }
.avatar-card canvas { height: 112px; box-sizing: content-box; flex-shrink: 0; }
.creator .preview canvas { box-sizing: content-box; }
.look-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
@media (max-width: 640px) {
  #toolbar { overflow-x: auto; justify-content: flex-start; scrollbar-width: thin; scrollbar-color: #9586b4 #40345e; }
  #toolbar::-webkit-scrollbar { display: block; height: 4px; background: #40345e; }
  #toolbar::-webkit-scrollbar-thumb { background: #9586b4; }
  #toolbar .tool { min-width: 58px; min-height: 62px; }
  #camBar { bottom: 160px; }
  .atlas .win-body { padding: 10px; }
  .atlas { max-height: calc(100dvh - 260px) !important; }
  .atlas .room-destination { gap: 8px; }
  .atlas .room-destination .thumb { width: 48px; height: 48px; overflow: hidden; }
  .atlas .room-destination .thumb canvas { width: 48px; height: 48px; }
  .atlas .users-pill { flex-shrink: 0; }
}

/* Iconos en línea y puntos de estado (sustituyen a los emojis del sistema) */
.ic-inline { display: inline-block; vertical-align: -3px; margin-right: 5px; }
.btn .ic-inline, .chip .ic-inline { margin-right: 2px; }
.sdot { display: inline-block; width: 10px; height: 10px; margin: 0 5px 0 1px; vertical-align: -1px; border: 2px solid var(--ink); background: var(--ink-faint); clip-path: var(--n2); }
.sdot.on { background: var(--teal); }
.sdot.busy { background: var(--amber); }
.sdot.dnd { background: var(--rose); }
.sdot.off { background: #d8cdb8; }
.sdot.sel { background: var(--violet); }

/* Botones que viven sobre la escena: laca nocturna como el resto del HUD */
.btn.hud-btn { background: #262046; color: var(--on-lacquer); border-color: var(--ink); box-shadow: var(--bevel-lacquer); }
.btn.hud-btn:hover { background: #2f2858; filter: none; }
.btn.hud-btn.active { background: var(--amber); color: var(--ink); box-shadow: inset 0 2px 0 var(--amber-hi); }
.btn.hud-btn .pxicon { width: 16px !important; height: 16px !important; }
/* Cierre de ventana: el mismo en todas (icono pixel sobre la cabecera nocturna) */
.win-head .x { display: grid; place-items: center; padding: 0; }
.win-head .x .pxicon { width: 16px !important; height: 16px !important; }

/* =====================================================================
   Página de inicio (tras iniciar sesión, antes de entrar al mundo)
   ===================================================================== */
#home {
  position: fixed; inset: 0; z-index: 4; overflow-y: auto; overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% -10%, rgba(255, 190, 85, .14), transparent 55%), linear-gradient(rgba(22, 15, 52, .62), rgba(22, 15, 52, .88));
}
.home-top, .home-grid { max-width: 1060px; margin: 0 auto; }
.home-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.home-logo { display: flex; align-items: center; gap: 8px; font-family: var(--f-px); font-weight: 700; font-size: 28px; color: var(--on-lacquer); text-shadow: 0 3px 0 var(--amber-d); flex: 1; }
.home-logo .pxicon { filter: drop-shadow(0 0 8px rgba(255, 190, 85, .7)); }
.home-wallet { display: flex; gap: 6px; flex-wrap: wrap; }
.hw { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: #262046; color: var(--on-lacquer); border: 2px solid var(--ink); border-bottom-width: 4px; clip-path: var(--n2); box-shadow: var(--bevel-lacquer); font-family: var(--f-px); font-weight: 600; font-size: 15px; }
.hw.chispas { color: var(--amber); } .hw.luces { color: var(--amber-hi); }
.hw.lvl { font-size: 13px; color: var(--on-lacquer-soft); }
.hw.lvl .xpbar { width: 64px; display: inline-block; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.hcard {
  background: var(--paper); border: 3px solid var(--ink); border-bottom-width: 7px; clip-path: var(--n4);
  box-shadow: var(--bevel-paper); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px;
}
.hcard-head { display: flex; align-items: center; gap: 8px; }
.hcard-head h2 { font-family: var(--f-px); font-weight: 600; font-size: 20px; margin: 0; }
.hcard p { margin: 0; }
.hcard > .btn { align-self: flex-start; }

/* tarjeta principal: tu faroliano y la entrada al mundo */
.hcard.h-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; color: var(--on-lacquer);
  background: radial-gradient(ellipse at 22% 88%, rgba(255, 190, 85, .28), transparent 40%), linear-gradient(#2f2768, #1d1846);
  box-shadow: var(--bevel-lacquer); padding: 18px 22px 20px;
}
.hero-stage { position: relative; width: 140px; height: 204px; display: grid; place-items: end center; }
.hero-stage::before { content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 22px; background: radial-gradient(ellipse, rgba(255, 210, 122, .45), transparent 70%); }
.home-avatar { position: relative; width: 108px; height: 192px; image-rendering: pixelated; }
.hero-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hero-info .kicker { font: 900 12px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--amber-hi); }
.hero-info h1 { font-family: var(--f-px); font-weight: 700; font-size: 32px; line-height: 1.05; margin: 0; }
.hero-info .muted { color: var(--on-lacquer-soft); font-size: 14px; }
.hero-info .enter { width: auto; align-self: flex-start; margin-top: 6px; font-size: 20px; padding: 10px 22px 8px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* noticias */
.news-list { display: flex; flex-direction: column; }
.news { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px 0; border-top: 2px solid var(--line); }
.news:first-child { border-top: none; padding-top: 2px; }
.news.live { grid-template-columns: auto 1fr; background: #fff3d6; margin: 0 -8px 6px; padding: 10px 8px; border: 2px solid var(--amber); clip-path: var(--n2); }
.news h3 { margin: 2px 0 4px; font: 800 16px var(--f-ui); }
.news p { color: var(--ink-soft); font-size: 14px; line-height: 1.4; margin: 0 0 6px; }
.news-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-faint); font-weight: 800; }
.tag { font: 900 11px var(--f-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--violet-d); background: #efe9ff; padding: 1px 7px; clip-path: var(--n2); }
.tag.live { color: var(--ink); background: var(--amber); align-self: start; }

/* tienda */
.shop-feature { display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px 10px 6px 6px; background: var(--paper2); border: 2px solid var(--line); clip-path: var(--n2); transition: border-color .12s; }
.shop-feature:hover { border-color: var(--ink-faint); }
.shop-feature canvas { width: 64px; height: 64px; image-rendering: pixelated; flex: none; }
.shop-feature > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-feature .kicker { font: 900 11px var(--f-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--amber-d); }
.shop-feature.season .kicker { color: var(--rose-d); }
.shop-feature b { font-weight: 800; }
.shop-feature .price { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-px); color: var(--amber-d); font-weight: 600; }
.shop-feature .progress { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.shop-feature .progress .xpbar { width: 70px; }
.shop-feature .xpbar > div, .q .xpbar > div { background: var(--amber); }

/* misiones, amistades y salas */
.q-list, .f-list, .r-list { display: flex; flex-direction: column; gap: 8px; }
.q-row { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.q-row span { flex: 1; min-width: 0; }
.q .xpbar { height: 8px; margin-top: 3px; background: var(--paper3); }
.q.done { opacity: .7; }
.q.done .xpbar > div { background: var(--teal); }
.f-row, .r-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fff; border: 2px solid var(--line); clip-path: var(--n2); text-align: left; }
.r-row:hover { border-color: var(--ink-faint); }
.f-row .grow, .r-row .grow { display: flex; flex-direction: column; min-width: 0; }
.f-row .muted, .r-row .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.users-pill .pxicon { display: inline-block; vertical-align: -3px; margin-right: 3px; }

@media (max-width: 760px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-logo { font-size: 24px; }
  .home-top .btn { order: 2; }
  .home-wallet { order: 3; width: 100%; }
  .hcard.h-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 16px; }
  .hero-info { align-items: center; }
  .hero-info .enter { align-self: stretch; }
  .hero-actions { justify-content: center; }
  .hero-info h1 { font-size: 26px; }
}
.q .xpbar { display: block; }
.h-now > .muted, .h-friends > .muted { font-size: 13px; }
@media (max-width: 760px) {
  .home-grid { display: flex; flex-direction: column; gap: 16px; }
  .home-col { display: contents; }
  .h-hero { order: 1; } .h-daily { order: 2; } .h-mail { order: 3; } .h-friends { order: 4; }
  .h-news { order: 5; } .h-shop { order: 6; } .h-quests { order: 7; } .h-now { order: 8; }
}
@media (max-width: 760px) { .home-grid .hcard { width: 100%; align-self: stretch; } }

/* Noticias: marcas, herramientas del equipo y editor */
.h-news .hcard-head { position: relative; }
.news-write { align-self: flex-start; }
.tag.pin { color: var(--ink); background: var(--amber-hi); }
.tag.draft { color: #fff; background: var(--ink-soft); }
.news.draft { opacity: .78; }
.news-tools { display: flex; gap: 6px; margin-top: 4px; }
.news-list.all { max-height: 70vh; overflow-y: auto; }
.news-editor { display: flex; flex-direction: column; gap: 10px; }
.news-editor textarea { resize: vertical; min-height: 120px; font-weight: 600; line-height: 1.4; }
.news-editor .lbl { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.ne-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.ne-check { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 700 !important; }
.ne-check input { width: 18px; height: 18px; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-opt { padding: 4px; background: #fff; border: 2px solid var(--line); clip-path: var(--n2); }
.icon-opt:hover { border-color: var(--ink-faint); }
.icon-opt.sel { border-color: var(--ink); background: #fff3d6; box-shadow: inset 0 -3px 0 var(--amber); }
.news-preview { border: 2px dashed var(--line-strong); padding: 6px 12px; background: #fffaf0; }
.preview-label { font: 900 11px var(--f-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }

/* =====================================================================
   Panel de administración
   ===================================================================== */
#admin { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; background: linear-gradient(#211a4c, #171238); color: var(--ink); }
.adm-top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--night); border-bottom: 3px solid var(--ink); color: var(--on-lacquer); }
.adm-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.adm-title h1 { margin: 0; font-family: var(--f-px); font-weight: 600; font-size: 22px; }
.adm-title .muted { color: var(--on-lacquer-soft); font-size: 13px; }
.adm-layout { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 0; }
.adm-nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; border-right: 2px solid #120c2a; background: #1d1844; overflow-y: auto; }
.adm-tab { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: transparent; border: none; color: var(--on-lacquer-soft); font-weight: 800; text-align: left; clip-path: var(--n2); }
.adm-tab:hover { background: rgba(255, 241, 214, .08); color: var(--on-lacquer); }
.adm-tab.active { background: var(--amber); color: var(--ink); box-shadow: inset 0 -3px 0 var(--amber-d); }
.adm-main { overflow-y: auto; padding: 16px 20px 40px; }
.adm-h { font-family: var(--f-px); font-weight: 600; font-size: 24px; color: var(--on-lacquer); margin: 0 0 12px; }
.adm-box { background: var(--paper); border: 3px solid var(--ink); border-bottom-width: 6px; clip-path: var(--n4); box-shadow: var(--bevel-paper); padding: 12px 14px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.adm-box h3 { margin: 0; font-family: var(--f-px); font-weight: 600; font-size: 18px; }
.adm-box p { margin: 0; }
.adm-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.adm-cols > .adm-box { margin-bottom: 0; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.adm-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 10px 12px; background: var(--paper); border: 2px solid var(--ink); border-bottom-width: 4px; clip-path: var(--n2); }
.adm-tile .pxicon { grid-row: span 2; }
.adm-tile b { font-family: var(--f-px); font-weight: 600; font-size: 22px; }
.adm-tile span { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.adm-tile.warn { background: #ffe1df; }
.adm-list { display: flex; flex-direction: column; gap: 6px; }
.adm-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fff; border: 2px solid var(--line); clip-path: var(--n2); }
.adm-row .grow { display: flex; flex-direction: column; min-width: 0; }
.adm-row .muted { font-size: 12px; }
.adm-search { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.adm-search input { flex: 1; min-width: 180px; }
.adm-table { display: flex; flex-direction: column; gap: 4px; }
.adm-tr { display: grid; grid-template-columns: 1.4fr 1fr .6fr .8fr 1fr 1fr; gap: 8px; align-items: center; padding: 6px 8px; background: #fff; border: 2px solid var(--line); clip-path: var(--n2); text-align: left; font-size: 14px; }
.adm-tr.head { background: transparent; border-color: transparent; font: 900 11px var(--f-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
button.adm-tr:hover { border-color: var(--ink-faint); }
.adm-tr.sel { border-color: var(--ink); background: #fff3d6; }
.adm-table.prices .adm-tr { grid-template-columns: 36px 1.6fr .7fr 1fr 1.6fr; }
.adm-table.prices canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.adm-tr.changed { background: #fff8e2; }
.adm-tr.retired { opacity: .7; background: #f3ecdf; }
.adm-table.log .adm-tr { grid-template-columns: 1fr .9fr 1fr .9fr 2fr; font-size: 13px; }
.role { font: 900 11px var(--f-ui); text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; clip-path: var(--n2); background: #efe9ff; color: var(--violet-d); justify-self: start; }
.role.mod { background: #dff5ef; color: var(--teal-d); }
.role.admin { background: var(--amber); color: var(--ink); }
.badge-s { font: 900 11px var(--f-ui); padding: 1px 7px; clip-path: var(--n2); }
.badge-s.bad { background: var(--rose); color: #fff; }
.badge-s.warn { background: var(--amber-hi); }
.adm-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.adm-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 800; }
.adm-field textarea { width: 100%; resize: vertical; }
.adm-user-head { display: flex; gap: 14px; align-items: center; }
.adm-user-head h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-avatar { width: 72px; height: 128px; image-rendering: pixelated; background: var(--paper2); border: 2px solid var(--line); flex: none; }
.adm-warn { color: var(--rose-d); font-weight: 800; }
.adm-offer { display: flex; gap: 10px; align-items: center; }
.adm-offer canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.home-motd { max-width: 1060px; margin: 0 auto 16px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--paper); border: 3px solid var(--ink); border-left-width: 8px; border-bottom-width: 6px; clip-path: var(--n2); font-weight: 800; }
.home-motd p { margin: 0; }
.home-motd.evento { border-left-color: var(--amber); background: #fff3d6; }
.home-motd.aviso { border-left-color: var(--rose); background: #ffe8ec; }
.home-motd.info { border-left-color: var(--violet); }
@media (max-width: 760px) {
  .adm-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .adm-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 2px solid #120c2a; padding: 8px; }
  .adm-tab { flex: none; }
  .adm-tab span { white-space: nowrap; }
  .adm-main { padding: 12px 12px 40px; }
  .adm-tr { grid-template-columns: 1fr 1fr; }
  .adm-tr.head { display: none; }
  .adm-table.prices .adm-tr, .adm-table.log .adm-tr { grid-template-columns: 1fr 1fr; }
  .adm-title h1 { font-size: 18px; }
}

/* Bonificaciones y eventos programados */
.bonus-chip { font-family: var(--f-px); font-weight: 700; color: var(--ink); background: var(--amber); padding: 1px 6px; clip-path: var(--n2); box-shadow: 0 0 10px rgba(255, 190, 85, .7); }
.home-bonus { max-width: 1060px; margin: 0 auto 16px; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: linear-gradient(90deg, #ffd27a, #ffbe55); border: 3px solid var(--ink); border-bottom-width: 6px; clip-path: var(--n2); }
.home-bonus div { display: flex; flex-direction: column; }
.home-bonus b { font-family: var(--f-px); font-weight: 600; font-size: 18px; }
.home-bonus span { font-weight: 800; font-size: 13px; }
.adm-live { display: flex; align-items: center; gap: 6px; font-weight: 800; background: #fff3d6; padding: 6px 8px; clip-path: var(--n2); }
.adm-row.retired { opacity: .6; }
.adm-box details summary { cursor: pointer; font-weight: 800; }

/* Panel: comunidad */
.adm-room-head { display: flex; align-items: center; gap: 10px; }
.adm-room-head .grow, .adm-trade-side { display: flex; flex-direction: column; }
.adm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.adm-chip { background: #eef2ff; padding: 2px 8px; font-weight: 800; clip-path: var(--n2); }
.adm-chip.mod, .adm-chip.admin { background: #ffe9b8; }
.adm-chat { background: #fbf7ef; border: 2px solid #e6dcc8; padding: 6px 8px; max-height: 220px; overflow: auto; font-size: 13px; line-height: 1.5; }
.adm-link { color: inherit; font-weight: 800; text-decoration: underline dotted; cursor: pointer; }
.adm-trade { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-trade .arrow { font-weight: 900; }
.adm-row.flagged { background: #fff3d6; }
.adm-row.note .grow { display: flex; flex-direction: column; }
.adm-box textarea { flex: 1; min-width: 200px; font: inherit; padding: 6px; }
.adm-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* Panel: estadísticas */
.adm-legend { display: flex; flex-wrap: wrap; gap: 14px; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.adm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--ink); }
.sw.a, .bar.a { background: #ffbe55; } .sw.b, .bar.b { background: #7a6cf0; } .sw.c, .bar.c { background: #3cc8a8; } .sw.d, .bar.d { background: #ef6f8e; }
.adm-chart { display: grid; grid-template-rows: 100%; gap: 3px; height: 150px; align-items: end; padding: 6px 4px 0;
  background: repeating-linear-gradient(to top, #efe6d4 0 1px, transparent 1px 25%); border-bottom: 3px solid var(--ink); }
.adm-chart .col { display: flex; flex-direction: column; align-items: stretch; height: 100%; min-width: 0; }
.adm-chart .bars { flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.adm-chart .bar { flex: 1; min-height: 2px; border: 2px solid var(--ink); border-bottom: 0; }
.adm-chart .col:hover .bar { filter: brightness(1.12); }
.adm-chart .lbl { font-size: 10px; text-align: center; color: #8a7f6a; white-space: nowrap; overflow: hidden; margin-top: 2px; }
.adm-chart .col:nth-child(even) .lbl { visibility: var(--odd-lbl, visible); }
.adm-rank { display: flex; flex-direction: column; gap: 6px; }
.adm-rank-row { display: grid; grid-template-columns: 28px minmax(110px, 1.2fr) 2fr 150px; align-items: center; gap: 8px; }
.adm-rank-row .track { height: 12px; background: #efe6d4; border: 2px solid var(--ink); }
.adm-rank-row .fill { height: 100%; background: #ffbe55; }
@media (max-width: 600px) {
  .adm-chart { height: 120px; --odd-lbl: hidden; }
  .adm-rank-row { grid-template-columns: 22px 1fr auto; } .adm-rank-row .muted { text-align: right; } .adm-rank-row .track { display: none; }
}
p.adm-warn { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
