/* Pasará: estética lineal, al estilo de las apps del sistema. Una tinta de acento, superficies
   planas sin bordes gruesos, separadores finos y tipografía del sistema. */

:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --sep: rgba(60, 60, 67, 0.16);
  --accent: #d9382c;        /* rellenos: texto blanco encima cumple AA */
  --accent-text: #b92f24;   /* el mismo acento como texto, sobre claro o tinte */
  --accent-strong: #b92f24;
  --accent-tint: rgba(217, 56, 44, 0.11);
  --on-accent: #ffffff;
  --green: #34c759;
  --yellow: #ffcc00;
  --blue: #0a84ff;
  --purple: #af52de;
  --overlay: rgba(0, 0, 0, 0.42);
  --toast-bg: rgba(28, 28, 30, 0.94);
  --toast-text: #ffffff;
  --toast-action: #ffa39b;
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --c: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #636366;
    --sep: rgba(84, 84, 88, 0.6);
    --accent: #e5473b;
    --accent-text: #ff7b71;
    --accent-strong: #c9382d;
    --accent-tint: rgba(255, 107, 96, 0.16);
    --overlay: rgba(0, 0, 0, 0.6);
    --toast-bg: rgba(58, 58, 60, 0.96);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
b, strong { font-weight: 600; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
svg.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
svg.ic.fill { fill: currentColor; stroke: none; }

/* ---------- vistas ---------- */

.view { display: none; max-width: 560px; margin: 0 auto; padding: 8px 16px 128px; }
body[data-view='home'] #view-home,
body[data-view='lobby'] #view-lobby,
body[data-view='game'] #view-game { display: block; }

/* ---------- capas fijas ---------- */

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
#reactions-layer { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
#toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; z-index: 70; width: min(92vw, 420px); pointer-events: none;
}
body[data-view='lobby'] #toasts { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 96px); }

/* ---------- piezas básicas ---------- */

.section-title {
  margin: 22px 0 8px 4px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.section-title .count { font-weight: 500; color: var(--text-2); letter-spacing: 0; text-transform: none; }
.section-title .tools { margin-left: auto; display: flex; gap: 14px; text-transform: none; letter-spacing: 0; }

.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 12px; }
.group .row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 48px; }
.group .row + .row { border-top: 1px solid var(--sep); }
.group .row .grow { flex: 1; min-width: 0; }
.caption { color: var(--text-2); font-size: 14px; }
.caption.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--accent-text); font-size: 14px; margin: 10px 4px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 16px; line-height: 1.2; white-space: nowrap;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-tint { background: var(--accent-tint); color: var(--accent-text); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 8px 10px; }
.btn-big { width: 100%; padding: 15px 20px; font-size: 17px; border-radius: 14px; }
.btn-small { padding: 6px 12px; font-size: 14px; border-radius: 9px; }
.text-btn { color: var(--accent-text); font-weight: 500; font-size: 15px; padding: 4px 2px; }
.text-btn:active { opacity: 0.6; }

input[type='text'], input[type='search'], input:not([type]) {
  width: 100%; padding: 11px 14px; border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); outline: none; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--text-3); }
input:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 15px; line-height: 1.2;
}
.chip-emoji { font-size: 18px; line-height: 1; }
.chip.off { opacity: 0.4; }
.chip.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.chip.host .crown { color: var(--yellow); }
.chip .wins { color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.chip .kick { color: var(--text-2); padding: 0 0 0 2px; display: inline-flex; }
.chip .kick:active { opacity: 0.5; }
.chip.pack { cursor: pointer; transition: transform 0.12s ease; padding: 7px 12px 7px 9px; }
.chip.pack:active { transform: scale(0.96); }
.chip.pack.added { background: var(--accent-tint); color: var(--accent-text); }
.chip.pack.random { background: var(--accent-tint); color: var(--accent-text); }
.chip.pack .n { font-size: 13px; }

/* ---------- inicio ---------- */

.hero { padding: 36px 4px 18px; }
.hero h1 { font-size: 40px; letter-spacing: -0.03em; }
.hero h1 .dot { color: var(--accent-text); }
.tagline { color: var(--text-2); font-size: 17px; margin-top: 4px; }

.avatar-btn {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; font-size: 24px; line-height: 1;
}
.avatar-btn:active { transform: scale(0.94); }
.avatar-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 12px 16px 14px;
  border-top: 1px solid var(--sep);
}
.avatar-grid button {
  aspect-ratio: 1; min-width: 0; border-radius: 50%; font-size: 24px; display: grid; place-items: center;
  transition: transform 0.1s ease, background 0.12s ease;
}
.avatar-grid button:active { transform: scale(0.9); }
.avatar-grid button.on { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent-text); }

.home-actions { margin: 14px 0 0; display: grid; gap: 10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 13px; margin: 8px 0 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--sep); }
.join-row { display: flex; gap: 10px; align-items: center; }
.join-row input { text-transform: uppercase; letter-spacing: 0.22em; font-weight: 600; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.join-row.linked input { display: none; }
.join-row.linked .btn { flex: 1; padding: 15px 20px; font-size: 17px; border-radius: 14px; background: var(--accent); color: var(--on-accent); }
#home-create-alt { display: block; margin: 10px auto 0; }
#resume-btn { margin-bottom: 14px; }

.howto .row { align-items: flex-start; }
.howto .num {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-text);
  font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.howto p { font-size: 15px; color: var(--text-2); }
.howto p b { color: var(--text); font-weight: 600; }

/* ---------- barra superior ---------- */

.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 8px 0 6px; min-height: 48px;
}
.topbar .left { justify-self: start; }
.topbar .right { justify-self: end; }
.topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar h1 b { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.nav-btn { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-text); font-weight: 500; font-size: 17px; padding: 6px 4px; }
.nav-btn:active { opacity: 0.6; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-text); }
.icon-btn:active { background: var(--accent-tint); }
.icon-btn svg.ic { width: 22px; height: 22px; }

/* ---------- sala de espera ---------- */

.invite { padding: 18px 16px 16px; text-align: center; }
.code-big {
  display: block; font-size: 40px; font-weight: 700; letter-spacing: 0.22em; padding-left: 0.22em;
  font-variant-numeric: tabular-nums; margin: 2px 0 4px;
}
.share-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.share-row .btn { flex: 1; }

.idea-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; }
.progress { padding: 12px 16px 14px; border-top: 1px solid var(--sep); }
.progress-bar { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: visible; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--accent); width: 0%; transition: width 0.35s ease; }
.progress-mark { position: absolute; top: 10px; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text-2); }
.progress-mark:last-of-type { transform: translateX(-100%); }
.progress-mark.hit { color: var(--text); }
.progress-text { margin-top: 26px; font-size: 14px; color: var(--text-2); }

.idea-list { list-style: none; margin: 0; padding: 0; }
.idea-list li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 46px; font-size: 16px; }
.idea-list li + li { border-top: 1px solid var(--sep); }
.idea-list li.new { animation: fade-in 0.25s ease both; }
.idea-list li .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.idea-list li .by { font-size: 16px; opacity: 0.9; }
.idea-list li .x { color: var(--text-3); display: inline-flex; padding: 4px; border-radius: 50%; }
.idea-list li .x:active { color: var(--accent-text); }
.empty { padding: 18px 16px; color: var(--text-2); font-size: 15px; text-align: center; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sticky-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep);
}
.sticky-bottom > div { max-width: 560px; margin: 0 auto; }
.sticky-bottom .caption { margin-top: 8px; text-align: center; }

/* ---------- partida ---------- */

