* { margin: 0; padding: 0; box-sizing: border-box; }

/* Necesario para que el atributo "hidden" funcione con display:flex */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px 0;
  background: #1a1c2c;
  font-family: "Courier New", monospace;
  color: #e8e8f0;
}

#app { width: min(98vw, 1760px); }
#layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 12px; align-items: start; }
#main-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

#stage { position: relative; border: 4px solid #0e0f1a; background: #262b44; overflow: hidden; }
#game {
  display: block;
  width: 100%;
  height: clamp(400px, 66vh, 820px);
  background: #262b44;
  cursor: crosshair;
}
#game.decorating { cursor: cell; }
/* Lienzo de presentación: el juego se dibuja en #game (invisible, recibe el ratón) y se reescala nítido a #view */
#view { position: absolute; left: 0; top: 0; width: 100%; height: clamp(400px, 66vh, 820px); display: none; pointer-events: none; background: #262b44; }
#stage.has-view #game { opacity: 0; }

#panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #262b44;
  border: 4px solid #0e0f1a;
}

.row { display: flex; flex-wrap: wrap; gap: 6px; }

button {
  padding: 6px 12px;
  font: bold 13px "Courier New", monospace;
  color: #e8e8f0;
  background: #3a4166;
  border: 2px solid #0e0f1a;
  cursor: pointer;
}
button:hover  { background: #4a5380; }
button.active { background: #5a8f4e; }

#name-form { align-items: center; }
#name-form label { font-size: 12px; color: #aab0d0; }
#name-input {
  width: 140px;
  padding: 6px 8px;
  font: 13px "Courier New", monospace;
  color: #e8e8f0;
  background: #1a1d33;
  border: 2px solid #0e0f1a;
  outline: none;
}
#name-input:focus { border-color: #8aa0ff; }
#net-status { font-size: 12px; font-weight: bold; text-align: center; }
#net-status.on  { color: #7ee07e; }
#net-status.off { color: #e0a070; }
#name-form { margin: 0; }

#banner {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 30;
  max-width: 92%; padding: 6px 12px; pointer-events: none;
  font: bold 13px "Courier New", monospace; text-align: center;
  color: #14101c; background: #ffe28a; border: 2px solid #0e0f1a; box-shadow: 0 3px 0 rgba(0,0,0,.35);
}

