* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1020; color: #fff; font-family: "Segoe UI", system-ui, sans-serif; user-select: none; }
canvas#juego { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

#menu { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(5, 8, 20, .72); }
.caja { width: min(92vw, 380px); padding: 32px 30px 26px; background: #121a33; border: 1px solid #2b3a6b; border-radius: 4px; text-align: center; }
.caja h1 { margin: 0; font-size: 2.2rem; letter-spacing: .12em; color: #ffd84d; }
.sub { margin: 4px 0 22px; color: #8b97c4; font-size: .9rem; }
.caja label { display: block; text-align: left; margin-bottom: 6px; font-size: .8rem; color: #8b97c4; text-transform: uppercase; letter-spacing: .08em; }
.caja input { width: 100%; padding: 12px; margin-bottom: 14px; border: 1px solid #2b3a6b; border-radius: 3px; background: #0b1226; color: #fff; font-size: 1rem; user-select: text; }
.caja button { width: 100%; padding: 13px; border: 0; border-radius: 3px; background: #ffd84d; color: #1a1500; font-size: 1.05rem; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.caja button:hover { background: #ffe680; }
.caja button:disabled { opacity: .6; cursor: wait; }
.estado { min-height: 1.3em; margin: 12px 0 0; font-size: .85rem; color: #ff8a8a; }
.controles { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid #243158; list-style: none; text-align: left; font-size: .85rem; color: #aab4da; line-height: 1.9; }
.controles b { color: #fff; }

#mira { --mira-color: #fff; --mira-tam: 16px; position: fixed; left: 50%; top: 50%; width: var(--mira-tam); height: var(--mira-tam); transform: translate(-50%, -50%); border: 2px solid var(--mira-color); border-radius: 50%; box-shadow: 0 0 3px #000; pointer-events: none; transition: width .12s, height .12s; }
#mira::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: var(--mira-color); }
#mira.apuntando { width: calc(var(--mira-tam) * .5); height: calc(var(--mira-tam) * .5); border-width: 1px; }
#marcador-impacto { position: fixed; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%) rotate(45deg); border: 3px solid #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
#marcador-impacto.on { opacity: 1; transition: none; }
#marcador-impacto.cabeza, #marcador-impacto.muerte { border-color: #ff4d4d; }
#dano { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(220, 0, 0, .55) 100%); transition: opacity .5s; }
#dano.on { opacity: 1; transition: none; }

#vida { position: fixed; left: 20px; bottom: 20px; width: 240px; height: 26px; background: rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .4); border-radius: 3px; overflow: hidden; }
#vida-barra { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #2ec27e, #8ff0a4); transition: width .15s; }
#vida-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: .9rem; text-shadow: 0 1px 2px #000; }
#stats { position: fixed; right: 20px; bottom: 20px; padding: 6px 12px; background: rgba(0, 0, 0, .5); border-radius: 3px; font-size: .95rem; }
#feed { position: fixed; right: 20px; top: 20px; margin: 0; padding: 0; list-style: none; text-align: right; font-size: .9rem; }
#feed li { margin-bottom: 4px; padding: 4px 10px; background: rgba(0, 0, 0, .55); border-radius: 3px; }
#muerto { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); padding: 10px 20px; background: rgba(0, 0, 0, .65); border-radius: 3px; font-size: 1.1rem; }
#tabla { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 360px; border-collapse: collapse; background: rgba(5, 8, 20, .85); font-size: .95rem; }
#tabla th, #tabla td { padding: 8px 16px; text-align: left; border-bottom: 1px solid #243158; }
#tabla td:nth-child(n+2), #tabla th:nth-child(n+2) { text-align: center; }
#tabla tr.yo td { color: #ffd84d; font-weight: 700; }

#mun { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 6px 18px; background: rgba(0, 0, 0, .5); border-radius: 3px; font-size: 2rem; font-weight: 800; letter-spacing: .04em; text-shadow: 0 1px 3px #000; }
#mun small { font-size: 1.1rem; font-weight: 600; color: #aab4da; }
#mun.bajo #mun-cargador { color: #ff6a5a; }
#recarga { position: fixed; left: 50%; top: 60%; transform: translateX(-50%); padding: 6px 16px; background: rgba(0, 0, 0, .55); border-radius: 3px; font-weight: 700; letter-spacing: .12em; color: #ffd84d; }

.ajustes { margin-top: 14px; text-align: left; border-top: 1px solid #243158; padding-top: 12px; }
.ajustes summary { cursor: pointer; font-size: .8rem; letter-spacing: .12em; color: #ffd84d; font-weight: 700; }
.ajustes .fila { display: grid; grid-template-columns: 1fr 120px 52px; align-items: center; gap: 8px; margin: 10px 0 0; font-size: .85rem; color: #cfd6f2; text-transform: none; letter-spacing: 0; }
.ajustes .fila.check { grid-template-columns: 22px 1fr; }
.ajustes input[type=range] { width: 100%; margin: 0; padding: 0; accent-color: #ffd84d; }
.ajustes input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: #ffd84d; }
.ajustes input[type=color] { width: 46px; height: 24px; padding: 0; margin: 0; border: 1px solid #2b3a6b; background: none; }
.ajustes output { text-align: right; color: #fff; font-variant-numeric: tabular-nums; font-size: .8rem; }
.ajustes .secundario { margin-top: 14px; padding: 8px; background: transparent; border: 1px solid #2b3a6b; color: #cfd6f2; font-size: .8rem; font-weight: 600; letter-spacing: .04em; }
.ajustes .secundario:hover { background: #1a2547; }

#minimapa { position: fixed; left: 16px; top: 16px; width: 170px; height: 170px; border: 2px solid rgba(255, 255, 255, .55); border-radius: 3px; opacity: .92; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }

#postura { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); padding: 4px 14px; background: rgba(0, 0, 0, .5); border-radius: 3px; font-size: .8rem; letter-spacing: .1em; color: #ffd84d; }
.caja .pie { margin: 14px 0 0; font-size: .75rem; }
.caja .pie a { color: #8b97c4; }

#debug { position: fixed; left: 16px; top: 196px; margin: 0; padding: 3px 9px; background: rgba(0, 0, 0, .55); border-radius: 3px; font: 12px/1.5 Consolas, monospace; color: #9fe8b0; white-space: pre-wrap; pointer-events: none; }
#debug[hidden] { display: none; }

#golpes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.golpe { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.golpe i { position: absolute; left: -170px; top: 0; width: 340px; height: 18vh; background: radial-gradient(ellipse at 50% 0%, rgba(255, 20, 20, .95) 0%, rgba(230, 0, 0, .55) 40%, rgba(230, 0, 0, 0) 75%); filter: blur(7px); }
#tabla tr.bot td { color: #ff7a12; }

.caja { max-height: 94vh; overflow-y: auto; }
.saludo { margin: 0 0 12px; font-size: .95rem; color: #cfd6f2; }
.saludo b { color: #fff; }
.rol { margin-left: 4px; padding: 1px 7px; border-radius: 3px; background: #ffd84d; color: #1a1500; font-size: .7rem; font-weight: 800; letter-spacing: .08em; }
.cuenta, .admin { margin-top: 14px; text-align: left; border-top: 1px solid #243158; padding-top: 12px; }
.cuenta summary, .admin summary { cursor: pointer; font-size: .8rem; letter-spacing: .12em; color: #ffd84d; font-weight: 700; }
.cuenta summary small { color: #8b97c4; font-weight: 400; letter-spacing: 0; }
.cuenta .ayuda, .admin .ayuda { margin: 8px 0; font-size: .8rem; color: #8b97c4; }
.cuenta input, .admin input[type=text] { width: 100%; margin: 6px 0 0; padding: 9px 10px; font-size: .9rem; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.cuenta .secundario, .admin .secundario { margin-top: 8px; padding: 8px; background: transparent; border: 1px solid #2b3a6b; color: #cfd6f2; font-size: .8rem; font-weight: 600; letter-spacing: .04em; }
.cuenta .secundario:hover, .admin .secundario:hover { background: #1a2547; }
.dos .secundario { margin-top: 0; }
.admin .fila { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin: 8px 0 0; }
.admin .fila span { display: none; }
.admin select { width: 100%; padding: 8px; background: #0b1226; color: #fff; border: 1px solid #2b3a6b; border-radius: 3px; font-size: .9rem; }
.admin .fila .secundario { margin-top: 0; width: auto; padding: 8px 12px; }
#adm-jugadores { display: grid; gap: 4px; max-height: 140px; overflow-y: auto; }
#adm-jugadores .jug { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 8px; background: #0b1226; border-radius: 3px; font-size: .85rem; }
#adm-jugadores .jug button { margin: 0; padding: 3px 9px; width: auto; background: #5c1b1b; border: 0; color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: 0; cursor: pointer; border-radius: 3px; }
#adm-jugadores .jug button:hover { background: #8a2222; }
#tabla tr.admin td { color: #ffd84d; }

/* menú ancho: dos columnas (partida y cuenta a la izquierda; administración, ajustes y controles a la derecha) para no tener que hacer scroll */
.caja { width: min(96vw, 860px); }
.caja .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; align-items: start; text-align: left; }
.caja .col > :first-child { margin-top: 0; }
.caja .col:last-child > details:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.caja .col:last-child > details[hidden] + details { margin-top: 0; border-top: 0; padding-top: 0; }
.caja .sub { margin-bottom: 18px; }
@media (max-width: 760px) { .caja .cols { grid-template-columns: 1fr; } .caja { width: min(92vw, 420px); } }