.scoreboard { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.scoreboard::-webkit-scrollbar { display: none; }
.score {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 68px; padding: 8px 8px 7px; border-radius: 12px; background: var(--surface); font-size: 12px; color: var(--text-2);
}
.score.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.score.off { opacity: 0.4; }
.score .e { font-size: 24px; line-height: 1; }
.score .n { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.score .n .crown { color: var(--yellow); }
.score .bar { width: 100%; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--accent); transition: width 0.3s ease; }
.score .pts { font-variant-numeric: tabular-nums; }
.score .tag { font-size: 11px; font-weight: 600; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.04em; }

.nudge {
  margin: 0 0 10px; padding: 9px 14px; border-radius: var(--radius-sm);
  background: var(--accent-tint); color: var(--accent-text); font-size: 14px; font-weight: 600; text-align: center;
}

.bingo-card {
  display: grid; gap: 6px; padding: 8px; border-radius: var(--radius); background: var(--surface); margin-bottom: 10px;
}
.bingo-card.size-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); --fs: clamp(14px, 4vw, 19px); --ar: 1; }
.bingo-card.size-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); --fs: clamp(12px, 3.1vw, 15px); --ar: 1; }
.bingo-card.size-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); --fs: clamp(9.5px, 2.5vw, 12.5px); --ar: 0.9; }

