:root {
  --bg: #111111;
  --card: #343a40;
  --card2: #2b3035;
  --row: rgba(255, 255, 255, 0.08);
  --row-hi: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: #a7adb4;
  --pink: #fe70c3;
  --pink-d: #c4469a;
  --blue: #007bff;
  --yellow: #e0a800;
  --red: #dc3545;
  --hud: rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: 'Ubuntu', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input { font-family: inherit; }
a { color: var(--muted); }

/* ===================== botones ===================== */
.b { border: 0; border-radius: 5px; font-family: 'Roboto', 'Ubuntu', sans-serif; font-weight: 500; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: filter .15s, transform .05s; }
.b:hover { filter: brightness(1.12); }
.b:active { transform: translateY(1px); }
.b.sm { font-size: 14px; padding: 6px 9px; }
.b.big { font-size: 20px; padding: 10px 12px; }
.b.full { width: 100%; margin-top: 10px; }
.b.blue { background: var(--blue); }
.b.yellow { background: var(--yellow); }
.b.red { background: var(--red); }
.b.pink { background: var(--pink); }
.btnrow { display: flex; gap: 10px; }
.btnrow .b { flex: 1; }

/* ===================== overlays ===================== */
.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: 14px; padding: 12px 16px 20px; background: rgba(0, 0, 0, 0.55);
  overflow-y: auto; z-index: 10; }
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }

.brand { text-align: center; }
#logo { margin: 0; font: 400 clamp(44px, 8vw, 84px)/1 'Russo One', sans-serif; letter-spacing: 1px;
  background: linear-gradient(180deg, #ffd1ee 0%, var(--pink) 45%, #b03b86 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #5c1d46) drop-shadow(0 0 22px rgba(254, 112, 195, .35)); }
#logo span { font-size: .62em; }

.dash { width: 100%; max-width: 1080px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--card); border-radius: 8px; padding: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.card h3 { margin: 0 0 10px; text-align: center; font-weight: 500; font-size: 22px; }

/* columna izquierda */
.skinsel { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0 12px; }
.arrow { background: none; border: 0; font-size: 34px; color: var(--muted); padding: 0 6px; line-height: 1; }
.arrow:hover { color: #fff; }
.skin-preview { cursor: pointer; opacity: .55; transition: opacity .15s, transform .15s; width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 58px; border: 6px solid rgba(0,0,0,.25); box-shadow: inset 0 0 0 3px rgba(255,255,255,.15); }
.grid-colors { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.grid-colors button { width: 24px; height: 24px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.grid-colors button.sel { border-color: #fff; transform: scale(1.15); }
.info { flex: 1; }
.keys { list-style: none; padding: 0; margin: 0; font-size: 14px; font-weight: 300; }
.keys li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--row); }
.keys kbd { font: 500 12px 'Ubuntu', sans-serif; background: var(--row-hi); border-radius: 4px; padding: 2px 7px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* columna central */
.namerow { display: flex; gap: 8px; margin-bottom: 10px; }
.namerow input { min-width: 0; padding: 10px 12px; font-size: 18px; color: #fff; background: rgba(255,255,255,.12);
  border: 0; border-radius: 5px; outline: none; }
.namerow input:focus { background: rgba(255,255,255,.2); box-shadow: 0 0 0 2px var(--pink); }
#tag { width: 72px; text-align: center; text-transform: uppercase; }
#nick { flex: 1; }
.meta { display: flex; justify-content: space-around; margin-top: 12px; font-size: 12px; color: var(--muted); }
#status { text-align: center; font-size: 13px; color: var(--pink); min-height: 16px; margin-top: 6px; }
.ad { flex: 1; display: flex; flex-direction: column; min-height: 250px; }
.ad-label { text-align: center; font-size: 11px; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; }
.ad-slot { flex: 1; min-height: 90px; border-radius: 6px; }

/* columna derecha */
.servers { flex: 1; display: flex; flex-direction: column; }
.tabs { display: flex; background: #464d55; border-radius: 5px; overflow: hidden; margin-bottom: 8px; }
.tabs button { flex: 1; border: 0; background: none; padding: 7px 8px; font-size: 14px; font-weight: 300; }
.tabs button.on { background: rgba(255,255,255,.2); }
.tablewrap { background: var(--card2); border-radius: 5px; flex: 1; min-height: 210px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-weight: 500; font-size: 13px; padding: 6px 4px; }
td { text-align: center; padding: 4px; font-weight: 300; cursor: pointer; }
td:first-child { font-weight: 500; }
td.mono { font-family: ui-monospace, monospace; font-size: 12px; }
tbody tr:hover { background: var(--row); }
tbody tr.sel { background: var(--pink); }
tbody tr.sel td { font-weight: 500; }
.social { display: flex; justify-content: center; gap: 12px; }
.social a { width: 46px; height: 46px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: #fff; text-decoration: none; font-weight: 700; font-size: 20px; }
.social svg { width: 24px; height: 24px; fill: #fff; }

/* muerte */
.card.death { width: 100%; max-width: 420px; text-align: center; padding: 20px; }
.death h2 { margin: 0 0 12px; font: 400 32px 'Russo One', sans-serif; color: var(--pink); }
.dstats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.dstats div { background: var(--card2); border-radius: 6px; padding: 10px; }
.dstats span { display: block; font-size: 26px; font-weight: 700; }
.dstats small { color: var(--muted); }
.death .ad-label { margin-top: 14px; }
.death .ad-slot { min-height: 100px; background: var(--card2); }

/* ===================== modales ===================== */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: center;
  justify-content: center; padding: 16px; }
.mbox { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; background: var(--card2); border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.mbox.wide { max-width: 760px; display: flex; flex-direction: column; overflow: hidden; }
.mhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--card);
  font-weight: 500; font-size: 18px; }
.mtext { padding: 4px 16px 10px; font-weight: 300; line-height: 1.5; font-size: 15px; }
.mclose { background: var(--red); border: 0; border-radius: 5px; width: 30px; height: 30px; font-size: 14px; flex-shrink: 0; }
.mtabs { display: flex; gap: 8px; padding: 8px; background: var(--card); align-items: center; }
.mtabs button:not(.mclose) { flex: 1; border: 0; border-radius: 5px; background: rgba(255,255,255,.08); padding: 8px 6px;
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtabs button.on { background: var(--pink); }
.mbody { display: flex; min-height: 320px; max-height: 70vh; }
.mside { width: 130px; background: var(--card); padding: 6px 0; flex-shrink: 0; overflow-y: auto; }
.mside button { display: block; width: 100%; border: 0; background: none; padding: 10px 8px; font-size: 14px;
  border-left: 3px solid transparent; }
.mside button.on { background: rgba(255,255,255,.06); border-left-color: var(--pink); }
.mcontent { flex: 1; overflow-y: auto; padding: 6px 0; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.04); }
.opt:hover { background: rgba(255,255,255,.03); }
.opt select { background: rgba(255,255,255,.08); color: #fff; border: 0; border-radius: 4px; padding: 5px 8px; font-size: 13px; }
.opt select option { background: #2b3035; }
.opt input[type=range] { accent-color: var(--pink); width: 150px; }
.opt .val { font-size: 11px; color: var(--muted); margin-left: 6px; }
.colorpick { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.colorpick input { width: 30px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
.switch { position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #555b62; border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--pink); }
.switch input:checked + span::after { transform: translateX(18px); }
.keybtn { min-width: 86px; background: rgba(255,255,255,.08); border: 0; border-radius: 4px; padding: 5px 10px;
  font: 500 12px 'Ubuntu', sans-serif; text-transform: uppercase; }
.keybtn.wait { background: var(--pink); }
.io-area { width: calc(100% - 32px); margin: 8px 16px; height: 200px; background: #1d2125; color: #ddd; border: 0; border-radius: 5px;
  font: 12px ui-monospace, monospace; padding: 8px; resize: vertical; user-select: text; }
.io-btns { display: flex; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; padding: 14px; }
.skin-grid button { aspect-ratio: 1; font-size: 26px; border-radius: 50%; border: 3px solid transparent; background: var(--card); padding: 0; }
.skin-grid button.sel { border-color: var(--pink); }
.emote-slots { display: flex; gap: 10px; justify-content: center; padding: 6px 14px; }
.emote-slots button { width: 64px; height: 64px; border-radius: 8px; border: 3px solid transparent; background: var(--card);
  font-size: 30px; position: relative; }
.emote-slots button.sel { border-color: var(--pink); }
.emote-slots button small { position: absolute; top: 2px; left: 5px; font-size: 11px; color: var(--muted); }

/* ===================== HUD ===================== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-size: 13px; font-family: 'Titillium Web', 'Ubuntu', sans-serif; }
#hud.off > :not(#stats) { display: none !important; }
#counter { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 14px; white-space: nowrap;
  text-shadow: 0 1px 2px #000; }
#allies { position: absolute; top: 8px; left: 8px; min-width: 150px; background: var(--hud); padding: 4px 8px; font: 400 12px 'Titillium Web', sans-serif; }
.hud-title { color: var(--pink); font-size: 13px; }
#alliesList div { display: grid; grid-template-columns: 16px 42px 28px 1fr; gap: 6px; white-space: nowrap; font-weight: 600; }
#alliesList div.me { color: var(--pink); }
.hud-box { position: absolute; top: 8px; right: 8px; width: 210px; background: var(--hud); padding: 8px 10px 6px; }
.hud-brand { font: 300 28px/1.1 'Titillium Web', sans-serif; color: var(--pink); text-align: center; margin-bottom: 4px; }
#lbList { font: 400 13px/1.5 'Titillium Web', 'Ubuntu', sans-serif; color: #b9bdc2; text-align: center; }
#lbList div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lbList div.me { color: #fff; font-weight: 600; }
#lbList div.extra { color: #fff; font-weight: 600; margin-top: 2px; }
#teamBar { display: flex; height: 10px; overflow: hidden; margin: 2px 0 6px; }
#chat { position: absolute; left: 0; bottom: 26px; width: min(360px, 62vw); pointer-events: auto; }
.chat-tabs { display: flex; }
.chat-tabs button { border: 0; background: rgba(0,0,0,.35); font-size: 11px; padding: 3px 10px; }
.chat-tabs button.on { background: var(--pink); }
#chatLog { background: var(--hud); height: 150px; overflow-y: auto; padding: 6px 8px; font-size: 12.5px; line-height: 1.35;
  scrollbar-width: thin; }
#chatLog .tm { color: #777; margin-right: 4px; font-size: 11px; }
#chatLog .tchan { color: #7ec8ff; }
#chatLog b { font-weight: 500; }
#chatInput { width: 100%; padding: 6px 8px; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 13px; outline: none; display: none; }
#chatInput.open { display: block; }
#stats { position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.6); padding: 4px 12px; font-weight: 600; font-size: 15px; white-space: pre; }
#mapWrap { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
#timer { background: #000; padding: 2px 6px; font-size: 11px; border-radius: 3px; }
#minimap { width: 180px; height: 180px; background: rgba(0,0,0,.35); }
#specTag { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); background: var(--hud); padding: 4px 12px; font-size: 13px; white-space: nowrap; }
#mobileBtns { position: absolute; right: 16px; bottom: 210px; display: flex; flex-direction: column; gap: 14px; pointer-events: auto; }
#mobileBtns button { width: 66px; height: 66px; border-radius: 50%; border: 3px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.12); font-size: 24px; font-weight: 700; touch-action: none; }
#toast { position: fixed; top: 40px; left: 50%; transform: translateX(-50%); background: var(--pink); padding: 10px 18px;
  border-radius: 6px; z-index: 40; font-weight: 500; }

/* ===================== responsive ===================== */
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr 1fr; }
  .dash .col:nth-child(2) { order: -1; grid-column: 1 / -1; }
  .ad { min-height: 120px; }
}
@media (max-width: 600px) {
  .dash { grid-template-columns: 1fr; }
  .dash .col:nth-child(2) { grid-column: auto; }
  .hud-box { width: 140px; padding: 4px 6px; }
  .hud-brand { font-size: 18px; }
  #lbList { font-size: 11px; }
  #minimap { width: 100px; height: 100px; }
  #mobileBtns { bottom: 130px; }
  #chat { width: 58vw; }
  #chatLog { height: 80px; font-size: 11px; }
  #counter { font-size: 11px; }
  #stats { font-size: 11px; white-space: normal; max-width: 72vw; padding: 3px 8px; }
  #chat { bottom: 40px; }
  #allies { display: none; }
  .mside { width: 96px; }
  .mtabs button:not(.mclose) { font-size: 12px; padding: 8px 4px; }
}

/* perfil local */
.profile .prow { display: flex; align-items: center; gap: 14px; background: var(--card2); border-radius: 8px; padding: 12px; }
.pavatar { width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; border: 4px solid rgba(0,0,0,.3); }
.pname { font-size: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plevel { font-size: 14px; }
.pgames { font-size: 12px; color: var(--muted); }
.xpbar { position: relative; height: 18px; background: var(--card2); border-radius: 9px; margin-top: 10px; overflow: hidden; }
#pXpFill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--pink); border-radius: 9px; transition: width .4s; }
.xpbar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 18px; font-weight: 500; }
.mtext h4 { margin: 14px 0 6px; }
.card.death .b.full { margin-top: 10px; }

.skin-preview.on { opacity: 1; transform: scale(1.06); box-shadow: inset 0 0 0 3px rgba(255,255,255,.15), 0 0 0 3px var(--pink); }

/* anuncio del administrador */
#announce { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); max-width: min(720px, 92vw); z-index: 40;
  background: rgba(20,20,24,.92); border: 2px solid var(--pink); color: #fff; padding: 10px 18px; border-radius: 8px;
  font: 500 16px 'Ubuntu', sans-serif; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.5); pointer-events: none; }
#announce.big { top: 30%; font-size: 26px; padding: 18px 26px; }