/* ---- Anuncio del administrador ---- */
#announce {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40;
  width: max-content; max-width: min(560px, 94%); display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 14px 12px; overflow: hidden; cursor: pointer;
  background: linear-gradient(180deg, #3a2a6e 0%, #241a4a 100%);
  border: 2px solid #ffd45c; border-radius: 12px;
  box-shadow: 0 0 0 2px #0e0f1a, 0 6px 0 rgba(0,0,0,.4), 0 0 22px rgba(255, 212, 92, .45);
  color: #fff; animation: an-in .45s cubic-bezier(.2, 1.3, .4, 1) both, an-glow 2.2s ease-in-out .5s infinite;
}
#announce[hidden] { display: none; }
#announce.out { animation: an-out .35s ease-in both; }
#announce::before {                       /* destello que cruza el cartel */
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); animation: an-shine 2.6s ease-in-out .4s infinite;
}
#announce .an-ico {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle at 35% 30%, #ffe9a0, #f2b632); border: 2px solid #0e0f1a; border-radius: 50%;
  box-shadow: 0 2px 0 rgba(0,0,0,.4); animation: an-ring 1.1s ease-in-out .3s 3;
}
#announce .an-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
#announce .an-tag { font: bold 11px "Courier New", monospace; letter-spacing: 3px; color: #ffd45c; }
#announce .an-text { font: bold 16px/1.25 "Courier New", monospace; overflow-wrap: anywhere; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
#announce .an-bar {                        /* barra de tiempo restante */
  position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: #ffd45c; transform-origin: left;
  animation: an-time var(--an-ms, 8s) linear both;
}
@keyframes an-in { from { transform: translate(-50%, -140%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes an-out { to { transform: translate(-50%, -140%); opacity: 0; } }
@keyframes an-glow { 50% { box-shadow: 0 0 0 2px #0e0f1a, 0 6px 0 rgba(0,0,0,.4), 0 0 34px rgba(255, 212, 92, .8); } }
@keyframes an-shine { to { left: 130%; } }
@keyframes an-ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-16deg); } 75% { transform: rotate(16deg); } }
@keyframes an-time { to { transform: scaleX(0); } }
/* ---- Pregunta de confirmación del administrador (misma estética que el anuncio) ---- */
#admin-ask {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 45;
  width: max-content; max-width: min(560px, 94%); display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px 12px;
  background: linear-gradient(180deg, #5a2a52 0%, #351a40 100%); border: 2px solid #ff9ad5; border-radius: 12px; color: #fff;
  box-shadow: 0 0 0 2px #0e0f1a, 0 6px 0 rgba(0,0,0,.4), 0 0 22px rgba(255, 154, 213, .45); animation: an-in .35s cubic-bezier(.2, 1.3, .4, 1) both;
}
#admin-ask[hidden] { display: none; }
#admin-ask .an-ico { flex: none; width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px; background: radial-gradient(circle at 35% 30%, #ffd1ea, #e0589f); border: 2px solid #0e0f1a; border-radius: 50%; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
#admin-ask .an-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#admin-ask .an-tag { font: bold 11px "Courier New", monospace; letter-spacing: 3px; color: #ff9ad5; }
#admin-ask .an-text { font: bold 15px/1.3 "Courier New", monospace; overflow-wrap: anywhere; }
#admin-ask .ask-btns { display: flex; gap: 8px; margin-top: 6px; }
#admin-ask .ask-btns button { cursor: pointer; font: bold 13px "Courier New", monospace; padding: 6px 14px; border: 2px solid #0e0f1a; border-radius: 6px; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
#admin-ask .ask-yes { background: #ffd45c; color: #1a1205; }
#admin-ask .ask-yes:hover { background: #ffe38a; }
#admin-ask .ask-no { background: #39406b; color: #fff; }
#admin-ask .ask-no:hover { background: #4a5390; }
@media (prefers-reduced-motion: reduce) { #admin-ask { animation: none; } }
@media (max-width: 560px) { #announce { padding: 8px 14px 12px 8px; gap: 8px; } #announce .an-ico { width: 34px; height: 34px; font-size: 19px; } #announce .an-text { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { #announce, #announce::before, #announce .an-ico { animation: none; } }

#admin-box { font-size: 12px; color: #aab0d0; }
#admin-box summary { cursor: pointer; font-weight: bold; }
#admin-box .row { margin: 6px 0; }
#admin-box input {
  padding: 6px 8px; font: 13px "Courier New", monospace; color: #e8e8f0;
  background: #1a1d33; border: 2px solid #0e0f1a; outline: none;
}
#admin-box input:focus { border-color: #8aa0ff; }
#admin-announce input { flex: 1; min-width: 0; }
#admin-msg { align-self: center; color: #e0a070; }
#admin-players { width: 100%; border-collapse: collapse; margin-top: 6px; }
#admin-players th, #admin-players td { text-align: left; padding: 3px 6px; border-bottom: 1px solid #2a2f50; }
#admin-players td button { padding: 2px 6px; font-size: 11px; margin-right: 4px; }
#admin-bans { margin-top: 6px; }
#admin-bans button { padding: 2px 6px; font-size: 11px; }

#reset-btn { margin-left: auto; background: #7a3a3a; }
#reset-btn:hover { background: #944545; }

#hint { font-size: 12px; line-height: 1.5; color: #aab0d0; }

/* ---- Catálogo con pestañas (Fase 15) ---- */
#catalog { flex-direction: column; gap: 6px; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-env { display: flex; gap: 4px; }
.cat-bar input { flex: 1 1 110px; min-width: 90px; padding: 4px 8px; font-size: 12px; }
.cat-info { flex-basis: 100%; font-size: 11px; color: #aab0d0; }
.cat-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; max-height: 340px; overflow-y: auto; padding-right: 2px; }
.item-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 3px; font-size: 11px; line-height: 1.15; background: #2a2f4f; border: 1px solid transparent; position: relative; }
.item-btn img { width: 64px; height: 56px; object-fit: contain; image-rendering: auto; }
.item-btn .item-name { text-align: center; word-break: break-word; }
.item-btn.active { border-color: #8a6fd1; background: #3b3f6e; }
.item-btn.special { border-color: #c9a227; }
.item-btn.exclusive { border-color: #d14b6f; }
.item-btn.locked { cursor: not-allowed; }
.item-btn.locked img { opacity: .35; filter: grayscale(.8); }
.item-btn .item-lock { position: absolute; top: 2px; right: 3px; font-size: 10px; background: #000a; border-radius: 6px; padding: 0 4px; }
.cat-btn { background: #2f3558; font-size: 12px; padding: 4px 10px; }
.cat-btn.active { background: #8a6fd1; }
.item-btn[hidden] { display: none; }

/* ---- Navegador de salas ---- */
#rooms-list { display: flex; flex-direction: column; gap: 4px; }
.room-head { margin-top: 4px; font-size: 12px; font-weight: bold; color: #8aa0ff; }
.room-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 4px 6px; background: #2a2f50; border: 2px solid #0e0f1a; font-size: 12px;
}
.room-row.here { border-color: #5a8f4e; }
.room-name { font-weight: bold; }
.room-meta { flex: 1; min-width: 120px; color: #aab0d0; }
.room-row button { padding: 3px 9px; font-size: 12px; }
.room-row button:disabled { opacity: .55; cursor: default; }
.room-row button.danger { background: #7a3a3a; }
.room-pass, #room-form input, #room-form select {
  padding: 5px 7px; font: 13px "Courier New", monospace; color: #e8e8f0;
  background: #1a1d33; border: 2px solid #0e0f1a; outline: none;
}
.room-pass { width: 90px; }
#room-form input:focus, .room-pass:focus { border-color: #8aa0ff; }
#room-name { flex: 1; min-width: 150px; }
#room-pass-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #aab0d0; }
#room-pass { width: 100px; }
.room-err, #rooms-msg { color: #e0a070; font-size: 12px; }
.room-err { width: 100%; }
.rooms-note { font-size: 11px; color: #8089b0; line-height: 1.4; }


/* ============================================================
   Fase 16: todo dentro de la ventana del juego
   ============================================================ */
input[type=text], input[type=password], input[type=search], select {
  padding: 5px 7px; font: 13px "Courier New", monospace; color: #e8e8f0;
  background: #1a1d33; border: 2px solid #0e0f1a; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: #8aa0ff; }

/* Barra inferior */
#dock {
  position: relative; z-index: 20;
  display: flex; align-items: stretch; gap: 4px; padding: 4px;
  background: #14162a; border-top: 3px solid #0e0f1a;
}
.dock-btn {
  position: relative; display: flex; align-items: center; gap: 5px;
  padding: 4px 9px; font-size: 12px; background: #3a4166;
}
.dock-btn span { font-size: 16px; line-height: 1; }
.dock-btn.open { background: #5a8f4e; }
.badge {
  min-width: 16px; padding: 0 4px; font: bold 11px "Courier New", monospace; font-style: normal;
  line-height: 16px; text-align: center; color: #fff; background: #d6584f; border-radius: 8px;
}
.dock-btn .badge { position: absolute; top: -6px; right: -4px; }
#chat-form { flex: 1; display: flex; gap: 4px; min-width: 0; margin: 0; }
#chat-input { flex: 1; min-width: 0; }
#chat-form button { padding: 4px 10px; }
#chat-target { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #2f3558; font-size: 12px; }
#chat-target.priv { background: #8a3fd1; }

/* Ventanas flotantes */
.win {
  position: absolute; left: 8px; bottom: 56px; z-index: 25;
  width: min(430px, 58%); max-height: calc(100% - 68px);
  display: flex; flex-direction: column;
  background: #1e2238; border: 3px solid #0e0f1a; box-shadow: 0 6px 0 rgba(0,0,0,.35);
  font-size: 12px;
}
.win-small { width: min(300px, 50%); }
#win-chat { left: auto; right: 8px; width: min(320px, 44%); height: min(260px, calc(100% - 64px)); }
.win-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 4px 10px; background: #3a4166; font-size: 13px; flex: none;
}
.win-x { padding: 1px 8px; font-size: 12px; background: #7a3a3a; }
.win-x:hover { background: #944545; }
.win-body { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 4px 4px 0; background: #262b44; flex: none; }
.tab { padding: 4px 9px; font-size: 12px; background: #2f3558; border-bottom: 0; }
.tab.active { background: #8a6fd1; }

/* Mi personaje */
#name-form { align-items: center; flex-wrap: wrap; }
#name-form label { font-size: 12px; color: #aab0d0; }
#name-input { flex: 1 1 110px; width: 110px; }
#look-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
#look-row label { display: flex; align-items: center; gap: 5px; color: #aab0d0; }
#look-row input[type=color] { width: 30px; height: 24px; padding: 0; background: none; border: 2px solid #0e0f1a; cursor: pointer; flex: none; }

/* Acciones */
#emote-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.emote-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 12px; }
.emote-btn span { font-size: 24px; line-height: 1; }

/* Salas */
.rooms-body { max-height: 330px; }
#rooms-search { width: 100%; }
#room-form { display: flex; flex-direction: column; gap: 6px; }
#room-form[hidden] { display: none; }
.room-desc { width: 100%; color: #8f98c4; font-size: 11px; }

/* Chat */
#priv-pick { padding: 4px; background: #262b44; flex: none; }
#priv-select { width: 100%; }
#chat-log { flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; word-break: break-word; }
.log-line { line-height: 1.35; }
.log-line .who { font-weight: bold; color: #8aa0ff; }
.log-line.me .who { color: #ffd37a; }
.log-line.sys { color: #8089b0; font-style: italic; }
.log-line.priv .who { color: #d9a0ff; }
.log-line.priv { color: #f0e3ff; }
.log-empty { color: #8089b0; padding: 6px 0; }

/* Pantallas estrechas: las ventanas ocupan casi todo el marco */
@media (max-width: 640px) {
  .dock-btn b { display: none; }
  .tab { font-size: 11px; padding: 4px 6px; }
  #dock { flex-wrap: wrap; justify-content: center; }
  #chat-form { flex: 1 1 100%; order: 2; }
  .win, #win-chat, .win-small { left: 6px; right: 6px; width: auto; bottom: 90px; max-height: calc(100% - 98px); }
  #win-chat { height: min(300px, calc(100% - 98px)); }
  .me-body { flex-direction: column; align-items: center; }
  #chat-target { max-width: 60px; }
}


/* ============================================================
   Fase 18: pantalla grande + editor de personaje
   ============================================================ */
}

/* Editor de personaje */
.win-wide { width: min(780px, calc(100% - 16px)); height: min(620px, calc(100% - 68px)); }
.win-wide .win-body { flex: 1; }
.me-body { flex-direction: row !important; gap: 12px; overflow: hidden !important; }
.me-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 250px; }
#me-preview-host { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#me-canvas { width: 250px; height: 300px; background: radial-gradient(#3a4266, #262b44); border: 2px solid #0e0f1a; cursor: pointer; image-rendering: pixelated; }
.pv-rot { display: flex; gap: 6px; }
.pv-rot button { padding: 2px 14px; }
.pv-pose { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; }
.pv-pose button { padding: 3px 4px; font-size: 11px; }
.pv-pose button.active { background: #5a8f4e; }
#look-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.ed-tabs { flex-wrap: wrap; }
.ed-body { flex: 1; overflow-y: auto; padding: 6px 2px 2px; min-height: 0; }
.ed-sec { margin-bottom: 10px; display: flex; flex-direction: column; gap: 5px; }
.ed-sec h4 { font-size: 12px; color: #8aa0ff; }
.ed-label { font-size: 11px; color: #8089b0; min-width: 58px; align-self: center; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 3px 8px; font-size: 11px; background: #2f3558; }
.chip.active { background: #8a6fd1; }
.ed-colors { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sw { width: 20px; height: 20px; padding: 0; border: 2px solid #0e0f1a; }
.sw.active { outline: 2px solid #fff; outline-offset: 1px; }
.sw-free { width: 26px; height: 22px; padding: 0; border: 2px solid #0e0f1a; background: none; cursor: pointer; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 4px; }
.thumb { position: relative; display: flex; align-items: center; justify-content: center; padding: 2px; min-height: 56px; background: #2a2f4f; border: 2px solid transparent; }
.thumb canvas { max-width: 100%; image-rendering: pixelated; }
.thumb i { position: absolute; left: 2px; bottom: 0; font-size: 9px; font-style: normal; color: #8089b0; }
.thumb.active { border-color: #ffd37a; background: #3b3f6e; }
@media (max-width: 760px) {
  .me-body { flex-direction: column !important; overflow-y: auto !important; }
  .me-preview { width: 100%; }
  #me-canvas { width: 200px; height: 240px; }
  .win-wide { height: calc(100% - 98px); }
}

/* Cuenta (Fase 19): franja encima del editor */
#auth-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 7px 10px; background: #1d2036; border-bottom: 2px solid #0e0f1a; }
#auth-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
#auth-form strong { color: #8fa0ff; }
#auth-form .row { flex-wrap: nowrap; }
#auth-form .rooms-note { flex-basis: 100%; margin: 0; }
#auth-form input { width: 130px; padding: 5px 6px; font: 13px "Courier New", monospace; color: #e8e8f0; background: #13152a; border: 2px solid #0e0f1a; }
#auth-in { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#auth-msg { margin: 0; flex-basis: 100%; }
#auth-msg:empty { display: none; }
#auth-msg.err { color: #ff8a80; }
#auth-msg.ok { color: #8fe08f; }

#auth-form input[type=email] { width: 190px; }
#auth-recover { display: flex; gap: 6px; flex-basis: 100%; }
#auth-recover input { width: 130px; padding: 5px 6px; font: 13px "Courier New", monospace; color: #e8e8f0; background: #13152a; border: 2px solid #0e0f1a; }
.link-btn { background: none; border: none; color: #8fa0ff; text-decoration: underline; font-weight: normal; padding: 6px 4px; }
#pin-box { flex-basis: 100%; padding: 8px; background: #3b2f12; border: 2px solid #e0b84a; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#pin-value { font-size: 26px; letter-spacing: 6px; color: #ffd866; user-select: all; }
#pin-box .rooms-note { margin: 0; }
#legacy-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex-basis: 100%; }
#legacy-box input { width: 190px; padding: 5px 6px; font: 13px "Courier New", monospace; color: #e8e8f0; background: #13152a; border: 2px solid #0e0f1a; }
.acct-tools { border: 2px solid #0e0f1a; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.acct-tools input { padding: 4px 6px; font: 13px "Courier New", monospace; color: #e8e8f0; background: #13152a; border: 2px solid #0e0f1a; width: 150px; }
#acct-out.ok { color: #8fe08f; } #acct-out.err { color: #ff8a80; }
#auth-box [hidden], #acct-tools [hidden] { display: none !important; }

/* Rango por horas de juego (Fase 20) */
#rank-box { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; background: #1d2036; border: 2px solid #0e0f1a; font-size: 12px; line-height: 1.35; }
#rank-text { color: #ffd866; font-weight: bold; }
.rank-track { height: 8px; background: #13152a; border: 1px solid #0e0f1a; }
.rank-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7a5cff, #ffd866); transition: width .9s linear; }
#rank-next { color: #9aa3d6; }
.item-btn:disabled { cursor: not-allowed; opacity: .55; filter: grayscale(.6); }
.item-btn:disabled:hover { transform: none; }

/* Fase 21: figuras desbloqueables por Días de Rango */
.fig-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
.thumb.fig { min-height: 88px; }
.thumb.fig canvas { max-height: 80px; }
.thumb.fig .fig-lock { display: none; position: absolute; right: 3px; top: 2px; font-size: 13px; text-shadow: 0 0 3px #000; }
.thumb.fig.locked { cursor: not-allowed; opacity: .75; }
.thumb.fig.locked canvas { filter: grayscale(1) brightness(.45); }
.thumb.fig.locked .fig-lock { display: block; }
.thumb.fig:disabled { color: inherit; }
.thumb.fig.locked:hover::after { content: attr(title); position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); width: max-content; max-width: 190px; padding: 4px 7px; background: #11142a; border: 1px solid #ffd37a; color: #ffe9b0; font-size: 11px; line-height: 1.25; text-align: center; pointer-events: none; }
.ed-note { margin: 0 0 6px; font-size: 11px; color: #8d96c0; }

/* Fase 22: economía (Laurus · Nobilis · Perla) */
#eco-hud { position: absolute; top: 8px; right: 8px; z-index: 22; display: flex; flex-direction: column; gap: 3px; padding: 6px 9px; background: #0e1022e6; border: 2px solid #3a4070; font: 12px/1.2 ui-monospace, Consolas, 'Courier New', monospace; color: #dfe3ff; pointer-events: auto; }
#eco-hud .eco-cur { display: flex; align-items: center; gap: 6px; padding: 1px 3px; }
#eco-hud .eco-name { color: #aab0d0; }
#eco-hud .eco-val { margin-left: auto; min-width: 3ch; text-align: right; font-weight: 700; color: #fff; }
#eco-hud.free .eco-val { color: #8d96c0; }
.eco-ico { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
#eco-hud .eco-cur.cur-laurus .eco-val { color: #9ff0a8; }
#eco-hud .eco-cur.cur-nobilis .eco-val { color: #ffd37a; }
#eco-hud .eco-cur.cur-perla .eco-val { color: #e3d4ff; }
#eco-hud .eco-cur.up { animation: ecoUp 1.4s; }
#eco-hud .eco-cur.down { animation: ecoDown 1.4s; }
#eco-hud .eco-cur.bad { animation: ecoBad .9s steps(2) 3; }
@keyframes ecoUp { 0%, 40% { background: #2e7d4a; } 100% { background: transparent; } }
@keyframes ecoDown { 0%, 40% { background: #7d4a2e; } 100% { background: transparent; } }
@keyframes ecoBad { 0% { background: #b3261e; } 50% { background: transparent; } }
#eco-toast { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 2001; max-width: 70%; padding: 8px 14px; font-size: 13px; font-weight: 700; text-align: center; border: 2px solid; pointer-events: none; }
#eco-toast[hidden] { display: none; }
#eco-toast.ok { background: #16391f; border-color: #3fae5a; color: #c8f5cf; }
#eco-toast.err { background: #4a1412; border-color: #ff5a4d; color: #ffd7d3; }
#eco-toast.blink { animation: ecoBlink .55s steps(1) infinite; }
@keyframes ecoBlink { 0% { opacity: 1; } 50% { opacity: .25; } }
.item-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item-cell .item-btn { width: 100%; flex: 1 1 auto; }
.item-price { display: flex; align-items: center; justify-content: center; gap: 4px; font: 11px ui-monospace, Consolas, monospace; color: #dfe3ff; }
.item-price.poor { color: #ff9a92; }
.buy-btn { font-size: 11px; padding: 3px 4px; background: #2f6f45; border: 1px solid #3fae5a; color: #fff; }
.buy-btn:hover { background: #3b8a58; }
.item-stock { font-size: 10px; text-align: center; color: #8fd6a0; }

/* Fase 23: Tienda e Inventario */
.shop-btn { background: #6a4a1a; border: 1px solid #e0b13a; color: #ffe9b0; }
.shop-btn:hover { background: #805a22; }
.shop-btn.active { background: #e0b13a; color: #1a1408; }
#shop { flex-direction: column; gap: 6px; }
.shop-note { margin: 0; font-size: 12px; color: #c9d0f0; }
.shop-items { max-height: 380px; }
.item-btn.in-inv { border-color: #3fae5a; }

/* ---- Tienda Nobilis (Fase 27) ---- */
#noble-list { display: flex; flex-direction: column; gap: 4px; }
.noble-row { border-color: #6b4f12; }
.noble-row.here { border-color: #5a8f4e; }
.noble-acts { flex-basis: 100%; display: flex; gap: 6px; }
.noble-acts:empty { display: none; }
.noble-row .room-desc { flex-basis: 100%; color: #aab0d0; font-size: 11px; }
.rent-btn { background: #b8861f; color: #1a1205; font-weight: bold; }
.rent-btn:hover { background: #d6a232; }
.fx-btn { background: #6d4fd6; color: #fff; font-weight: bold; }
.fx-btn:hover { background: #8466f0; }

/* ---- Mascotas Premium (Fase 28) ---- */
#me-pets[hidden], .me-body[hidden] { display: none !important; }
#me-pets { flex: 1; }
#pets-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.pet-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; background: #2a2f50; border: 2px solid #0e0f1a; text-align: center; font-size: 12px; }
.pet-ico { width: 72px; height: 72px; image-rendering: pixelated; }
.pet-meta { color: #aab0d0; font-size: 11px; }
.pet-card button { padding: 3px 8px; font-size: 12px; }
.pet-card button:disabled { opacity: .55; cursor: default; }

/* ---- Crónicas y Votación (Fase 29) ---- */
#win-patch { width: min(420px, 60%); border-color: #14204f; }
#win-patch .win-top { background: var(--accent, #3a4166); color: #0e1438; }
#patch-lines { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.4; color: #dfe4ff; }
#patch-lines li { padding-left: 14px; position: relative; }
#patch-lines li::before { content: "▶"; position: absolute; left: 0; color: var(--accent, #8aa0ff); font-size: 10px; top: 2px; }
#win-vote { width: min(520px, 70%); background: #0b1a3a; border-color: #3a5fc0; box-shadow: 0 6px 0 rgba(0,0,0,.45), inset 0 0 0 2px #14286a; }
#win-vote .win-top { background: #14286a; color: #dbe6ff; }
.vote-body h4 { font-size: 14px; color: #ffe9b0; text-align: center; margin: 2px 0 6px; }
#vote-ballot { display: flex; flex-direction: column; gap: 8px; }
.vote-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; background: #10224d; border: 2px solid #1b3a82; color: #cfe0ff; font: inherit; font-size: 13px; cursor: pointer; }
.vote-opt:hover:not(:disabled) { border-color: #6a8ae0; }
.vote-opt.sel { border-color: #ffe9b0; background: #17306a; color: #fff; }
.vote-opt b { flex: none; width: 26px; height: 26px; display: grid; place-items: center; color: #fff; font: bold 14px "Courier New", monospace; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.vote-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 4px; }
.vote-confirm p { flex: 1 1 100%; margin: 0; text-align: center; font-size: 12px; color: #ffe9b0; }
.vote-ok, .vote-no { padding: 7px 12px; font: bold 13px inherit; border: 2px solid #1b3a82; background: #1f3f90; color: #fff; cursor: pointer; }
.vote-ok { background: #2a8a4a; border-color: #4acf7a; }
.vote-ok:disabled, .vote-no:disabled { opacity: .5; cursor: default; }
#vote-bars { display: flex; flex-direction: column; gap: 10px; }
.vote-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center; padding: 6px; background: #10224d; border: 2px solid #1b3a82; }
.vote-row.mine { border-color: #ffe9b0; }
.vote-lbl { grid-column: 1 / 3; font-size: 12px; color: #cfe0ff; }
.vote-bar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; }
.vote-bar i { height: 16px; background: #13264f; box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); }
.vote-bar i.on { background: var(--c); box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.3); }
.vote-pct { font: bold 14px "Courier New", monospace; color: #fff; min-width: 54px; text-align: right; }
.vote-total { text-align: center; font-size: 11px; color: #8fb0ff; }
#vote-warn { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 60; max-width: min(520px, 80%); padding: 10px 14px; background: #0b1a3a; color: #ffe9b0; border: 3px solid #ff6a5a; box-shadow: 0 4px 0 rgba(0,0,0,.5); font-size: 13px; text-align: center; }
#vote-warn.shake { animation: votewarn .5s steps(6); }
@keyframes votewarn { 0%, 100% { transform: translateX(-50%); } 20% { transform: translateX(calc(-50% - 6px)); } 40% { transform: translateX(calc(-50% + 6px)); } 60% { transform: translateX(calc(-50% - 4px)); } 80% { transform: translateX(calc(-50% + 4px)); } }

/* ---- Ventana "Construir" (Caminar / Decorar / Tienda / Inventario dentro del juego) ---- */
.win-build { width: min(420px, 60%); height: min(540px, calc(100% - 68px)); }
.win-build .build-body { flex: 1; }
.win-build .cat-items { max-height: none; }
#win-build #catalog, #win-build #shop { flex-wrap: nowrap; }
#win-build #hint { margin: 0; }
@media (max-width: 640px) { .win-build { height: calc(100% - 98px); } }

/* Móvil: con una ventana abierta el monedero se oculta (tapaba el botón ✕) */
@media (max-width: 640px) { #stage.win-open #eco-hud { display: none; } }

/* ---- Fase 31: Panel de Administración dentro del juego + Reportes ---- */
.win-admin .admin-body { flex: 1; gap: 8px; }
#admin-box { color: #c9cfee; }
#admin-box .acct-tools > legend, #admin-box legend { padding: 0 6px; color: #8aa0ff; font-weight: bold; }
.admin-scroll { max-height: 190px; overflow: auto; border: 1px solid #2a2f50; background: #14172b; padding: 4px; }
.admin-scroll:empty { display: none; }
.adm-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.adm-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.adm-slider { position: relative; width: 38px; height: 20px; background: #3a4166; border: 2px solid #0e0f1a; flex: none; transition: background .15s; }
.adm-slider::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; background: #e8e8f0; transition: left .15s; }
.adm-switch input:checked + .adm-slider { background: #5a8f4e; }
.adm-switch input:checked + .adm-slider::after { left: 20px; }
.adm-switch input:focus-visible + .adm-slider { outline: 2px solid #8aa0ff; }
.adm-switch em { font-style: normal; color: #8089b0; }
.adm-switch em.on { color: #9ff0a8; }
#adm-maint { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 10px; }
.adm-maint-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px; }
.adm-maint-row.closed { background: #4a2a2a; }
.adm-maint-row select { max-width: 150px; }
#admin-players td, #admin-players th { white-space: nowrap; }
.rep-row { padding: 6px; border-bottom: 1px solid #2a2f50; }
.rep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rep-head time { color: #8089b0; margin-left: auto; }
.rep-head button { padding: 2px 6px; font-size: 11px; }
.rep-cat { padding: 0 6px; border: 1px solid; font-size: 11px; }
.rep-user .rep-cat { color: #ff9c8a; } .rep-bug .rep-cat { color: #ffd37a; } .rep-idea .rep-cat { color: #9ff0a8; }
.rep-text { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; color: #e8e8f0; }
#admin-log { font: 11px/1.45 ui-monospace, Consolas, 'Courier New', monospace; max-height: 240px; }
#admin-log > div { display: flex; gap: 6px; word-break: break-word; }
#admin-log time { color: #6a739c; flex: none; }
#admin-log .log-spam { color: #ff9c8a; } #admin-log .log-eco { color: #ffd37a; } #admin-log .log-admin { color: #8aa0ff; } #admin-log .log-report { color: #d9a0ff; }
#admin-log-box > summary { cursor: pointer; font-weight: bold; }
#admin-log-box[open] > summary { margin-bottom: 6px; }

#report-btn { position: absolute; top: 108px; right: 8px; z-index: 22; padding: 4px 9px; font-size: 12px; background: #0e1022e6; border: 2px solid #3a4070; color: #ffd0c8; }
#report-btn:hover { background: #26305a; }
@media (max-width: 640px) { #stage.win-open #report-btn { display: none; } }
.win-report { left: 50%; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 16px)); background: #0b1a3a; border-color: #050b1f; }
.win-report .win-top { background: #17306b; }
.report-body { display: flex; flex-direction: column; gap: 6px; background: #0b1a3a; }
.report-body label { color: #aab8e8; }
.report-body select, .report-body input, .report-body textarea { width: 100%; box-sizing: border-box; background: #0f2250; border-color: #050b1f; color: #e8eeff; font: 13px "Courier New", monospace; padding: 5px 7px; }
.report-body textarea { resize: vertical; min-height: 110px; }
.report-body [hidden] { display: none; }
.report-foot { display: flex; justify-content: space-between; align-items: center; color: #8d9bd0; }
#report-send { background: #2f5fd1; }
#report-send:disabled { opacity: .5; cursor: wait; }
.rooms-note.err { color: #ff9c8a; }
@media (max-width: 640px) { .win-report { top: 8px; transform: translateX(-50%); } }

#chat-target[hidden] { display: none; }

.dock-btn[hidden] { display: none; }
#admin-access { margin-top: 4px; font-size: 12px; color: #aab0d0; }
#admin-access > summary { cursor: pointer; }
#admin-access .row { margin: 6px 0; }
#admin-access input { padding: 5px 8px; font: 13px "Courier New", monospace; color: #e8e8f0; background: #1a1d33; border: 2px solid #0e0f1a; }
#admin-msg { align-self: center; color: #e0a070; }

.rep-answer { margin-top: 4px; padding: 4px 6px; background: #1c2c4a; border-left: 3px solid #5a8f4e; color: #cfe3ff; word-break: break-word; }
.rep-reply-box { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding: 6px; background: #14203d; border: 1px solid #2f4a8a; }
.rep-reply-box textarea, .rep-reply-box select { width: 100%; box-sizing: border-box; background: #0f2250; color: #e8eeff; border: 2px solid #050b1f; font: 12px "Courier New", monospace; padding: 4px 6px; }
.rep-reply-box button { padding: 3px 8px; font-size: 11px; }
#report-replies { margin-top: 6px; border-top: 1px solid #2f4a8a; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
#report-replies h4 { margin: 0; font-size: 12px; color: #8aa0ff; }
#report-replies[hidden] { display: none; }
.rr-item { padding: 5px 7px; background: #12285e; border-left: 3px solid #5a8f4e; font-size: 12px; line-height: 1.35; word-break: break-word; }
.rr-item.new { border-left-color: #ffd37a; background: #1b3270; }
.rr-item small { display: block; color: #8d9bd0; }
.rr-item .rr-st { font-weight: bold; color: #cfe3ff; }
#report-btn.has-reply { border-color: #ffd37a; color: #ffe9b0; }


/* ============================================================
   Modo incrustado (iframe) o ?full=1: el juego llena la ventana de borde a borde y es 100% responsivo.
   El lienzo (#game) toma todo el alto que deja la barra inferior; js/game.js (fitCanvas) recalcula resolución, zoom y centrado
   en cada cambio de tamaño del iframe, sin deformar los sprites.
   ============================================================ */
html.embed, html.embed body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; display: block; background: #1a1c2c; }
html.embed #app { width: 100vw; height: 100vh; height: 100dvh; margin: 0; padding: 0; }
html.embed #layout { display: block; height: 100%; margin: 0; }
html.embed #main-col { height: 100%; gap: 0; }
html.embed #side { display: none; }
html.embed #stage { display: flex; flex-direction: column; width: 100%; height: 100%; border: 0; margin: 0; }
html.embed #game { flex: 1 1 0; min-height: 0; width: 100%; height: auto; }
html.embed #view { height: 100%; }
html.embed #dock { flex: 0 0 auto; }

/* Compra de Perlas (Fase 38) */
#me-perlas[hidden] { display: none !important; }
#me-perlas { flex: 1; }
#pp-packs { flex-wrap: wrap; gap: 6px; }
#pp-packs button { min-width: 74px; padding: 6px 10px; }
#pp-packs button.on { background: #7a55c9; border-color: #d9c4ff; color: #fff; }
.pp-custom { align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-custom input { width: 90px; }
#pp-total { color: #e3d4ff; }
#pp-buttons { max-width: 420px; min-height: 48px; margin-top: 4px; }
#pp-box.off { opacity: .5; pointer-events: none; }
#pp-msg.err { color: #ff9a9a; }
#pp-msg.ok { color: #9ff0a8; }
#pp-receipt { padding: 8px; background: #1d3a2a; border: 2px solid #3fae5a; display: flex; flex-direction: column; gap: 4px; }
#pp-receipt code { color: #fff; background: #0e1022; padding: 1px 5px; font-size: 13px; user-select: all; }
#pp-history { display: flex; flex-direction: column; gap: 3px; }
.pp-row { display: flex; gap: 8px; align-items: center; padding: 4px 6px; background: #2a2f50; font-size: 12px; flex-wrap: wrap; }
.pp-row code { color: #dfe3ff; user-select: all; }
.pp-row .pp-st { margin-left: auto; color: #9ff0a8; }
.pp-row .pp-st.bad { color: #ff9a9a; }
.pp-row .pp-st.mid { color: #ffd37a; }
#pp-spent { font-weight: 400; color: #aab0d0; font-size: 12px; }
#eco-hud .eco-cur.cur-perla { cursor: pointer; }

/* Panel de información (abajo a la derecha): objeto o personaje pulsado */
#pick-panel { position: absolute; right: 10px; bottom: 54px; z-index: 21; width: min(360px, calc(100% - 20px)); display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 8px 26px 8px 10px;
  background: #0e1022f2; border: 2px solid #ffd37a; color: #fff; font: 12px/1.3 ui-monospace, Consolas, 'Courier New', monospace; box-shadow: 0 2px 0 #0008; }
#pick-panel[hidden] { display: none; }
#pick-panel #pick-art { flex: none; width: 132px; height: 200px; background: radial-gradient(ellipse at 50% 85%, #2a3060 0%, #14172e 70%); border: 1px solid #3a4166; image-rendering: auto; }
#pick-panel #pick-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
#pick-panel #pick-title { font-size: 14px; word-break: break-word; }
#pick-panel #pick-sub { color: #aab0d0; }
#pick-panel #pick-extra { color: #9ff0a8; }
#pick-panel #pick-extra:empty, #pick-panel #pick-sub:empty { display: none; }
#pick-panel #pick-x { position: absolute; top: 3px; right: 3px; padding: 0 6px; font-size: 12px; line-height: 18px; background: #3a4166; }
#pick-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
#pick-actions:empty { display: none; }
#pick-actions button { padding: 4px 10px; font-size: 12px; }
#pick-actions button.buy { background: #3f8f4e; border-color: #9ff0a8; }
#pick-actions button.emo { background: #3a4166; border-color: #aab0d0; }
#pick-actions button.ign { background: #7a3a4a; border-color: #ff9a9a; }
@media (max-width: 640px) { #pick-panel { bottom: 96px; } }

/* ---- Vallas publicitarias (Fase 40): dos por sala oficial, en las esquinas superiores ---- */

/* Ventana para anunciarse */
#ad-modal { position: absolute; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: #05061299; padding: 8px; }
#ad-modal[hidden] { display: none; }
#ad-modal .ad-card { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #1b1e36; border: 3px solid #ffd37a; box-shadow: 0 6px 0 #0008; color: #e8e8f0; }
#ad-modal header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #262b4a; border-bottom: 2px solid #0e0f1a; }
#ad-modal .ad-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
#ad-modal .ad-sec { display: flex; flex-direction: column; gap: 5px; }
#ad-modal .ad-sec > b { color: #ffd37a; font-size: 12px; }
#ad-modal input[type=url], #ad-modal input[type=number], #ad-modal input[type=file] { width: 100%; padding: 6px; background: #0e1022; border: 2px solid #3a4166; color: #fff; font: inherit; }
#ad-modal input[type=number] { width: 90px; flex: none; }
#ad-modal .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#ad-slots { display: flex; gap: 8px; }
#ad-slots .ad-slot-btn { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px; text-align: left; background: #262b4a; border: 2px solid #3a4166; }
#ad-slots .ad-slot-btn small { color: #9aa3cf; font-size: 11px; }
#ad-slots .ad-slot-btn.on { border-color: #ffd37a; background: #34305a; }
#ad-packs { display: flex; gap: 4px; flex-wrap: wrap; }
#ad-packs button { padding: 4px 8px; font-size: 12px; }
#ad-packs button.on { border-color: #ffd37a; background: #34305a; }
#ad-modal .ad-total { font-size: 15px; font-weight: 700; color: #9ff0a8; }
#ad-preview .ad-prev-img { display: block; width: 150px; aspect-ratio: 300 / 250; border: 2px solid #3a4166; }
#ad-pay.off { display: none; }
#ad-buttons { min-height: 44px; }
#ad-receipt { padding: 8px; background: #1d3a2a; border: 2px solid #3fae5a; display: flex; flex-direction: column; gap: 4px; }
#ad-receipt code { color: #fff; background: #0e1022; padding: 1px 5px; font-size: 13px; user-select: all; }
#ad-mine { display: flex; flex-direction: column; gap: 4px; }
#ad-mine .ad-row { display: flex; gap: 8px; align-items: center; padding: 4px; background: #2a2f50; font-size: 12px; }
#ad-mine .ad-row img { width: 60px; aspect-ratio: 300 / 250; flex: none; border: 1px solid #0e0f1a; }
#ad-mine .ad-row-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#ad-mine .ad-row-t code { color: #aab0d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ad-mine .pp-st { margin-left: auto; color: #9ff0a8; white-space: nowrap; }
#ad-mine .pp-st.bad { color: #ff9a9a; }
#ad-modal .rooms-note.err { color: #ff9a9a; }
#ad-modal .rooms-note.ok { color: #9ff0a8; }
#ad-modal .ad-legal { font-size: 11px; opacity: 0.8; }

/* ============================================================
   TERMINAL: perfil, amigos y mensajes (js/terminal.js) - estética retro azul marino
   ============================================================ */
.term-btn { background: #0b1f4d; color: #9fd0ff; border: 2px solid #2a56b8; letter-spacing: 1px; text-transform: uppercase; box-shadow: inset 0 0 0 1px #0a1638; }
.term-btn span { font-size: 14px; color: #5fe0a0; }
.term-btn:hover { background: #12306e; }
.term-btn.open { background: #1a3c8a; color: #fff; }
.term-btn.alert { animation: termblink .8s steps(2, end) infinite; }
@keyframes termblink {
  0%, 49%   { background: #f2c744; color: #2a1c00; border-color: #fff3b0; box-shadow: 0 0 10px #f2c744; }
  50%, 100% { background: #0b1f4d; color: #9fd0ff; border-color: #2a56b8; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .term-btn.alert { animation: none; background: #f2c744; color: #2a1c00; } }

.term-win { left: 8px; bottom: 56px; width: min(400px, 62%); height: min(430px, calc(100% - 68px)); background: #08153a; border-color: #02071a; color: #cfe6ff; }
.term-win .win-top, .term-chat .win-top { background: #12306e; color: #bfe0ff; letter-spacing: 2px; font-family: "Courier New", monospace; }
.term-tabs { background: #0a1b4a; }
.term-tabs .tab { background: #0f2a66; color: #8fb6ec; position: relative; }
.term-tabs .tab.active { background: #1f4fb0; color: #fff; }
.term-tabs .tab .badge { margin-left: 5px; }
.term-body { flex: 1; gap: 5px; color: #cfe6ff; background: repeating-linear-gradient(0deg, rgba(120,170,255,.05) 0 1px, transparent 1px 3px); }
.term-empty { color: #6f8fc4; font-style: italic; padding: 4px 2px; }
.tp-card { display: flex; gap: 12px; align-items: center; padding: 8px; border: 2px solid #1f4fb0; background: #0b1f4d; }
.tp-avatar { width: 90px; height: 112px; image-rendering: auto; background: #05102b; border: 2px solid #1f4fb0; flex: none; }
.tp-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-label { font-size: 10px; letter-spacing: 2px; color: #6f9be0; margin-top: 4px; }
.tp-name { font-size: 18px; font-weight: bold; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.tp-rank { color: #5fe0a0; font-weight: bold; }
.tp-acc { color: #aab0d0; } .tp-acc.ok { color: #5fe0a0; }
.tp-bio { width: 100%; box-sizing: border-box; resize: none; background: #05102b; border: 2px solid #1f4fb0; color: #cfe6ff; font: inherit; line-height: 1.3; padding: 4px 6px; white-space: pre; overflow: hidden; }
.tp-bio-row { display: flex; align-items: center; gap: 8px; }
.tp-bio-note { color: #6f8fc4; font-size: 11px; }
.term-prof { left: 60px; top: 60px; bottom: auto; width: min(290px, 70%); height: auto; background: #08153a; border-color: #02071a; color: #cfe6ff; }
.term-prof .term-body { flex: none; padding: 8px; }
.tp-bio-view { white-space: pre-wrap; word-break: break-word; line-height: 1.3; min-height: 3.9em; padding: 4px 6px; background: #05102b; border: 2px solid #1f4fb0; }
.tp-bio-view.empty { color: #6f8fc4; font-style: italic; }
.tf-add { display: flex; gap: 4px; }
.tf-add input { flex: 1; background: #05102b; border-color: #1f4fb0; color: #cfe6ff; }
.tf-status { color: #f2c744; font-size: 11px; padding: 2px; }
.tf-h { margin-top: 6px; font-size: 10px; letter-spacing: 2px; color: #6f9be0; border-bottom: 1px solid #1f4fb0; padding-bottom: 2px; }
.tf-row { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.tf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: bold; }
.tf-name.on { color: #5fe08a; } .tf-name.off { color: #8a90a6; font-weight: normal; }
.tf-btn { padding: 2px 8px; font-size: 11px; background: #1f4fb0; color: #fff; }
.tf-btn.ok { background: #2f8f5a; }
.tf-btn.del { background: #5a2f3a; color: #ffb0b0; }
.tm-row { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 5px 6px; background: #0f2a66; color: #cfe6ff; position: relative; }
.tm-row.unread { background: #1f4fb0; }
.tm-dot.on { color: #5fe08a; } .tm-dot.off { color: #8a90a6; }
.tm-name { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.tm-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8fb6ec; }

/* Chats privados 1 a 1: ventanas independientes */
.term-chat { left: 40px; top: 50px; bottom: auto; width: min(290px, 70%); height: min(300px, calc(100% - 80px)); background: #08153a; border-color: #02071a; }
.term-chat .win-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
.tc-state { font-size: 10px; margin: 0 6px 0 auto; } .tc-state.on { color: #5fe08a; } .tc-state.off { color: #8a90a6; }
.tc-log { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-height: 0; color: #cfe6ff; }
.tc-msg { word-break: break-word; line-height: 1.3; }
.tc-msg b { color: #8fd0ff; margin-right: 5px; } .tc-msg.me b { color: #f2c744; } .tc-msg.err { color: #ff9a9a; }
.tc-time { color: #5f7fb4; font-size: 10px; margin-right: 5px; }
.tc-form { display: flex; gap: 3px; padding: 4px; background: #0a1b4a; flex: none; }
.tc-form input { flex: 1; background: #05102b; border-color: #1f4fb0; color: #cfe6ff; }
.tc-form input:disabled { opacity: .5; }

/* Avisos flotantes (invitaciones y resultados) */
.term-toasts { position: absolute; right: 8px; top: 8px; z-index: 90; display: flex; flex-direction: column; gap: 6px; width: min(300px, 70%); pointer-events: none; }
.term-toasts > * { pointer-events: auto; }
.term-note { padding: 6px 9px; font-size: 12px; background: #0b1f4d; color: #cfe6ff; border: 2px solid #2a56b8; }
.term-note.ok { border-color: #2f8f5a; } .term-note.err { border-color: #b8453a; color: #ffd0d0; } .term-note.req { border-color: #f2c744; }
.term-invite { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: #0b1f4d; color: #fff; border: 3px solid #f2c744; box-shadow: 0 0 12px rgba(242,199,68,.5); font-size: 12px; }
.term-invite b { color: #f2c744; }
.ti-row { display: flex; gap: 6px; }
.ti-yes { background: #2f8f5a; padding: 3px 14px; } .ti-no { background: #5a2f3a; padding: 3px 14px; }

/* Corona de inquilino Nobilis (Fase 60): botón junto al nombre en Mi Perfil */
.tp-crown { background: none; border: 0; padding: 0 4px 0 0; margin: 0; font-size: 16px; cursor: pointer; line-height: 1; filter: grayscale(1) opacity(.45); }
.tp-crown.on { filter: none; }
.tp-crown:hover { transform: scale(1.15); }

/* Vista previa de la sala y lista Negar (Fase 60) */
#room-preview { display: block; width: 100%; max-width: 300px; margin: 6px auto 2px; border: 1px solid #2c3050; border-radius: 6px; image-rendering: auto; }
#room-preview-note { text-align: center; margin: 0 0 6px; }
.deny-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#deny-form { display: flex; gap: 6px; margin: 6px 0; }
#deny-form input { flex: 1; min-width: 0; }
#deny-list .deny-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
#deny-list .deny-row span { overflow: hidden; text-overflow: ellipsis; }
#deny-list .deny-empty { opacity: .6; padding: 6px; }

/* Confirmaciones dentro del juego (Fase 60): sustituyen a las ventanas del navegador */
#gconfirm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 7, 16, .66); }
#gconfirm[hidden] { display: none; }
.gc-box { width: min(340px, 86%); background: #161a33; border: 2px solid #3b4272; border-radius: 8px; padding: 16px 16px 12px; box-shadow: 0 8px 28px rgba(0,0,0,.6); text-align: center; }
.gc-box p { margin: 0 0 14px; line-height: 1.4; }
.gc-row { display: flex; gap: 10px; justify-content: center; }
.gc-row button { min-width: 96px; }

/* Moderación de anuncios (Fase 61) */
#ads-mod { margin-top: 8px; padding: 8px; border: 1px solid #3b4272; border-radius: 6px; background: rgba(255,255,255,.03); }
#ads-mod .ads-mod-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
#ads-mod .ads-mod-body { display: flex; gap: 10px; align-items: flex-start; }
#ads-mod #am-img { border: 1px solid #2c3050; background: #000; object-fit: contain; }
#ads-mod .am-f { display: block; margin: 6px 0 2px; font-size: 12px; }
#ads-mod .am-f input[type=text], #ads-mod .am-f textarea { display: block; width: 100%; box-sizing: border-box; }
#ads-mod .am-chk { font-size: 12px; margin-left: 8px; }

/* Calendario de días de las vallas (Fase 61) */
#ad-cal { max-width: 330px; margin: 6px 0; }
#ad-cal .cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; text-transform: capitalize; }
#ad-cal .cal-head button { min-width: 32px; }
#ad-cal .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
#ad-cal .cal-w { text-align: center; font-size: 11px; opacity: .7; }
#ad-cal .cal-d { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3px 0; min-height: 38px; border-radius: 5px; border: 1px solid #343a63; background: #1f2447; color: inherit; line-height: 1.1; cursor: pointer; }
#ad-cal .cal-d b { font-size: 13px; }
#ad-cal .cal-d small { font-size: 10px; color: #7ee2a0; min-height: 11px; }
#ad-cal .cal-d.few small { color: #ffc766; }
#ad-cal .cal-d.full { background: #2a1d2a; border-color: #5a2a3a; }
#ad-cal .cal-d.full small { color: #ff8a8a; }
#ad-cal .cal-d.today { box-shadow: inset 0 0 0 1px #ffd45c; }
#ad-cal .cal-d.on { background: #6d4fd6; border-color: #b9a6ff; color: #fff; }
#ad-cal .cal-d.on small { color: #fff; }
#ad-cal .cal-d:disabled { opacity: .35; cursor: default; }
#ad-packs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }

/* ---- Azotea (Fase 62): capa HTML de la pantalla de streaming, encima del canvas y debajo de las ventanas ---- */
#rooftop-screen { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; z-index: 10; transform-origin: 0 0; background: #05060a; overflow: hidden; }
#rooftop-screen[hidden] { display: none; }
#rooftop-screen .rs-host { position: absolute; inset: 0; }
#rooftop-screen .rs-shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
#rooftop-screen .rs-shield.rs-open { clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 22% 22%, 78% 22%, 78% 72%, 22% 72%, 22% 22%); }
#rooftop-screen .rs-shield.rs-hole { bottom: 110px; cursor: default; }
#rooftop-screen .rs-ctrl { position: absolute; left: 0; right: 0; bottom: 0; height: 84px; z-index: 4; display: flex; align-items: center; gap: 22px; padding: 0 28px; background: #0b1020; border-top: 3px solid #5ee0ff; }
#rooftop-screen .rs-ctrl button { width: 64px; height: 56px; font-size: 32px; cursor: pointer; color: #5ee0ff; background: #14213f; border: 2px solid #5ee0ff; }
#rooftop-screen .rs-ctrl input { flex: 0 0 360px; height: 40px; cursor: pointer; accent-color: #5ee0ff; }
#rooftop-screen .rs-bigplay { pointer-events: none; position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); z-index: 5; padding: 26px 48px; font-size: 48px; cursor: pointer; color: #fff; background: rgba(11, 22, 48, .88); border: 4px solid #5ee0ff; }
#rooftop-screen .rs-bigplay[hidden] { display: none; }
#rooftop-screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
#rooftop-screen .rs-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; color: #5ee0ff; font-family: "Courier New", monospace; text-align: center;
  background: repeating-linear-gradient(0deg, rgba(94,224,255,.05) 0 4px, transparent 4px 8px), #05060a; cursor: default; }
#rooftop-screen .rs-off b { font-size: 84px; letter-spacing: 6px; }
#rooftop-screen .rs-off span { font-size: 36px; color: #9fb2d4; }
#rooftop-screen .rs-off[hidden] { display: none; }
#rooftop-screen-btn { position: absolute; z-index: 11; width: 98px; padding: 3px 0; font-size: 11px; font-family: inherit; cursor: pointer; color: #5ee0ff; background: #0b1630; border: 1px solid #5ee0ff; }
#rooftop-screen-btn:hover { background: #12224a; }
#rooftop-screen-btn[hidden] { display: none; }
#screen-cfg { position: absolute; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; background: rgba(6, 7, 16, .66); }
#screen-cfg[hidden] { display: none; }
#screen-cfg .sc-box { width: min(420px, calc(100% - 24px)); background: #1b2030; border: 2px solid #5ee0ff; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; color: #e8ecf6; }
#screen-cfg h3 { margin: 0; font-size: 16px; }
#screen-cfg .sc-note { margin: 0; font-size: 12px; color: #9fb2d4; }
#screen-cfg label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
#screen-cfg input, #screen-cfg select { padding: 6px 8px; font: inherit; background: #0e1220; color: #fff; border: 1px solid #3a4560; }
#screen-cfg .sc-msg { margin: 0; min-height: 16px; font-size: 12px; color: #ffd45c; }
#screen-cfg .sc-row { display: flex; gap: 8px; justify-content: flex-end; }
#screen-cfg .sc-row button { padding: 6px 12px; font: inherit; cursor: pointer; background: #2a3350; color: #fff; border: 1px solid #5a6890; }
#screen-cfg .sc-row #sc-go { background: #1f8f5f; border-color: #4ecb8d; }
#screen-cfg .sc-row .sc-danger { background: #8a2f3a; border-color: #d6584f; }

/* ---- Máquina del Tablón de Sugerencias (Fase 72) ---- */
#tablon { position: absolute; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center; background: rgba(6, 7, 16, .7); }
#tablon[hidden] { display: none; }
#tablon .tb-box { width: min(620px, calc(100% - 20px)); max-height: calc(100% - 24px); display: flex; flex-direction: column; background: #0b1a3a; border: 3px solid #3a5fc0; box-shadow: 0 6px 0 rgba(0,0,0,.5), inset 0 0 0 2px #14286a; color: #dbe6ff; font-size: 13px; }
#tablon .tb-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: #14286a; color: #ffe9b0; }
#tablon .tb-x { background: none; border: 0; color: #fff; font-size: 16px; cursor: pointer; }
#tablon .tb-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
#tablon .tb-msg { margin: 0; padding: 5px 10px; min-height: 18px; font-size: 12px; color: #9af0b0; border-top: 1px solid #1b3a82; }
#tablon .tb-msg.bad { color: #ffb4a8; }
#tablon .tb-note { margin: 0; font-size: 12px; color: #9fb2d4; }
#tablon .tb-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#tablon .tb-why { font-size: 12px; color: #ffd45c; flex: 1 1 200px; }
#tablon .tb-btn { padding: 6px 12px; font: inherit; font-weight: bold; cursor: pointer; color: #fff; background: #1f3f90; border: 2px solid #3a5fc0; }
#tablon .tb-btn:hover:not(:disabled) { background: #2a52b8; }
#tablon .tb-btn:disabled { opacity: .45; cursor: not-allowed; }
#tablon .tb-del { background: #8a2f3a; border-color: #d6584f; }
#tablon .tb-cfg { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px; background: #10224d; border: 1px solid #3a5fc0; }
#tablon .tb-cfg input { width: 70px; padding: 4px; background: #0e1220; color: #fff; border: 1px solid #3a4560; font: inherit; }
#tablon .tb-list { display: flex; flex-direction: column; gap: 6px; }
#tablon .tb-card { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; background: #10224d; border: 2px solid #1b3a82; color: #cfe0ff; font: inherit; cursor: pointer; }
#tablon .tb-card:hover { border-color: #6a8ae0; }
#tablon .tb-card.mine { border-color: #ffe9b0; }
#tablon .tb-n { flex: none; min-width: 38px; color: #ffe9b0; font: bold 15px "Courier New", monospace; }
#tablon .tb-mid { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#tablon .tb-t { font-weight: bold; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tablon .tb-mid small, #tablon .tb-meta { color: #8fa4cf; font-size: 11px; }
#tablon .tb-chip { flex: none; padding: 2px 8px; font-size: 11px; font-weight: bold; color: #0b1020; }
#tablon .tb-readhead { display: flex; align-items: center; gap: 10px; }
#tablon .tb-readhead h4 { flex: 1; margin: 0; color: #fff; font-size: 15px; word-break: break-word; }
#tablon .tb-text { margin: 0; padding: 8px; background: #10224d; white-space: pre-wrap; word-break: break-word; }
#tablon .tb-reply { padding: 8px; background: #17306a; border-left: 4px solid #ffe9b0; }
#tablon .tb-reply p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
#tablon .tb-admin { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px dashed #d6584f; }
#tablon .tb-admin select, #tablon input#tb-title, #tablon textarea { padding: 6px; font: inherit; background: #0e1220; color: #fff; border: 1px solid #3a4560; width: 100%; box-sizing: border-box; resize: vertical; }
#tablon .tb-row { display: flex; gap: 8px; }
#tablon .tb-cnt { color: #8fa4cf; }

/* Franjas de 5 minutos de las vallas (Fase 74) */
#ad-turns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0; }
#ad-turns .fr { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 5px; border: 1px solid #343a63; background: #1f2447; color: inherit; cursor: pointer; }
#ad-turns .fr b { font-size: 14px; } #ad-turns .fr small { font-size: 10px; color: #7ee2a0; }
#ad-turns .fr.busy { background: #2a1d2a; border-color: #5a2a3a; opacity: .6; cursor: default; } #ad-turns .fr.busy small { color: #ff8a8a; }
#ad-turns .fr.on { background: #6d4fd6; border-color: #b9a6ff; color: #fff; } #ad-turns .fr.on small { color: #fff; }
#ad-franja-packs { display: flex; gap: 4px; flex-wrap: wrap; } #ad-franja-packs button { padding: 4px 8px; font-size: 12px; }
/* Desconectados en el panel de administración (Fase 76) */
#admin-players .adm-off-h { background: #20264a; color: #ffd37a; font-weight: bold; padding: 4px 6px; }
#admin-players tr.adm-off td { opacity: .85; font-style: italic; }

/* Residente (Fase 89) */
.tp-wallet { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px; border: 2px solid #1f4fb0; background: #0b1f4d; }
.tp-wl { color: #8fb6ec; letter-spacing: 1px; } .tp-wv { color: #fff; font-size: 16px; }
.tp-res-btn { padding: 6px 10px; font-weight: bold; letter-spacing: 1px; color: #2a1a00; background: linear-gradient(#ffd966, #e0a92a); border: 2px solid #8a6212; }
.tp-res-btn:hover { background: linear-gradient(#ffe48a, #eab53a); }
.tp-ach { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 2px solid #8a6212; background: #2a2208; color: #ffe08a; }
.tp-ach-i { font-size: 18px; } .tp-ach-sw { display: flex; align-items: center; gap: 4px; color: #cfe6ff; font-size: 12px; cursor: pointer; }
.term-res { left: 440px; top: 70px; bottom: auto; width: min(330px, 80%); height: auto; max-height: 90%; background: #08153a; border-color: #02071a; color: #cfe6ff; }
.term-res .win-top { background: #8a6212; color: #fff3cc; letter-spacing: 2px; font-family: "Courier New", monospace; }
.term-res .term-body { flex: none; padding: 8px; overflow-y: auto; }
.tr-intro { margin: 0; color: #ffe08a; } .tr-list { margin: 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.tr-list b { color: #fff; } .tr-list span { color: #9fb6dc; }
.tr-bal { padding: 4px 6px; background: #05102b; border: 2px solid #1f4fb0; }
.tr-buy { padding: 6px; font-weight: bold; background: #2f8f5a; color: #fff; } .tr-buy:disabled { background: #34405a; color: #8a95b3; cursor: not-allowed; }
.tr-warn { margin: 0; color: #ffb06a; font-size: 12px; } .tr-msg { margin: 0; min-height: 1.3em; color: #5fe0a0; font-size: 12px; } .tr-msg.err { color: #ff9a9a; }

/* Aviso de beta (Fase 92) */
#beta-gate { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 9, 20, 0.92); font-family: "Courier New", monospace; }
#beta-gate .beta-box { max-width: 520px; max-height: 100%; overflow: auto; background: #0e1a3a; color: #dbe8ff; border: 3px solid #f0c040; border-radius: 6px; padding: 20px 24px; box-shadow: 0 0 0 4px #0a1128, 0 10px 40px rgba(0, 0, 0, 0.6); }
#beta-gate h2 { margin: 0 0 10px; color: #f0c040; letter-spacing: 2px; font-size: 20px; }
#beta-gate p { margin: 8px 0; line-height: 1.45; font-size: 14px; }
#beta-gate .beta-warn { color: #ffd98a; font-weight: bold; }
#beta-gate ul { margin: 6px 0 10px; padding-left: 22px; font-size: 14px; line-height: 1.6; }
#beta-gate li::marker { color: #ff7a7a; content: "✗  "; }
#beta-gate .beta-ck { display: block; margin: 14px 0; padding: 10px; background: #14254f; border: 1px solid #3a5aa8; border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 1.4; }
#beta-gate .beta-ck input { margin-right: 6px; transform: scale(1.2); }
#beta-gate #beta-go { width: 100%; padding: 12px; font: bold 16px "Courier New", monospace; background: #f0c040; color: #1a1400; border: 2px solid #a37f10; border-radius: 4px; cursor: pointer; }
#beta-gate #beta-go:disabled { background: #3a4466; color: #8a94b5; border-color: #2a3350; cursor: not-allowed; }
