:root {
  --brand: #0f8f7a;
  --brand-dark: #0b6e5e;
  --bg: #f0f2f5;
  --panel: #ffffff;
  --text: #1f2a30;
  --muted: #667781;
  --line: #e7eaec;
  --mine: #d9fdd3;
  --theirs: #ffffff;
  --chat-bg: #efeae2;
  --accent: #ff7a59;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { height: 100dvh; overflow: hidden; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }

/* ---------- login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #13b497 0%, #0f8f7a 45%, #0b5f8f 100%); }
.login-box { width: min(360px, 100%); background: #fff; padding: 32px 26px; border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.logo { font-size: 56px; line-height: 1; }
.login-box h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: -.5px; }
.sub { margin: 0 0 8px; color: var(--muted); }
.login-box input { font-size: 18px; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line); outline: none; }
.login-box input:focus { border-color: var(--brand); }
#lp { letter-spacing: 6px; text-align: center; }
.primary { background: var(--brand); color: #fff; border: 0; padding: 14px; border-radius: 12px; font-size: 18px; font-weight: 600; }
.primary:hover { background: var(--brand-dark); }
.err { color: #c92a2a; min-height: 1.2em; margin: 0; }

/* ---------- layout ---------- */
.app { display: flex; height: 100%; max-width: 1400px; margin: 0 auto; background: var(--panel); }
#sidebar { width: 380px; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: relative; background: var(--panel); }
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg);
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; position: relative; }
#chat .placeholder { display: none; }
#chat.empty > *:not(.placeholder) { display: none; }
#chat.empty .placeholder { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }

.bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 60px;
  background: var(--brand); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.bar b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title { display: flex; flex-direction: column; line-height: 1.2; }
