/* Trukeados
   Tipografía: Archivo (Omnibus-Type, Buenos Aires; Google Fonts, licencia OFL). Una sola familia:
   ancho normal para textos y botones, angosta (font-stretch) para rótulos.
   Paleta: grises neutros + los cuatro colores básicos de la baraja (espada azul, basto verde,
   oro amarillo, copa rojo). TODO color y tamaño base está en :root; la escena 3D usa js/theme.js. */

:root {
  /* grises */
  --bg: #121212;
  --surface: #1c1c1c;
  --surface-2: #262626;
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.24);
  --text: #f5f5f5;
  --text-hi: #ffffff;
  --text-dim: #b3b3b3;
  --muted: #808080;
  --text-on-light: #121212;
  /* los cuatro palos */
  --blue: #2f6fd6; /* espada */
  --green: #2e9e57; /* basto */
  --yellow: #f2c12e; /* oro */
  --red: #d93b30; /* copa */
  /* usos */
  --accent: var(--yellow);
  --accent-ink: #121212;
  --team0: #5b93e8;
  --team1: #ef6a5c;
  --panel: rgba(18, 18, 18, 0.9);
  --panel-soft: rgba(18, 18, 18, 0.72);
  --panel-hover: rgba(38, 38, 38, 0.96);
  --hover-tint: rgba(255, 255, 255, 0.08);
  --good-line: var(--green);
  --good-ink: #8fe0aa;
  --good-bg: rgba(46, 158, 87, 0.25);
  --bad-line: var(--red);
  --bad-ink: #ffb3ad;
  --bad-bg: rgba(217, 59, 48, 0.25);
  --offline: #ff8a80;
  --face-bg: #262626;
  --shade: rgba(0, 0, 0, 0.72);
  --shade-strong: rgba(8, 8, 8, 0.88);
  --glow: #1d2b22;
  /* tamaños de los botones (grandes para tocar fácil) */
  --btn-font: 17px;
  --btn-pad: 12px 20px;
  --btn-min-h: 46px;
  --btn-call-font: 22px;
  --panel-w: clamp(300px, 30vw, 380px);
  /* tipografía */
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --narrow: 78%;
  /* esquinas suaves (sala de espera) */
  --radius-soft: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
code { font-family: ui-monospace, monospace; background: rgba(0, 0, 0, 0.33); padding: 1px 5px; border-radius: 2px; font-size: 12px; }
kbd { font-family: var(--font); font-stretch: var(--narrow); font-size: 11px; font-weight: 700; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; line-height: 16px; display: inline-block; color: var(--text-dim); }
.screen { position: fixed; inset: 0; }