.cell {
  position: relative; aspect-ratio: var(--ar);
  border-radius: 10px; background: var(--surface-2); color: var(--text);
  padding: 5px 4px; display: grid; place-items: center; text-align: center;
  font-weight: 500; font-size: var(--fs); line-height: 1.12; overflow: hidden; overflow-wrap: break-word; hyphens: auto;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.cell span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.cell:not(.marked):not(.free):active { transform: scale(0.95); }
.cell.free { background: var(--surface-3); color: var(--text-2); font-weight: 600; letter-spacing: 0.04em; font-size: calc(var(--fs) * 0.9); }
.cell.marked { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.cell.marked.mine { background: var(--accent-strong); }
.cell .who {
  position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); display: grid; place-items: center; font-size: 11px; line-height: 1;
}
.bingo-card.size-5 .cell .who { width: 15px; height: 15px; font-size: 9px; right: 2px; bottom: 2px; }
.cell.stamp { animation: stamp 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }
@keyframes stamp { 0% { transform: scale(0.8); opacity: 0.6; } 100% { transform: none; opacity: 1; } }
.cell.deal { animation: deal 0.3s ease both; animation-delay: calc(var(--i) * 22ms); }
@keyframes deal { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.cell.win { box-shadow: inset 0 0 0 2px var(--yellow); }

.bingo-card.mini { gap: 3px; padding: 5px; margin: 10px auto; max-width: 220px; background: var(--surface-2); }
.bingo-card.mini .cell { border-radius: 5px; font-size: 6px; padding: 1px; aspect-ratio: 1; background: var(--surface); }
.bingo-card.mini .cell.marked { background: var(--accent); }
.bingo-card.mini .cell.free { background: var(--surface-3); }
.bingo-card.mini .cell .who { display: none; }

.game-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.reaction-bar { display: flex; gap: 6px; }
.reaction-bar button { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); font-size: 20px; display: grid; place-items: center; transition: transform 0.1s ease; }
.reaction-bar button:active { transform: scale(0.85); }

.feed p { font-size: 14px; color: var(--text-2); padding: 10px 16px; }
.feed p + p { border-top: 1px solid var(--sep); }
.feed p b { color: var(--text); font-weight: 600; }
.feed p.hot { color: var(--text); }
.host-game-controls { margin-top: 16px; text-align: center; }

.float { position: absolute; bottom: 90px; font-size: 44px; line-height: 1; animation: float-up 1.9s ease-out forwards; will-change: transform, opacity; }
.float small { position: absolute; right: -10px; bottom: -6px; font-size: 18px; }
@keyframes float-up {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  12% { opacity: 1; transform: translateY(-30px) scale(1.1); }
  100% { transform: translateY(-75vh) scale(0.9); opacity: 0; }
}

/* ---------- aviso de línea ---------- */

.banner {
  position: fixed; top: 22%; left: 50%; transform: translateX(-50%); z-index: 65; pointer-events: none;
  padding: 18px 32px; border-radius: 22px; text-align: center; white-space: nowrap;
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
  animation: banner-in 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.1) both, banner-out 0.3s ease-in 3s forwards;
}
.banner small { display: block; font-size: 15px; font-weight: 500; color: var(--text-2); margin-top: 2px; letter-spacing: 0; }
@keyframes banner-in { from { transform: translateX(-50%) scale(0.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes banner-out { to { transform: translateX(-50%) scale(0.95); opacity: 0; } }

/* ---------- avisos ---------- */

.toast {
  pointer-events: none;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-text); font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.22s ease both;
}
.toast .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .btn-small { pointer-events: auto; flex: 0 0 auto; background: transparent; color: var(--toast-action); font-weight: 600; padding: 4px 2px; }
.toast .btn-small + .btn-small { margin-left: -4px; }
.toast.good .t::before, .toast.bad .t::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 8px 1px 0; background: var(--green); }
.toast.bad .t::before { background: var(--accent); }
.toast.out { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- final de ronda (hoja desde abajo) ---------- */

.overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.25s ease both; }
.overlay-card {
  width: min(100%, 560px); max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  text-align: center; animation: sheet-up 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.05) both;
}
.overlay-card .grabber, .sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.bingo-word { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0 2px; }
.winner { font-size: 18px; font-weight: 600; margin: 4px 0 2px; }
.winner .big { display: block; font-size: 56px; line-height: 1.1; margin-bottom: 4px; }
.winner .you { color: var(--accent-text); }
#end-stats { margin: 4px 0 10px; }
.ranking { list-style: none; padding: 0; margin: 12px 0 14px; text-align: left; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.ranking li + li { border-top: 1px solid var(--sep); }
.ranking li .pos { width: 26px; text-align: center; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ranking li.first .pos { color: var(--accent-text); }
.ranking li .nm { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking li .nm .wins { color: var(--text-2); font-size: 13px; margin-left: 6px; }
.ranking li .pts { font-variant-numeric: tabular-nums; color: var(--text-2); }
.ranking li.me { background: var(--accent-tint); }
.ranking li.me .pts, .ranking li.me .pos { color: var(--text); }
.overlay-card .btn-big { margin-top: 8px; }
.overlay-card .caption { margin-top: 10px; }
#end-leave { margin-top: 6px; }

/* ---------- hoja: todas las ideas ---------- */

.sheet { position: fixed; inset: 0; z-index: 45; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--overlay); animation: fade-in 0.2s ease both; }
.sheet-panel {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%, 560px); max-height: 84dvh; outline: none;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; animation: sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.05) both;
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.overlay-card { animation-name: sheet-up-plain; }
@keyframes sheet-up-plain { from { transform: translateY(100%); } to { transform: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.sheet-head h2 { font-size: 20px; }
.segmented { display: flex; background: var(--surface-2); border-radius: 9px; padding: 2px; margin: 10px 0 10px; }
.segmented button { flex: 1; padding: 6px 10px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--text); }
.segmented button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
.search-wrap { position: relative; }
.search-wrap svg.ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; }
#sheet-search { padding-left: 34px; font-size: 16px; }
.sheet-panel ul { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; min-height: 0; background: var(--surface-2); border-radius: var(--radius); }
.sheet-panel li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; font-size: 15px; }
.sheet-panel li + li { border-top: 1px solid var(--sep); }
.sheet-panel li.marked { color: var(--text-3); text-decoration: line-through; cursor: default; }
.sheet-panel li .mk { width: 22px; text-align: center; font-size: 15px; color: var(--text-3); }
.sheet-panel li .txt { flex: 1; overflow-wrap: anywhere; }
.sheet-panel li .on-card { font-size: 11px; font-weight: 600; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.04em; }
.sheet-panel li .btn-small { text-decoration: none; background: transparent; color: var(--accent-text); padding: 2px 4px; }
.sheet-panel .empty { background: transparent; }