.bar .title small { opacity: .85; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { background: transparent; border: 0; color: inherit; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.icon:hover { background: rgba(255,255,255,.15); }
.back { display: none; }

.banner { padding: 9px 14px; font-size: 14px; background: #e7f5ff; color: #1c4f7a; border-bottom: 1px solid var(--line); }
.banner.warn { background: #fff4e6; color: #a5570c; }

/* ---------- listas ---------- */
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.list li:hover { background: #f5f6f6; }
.list li.active { background: #e9edef; }
.list li.hint { cursor: default; color: var(--muted); justify-content: center; text-align: center; padding: 30px 20px; border: 0; }
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.row small { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.row small.hot { color: var(--brand); font-weight: 600; }
.preview { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--brand); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 7px;
  font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }

.avatar { width: 50px; height: 50px; border-radius: 50%; background: #e6f6f2; display: grid; place-items: center;
  font-size: 28px; flex-shrink: 0; position: relative; }
.avatar.sm { width: 40px; height: 40px; font-size: 22px; background: rgba(255,255,255,.9); }
.avatar .dot { position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; background: #2fd36b; border: 2px solid #fff; border-radius: 50%; }

.panel { position: absolute; inset: 0; background: var(--panel); display: flex; flex-direction: column; z-index: 5; }

/* ---------- mensajes ---------- */
#messages { flex: 1; overflow-y: auto; padding: 12px 6% 8px; display: flex; flex-direction: column; gap: 2px; }
#messages .hint { margin: auto; color: var(--muted); background: rgba(255,255,255,.8); padding: 8px 14px; border-radius: 10px; }
.day { text-align: center; margin: 12px 0 8px; }
.day span { background: #fff; color: var(--muted); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.08); text-transform: capitalize; }
.older { text-align: center; margin: 6px 0; }
.older button { border: 0; background: #fff; color: var(--brand); padding: 6px 14px; border-radius: 999px; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.msg { display: flex; margin-top: 6px; }
.msg.cont { margin-top: 1px; }
.msg.mine { justify-content: flex-end; }
.bubble { max-width: min(75%, 560px); padding: 6px 9px 7px 10px; border-radius: 10px; background: var(--theirs);
  box-shadow: 0 1px 1px rgba(0,0,0,.1); position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.mine .bubble { background: var(--mine); }
.msg:not(.cont).theirs .bubble { border-top-left-radius: 2px; }
.msg:not(.cont).mine .bubble { border-top-right-radius: 2px; }
.bubble .name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; font-size: 15.5px; line-height: 1.35; }
.bubble .time { float: right; font-size: 11px; color: var(--muted); margin: 8px 0 -4px 10px; }
.bubble.big { background: transparent; box-shadow: none; }
.bubble.big .text { font-size: 44px; line-height: 1.1; }

/* ---------- escribir ---------- */
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; background: #f0f2f5;
  padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.composer .icon { color: var(--muted); font-size: 24px; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 22px; padding: 11px 16px; font: inherit; font-size: 16px;
  outline: none; max-height: 140px; background: #fff; }
.composer textarea:disabled { background: #e9ecef; }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 20px; flex-shrink: 0; }
.send:disabled { background: #adb5bd; }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; padding: 8px;
  background: #fff; border-top: 1px solid var(--line); max-height: 200px; overflow-y: auto; }
.emoji-panel button { border: 0; background: transparent; font-size: 26px; padding: 4px; border-radius: 8px; }
.emoji-panel button:hover { background: #f1f3f5; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #323232; color: #fff;
  padding: 12px 18px; border-radius: 10px; z-index: 50; max-width: 90vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

/* ---------- móvil ---------- */
@media (max-width: 799px) {
  #sidebar { width: 100%; border: 0; }
  #chat { display: none; }
  .in-chat #sidebar { display: none; }
  .in-chat #chat { display: flex; }
  .back { display: grid; }
  #messages { padding: 10px 10px 6px; }
  .bubble { max-width: 85%; }
}

/* =================================================================== v1.1 */
.btn { border: 0; background: #f1f3f5; color: var(--text); padding: 9px 14px; border-radius: 10px; font-weight: 600; }
.btn.p { background: var(--brand); color: #fff; } .btn.d { background: #fff0f0; color: #c92a2a; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; }

/* avatares SVG */
.avatar svg { width: 100%; height: 100%; border-radius: 50%; display: block; }
.avatar.xs { width: 20px; height: 20px; font-size: 13px; display: inline-grid; vertical-align: -5px; margin-right: 5px; background: transparent; }
.avatar.xl { width: 110px; height: 110px; font-size: 62px; }
.me-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: inherit; padding: 2px 8px 2px 2px; border-radius: 999px; min-width: 0; }
.me-btn:hover { background: rgba(255,255,255,.15); }
.me-btn b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll { flex: 1; overflow-y: auto; }
.version-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 14px; }

/* editor de avatar */
.av-editor { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.av-preview { width: 150px; height: 150px; margin: 4px auto; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.av-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.av-tabs button { flex-shrink: 0; border: 0; background: #f1f3f5; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); }
.av-tabs button.on { background: var(--brand); color: #fff; }
.av-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.av-opt { width: 100%; aspect-ratio: 1; height: auto; border: 3px solid transparent; padding: 0; background: transparent; }
.av-opt.on, .av-swatch.on { border-color: var(--brand); box-shadow: 0 0 0 2px #fff inset; }
.av-swatch { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(0,0,0,.08); }
.av-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; position: sticky; bottom: 0; background: var(--panel); padding: 8px 0; }

/* llamadas en el chat */
.callbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: #d3f9d8; color: #1b5e20; font-size: 14px; }
.btn-join { border: 0; background: #2f9e44; color: #fff; padding: 7px 16px; border-radius: 999px; font-weight: 700; animation: pulse 1.6s infinite; }
.live { color: #2f9e44; font-weight: 600; }
.sys { text-align: center; margin: 8px 0; }
.sys span { background: #fff8e1; color: #7a5b00; font-size: 13px; padding: 6px 12px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* pantalla de videollamada */
.call { position: fixed; inset: 0; z-index: 40; background: #101418; color: #fff; display: flex; flex-direction: column; }
.call-top { text-align: center; padding: max(12px, env(safe-area-inset-top)) 12px 6px; display: flex; flex-direction: column; }
.call-top b { font-size: 18px; } .call-top small { opacity: .75; font-variant-numeric: tabular-nums; }
.call-grid { flex: 1; display: grid; gap: 8px; padding: 8px; min-height: 0; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.call-grid.n2 { grid-template-columns: 1fr; }
.call-grid.n3, .call-grid.n4 { grid-template-columns: 1fr 1fr; }
.call-grid.n5, .call-grid.n6 { grid-template-columns: 1fr 1fr; }
@media (orientation: landscape) {
  .call-grid.n2 { grid-template-columns: 1fr 1fr; }
  .call-grid.n5, .call-grid.n6 { grid-template-columns: 1fr 1fr 1fr; }
}
.call-wait { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; opacity: .9; }
.call-wait .avatar { animation: pulse 1.6s infinite; }
.tile { position: relative; background: #1f262d; border-radius: 16px; overflow: hidden; min-height: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile-av { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #1f262d; }
.tile.nocam .tile-av { display: flex; }
.tile-name { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.tile-status { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.self-tile { position: absolute; right: 14px; bottom: 110px; width: 120px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background: #333; box-shadow: 0 6px 20px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.3); z-index: 2; }
.self-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.self-tile.mirror video { transform: scaleX(-1); }
.self-av { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #2a3138; }
.self-av .avatar { width: 64px; height: 64px; font-size: 36px; }
.self-tile.nocam .self-av { display: flex; }
@media (min-width: 800px) { .self-tile { width: 200px; aspect-ratio: 4 / 3; } }
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 14px 10px max(18px, env(safe-area-inset-bottom)); }
.cbtn { width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 24px; display: grid; place-items: center; }
.cbtn:hover { background: rgba(255,255,255,.26); }
.cbtn.off { background: #fff; color: #111; }
.cbtn.end { background: #e03131; transform: rotate(135deg); }
.cbtn.ok { background: #2f9e44; animation: pulse 1.2s infinite; }

/* selector de fondos */
.bg-picker { position: absolute; left: 0; right: 0; bottom: 92px; margin: 0 auto; width: min(640px, calc(100% - 20px)); max-height: 55vh; overflow-y: auto;
  background: rgba(20,24,28,.96); border-radius: 18px; padding: 12px; z-index: 3; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.bg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.bg-item { position: relative; border: 3px solid transparent; border-radius: 12px; padding: 0; background: #2a3138; color: #fff; overflow: hidden; aspect-ratio: 16 / 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bg-item.on { border-color: #20c997; }
.bg-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-item small { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.55); font-size: 12px; padding: 3px; }
.bg-ico { font-size: 28px; margin-bottom: 14px; }
.bg-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.65); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; z-index: 1; }

/* llamada entrante */
.ring { position: fixed; inset: 0; z-index: 45; background: linear-gradient(160deg, #0f8f7a, #0b4f6e); color: #fff; display: grid; place-items: center; }
.ring-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; }
.ring-box h2 { margin: 14px 0 0; font-size: 28px; }
.ring-box p { margin: 0 0 30px; opacity: .9; }
.ring-actions { display: flex; gap: 60px; }
.ring-actions .cbtn { width: 70px; height: 70px; font-size: 28px; }
.ring-actions .cbtn.end { transform: none; }
.pulse { animation: pulse 1.4s infinite; }

/* aviso de actualización */
.upd-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 20px; }
.upd-box { background: #fff; color: var(--text); border-radius: 22px; padding: 26px 22px 20px; width: min(420px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.upd-ico { font-size: 52px; }
.upd-box h2 { margin: 8px 0 12px; font-size: 21px; }
.upd-box ul { text-align: left; padding-left: 4px; list-style: none; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.upd-box li { background: #f1f8f6; padding: 9px 12px; border-radius: 10px; font-size: 15px; }
.upd-actions { display: flex; gap: 10px; justify-content: center; }
.upd-actions .btn { padding: 12px 20px; font-size: 16px; }

/* =================================================================== v1.2 juegos */
.gdock { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.06); max-height: 58vh; display: flex; flex-direction: column; z-index: 2; }
.gdock-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; background: #f6f3ff; }
.gdock-bar .icon { color: #5f3dc4; font-size: 18px; width: 34px; height: 34px; }
.gdock-tabs { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.gtab { flex-shrink: 0; border: 0; background: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: #5f3dc4; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gtab small { font-weight: 500; opacity: .75; margin-left: 4px; }
.gtab.on { background: #7048e8; color: #fff; }
.gtab.hot:not(.on) { background: #d3f9d8; color: #2b8a3e; animation: pulse 1.6s infinite; }
.gdock-body { overflow-y: auto; }
.gdock.min .gdock-body { display: none; }

.game { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.g-head { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; font-weight: 700; font-size: 15px; }
.g-pl { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: #f1f3f5; }
.g-pl.turn { background: #d3f9d8; box-shadow: 0 0 0 2px #51cf66 inset; }
.g-vs { color: var(--muted); font-size: 12px; font-weight: 600; }
.g-status { font-size: 14px; color: var(--muted); text-align: center; }
.g-status b { color: var(--text); }
.g-myturn { color: #2b8a3e; font-weight: 800; font-size: 16px; }
.g-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.g-join { font-size: 16px; padding: 10px 22px; animation: pulse 1.6s infinite; }
.g-wait { font-size: 54px; opacity: .5; }

/* tres en raya */
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(240px, 70vw); }
.ttt-c { aspect-ratio: 1; border: 0; border-radius: 12px; background: #f1f3f5; font-size: clamp(28px, 9vw, 44px); display: grid; place-items: center; padding: 0; }
.ttt-c:not(:disabled):hover { background: #e5dbff; }
.ttt-c:not(:disabled) { cursor: pointer; background: #f3f0ff; }
.ttt-c.win { background: #b2f2bb; }

/* conecta 4 */
.c4 { display: flex; gap: 4px; background: #1c64d1; padding: 6px; border-radius: 14px; }
.c4-col { display: flex; flex-direction: column; gap: 4px; border: 0; background: transparent; padding: 2px; border-radius: 10px; }
.c4-col:not(:disabled):hover { background: rgba(255,255,255,.18); }
.c4-c { width: clamp(28px, 9vw, 40px); aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: inset 0 2px 3px rgba(0,0,0,.25); }
.c4-c.p0 { background: #f03e3e; } .c4-c.p1 { background: #fcc419; }
.c4-c.last { outline: 3px solid rgba(255,255,255,.85); }
.c4-c.win { box-shadow: 0 0 0 4px #69db7c; }

/* piedra papel tijera */
.rps-score { font-size: 16px; text-align: center; } .rps-score b { font-size: 22px; } .rps-score small { display: block; color: var(--muted); font-size: 12px; }
.rps-pick { display: flex; gap: 10px; }
.rps-pick button { border: 0; background: #f3f0ff; border-radius: 16px; font-size: 40px; width: 82px; padding: 8px 0 4px; display: flex; flex-direction: column; align-items: center; }
.rps-pick button:hover { background: #e5dbff; transform: translateY(-2px); }
.rps-pick small { font-size: 12px; color: var(--muted); }
.rps-wait { font-size: 15px; text-align: center; }
.rps-rounds { margin: 0; padding-left: 20px; font-size: 13px; color: var(--muted); }

/* ahorcado */
.hm { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.hm-left { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); }
.hm-svg { width: 90px; height: 98px; stroke: #343a40; stroke-width: 4; fill: none; stroke-linecap: round; }
.hm-right { display: flex; flex-direction: column; gap: 6px; align-items: center; max-width: 100%; }
.hm-hint { font-size: 14px; background: #fff9db; padding: 4px 10px; border-radius: 8px; }
.hm-word { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.hm-word span { width: 26px; height: 34px; border-bottom: 3px solid #343a40; display: grid; place-items: end center; font-size: 22px; font-weight: 800; }
.hm-word span.sp { border: 0; width: 12px; }
.hm-secret, .hm-last, .hm-ww { font-size: 13px; color: var(--muted); }
.hm-keys { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; width: min(400px, 100%); }
.hm-k { border: 0; background: #f3f0ff; border-radius: 8px; font-weight: 700; font-size: 15px; padding: 7px 0; color: #5f3dc4; }
.hm-k:hover:not(:disabled) { background: #d0bfff; }
.hm-k.ok { background: #b2f2bb; color: #2b8a3e; } .hm-k.ko { background: #ffe3e3; color: #c92a2a; text-decoration: line-through; }
.hm-guess { display: flex; gap: 6px; width: min(400px, 100%); }
.hm-guess input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 10px; padding: 7px 10px; font: inherit; text-transform: uppercase; }

/* tarjetas de juego en el chat */
.gcard-row { display: flex; justify-content: center; margin: 8px 0; }
.gcard { display: flex; align-items: center; gap: 10px; border: 0; background: #f3f0ff; color: var(--text); text-align: left; padding: 8px 12px; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); max-width: min(92%, 460px); }
.gcard:hover { background: #e5dbff; }
.gc-emoji { font-size: 26px; }
.gc-txt { display: flex; flex-direction: column; font-size: 14px; }
.gc-st { color: #5f3dc4; font-weight: 700; font-size: 12px; }
.gc-go { color: #7048e8; font-weight: 700; font-size: 13px; white-space: nowrap; }

/* selector de juegos */
.gpicker { background: #fff; border-top: 1px solid var(--line); padding: 10px 12px; max-height: 60vh; overflow-y: auto; }
.gp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.gp-head .icon { color: var(--muted); }
.gp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.gp-item { display: flex; gap: 10px; align-items: center; border: 0; background: #f3f0ff; border-radius: 14px; padding: 10px; text-align: left; color: var(--text); }
.gp-item:hover { background: #e5dbff; }
.gp-emoji { font-size: 30px; }
.gp-txt { display: flex; flex-direction: column; } .gp-txt small { color: var(--muted); font-size: 12.5px; }
.gp-word { display: flex; flex-direction: column; gap: 8px; }
.gp-word input { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px; }
.gp-word input[name=word] { text-transform: uppercase; letter-spacing: 2px; }
.gp-actions { display: flex; gap: 8px; justify-content: flex-end; }
#gameBtn:disabled { opacity: .4; }
@media (max-width: 799px) { .gdock { max-height: 62vh; } }
.ttt-c:disabled, .c4-col:disabled, .hm-k:disabled { color: inherit; opacity: 1; }
.ttt-c:disabled { color: #000; }

/* =================================================================== v1.3 más juegos */
/* hundir la flota */
.bs { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; width: min(320px, 86vw); background: #1864ab; padding: 4px; border-radius: 10px; }
.bs.small { width: min(200px, 54vw); opacity: .95; }
.bs-c { aspect-ratio: 1; border: 0; border-radius: 3px; background: #74c0fc; padding: 0; font-size: clamp(10px, 3vw, 16px); display: grid; place-items: center; color: #fff; }
.bs.small .bs-c { font-size: 9px; }
.bs-c:not(:disabled) { background: #a5d8ff; cursor: crosshair; }
.bs-c:not(:disabled):hover { background: #ffe066; }
.bs-c.ship { background: #495057; }
.bs-c.miss { background: #d0ebff; color: #1c7ed6; font-size: 20px; }
.bs-c.hit { background: #ffa94d; }
.bs-c.sunk { background: #c92a2a; }
.bs-c.last { outline: 3px solid #ffd43b; outline-offset: -2px; }
.bs-label { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; margin-top: 4px; }
.bs-last { font-weight: 700; font-size: 15px; }
.bs-pair { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* memoria */
.mem-score { font-size: 16px; } .mem-score b { font-size: 20px; }
.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: min(300px, 80vw); }
.mem-c { aspect-ratio: 1; border: 0; border-radius: 12px; font-size: clamp(22px, 7vw, 34px); background: linear-gradient(135deg, #7048e8, #9775fa); color: #fff; padding: 0;
  box-shadow: 0 2px 0 rgba(0,0,0,.15); transition: transform .15s; }
.mem-c:not(:disabled):hover { transform: translateY(-2px); }
.mem-c.up { background: #fff3bf; box-shadow: 0 0 0 3px #fcc419 inset; }
.mem-c.f0 { background: #e5dbff; } .mem-c.f1 { background: #d3f9d8; }
.mem-c:disabled { opacity: 1; color: inherit; }

/* dibuja y adivina */
.dr-word { font-size: 15px; } .dr-word b { color: #7048e8; font-size: 18px; letter-spacing: 1px; }
.dr-letters { font-size: 20px; font-weight: 800; letter-spacing: 2px; text-align: center; } .dr-letters small { font-size: 12px; color: var(--muted); letter-spacing: 0; font-weight: 500; }
.dr-cv { width: min(420px, 92vw); aspect-ratio: 4 / 3; height: auto; border-radius: 12px; box-shadow: 0 0 0 2px #e9ecef; background: #fff; touch-action: none; }
.dr-cv.can { cursor: crosshair; box-shadow: 0 0 0 3px #b197fc; }
.dr-tools { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: center; max-width: 420px; }
.dr-col { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #dee2e6; padding: 0; }
.dr-col.on { box-shadow: 0 0 0 3px #7048e8; }
.dr-w { width: 30px; height: 30px; border-radius: 8px; border: 0; background: #f1f3f5; display: grid; place-items: center; padding: 0; }
.dr-w i { background: #343a40; border-radius: 50%; display: block; }
.dr-w.on { background: #d0bfff; }
.dr-sep { width: 1px; height: 22px; background: #dee2e6; margin: 0 2px; }
.dr-guesses { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 420px; }
.dr-guesses span { font-size: 13px; background: #f1f3f5; padding: 3px 9px; border-radius: 999px; }
.dr-guesses span.ok { background: #d3f9d8; font-weight: 700; }
.gp-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-idea { border: 0; background: #f3f0ff; color: #5f3dc4; padding: 7px 12px; border-radius: 999px; font-weight: 600; }
.gp-idea:hover { background: #d0bfff; } .gp-idea.more { background: #f1f3f5; color: var(--muted); }
.gp-word .note { font-size: 13px; color: var(--muted); }

/* trivial */
.tv-scores { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tv-last { font-size: 13px; color: var(--muted); text-align: center; max-width: 440px; }
.tv-q { font-size: 18px; font-weight: 800; text-align: center; max-width: 460px; }
.tv-a { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(460px, 100%); }
.tv-a button { border: 0; background: #f3f0ff; border-radius: 12px; padding: 12px 10px; font-weight: 700; font-size: 15px; text-align: left; color: var(--text); }
.tv-a button:hover:not(:disabled) { background: #d0bfff; }
.tv-a button:disabled { opacity: .5; }
.tv-wrong { font-size: 13px; color: #c92a2a; }
@media (max-width: 420px) { .tv-a { grid-template-columns: 1fr; } }

/* =================================================================== v1.4 jugar en la videollamada */
.call-game { display: flex; flex-direction: column; background: #fff; color: var(--text); overflow: hidden; min-height: 0; }
.call-game .gdock { max-height: none; flex: 1; min-height: 0; box-shadow: none; border: 0; }
.call-game .gdock-body { flex: 1; }
.call-game .gpicker { max-height: none; border: 0; flex: 1; }
.cbtn.off#cGame { background: #7048e8; color: #fff; }
.call.with-game .call-grid { flex: 0 0 auto; height: 30vh; grid-auto-flow: column; grid-template-columns: none !important; grid-auto-columns: minmax(45%, 1fr); grid-auto-rows: 100%; overflow-x: auto; }
.call.with-game .call-wait .avatar { width: 64px; height: 64px; font-size: 36px; }
.call.with-game .call-game { flex: 1; margin: 0 8px; border-radius: 16px; }
.call.with-game .self-tile { width: 76px; top: max(54px, calc(env(safe-area-inset-top) + 44px)); bottom: auto; right: 12px; }
.call.with-game .call-controls { padding-top: 8px; }
.call.with-game .cbtn { width: 50px; height: 50px; font-size: 21px; }
.call.with-game .bg-picker { bottom: 76px; }
@media (min-width: 900px) {
  .call.with-game { display: grid; grid-template-columns: minmax(0, 1fr) min(520px, 46vw); grid-template-rows: auto minmax(0, 1fr) auto; }
  .call.with-game .call-top { grid-column: 1; grid-row: 1; }
  .call.with-game .call-grid { grid-column: 1; grid-row: 2; height: auto; grid-auto-flow: row; grid-template-columns: 1fr !important; grid-auto-columns: auto; grid-auto-rows: 1fr; overflow: hidden; }
  .call.with-game .call-controls { grid-column: 1; grid-row: 3; }
  .call.with-game .call-game { grid-column: 2; grid-row: 1 / span 3; margin: 10px 10px 10px 0; }
  .call.with-game .self-tile { width: 150px; top: auto; bottom: 90px; left: 20px; right: auto; }
}
#cGame.hot { background: #2f9e44; animation: pulse 1.2s infinite; }
#callView:not(.hidden) ~ #toast { bottom: auto; top: 76px; }