/* ---------- botones ---------- */
.btn {
  font-family: var(--font); font-stretch: var(--narrow);
  font-weight: 600;
  font-size: var(--btn-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  padding: var(--btn-pad);
  min-height: var(--btn-min-h);
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.1;
}
.btn:hover { border-color: var(--text-dim); background: var(--panel-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--text-hi); }
.btn.good { border-color: var(--good-line); color: var(--good-ink); }
.btn.good:hover { background: var(--good-bg); }
.btn.danger { border-color: var(--bad-line); color: var(--bad-ink); }
.btn.danger:hover { background: var(--bad-bg); }
/* cantos: tipografía de imprenta, sin mayúsculas, con raya de latón abajo */
.btn.call {
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--btn-call-font);
  letter-spacing: 0;
  text-transform: none;
  padding: 9px 24px 10px;
  border-color: var(--line-2);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.btn.call:hover { color: var(--text-hi); box-shadow: inset 0 -3px 0 var(--accent); }
.btn.big { padding: 15px 26px; font-size: 19px; min-height: 54px; }
.btn.small { padding: 7px 13px; font-size: 14px; min-height: 36px; }
.btn.ghost { background: var(--panel-soft); border-color: var(--line); }

/* ---------- menú ---------- */
/* una sola tarjeta, con el mismo idioma que la sala de espera; entra en pantalla sin scroll */
#menu { overflow-y: auto; scrollbar-width: none; display: flex; padding: 24px 16px; background: radial-gradient(ellipse at 50% -20%, var(--glow) 0%, transparent 60%), var(--bg); }
#menu::-webkit-scrollbar { display: none; }
.m-wrap { width: min(600px, 100%); margin: auto; display: flex; flex-direction: column; gap: 16px; }
.m-head h1 { font-family: var(--font); font-weight: 700; font-size: clamp(38px, 6vw, 58px); margin: 0; letter-spacing: -0.5px; line-height: 1; }
.m-head h1 span { font-weight: 400; color: var(--accent); }
.tag { color: var(--text-dim); margin: 6px 0 0; font-size: 16px; }
.m-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-soft); padding: 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.m-card h3 { margin: 0 0 8px 2px; font-stretch: var(--narrow); font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); }
.m-card h3 small { text-transform: none; letter-spacing: 0; font-stretch: 100%; font-size: 13px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
/* tu nombre, con tu inicial como en la mesa */
.m-name { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 8px; border-radius: var(--radius-soft); background: var(--surface-2); border: 1px solid transparent; }
.m-name:focus-within { border-color: var(--accent); }
.m-name .w-av { width: 36px; height: 36px; background: var(--accent); color: var(--accent-ink); font-size: 17px; }
#name { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 17px; padding: 8px 0; }
/* lo principal: armar una mesa o entrar con un código */
.m-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-create { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left; white-space: normal; border-radius: var(--radius-soft); padding: 14px 18px; }
.m-create small { text-transform: none; letter-spacing: 0; font-stretch: 100%; font-weight: 400; font-size: 13px; line-height: 1.3; opacity: 0.7; }
.m-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-content: center; padding: 10px; border-radius: var(--radius-soft); border: 1px dashed var(--line-2); }
#join-code { min-width: 0; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-soft); padding: 6px 10px; text-align: center; font-family: ui-monospace, monospace; font-size: 30px; font-weight: 700; letter-spacing: 0.3em; color: var(--accent); }
#join-code:focus { border-color: var(--accent); outline: 0; }
#join-code::placeholder { color: var(--muted); }
.m-join .btn { border-radius: var(--radius-soft); padding: 8px 16px; }
.m-join small { grid-column: 1 / -1; text-align: center; color: var(--text-dim); font-size: 13px; }
/* partida rápida y práctica: la misma fila de modos, una al lado de la otra */
.m-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.m-pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.m-pills button { padding: 10px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: none; color: var(--text); font-stretch: var(--narrow); font-weight: 600; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.m-pills button:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
/* mesas públicas: pocas y en filas, solo si hay */
.m-public { padding-top: 14px; border-top: 1px solid var(--line); }
.m-tables { display: flex; flex-direction: column; gap: 6px; }
.m-table { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 12px; border-radius: var(--radius-soft); background: var(--surface-2); }
.m-tmode { flex: none; font-stretch: var(--narrow); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); font-size: 14px; }
.m-tinfo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-tinfo b { font-weight: 600; }
.m-tinfo small { margin-left: 8px; color: var(--text-dim); font-size: 13px; }
.m-table .btn { border-radius: 999px; }
.credits { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.4; }
@media (max-width: 560px) {
  #menu { padding: 16px; }
  .m-wrap { gap: 12px; }
  .m-card { padding: 14px; gap: 14px; }
  .m-main, .m-modes { grid-template-columns: 1fr; }
  .m-modes { gap: 12px; }
  .m-create { padding: 12px 16px; min-height: 0; }
  .m-head h1 { font-size: 40px; }
  .tag { font-size: 14px; margin-top: 4px; }
  .m-card h3 { margin-bottom: 6px; }
  .m-join { padding: 8px; }
  .m-join small { display: none; }
  #join-code { font-size: 26px; }
  .m-pills button { padding: 8px 4px; }
  .m-tinfo small { display: block; margin-left: 0; }
}
@media (max-height: 640px) {
  #menu { padding-top: 14px; padding-bottom: 14px; }
  .m-wrap { gap: 10px; }
  .m-head h1 { font-size: 36px; }
  .tag { display: none; }
  .m-card { gap: 12px; padding: 14px 16px; }
  .m-modes, .m-public { padding-top: 10px; }
  .m-join small { display: none; }
  .m-pills button { padding: 8px 4px; }
}
#chat-input {
  font-family: var(--font); text-transform: none; letter-spacing: 0;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--text); padding: 10px 12px; border-radius: 3px; font-size: 16px; outline: none; min-width: 0;
}
#chat-input:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.seg button { flex: 1; background: none; border: 0; border-right: 1px solid var(--line); color: var(--text-dim); padding: 11px 12px; cursor: pointer; font-family: var(--font); font-stretch: var(--narrow); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; font-size: 15px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--bg); }