/* Biblioteca personal, invitaciones y revisión de marcados. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.visually-hidden:focus-visible { position: static; width: auto; height: auto; margin: 0; clip-path: none; }
.modal-open { overflow: hidden; }
.invite-qr { margin: 16px auto 0; }
.invite-qr img { width: min(220px, 100%); height: auto; padding: 8px; background: white; border-radius: 12px; }
.share-row { flex-wrap: wrap; }
.room-settings { margin-top: 12px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; text-align: left; }
.toggle-row span { min-width: 0; }
.toggle-row small { display: block; font-size: 12px; color: var(--text-2); margin-top: 4px; }
.toggle-row input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--blue); }
.approval-note { margin-top: 8px; }
.host-game-controls .toggle-row { margin-bottom: 14px; }
.library-tools { padding: 14px 16px; border-top: 1px solid var(--sep); }
.library-tools summary { cursor: pointer; font-weight: 600; }
.library-tools > .caption { margin-top: 10px; }
.library-tools .idea-row { padding: 12px 0; }
.library-tools input { min-width: 0; }
.library-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.library-actions .btn { flex: 1 1 auto; text-align: center; }
.saved-packs { display: grid; gap: 8px; margin: 8px 0; }
.saved-pack { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.saved-pack .btn { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.saved-pack .text-btn { flex: 0 0 auto; }
.cell.pending { outline: 2px dashed var(--blue); outline-offset: -3px; }
.pending-review { margin-top: 16px; padding: 14px; }
.pending-review h2 { font-size: 16px; margin-bottom: 8px; }
.pending-review ul { padding: 0; list-style: none; }
.pending-review li { padding: 10px 0; display: grid; gap: 8px; overflow-wrap: anywhere; }
.pending-review li + li { border-top: 1px solid var(--sep); }
.pending-review small { display: block; margin-top: 3px; color: var(--text-2); }
.review-actions { display: flex; gap: 14px; align-items: center; }
.sheet-panel li { padding: 0; cursor: default; }
.sheet-idea { display: flex; flex: 1; width: 100%; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; font-size: inherit; color: inherit; }
.sheet-idea[aria-disabled='true'] { cursor: wait; }
.sheet-panel li > .btn-small { margin-right: 12px; }
.sheet-panel li.empty, .sheet-panel .import-preview li { padding: 11px 14px; }
#end-close { float: right; }
.conn { max-width: calc(100vw - 24px); width: max-content; text-align: center; }
.conn .text-btn { color: inherit; margin-left: 6px; }

/* ---------- conexión ---------- */

.conn {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80;
  padding: 7px 14px; border-radius: 999px; background: var(--toast-bg); color: var(--toast-text); font-size: 13px; font-weight: 500;
}

/* ---------- pantallas anchas ---------- */

@media (min-width: 900px) {
  body[data-view='game'] #view-game { max-width: 960px; display: grid; grid-template-columns: 1fr 320px; column-gap: 28px; align-items: start; }
  #view-game .topbar, #view-game .scoreboard { grid-column: 1 / -1; }
  #view-game .main { grid-column: 1; }
  #view-game .side { grid-column: 2; }
  .bingo-card.size-5 { --fs: 14px; }
  .bingo-card.size-4 { --fs: 16px; }
  .bingo-card.size-3 { --fs: 20px; }
}

@media (max-width: 360px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .hero h1 { font-size: 34px; }
  .bingo-card { padding: 6px; gap: 4px; }
  .cell { padding: 3px; border-radius: 8px; }
  .bingo-card.size-5 { --fs: 9.5px; }
  .code-big { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

