:root {
  --wood: #5a3d22;
  --wood-dark: #3a2614;
  --wood-light: #7a5532;
  --parchment: #efe2c2;
  --ink: #2b1d10;
  --gold: #d9b45a;
  --blue: #2f6fd6;
  --red: #c8322b;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c140c; color: var(--parchment); font: 15px/1.4 system-ui, sans-serif; }
canvas { display: block; width: 100vw; height: 100vh; cursor: crosshair; touch-action: none; }
.hidden { display: none !important; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20, 12, 5, .72); padding: 16px; overflow-y: auto; }
.overlay .card { margin: auto; }
.card { background: linear-gradient(#f4e8cc, #e4d2a8); color: var(--ink); border: 6px solid var(--wood); border-radius: 6px; box-shadow: 0 0 0 2px var(--gold), 0 20px 60px #000a; padding: 24px 28px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.card.wide { max-width: 640px; }
h1, h2, h3 { font-family: var(--serif); margin: 0; letter-spacing: .04em; }
h1 { font-size: 40px; text-align: center; color: var(--wood-dark); }
.sub { text-align: center; margin: -8px 0 4px; font-style: italic; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
input { font: inherit; padding: 8px 10px; border: 2px solid var(--wood-light); border-radius: 4px; background: #fffaf0; color: var(--ink); min-width: 0; }
#code { text-transform: uppercase; letter-spacing: .3em; flex: 1; }
button { font: 600 15px var(--serif); padding: 9px 14px; border: 2px solid var(--wood-dark); border-radius: 4px; background: var(--wood-light); color: var(--parchment); cursor: pointer; }
button:hover { background: var(--wood); }
button.primary { background: #2f5d2a; border-color: #1c3a19; }
button.primary:hover { background: #3c7535; }
button.on { background: #8a6d1f; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > input { flex: 1; }
.error { color: #a01d16; margin: 0; min-height: 1em; }
.muted { opacity: .7; margin: 0; }
.small { font-size: 13px; }
#roomCode { letter-spacing: .2em; color: #8a1f16; }

.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col { border: 2px solid var(--wood-light); border-radius: 4px; padding: 8px 10px; background: #fff8e8; min-height: 140px; }
.col.A h3 { color: var(--blue); }
.col.B h3 { color: var(--red); }
.col ul { list-style: none; margin: 6px 0 0; padding: 0; }
.col li { padding: 3px 0; display: flex; justify-content: space-between; border-bottom: 1px dashed #d8c69c; }
.col li.me { font-weight: 700; }
.tick { color: #2f5d2a; font-weight: 700; }
.col li .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; background: var(--gold); color: var(--ink); border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.kick { padding: 0 6px; margin-left: 6px; font: 700 12px system-ui, sans-serif; background: #8a2a20; border-color: #5a1810; line-height: 18px; }
.kick:hover { background: #a83226; }
#specs .kick { vertical-align: middle; }
#status { font-weight: 600; margin: 0; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#scorebar, #panel { pointer-events: auto; }
#scorebar { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; align-items: center; background: var(--wood-dark); border: 3px solid var(--wood-light); border-top: 0; border-radius: 0 0 8px 8px; padding: 6px 18px; font-family: var(--serif); font-size: 18px; }
#scorebar .A { color: #8db4ff; }
#scorebar .B { color: #ff9a92; }
#clock { font-size: 22px; color: var(--gold); min-width: 64px; text-align: center; }
#panel { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 16px; align-items: center; padding: 10px 16px; background: linear-gradient(var(--wood), var(--wood-dark)); border-top: 4px solid var(--wood-light); }
#portrait { width: 64px; height: 64px; border: 3px solid var(--gold); border-radius: 4px; background: #2a1c0e center/contain no-repeat; flex: none; }
#info { min-width: 200px; }
#clsName { font: 700 20px var(--serif); }
.hpbar { position: relative; height: 16px; background: #1a0f06; border: 1px solid #000; margin: 4px 0; }
#hpFill { height: 100%; background: #3ca33a; width: 100%; transition: width .15s; }
#hpText { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 16px; }
#counter { font-size: 13px; opacity: .85; }
#lives { font-size: 12px; color: var(--gold); margin-top: 2px; }
.opts select { flex: 1; }
.sizeRow { gap: 6px; }
.sizeRow #sizeText { flex: 1 1 100%; }
#helpBox { margin-left: auto; text-align: right; max-width: 440px; }
#helpHead { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); margin-bottom: 2px; }
#helpClose { padding: 0 5px; font: 700 11px/16px system-ui, sans-serif; background: var(--wood-dark); border-color: var(--wood-light); border-radius: 3px; }
#help { font-size: 12px; opacity: .82; line-height: 1.35; }
#helpOpen { margin-left: auto; width: 28px; height: 28px; padding: 0; border-radius: 50%; font: 700 15px var(--serif); background: var(--wood-dark); border-color: var(--gold); color: var(--gold); }
#deadMsg { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: #000a; padding: 8px 16px; border-radius: 4px; font-family: var(--serif); }

.endTable { width: 100%; border-collapse: collapse; font-size: 14px; }
.endTable th, #endTable td { padding: 4px 6px; border-bottom: 1px solid #d8c69c; text-align: left; }
.endTable tr.A td:first-child { border-left: 4px solid var(--blue); }
.endTable tr.B td:first-child { border-left: 4px solid var(--red); }
.endTable tr.dead { opacity: .6; }

@media (max-width: 700px) {
  .teams { grid-template-columns: 1fr; }
  #panel { padding: 8px 10px; gap: 10px; }
  #portrait { width: 48px; height: 48px; }
  #info { min-width: 150px; }
  #helpBox { position: fixed; right: 10px; bottom: 82px; background: rgba(42, 28, 14, .94); border: 2px solid var(--gold); border-radius: 6px; padding: 8px 10px; max-width: calc(100vw - 20px); z-index: 15; }
}

/* minimapa en el centro del panel, siempre visible */
#minimapWrap, #touchBtns { pointer-events: auto; }
#minimapWrap { position: absolute; left: 50%; bottom: 6px; width: max-content; display: block; transform: translateX(-50%); background: rgba(28, 20, 12, .95); border: 3px solid var(--wood-light); border-radius: 6px; box-shadow: 0 0 0 1px var(--gold), 0 6px 18px #000a; padding: 3px; line-height: 0; }
#minimap { display: block; width: 300px; height: 160px; cursor: pointer; border-radius: 3px; }
#touchBtns { pointer-events: auto; }
#minimap { display: block; width: 300px; height: 160px; cursor: pointer; border-radius: 3px; }
#touchBtns { position: fixed; right: 12px; top: 54px; display: none; flex-direction: column; gap: 6px; }
#touchBtns button { width: 38px; height: 38px; padding: 0; border-radius: 50%; font: 700 17px system-ui, sans-serif; background: rgba(58, 38, 20, .88); border-color: var(--gold); }
@media (pointer: coarse), (max-width: 700px) {
  #touchBtns { display: flex; }
  #minimap { width: 180px; height: 96px; }
}
#debugStats { position: fixed; top: 8px; left: 8px; background: rgba(0, 0, 0, .72); color: #d8f3a2; font: 11px/1.35 ui-monospace, monospace; padding: 6px 8px; border-radius: 4px; border: 1px solid #556; pointer-events: none; z-index: 25; white-space: pre; }
.col li.offline { opacity: .6; font-style: italic; }

/* menú: crear y listado de salas */
.create { align-items: center; }
.create button { flex: 1; }
.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
.listTitle { font-size: 18px; color: var(--wood-dark); }
#roomList { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; border: 2px solid var(--wood-light); border-radius: 4px; background: #fff8e8; }
#roomList li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px dashed #d8c69c; }
#roomList li:last-child { border-bottom: 0; }
#roomList .rname { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#roomList .rinfo { font-size: 13px; opacity: .75; white-space: nowrap; }
#roomList button { padding: 5px 10px; font-size: 14px; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
#roomName { color: var(--wood-dark); }
#roomKind { font: 13px system-ui, sans-serif; }

/* chat */
#chat { display: flex; flex-direction: column; gap: 6px; }
#chatLog { overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
#chatLog .sys { font-style: italic; opacity: .65; }
#chatLog b.A { color: var(--blue); }
#chatLog b.B { color: var(--red); }
#chatLog b.spec { color: #777; }
#chatInput { width: 100%; }
/* en el lobby va dentro de la tarjeta */
#chatSlot #chat { border: 2px solid var(--wood-light); border-radius: 4px; background: #fff8e8; padding: 6px; }
#chatSlot #chatLog { height: 110px; }
/* en partida flota abajo a la izquierda */
body > #chat { position: fixed; left: 12px; bottom: 100px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
body > #chat #chatLog { max-height: 180px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
body > #chat #chatLog b.A { color: #8db4ff; }
body > #chat #chatLog b.B { color: #ff9a92; }
body > #chat #chatLog b.spec { color: #ccc; }
body > #chat #chatLog > div { transition: opacity .6s; }
body > #chat #chatLog > div.old { opacity: 0; }
body > #chat.typing #chatLog > div.old { opacity: .85; }
body > #chat #chatInput { display: none; pointer-events: auto; background: rgba(20,12,5,.85); color: #fff; border-color: var(--gold); }
body > #chat.typing #chatInput { display: block; }
body > #chat.typing #chatLog { background: rgba(0,0,0,.35); border-radius: 4px; padding: 4px; }

select { font: inherit; padding: 7px 8px; border: 2px solid var(--wood-light); border-radius: 4px; background: #fffaf0; color: var(--ink); }
.sizeRow { align-items: center; justify-content: space-between; font-weight: 600; }
.sizeRow select:disabled { opacity: .6; }

.seedRow { align-items: center; }
label.inline { flex-direction: row; align-items: center; gap: 8px; flex: 1; }
label.inline input { flex: 1; text-transform: uppercase; letter-spacing: .1em; }
#lastSeed { font-size: 13px; padding: 6px 10px; }
#roomPw { text-transform: none; letter-spacing: normal; }
#createPw { width: 100%; }
.lock { margin-right: 4px; }

/* fondos de Codex (assets/ui) */
#menu { background: linear-gradient(rgba(20,12,5,.25), rgba(20,12,5,.55)), url(assets/ui/splash_title.webp) center/cover no-repeat; }
#lobby { background: linear-gradient(rgba(20,12,5,.3), rgba(20,12,5,.5)), url(assets/ui/splash_lobby.webp) center/cover no-repeat; }
#end { background: linear-gradient(rgba(20,12,5,.2), rgba(20,12,5,.5)), url(assets/ui/splash_victory.webp) center/cover no-repeat; }
#end.defeat { background-image: linear-gradient(rgba(20,12,5,.2), rgba(20,12,5,.5)), url(assets/ui/splash_defeat.webp); }

h1.logo { margin: -10px 0 -4px; line-height: 0; }
h1.logo img { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 6px #0007); }

/* stamina en el panel */
.stbar { position: relative; height: 10px; background: #1a0f06; border: 1px solid #000; margin: 2px 0 4px; }
#stFill { height: 100%; background: #d9c04a; width: 100%; transition: width .15s; }
#stText { position: absolute; inset: 0; text-align: center; font-size: 9px; line-height: 10px; color: #1a0f06; font-weight: 700; }
.stbar.tired #stFill { background: #e0662a; animation: blink .5s steps(2) infinite; }
.stbar.tired #stText { color: #fff; }
@keyframes blink { 50% { opacity: .55; } }

/* cartel de victoria / derrota sobre el campo */
#banner { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; animation: bannerIn .6s ease-out; }
#bannerBig { font: 700 clamp(44px, 9vw, 96px)/1 var(--serif); letter-spacing: .06em; color: var(--gold); text-shadow: 0 4px 0 #3a2614, 0 0 30px #000, 0 0 60px #000a; }
#bannerSmall { margin-top: 10px; font: 600 clamp(16px, 2.6vw, 24px) var(--serif); color: var(--parchment); text-shadow: 0 2px 6px #000; }
#banner.lose #bannerBig { color: #c9c1b0; }
#banner.win #bannerBig { animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes bannerIn { from { opacity: 0; transform: translateX(-50%) scale(1.4); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes glow { to { text-shadow: 0 4px 0 #3a2614, 0 0 40px #f3d36b, 0 0 80px #d9b45a; } }
.endTable tr.me td { font-weight: 700; }

/* lobby con tarjetas de consejos al costado */
.lobbyWrap { display: flex; gap: 18px; align-items: flex-start; justify-content: center; margin: auto; width: 100%; max-width: 960px; }
.lobbyWrap .card { margin: 0; }
#tips { width: 280px; flex: none; display: flex; flex-direction: column; gap: 8px; margin-top: 40px; }
.tip { background: linear-gradient(#f4e8cc, #e4d2a8); color: var(--ink); border: 4px solid var(--wood); border-radius: 6px; box-shadow: 0 0 0 2px var(--gold), 0 12px 40px #000a; padding: 14px 16px; min-height: 190px; }
.tip.fade { animation: tipIn .45s ease-out; }
@keyframes tipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tipHead { font: 600 12px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: #8a1f16; display: flex; justify-content: space-between; }
.tip h3 { font-size: 20px; margin: 6px 0; color: var(--wood-dark); }
.tip p { margin: 0; font-size: 14px; }
.tipNav { justify-content: center; }
.tipNav button { padding: 2px 16px; font-size: 20px; line-height: 1.2; }
.give { padding: 0 4px; margin-left: 6px; font: 12px system-ui, sans-serif; background: #8a6d1f; border-color: #5a4810; line-height: 18px; }
@media (max-width: 960px) {
  .lobbyWrap { flex-direction: column; align-items: center; }
  #tips { width: 100%; max-width: 640px; position: static; }
  .tip { min-height: 0; }
}

/* botones de sonido */
#audioBtns { position: fixed; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 20; }
#audioBtns button { width: 36px; height: 36px; padding: 0; font: 18px system-ui, sans-serif; border-radius: 50%; background: rgba(58, 38, 20, .85); border-color: var(--gold); }
#audioBtns button.off { opacity: .45; text-decoration: line-through; }

.credits { opacity: .75; }
.credits summary { font-weight: 600; margin: 0; }

/* login opcional */
.authRow { align-items: center; gap: 10px; }
button.google { background: #fff; color: #3c4043; border-color: #9a8a6a; font-family: system-ui, sans-serif; display: inline-flex; align-items: center; gap: 8px; }
button.google:hover { background: #f1ece0; }
button.google .g { font: 700 16px system-ui, sans-serif; color: #4285f4; }
#authInfo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
#authInfo.hidden { display: none; }
#authPhoto { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--gold); }
button.link { background: none; border: 0; color: #8a1f16; padding: 0 4px; font: 600 13px system-ui, sans-serif; text-decoration: underline; }
button.link:hover { background: none; }
.av { width: 18px; height: 18px; border-radius: 50%; vertical-align: -4px; margin-right: 5px; }
.ok { color: #2f6fd6; font-weight: 700; margin-left: 3px; font-size: 12px; }
a.link { color: #8a1f16; font: 600 13px system-ui, sans-serif; }
.adminBtn { display: inline-block; font: 700 14px var(--serif); padding: 7px 12px; border: 2px solid var(--wood-dark); border-radius: 4px; background: var(--gold); color: var(--ink); text-decoration: none; }
.adminBtn:hover { background: #e8c873; }

/* retratos (Codex) */
#portrait { background-size: cover; }
#reveal { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; align-items: center; background: rgba(28, 20, 12, .88); border: 3px solid var(--gold); border-radius: 8px; padding: 16px 22px; box-shadow: 0 12px 40px #000c; pointer-events: none; animation: revealIn .45s ease-out; transition: opacity .6s; }
#reveal.out { opacity: 0; }
#revealImg { width: 112px; height: 112px; border: 4px solid var(--gold); border-radius: 6px; image-rendering: auto; }
.revealHead { font: 600 13px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); }
#revealCls { font: 700 34px/1.1 var(--serif); }
#revealSub { font-size: 14px; opacity: .85; max-width: 300px; margin-top: 4px; }
@keyframes revealIn { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
img.mini { width: 22px; height: 22px; border-radius: 3px; vertical-align: -6px; margin-right: 6px; border: 1px solid var(--wood-light); }
.tipPortrait { float: left; width: 64px; height: 64px; border-radius: 4px; border: 2px solid var(--wood); margin: 2px 10px 4px 0; }
.tipRow { display: flex; gap: 6px; margin-bottom: 8px; }
.tipRow .tipPortrait { float: none; width: 56px; height: 56px; margin: 0; }

/* menú simple, ranking, moderación */
.create input { flex: 1; }
.createNote { margin-top: -6px; }
.rankBtn { align-self: flex-start; }
.elo { font: 700 11px system-ui, sans-serif; background: #e8d9a8; color: var(--ink); border: 1px solid var(--wood-light); border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.badge.staff { background: #2f6fd6; color: #fff; }
.mute { padding: 0 4px; margin-left: 6px; font: 12px system-ui, sans-serif; background: #6a5a3a; border-color: #3a2a14; line-height: 18px; }
.mute.on { background: #8a2a20; }
#chatLog b.staff { color: #b8860b; }
body > #chat #chatLog b.staff { color: #f3d36b; }
#rankList { width: 100%; border-collapse: collapse; font-size: 14px; }
#rankList th, #rankList td { padding: 5px 6px; border-bottom: 1px solid #d8c69c; text-align: left; }
.endTable td.eloD.up small { color: #2f5d2a; } #endTable td.eloD.down small { color: #a01d16; }
.create button { flex: none; }

/* ---- menús por pasos (2026-11-29, Claude) ---- */
/* menú principal: crear y unirse lado a lado, salas, pie */
#menu .card { max-width: 520px; }
.menuGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.box { border: 2px solid var(--wood-light); border-radius: 4px; background: #fff8e8; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.box .listTitle { font-size: 16px; }
.box .createNote { margin: 0; }
#code { flex: none; text-align: center; }
.menuFoot { align-items: center; justify-content: space-between; }
@media (max-width: 520px) { .menuGrid { grid-template-columns: 1fr; } }

/* lobby */
.lobbyHead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.lobbyHead .share { flex: 1 1 260px; }
.count { font: 700 13px system-ui, sans-serif; color: var(--ink); opacity: .7; margin-left: 4px; }
.count.full { color: #2f5d2a; opacity: 1; }
.col h3 { display: flex; align-items: baseline; justify-content: space-between; }
.lobbyBottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings, .chatCol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.adminBtns:empty, .adminBtns:not(:has(button:not(.hidden))) { display: none; }
#chatSlot #chatLog { height: 130px; }
@media (max-width: 760px) { .lobbyBottom { grid-template-columns: 1fr; } }

/* salas grandes: listas en columnas, filas finas, sin consejos */
#lobby.big .lobbyWrap { max-width: 1240px; }
#lobby.big .card.wide { max-width: 1180px; }
#lobby.big #tips { display: none; }
#lobby.big .col ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 10px; }
#lobby.big .col li { font-size: 13px; padding: 1px 0; }
#lobby.big .col li .tick { font-size: 0; } #lobby.big .col li .tick:not(:empty)::before { content: '✔'; font-size: 13px; }
#lobby.huge .col ul { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
#lobby.huge .col li { font-size: 12px; }
#lobby.huge .col li .av { display: none; }

/* pantalla final: equipos lado a lado */
#end .card.wide { max-width: 980px; }
.endTeams { align-items: start; }
.endTeams .col.won { box-shadow: 0 0 0 3px var(--gold); }
.endTeams .col > p { margin: 2px 0 6px; }
.endScroll { max-height: 56vh; overflow-y: auto; }
.endTable { font-size: 13px; }
.endTable th { position: sticky; top: 0; background: #fff8e8; }
.endTable td.who { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endTable tr.me td { background: #f3e3b0; }
.endTable td:first-child { border-left: 0 !important; }
#reconnecting { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: #8a2a20e6; color: #fff; padding: 8px 16px; border-radius: 4px; border: 2px solid var(--gold); font-family: var(--serif); z-index: 30; }

/* chat en partida: siempre muestra lo último, sin barra de scroll encima del mapa */
body > #chat { bottom: calc(var(--panelH, 84px) + 12px); }
body > #chat #chatLog { overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; }
body > #chat #chatLog::-webkit-scrollbar { display: none; }
/* chat del lobby: barra fina con los colores del juego */
#chatSlot #chatLog { scrollbar-width: thin; scrollbar-color: var(--wood-light) transparent; }
#chatSlot #chatLog::-webkit-scrollbar { width: 6px; }
#chatSlot #chatLog::-webkit-scrollbar-thumb { background: var(--wood-light); border-radius: 3px; }
body > #chat { width: min(380px, calc(50vw - 180px)); min-width: 200px; }

/* menú de pausa (Esc) */
#pause { z-index: 40; background: rgba(20, 12, 5, .6); }
.pauseCard { max-width: 340px; text-align: center; }
.pauseCard button { width: 100%; }
button.danger { background: #8a2a20; border-color: #5a1810; }
button.danger:hover { background: #a83226; }
#menuBtn { position: fixed; top: 8px; left: 8px; z-index: 20; width: 36px; height: 36px; padding: 0; border-radius: 50%; font: 18px system-ui, sans-serif; background: rgba(58, 38, 20, .85); border-color: var(--gold); }

/* capitán y voz */
.cap { margin-left: 3px; }
#voiceInd { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 25; background: rgba(28, 20, 12, .9); border: 2px solid var(--gold); color: var(--parchment); border-radius: 18px; padding: 5px 14px; font: 600 14px var(--serif); pointer-events: none; animation: tipIn .2s ease-out; }
#voiceInd.mine { border-color: #7dff8a; color: #c9ffd0; }
#pttBtn { position: fixed; left: 8px; top: 52px; z-index: 20; width: 44px; height: 44px; padding: 0; border-radius: 50%; font: 20px system-ui, sans-serif; background: rgba(58, 38, 20, .9); border-color: var(--gold); touch-action: none; user-select: none; }
#pttBtn:active { background: #2f5d2a; border-color: #7dff8a; }

/* ---- sala ordenada por bloques (2026-11-29) ---- */
.lobbyCard { gap: 14px; }
.captains { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: linear-gradient(#3a2614, #2a1c0e); border: 2px solid var(--gold); border-radius: 6px; padding: 10px 12px; color: var(--parchment); }
.capBox { background: rgba(255, 255, 255, .06); border-radius: 4px; padding: 8px 10px; border-left: 5px solid; }
.capBox.A { border-color: var(--blue); } .capBox.B { border-color: var(--red); }
.capLabel { font: 800 13px system-ui, sans-serif; letter-spacing: .14em; color: var(--gold); }
.capName { font: 700 22px var(--serif); margin-top: 2px; min-height: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capBox.A .capName { color: #8db4ff; } .capBox.B .capName { color: #ff9a92; }
.capName.me::after { content: ' (vos)'; font: 600 13px system-ui, sans-serif; color: #c9ffd0; }
.capNote { grid-column: 1 / -1; margin: 0; font-size: 13px; opacity: .85; }
.block { border: 2px solid var(--wood-light); border-radius: 6px; background: rgba(255, 248, 232, .55); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.block .teams .col { background: #fff8e8; }
.blockTitle { font-size: 18px; color: var(--wood-dark); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.subTitle { font: 700 12px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--wood); margin: 4px 0 4px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.form label { font-size: 13px; gap: 3px; }
.form label.wideField { grid-column: 1 / -1; }
.form label.wideField .row { flex-wrap: nowrap; }
.form label.wideField input { flex: 1; text-transform: uppercase; letter-spacing: .1em; }
.form select { width: 100%; }
.form .check { grid-column: 1 / -1; font-size: 14px; }
#roomPw { flex: 1; }
.playerBtns button { flex: 1 1 auto; }
button.ghost { background: transparent; color: var(--wood-dark); }
button.ghost:hover { background: rgba(90, 61, 34, .15); }
.lobbyBottom { align-items: start; }
#status { padding: 6px 10px; border-radius: 4px; background: rgba(47, 93, 42, .12); border-left: 4px solid #2f5d2a; }
#status:empty { display: none; }
@media (max-width: 760px) { .captains, .form { grid-template-columns: 1fr; } }

/* capitán: cuadro propio arriba de cada equipo */
.col .capBox { margin: 6px 0 8px; background: linear-gradient(#3a2614, #2a1c0e); border: 2px solid var(--gold); border-left-width: 6px; border-radius: 5px; padding: 6px 10px; color: var(--parchment); }
.col.A .capBox { border-left-color: var(--blue); } .col.B .capBox { border-left-color: var(--red); }
.col .capName { font-size: 19px; }
.capNote { margin: 0; }

/* filas de jugadores: los humanos ocupan todo el ancho (iconos con aire), los bots van en columnas */
#lobby.big .col li.human { grid-column: 1 / -1; font-size: 14px; padding: 4px 0; gap: 6px; }
#lobby.huge .col li.human { font-size: 14px; }
#lobby.huge .col li.human .av { display: inline-block; }
.col li.human .who { overflow: visible; white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.col li .kick, .col li .mute, .col li .give, .col li .capGive { flex: none; }
.capGive { padding: 0 5px; margin-left: 6px; font: 12px system-ui, sans-serif; background: #3a2614; border-color: var(--gold); line-height: 18px; }
.capGive:hover { background: #5a3d22; }

/* recursos del equipo (arriba a la izquierda del marcador) */
#resBar { position: absolute; top: 0; left: 56px; display: flex; gap: 14px; align-items: center; background: var(--wood-dark); border: 3px solid var(--wood-light); border-top: 0; border-radius: 0 0 8px 8px; padding: 4px 14px; font: 700 18px var(--serif); color: var(--parchment); pointer-events: auto; }
#resBar .res { display: inline-flex; align-items: center; gap: 6px; min-width: 64px; }
#resBar img { width: 28px; height: 28px; filter: drop-shadow(0 1px 2px #000a); }
@media (max-width: 700px) { #resBar { left: 52px; gap: 8px; padding: 3px 8px; font-size: 15px; } #resBar img { width: 22px; height: 22px; } }

/* herrería: arriba, entre los recursos y el marcador */
#smithy { display: flex; gap: 6px; padding-left: 12px; margin-left: 2px; border-left: 2px solid var(--wood-light); }
#smithy .tech { position: relative; width: 46px; height: 46px; padding: 2px; border-radius: 6px; background: #2a1c0e; border: 2px solid #5a4a30; cursor: default; overflow: hidden; }
#smithy .tech img { width: 100%; height: 100%; display: block; opacity: .45; filter: grayscale(.6); }
#smithy .tech.mine { border-color: #8a7550; }
#smithy .tech.buy { cursor: pointer; border-color: var(--gold); }
#smithy .tech.buy img { opacity: 1; filter: none; }
#smithy .tech.buy:hover { background: #4a341c; transform: translateY(1px); }
#smithy .tech.done { border-color: #5fbf5a; }
#smithy .tech.done img { opacity: 1; filter: none; }
#smithy .tech.busy img { opacity: .9; filter: none; }
#smithy .prog { position: absolute; left: 0; right: 0; top: 0; background: rgba(0, 0, 0, .55); pointer-events: none; }
#smithy .secs { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 800 16px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 3px #000; }
#smithy .ok { position: absolute; right: 2px; bottom: 0; font: 800 13px system-ui, sans-serif; color: #7dff8a; text-shadow: 0 1px 2px #000; }
#smithy .cost { position: absolute; left: 0; right: 0; bottom: 0; font: 700 9px system-ui, sans-serif; color: #fff; background: rgba(0, 0, 0, .6); text-align: center; line-height: 12px; }
#stats { font-size: 13px; margin-top: 1px; }
#stats b { color: #fff; }
#stats .up { color: #7dff8a; font-weight: 700; }
@media (max-width: 900px) { #resBar { flex-wrap: wrap; max-width: calc(100vw - 70px); } #smithy .tech { width: 36px; height: 36px; } }
/* si no entra al lado del marcador, la barra de recursos y herrería baja un poco */
@media (max-width: 1180px) { #resBar { top: 44px; border-top: 3px solid var(--wood-light); border-radius: 8px; } }

/* tarjeta de stats de una unidad */
#inspect { position: fixed; top: 52px; right: 8px; z-index: 22; width: 250px; background: linear-gradient(#f4e8cc, #e4d2a8); color: var(--ink); border: 4px solid var(--wood); border-radius: 6px; box-shadow: 0 0 0 2px var(--gold), 0 12px 30px #000a; padding: 10px 12px; font-size: 13px; animation: tipIn .2s ease-out; }
#inspect .iClose { position: absolute; top: 4px; right: 4px; padding: 0 6px; font: 700 12px/18px system-ui, sans-serif; }
.iHead { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.iHead img { width: 48px; height: 48px; border-radius: 4px; border: 2px solid var(--wood); }
.iName { font: 700 17px var(--serif); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iName.A { color: var(--blue); } .iName.B { color: var(--red); }
.iSub { font-size: 12px; opacity: .8; }
.iBar { position: relative; height: 14px; background: #1a0f06; border: 1px solid #000; border-radius: 2px; margin-bottom: 8px; }
.iBar div { height: 100%; background: #3ca33a; }
.iBar span { position: absolute; inset: 0; text-align: center; font: 700 10px/14px system-ui, sans-serif; color: #fff; }
.iGrid { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; }
.iGrid b { text-align: right; }
.iGrid i { color: #2f8a2a; font-style: normal; font-weight: 700; }
.iUps { margin-top: 8px; font-size: 12px; color: #5a3d22; }
.iWarn { margin-top: 6px; font-weight: 700; color: #a01d16; }
.iGood { margin-top: 6px; font-weight: 700; color: #2f5d2a; }

/* Tutorial en video (menú principal) */
.tutBtn { display: block; margin: 4px auto 10px; padding: 6px 18px; background: #2f5d2a; color: #fff; }
.tutCard { width: min(1000px, 96vw); max-width: none; }
.tutCard iframe { border: 0;  display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; margin: 8px 0 12px; }
.tutCard .buttons { align-items: center; }