/* ---------- partida ---------- */
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag3d { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: opacity 0.2s; }
.nameplate { font-family: var(--font); font-stretch: var(--narrow); font-weight: 600; font-size: 16px; letter-spacing: 0.04em; background: var(--panel); border-left: 3px solid var(--line-2); padding: 3px 10px 3px 8px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.nameplate:empty { display: none; }
.nameplate.t0 { border-left-color: var(--team0); }
.nameplate.t1 { border-left-color: var(--team1); }
.nameplate.turn { background: var(--text); color: var(--bg); }
.nameplate .chip { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.nameplate.turn .chip { color: var(--muted); }
.nameplate .chip.eye { color: var(--accent); }
.nameplate .off { color: var(--offline); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
/* globos de los cantos: papelito marfil, letra de imprenta en cursiva */
.bubble { background: var(--text); color: var(--text-on-light); font-family: var(--font); font-weight: 700; padding: 5px 14px 6px; border-radius: 2px; font-size: 19px; position: relative; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); animation: pop 0.18s ease-out; max-width: 260px; text-align: center; }
.bubble::after { content: ''; position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: var(--text); border-bottom: 0; }
.bubble.call { font-size: 23px; }
.bubble.chat { font-family: var(--font); font-weight: 500; font-size: 14px; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }

#topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 6px; align-items: center; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); pointer-events: none; }
#topbar > * { pointer-events: auto; }
#topbar .spacer { flex: 1; pointer-events: none; }
.code-chip { background: var(--panel); border: 1px solid var(--line-2); border-radius: 3px; padding: 5px 10px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.code-chip span { font-family: var(--font); font-stretch: var(--narrow); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.code-chip b { font-family: ui-monospace, monospace; letter-spacing: 0.25em; font-size: 15px; color: var(--text); }
#zoom-btn kbd { margin-left: 2px; }
.badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 2px; }

#anotador { position: absolute; left: 12px; top: 60px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px 6px; color: var(--text); min-width: 100px; z-index: 2; }
.an-head, .an-foot { display: grid; grid-template-columns: 1fr 1fr; text-align: center; gap: 6px; }
.an-head span { font-family: var(--font); font-stretch: var(--narrow); font-weight: 600; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); padding-bottom: 5px; border-bottom: 1px solid var(--line-2); }
.an-body { display: flex; justify-content: center; gap: 6px; padding-top: 6px; }
.an-sep { width: 1px; background: var(--line-2); }
.an-foot { margin-top: 2px; border-top: 1px solid var(--line-2); padding-top: 4px; font-family: var(--font); font-weight: 700; font-size: 19px; }
.an-muestra { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.an-muestra small { font-stretch: var(--narrow); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.an-muestra img { width: 46px; border-radius: 3px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.an-foot small { grid-column: 1 / -1; font-family: var(--font); font-stretch: var(--narrow); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

#status-line { font-family: var(--font); font-stretch: var(--narrow); font-weight: 700; font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); padding-bottom: 8px; border-bottom: 1px solid var(--line-2); line-height: 1.25; }
#status-line:empty { display: none; }
#status-line.mine { color: var(--text); border-bottom: 2px solid var(--accent); }

#look-bar { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 2; display: flex; flex-direction: row; align-items: center; gap: 2px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 3px; padding: 6px; }
#look-bar:empty { display: none; }
#look-bar .lbl { font-family: var(--font); font-stretch: var(--narrow); font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; padding: 0 6px; white-space: nowrap; }
#look-bar .btn { flex-direction: column; gap: 0; border: 0; background: none; font-size: 14px; padding: 4px 10px; min-height: 38px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0.02em; }
#look-bar .btn:hover { background: var(--hover-tint); }
#look-bar .btn.on { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
#look-bar small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; display: block; line-height: 1.2; }
#look-bar small .pie { color: var(--accent); font-weight: 700; }

/* Abajo a la izquierda: señas y trampa. Abajo a la derecha: el panel con el estado y las acciones.
   El centro de abajo queda libre: ahí está tu mano. */
#tools { position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 3; }
#panel {
  position: absolute; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 3;
  width: var(--panel-w);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
#actions { display: flex; flex-direction: column; gap: 10px; }
#actions:empty { display: none; }
#actions.busy .act-group, #panel.busy #card-actions { opacity: 0.55; }
.act-group, #card-actions { display: flex; flex-direction: column; gap: 5px; }
.act-group .lbl, #card-actions .lbl { font-family: var(--font); font-stretch: var(--narrow); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
/* botones en grilla: nunca se pisan, se acomodan en filas parejas */
/* grilla fija: 2 por fila (los cantos quedan 2×2); la carta elegida, 3 en una fila. Nunca se pisan ni scrollean. */
.act-group .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#card-actions .btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.act-group .btn:only-child, #card-actions [data-play="burn"] { grid-column: 1 / -1; }
#panel .btn { min-height: 44px; padding: 8px 10px; font-size: 15px; letter-spacing: 0.04em; line-height: 1.15; }
#panel .btn.call { font-size: 19px; padding: 6px 10px; }
.act-group .btn, #card-actions .btn { width: 100%; white-space: normal; text-align: center; }
#status-line small { display: block; margin-top: 5px; font-size: 13px; font-weight: 500; font-stretch: 100%; text-transform: none; letter-spacing: 0; color: var(--muted); line-height: 1.35; }
/* "Cantar otro número": elegís con − / + (salta los números que no existen en el envido) */
.lie { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.lie-q { grid-column: 1 / -1; color: var(--text-dim); font-size: 14px; }
.lie .lie-step { width: 44px; font-size: 22px; padding: 4px 0; }
.lie-v { text-align: center; font-size: 26px; font-weight: 700; color: var(--accent); }
.lie .lie-go { grid-column: 1 / 3; }
.lie .lie-back { grid-column: 3; width: auto; }

.dropdown { position: relative; }
.dropdown .menu { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 3px; padding: 4px; min-width: 270px; max-height: 60vh; overflow-y: auto; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); z-index: 5; }
.menu .item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: 2px; cursor: pointer; font-size: 16px; }
.menu .item:hover { background: var(--hover-tint); }
.menu .item b { font-weight: 600; }
.menu .item small { display: block; color: var(--muted); font-size: 13px; }
.menu .item canvas { width: 52px; height: 52px; border-radius: 2px; background: var(--face-bg); flex: none; }
.menu .tip { font-size: 12px; line-height: 1.45; color: var(--text-dim); padding: 8px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .tip b { color: var(--text); }

#mirror { position: absolute; left: 12px; bottom: 80px; z-index: 3; width: 110px; height: 110px; background: var(--face-bg); border: 1px solid var(--line-2); border-radius: 3px; }

#chat { position: absolute; right: 12px; top: 56px; bottom: 96px; width: min(340px, calc(100vw - 24px)); background: var(--panel-hover); border: 1px solid var(--line-2); border-radius: 3px; display: flex; flex-direction: column; z-index: 5; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-family: var(--font); font-stretch: var(--narrow); text-transform: uppercase; letter-spacing: 0.1em; font-size: 13px; }
#chat-log { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; font-size: 14px; line-height: 1.4; }
#chat-log .sys { color: var(--muted); font-size: 13px; }
#chat-log b { font-weight: 600; }
#chat-log b.t0 { color: var(--team0); }
#chat-log b.t1 { color: var(--team1); }
#quick-phrases { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); }
#quick-phrases button { font-size: 14px; padding: 6px 10px; border-radius: 2px; background: none; border: 1px solid var(--line); cursor: pointer; }
#quick-phrases button:hover { border-color: var(--text-dim); }
#chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
#chat-input { flex: 1; font-size: 14px; padding: 7px 10px; }

.overlay { position: absolute; inset: 0; background: var(--shade); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 6; }
.card-box { background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; padding: 22px; width: min(620px, 100%); max-height: 100%; overflow-y: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7); }
.card-box h2 { font-family: var(--font); font-weight: 700; margin: 0 0 4px; font-size: 28px; }
/* sala de espera: una tarjeta cálida que entra entera en pantalla (sin scroll) */
#waiting { background: var(--shade-strong); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* con la sala de espera abierta, los avisos van abajo para no taparla */
.screen:has(#waiting:not(.hidden)) #toast-area { top: auto; bottom: 16px; }
#waiting .w-box { width: min(560px, 100%); padding: 20px 22px 18px; border-radius: var(--radius-soft); overflow-x: hidden; scrollbar-width: none; display: flex; flex-direction: column; gap: 16px; }
#waiting .w-box::-webkit-scrollbar { display: none; }
.w-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.w-head h2 { font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.w-head .muted { font-size: 15px; color: var(--text-dim); margin-top: 4px; }
.w-exit { flex: none; background: none; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text-dim); font-size: 14px; padding: 6px 14px; cursor: pointer; }
.w-exit:hover { color: var(--text); border-color: var(--text-dim); }
/* el código es lo más grande: se dicta o se tipea en un toque */
.w-invite { display: flex; align-items: stretch; gap: 10px; }
.w-code { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px 10px; border-radius: var(--radius-soft); border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--accent); cursor: pointer; }
.w-code:hover { border-color: var(--accent); }
.w-code small { color: var(--text-dim); font-size: 13px; }
.w-code b { font-family: ui-monospace, monospace; font-size: 44px; line-height: 1; letter-spacing: 0.28em; margin-right: -0.28em; }
.w-share { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.w-share .btn { border-radius: 999px; }
.w-teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.w-vs { color: var(--muted); font-stretch: var(--narrow); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.w-team { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.w-team h3 { margin: 0 0 2px 4px; font-stretch: var(--narrow); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.w-team.t0 h3 { color: var(--team0); }
.w-team.t1 h3 { color: var(--team1); }
.w-seat { --tc: var(--team0); display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px; border-radius: var(--radius-soft); background: var(--surface-2); min-width: 0; border: 1px solid transparent; transition: border-color 0.12s, background 0.12s; }
.w-team.t1 .w-seat { --tc: var(--team1); }
.w-seat.me { border-color: var(--accent); }
.w-seat.off { opacity: 0.55; }
.w-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--tc); color: var(--text-hi); }
.w-nm { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-nm small { display: block; font-weight: 400; font-size: 13px; color: var(--text-dim); }
.w-seat.me .w-nm { color: var(--accent); }
.w-seat.free { background: none; border: 1px dashed var(--line-2); padding: 0 6px 0 0; }
.w-sit { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; align-self: stretch; padding: 6px 8px; background: none; border: 0; border-radius: var(--radius-soft); color: var(--text-dim); cursor: pointer; text-align: left; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-sit .w-av { background: none; border: 1px dashed var(--line-2); color: var(--muted); font-weight: 400; }
.w-sit:hover { color: var(--text); }
.w-sit:hover .w-av { border-color: var(--tc); color: var(--tc); }
.w-mini { flex: none; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--text-dim); font-size: 13px; padding: 5px 10px; cursor: pointer; }
.w-mini:hover { color: var(--text); border-color: var(--text-dim); }
/* arrastrar para cambiar de lugar (solo el anfitrión) */
.w-seat.drag { cursor: grab; touch-action: none; user-select: none; }
.w-grip { flex: none; width: 10px; margin-right: -4px; color: var(--muted); font-size: 16px; line-height: 1; }
.w-seat.drag:hover .w-grip { color: var(--text); }
#waiting.dragging, #waiting.dragging * { cursor: grabbing; }
#waiting.dragging .w-seat { border-style: dashed; border-color: var(--line-2); }
.w-seat.over { border: 1px solid var(--tc) !important; background: var(--hover-tint); }
.w-ghost { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; opacity: 0.92; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); background: var(--surface-2); }
.w-settings { display: flex; flex-direction: column; gap: 12px; }
.w-settings h3 { margin: 0; font-stretch: var(--narrow); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); }
.w-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.w-settings .seg { border-radius: var(--radius-soft); }
.w-settings .seg button { padding: 9px 8px; font-size: 14px; }
.w-pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.w-pills.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.w-pill { position: relative; cursor: pointer; }
.w-pill input { position: absolute; opacity: 0; pointer-events: none; }
.w-pill span { display: block; text-align: center; padding: 9px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-dim); font-size: 15px; line-height: 1.2; }
.w-pill span::before { content: '+ '; color: var(--muted); }
.w-pill:hover span { border-color: var(--text-dim); color: var(--text); }
.w-pill input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.w-pill input:checked + span::before { content: '✓ '; color: inherit; }
.w-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.w-foot { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.w-actions { display: flex; gap: 10px; }
.w-rules { flex: none; border-radius: var(--radius-soft); }
.w-rules.on { border-color: var(--text-dim); }
.w-start { flex: 1; min-width: 0; border-radius: var(--radius-soft); }
.w-note { margin: 0; text-align: center; color: var(--text-dim); font-size: 14px; }
@media (max-width: 520px) {
  #waiting .w-box { padding: 16px 16px 14px; gap: 12px; }
  .w-teams { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .w-vs { text-align: center; line-height: 1; }
  .w-team { gap: 5px; }
  .w-team h3 { margin-bottom: 0; }
  .w-seat { min-height: 42px; padding: 4px 8px; }
  .w-av { width: 28px; height: 28px; }
  .w-nm small { display: inline; margin-left: 6px; }
  .w-head h2 { font-size: 21px; }
  .w-foot .btn.big { font-size: 16px; padding: 10px 14px; letter-spacing: 0.03em; }
  .w-start { white-space: normal; }
  .w-code b { font-size: 38px; }
}
/* pantallas bajas: todo más apretado para que no haga falta scrollear */
@media (max-height: 640px) {
  #waiting { padding-top: 10px; padding-bottom: 10px; }
  #waiting .w-box { gap: 10px; padding-top: 14px; padding-bottom: 12px; }
  .w-head h2 { font-size: 20px; }
  .w-head .muted { font-size: 14px; margin-top: 2px; }
  .w-code { padding: 4px 10px 6px; }
  .w-code b { font-size: 32px; }
  .w-seat { min-height: 40px; padding: 3px 8px; }
  .w-av { width: 28px; height: 28px; }
  .w-nm small { display: inline; margin-left: 6px; }
  .w-foot { padding-top: 10px; }
  .w-foot .btn.big { min-height: 46px; padding: 10px 18px; font-size: 17px; }
}
@media (max-height: 520px) {
  .w-code small { display: none; }
  .w-team h3 { margin-bottom: 0; }
  .w-seat { min-height: 36px; }
}

/* nombre de la carta de la mesa bajo el mouse */
#card-tip { position: fixed; z-index: 8; transform: translate(14px, -130%); pointer-events: none; padding: 5px 10px; border-radius: var(--radius-soft); background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
#card-tip.hidden { display: none; }
#toast-area { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 7; width: min(520px, 92vw); }
.toast { background: var(--panel-hover); border: 1px solid var(--line-2); border-left: 3px solid var(--text-dim); padding: 8px 14px; border-radius: 2px; font-size: 14px; animation: pop 0.18s; text-align: left; line-height: 1.4; width: 100%; }
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast img { height: 66px; border-radius: 3px; margin: 6px 4px 0 0; vertical-align: middle; }

#result { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--shade); z-index: 8; padding: 16px; }
#result .card-box { text-align: center; }
#result .final { font-size: 56px; font-weight: 700; font-family: var(--font); margin: 8px 0 16px; }

#help .card-box { width: min(720px, 100%); }
#help h3 { font-family: var(--font); font-stretch: var(--narrow); text-transform: uppercase; letter-spacing: 0.1em; font-size: 13px; margin: 18px 0 6px; color: var(--accent); }
#help ul { padding-left: 18px; margin: 0; }
#help li { margin: 4px 0; color: var(--text-dim); line-height: 1.45; }
#help li b { color: var(--text); }
.help-ok { margin-top: 20px; display: flex; justify-content: flex-end; }
.help-ok .btn { min-width: 160px; }

@media (max-width: 1150px) { #look-bar .lbl { display: none; } #look-bar .btn { padding: 4px 7px; } }
@media (max-width: 1000px) { #look-bar { display: none; } }

@media (max-width: 760px) {
  #look-bar { display: none; }
  #panel { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; padding: 8px 10px; gap: 6px; }
  #status-line small, .act-group .lbl, #card-actions .lbl { display: none; }
  #panel .btn { min-height: 40px; padding: 6px 8px; font-size: 14px; }
  #panel .btn.call { font-size: 17px; padding: 4px 8px; }
  /* en celular todos los botones en una sola grilla de 4 columnas: el panel queda bajo y la mano no tapa las caras */
  #actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .act-group, .act-group .btns { display: contents; }
  .act-group .btn:only-child { grid-column: auto; }
  .lie { grid-column: 1 / -1; } /* el selector de "Cantar otro número" ocupa todo el ancho */
  #tools { left: 8px; bottom: auto; top: 52px; }
  #tools .btn { min-height: 36px; padding: 7px 11px; font-size: 14px; }
  #tools .dropdown .menu { bottom: auto; top: calc(100% + 6px); }
  .code-chip span { display: none; }
  #topbar { gap: 4px; padding-left: 8px; padding-right: 8px; }
  #topbar .btn.small { padding: 6px 9px; }
  :root { --btn-font: 16px; --btn-pad: 11px 16px; --btn-call-font: 20px; }
  #zoom-btn kbd { display: none; }
  #anotador { left: auto; top: 50px; right: 8px; transform: scale(0.8); transform-origin: top right; }
  #status-line { font-size: 15px; padding-bottom: 6px; }
  #mirror { width: 80px; height: 80px; bottom: auto; top: 100px; }
}
