/* Kids Family Call — cielo, caras grandes y llamadas sencillas */
:root {
  --grape: #5B2BC9;
  --grape-ink: #3C1A8F;
  --grape-night: #24124F;
  --sky-top: #9FD3FF;
  --sky-bottom: #EAF6FF;
  --sun: #FFC93C;
  --green: #1FB85A;
  --green-deep: #16924A;
  --red: #EB4747;
  --ink: #26233A;
  --muted: #6B6880;
  --paper: #FFFFFF;
  --line: #E6E1F5;
  --soft: #F5F1FF;
  --face: clamp(118px, 38vw, 200px);
  --radius-l: 28px;
  --radius-m: 16px;
  --display: 'Baloo 2', 'Nunito', ui-rounded, system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, -apple-system, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body); color: var(--ink); background: var(--soft);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-user-select: none; user-select: none;
  font-size: 17px; line-height: 1.45;
}
input, textarea { -webkit-user-select: text; user-select: text; }
body.sky-on { background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 70%) fixed; }
body.in-call { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
p { margin: 0; }
#app { position: relative; z-index: 1; min-height: 100%; }
.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon.inline { width: 1.1em; height: 1.1em; vertical-align: -0.2em; color: #1A73E8; }

/* ---------- cielo con nubes ---------- */
#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; display: none; }
.sky-on #sky { display: block; }
.cloud {
  position: absolute; left: 0; width: calc(170px * var(--s)); color: #fff; opacity: .92;
  animation: drift linear infinite; will-change: transform;
  filter: drop-shadow(0 6px 10px rgba(80, 140, 200, .12));
}
.cloud svg { width: 100%; display: block; }
@keyframes drift { from { transform: translateX(-30vw); } to { transform: translateX(115vw); } }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: calc(8px + var(--safe-t)); z-index: 5; display: flex; align-items: center; gap: 10px;
  margin: calc(8px + var(--safe-t)) 12px 0; padding: 12px 14px 12px 12px; color: #fff;
  background: linear-gradient(135deg, #5B2BC9, #7C5CFF); border-radius: 28px; box-shadow: 0 12px 28px rgba(59, 26, 143, .28);
}
.topbar-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.35rem, 5.5vw, 1.9rem); flex: 1; }
.me-badge { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 3px solid #fff; flex: none; transition: transform .2s; }
.me-badge .avatar { width: 100%; height: 100%; }
.me-badge.pressing { transform: scale(.88); transition: transform 1.8s linear; }
.badge { position: absolute; top: -4px; right: -6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: #FF8A3D; color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center; border: 2px solid var(--grape); }
.cam-chip { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--sun); color: var(--grape-ink); display: grid; place-items: center; border: 2px solid #fff; }
.cam-chip .icon { width: 15px; height: 15px; }

/* ---------- caras (pantalla principal) ---------- */
.avatar { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fff; }
.avatar.initial { display: grid; place-items: center; font-family: var(--display); font-weight: 800; color: var(--grape-ink); font-size: 2.6em; }
.avatar.sm { width: 48px; height: 48px; font-size: 1.2rem; flex: none; }
.avatar.md { width: 64px; height: 64px; font-size: 1.6rem; flex: none; }
.avatar.lg { width: 104px; height: 104px; font-size: 2.6rem; }
.avatar.xl { width: min(46vw, 220px); height: min(46vw, 220px); font-size: 5rem; }
.faces {
  display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 8px; row-gap: 6px;
  padding: 26px 14px calc(110px + var(--safe-b)); max-width: 980px; margin: 0 auto; justify-items: center;
}
.faces > .face:nth-child(even) { margin-top: calc(var(--face) * .55); }
.face { -webkit-touch-callout: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px; border-radius: 30px; touch-action: manipulation; }
.face .ring {
  position: relative; width: var(--face); height: var(--face); border-radius: 50%; padding: 6px;
  background: var(--grape); box-shadow: 0 14px 28px rgba(59, 26, 143, .22); transition: transform .18s ease;
}
.face .ring .avatar { border: 5px solid #fff; }
.face .name {
  font-family: var(--display); font-weight: 800; font-size: clamp(1.25rem, 5vw, 1.6rem); color: var(--ink);
  background: rgba(255, 255, 255, .85); padding: 2px 16px; border-radius: 999px; max-width: calc(var(--face) + 20px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.face .presence { position: absolute; right: 9%; bottom: 9%; width: 22%; height: 22%; max-width: 38px; max-height: 38px; border-radius: 50%; background: var(--green); border: 4px solid #fff; transform: scale(0); transition: transform .25s; }
.face.online .presence { transform: scale(1); }
.face:active .ring, .face.tapped .ring { transform: scale(.93); }
.face.resting .ring { filter: grayscale(.6); opacity: .7; }
.face .zzz { position: absolute; top: 2%; right: 2%; font-size: clamp(1.6rem, 7vw, 2.4rem); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .25)); }
.face .rest-note { font-weight: 800; font-size: .95rem; color: var(--grape-ink); background: rgba(255, 255, 255, .85); padding: 1px 12px; border-radius: 999px; margin-top: -4px; white-space: nowrap; }
.face.add .ring { background: #fff; color: var(--grape); display: grid; place-items: center; width: calc(var(--face) * .62); height: calc(var(--face) * .62); margin: calc(var(--face) * .19) 0; }
.face.add .ring .icon { width: 48%; height: 48%; }
.face.add .ring { color: #fff; background: radial-gradient(circle at 34% 28%, #A88EFF, #6E45E6 58%, #5126C2); box-shadow: 0 16px 30px rgba(91, 43, 201, .35), inset 0 -10px 18px rgba(40, 10, 120, .25), inset 0 8px 14px rgba(255, 255, 255, .25); }
/* Rayitas de brillo junto a cada cara (del color de su personaje) */
.sparks { position: absolute; top: -9%; right: -7%; width: 30%; height: 30%; pointer-events: none; }
.sparks i { position: absolute; width: 16%; height: 44%; border-radius: 99px; background: currentColor; }
.sparks i:first-child { left: 22%; top: 6%; transform: rotate(24deg); }
.sparks i:last-child { left: 62%; top: 44%; transform: rotate(64deg); }
.faces > .face:nth-child(even) .sparks { right: auto; left: -7%; transform: scaleX(-1); }
.faces.small .sparks { display: none; }
/* Campanita de llamadas perdidas */
/* Barra "Kaih está hablando con…" en la app del padre, con el botón para escuchar en modo fantasma */
.live-calls { display: grid; gap: 10px; margin: 14px 12px 0; }
.live-card { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 22px; padding: 10px 12px; box-shadow: 0 10px 24px rgba(30, 20, 60, .14); }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); flex: none; animation: cb-blink 1.2s ease-in-out infinite; }
.btn.ghost-btn { background: var(--grape-night); color: #fff; min-height: 44px; padding: 0 16px; flex: none; }
.call.ghost .call-status { background: rgba(20, 10, 50, .75); }
.bell { position: relative; }
.bell .badge { top: -5px; right: -5px; background: var(--red); border-color: #fff; }
.faces.small { --face: 96px; padding: 4px 0 8px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.faces.small > .face:nth-child(even) { margin-top: 0; }
.faces.small .name { font-size: 1.05rem; }
@media (min-width: 640px) {
  :root { --face: clamp(150px, 22vw, 210px); }
  .faces { grid-template-columns: repeat(3, 1fr); }
  .faces > .face:nth-child(even) { margin-top: 0; }
  .faces > .face:nth-child(3n+2) { margin-top: calc(var(--face) * .5); }
}
@media (min-width: 1100px) {
  .faces { grid-template-columns: repeat(4, 1fr); }
  .faces > .face:nth-child(3n+2) { margin-top: 0; }
  .faces > .face:nth-child(even) { margin-top: calc(var(--face) * .5); }
}
.empty { margin: 40px 20px; padding: 24px; background: rgba(255, 255, 255, .9); border-radius: var(--radius-l); text-align: center; font-weight: 700; }

/* ---------- inicio del adulto ---------- */
.adult .faces { padding-bottom: 20px; }
.recent { max-width: 640px; margin: 0 auto; padding: 0 16px calc(40px + var(--safe-b)); }
.recent h2 { margin: 6px 6px 10px; }
.notice { margin: 16px auto 0; max-width: 620px; background: #fff; border-radius: var(--radius-m); padding: 16px; display: grid; gap: 12px; box-shadow: 0 6px 20px rgba(40, 40, 90, .08); border-left: 6px solid var(--sun); }
.adult > .notice { margin: 16px 16px 0; }
@media (min-width: 652px) { .adult > .notice { margin: 16px auto 0; } }
.ok-line { color: var(--green-deep); font-weight: 800; }

/* ---------- listas ---------- */
.list { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--radius-m); overflow: hidden; box-shadow: 0 4px 16px rgba(40, 40, 90, .06); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.tap { cursor: pointer; }
.row.tap:active { background: var(--soft); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-main strong { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--muted); }
.row.missed { background: #FFF0F0; box-shadow: inset 5px 0 0 var(--red); }
.row.missed .row-main strong, .row.missed .row-main small { color: var(--red); }
.row.missed .row-main small { font-weight: 700; }
.chip { font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--grape-ink); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 999px; font-weight: 800; background: var(--soft); color: var(--grape-ink); transition: transform .12s, filter .12s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--grape); color: #fff; }
.btn.big { min-height: 58px; font-size: 1.1rem; width: 100%; max-width: 380px; }
.btn.ghost { background: #fff; border: 2px solid var(--line); }
.btn.light { background: #fff; color: var(--grape-ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--red); border: 2px solid #F6CACA; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .92rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--grape-ink); background: #fff; flex: none; }
.icon-btn.light { background: rgba(255, 255, 255, .18); color: #fff; }
.round-btn { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .12s, background .2s; }
.round-btn .icon { width: 30px; height: 30px; }
.round-btn:active { transform: scale(.92); }
.round-btn.green { background: var(--green); box-shadow: 0 10px 24px rgba(31, 184, 90, .4); }
.round-btn.red { background: var(--red); box-shadow: 0 10px 24px rgba(235, 71, 71, .4); }
.round-btn.glass { background: rgba(255, 255, 255, .18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.round-btn.glass.off { background: #fff; color: var(--grape-night); }
.round-btn.sm { width: 46px; height: 46px; }
.round-btn.sm .icon { width: 22px; height: 22px; }
.round-btn.xl { width: 92px; height: 92px; }
.round-btn.xl .icon { width: 42px; height: 42px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }

/* ---------- pantallas centradas ---------- */
.center-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: calc(30px + var(--safe-t)) 24px calc(30px + var(--safe-b)); max-width: 520px; margin: 0 auto; }
.center-screen > p { color: #3D3956; font-size: 1.08rem; }
.logo { width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 12px 30px rgba(59, 26, 143, .25); }
.big-icon { width: 104px; height: 104px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 3.4rem; color: var(--grape); }
.big-icon .icon { width: 52px; height: 52px; }
.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; font-family: var(--display); font-weight: 800; color: var(--grape-ink); }
.splash img { border-radius: 24px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
/* Guía visual para instalar en iPhone/iPad (imita los botones de Safari) */
.install-guide { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; width: 100%; text-align: left; }
.ig-step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; background: #fff; border-radius: var(--radius-m); padding: 14px; box-shadow: 0 4px 14px rgba(40, 40, 90, .07); }
.notice .ig-step { box-shadow: none; border: 2px solid var(--line); }
.ig-n { width: 34px; height: 34px; border-radius: 50%; background: var(--grape); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.ig-body { display: grid; gap: 10px; min-width: 0; }
.ig-body > strong { font-size: 1.05rem; line-height: 1.3; }
.ig-en { margin-left: 8px; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--soft); padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.ig-body > small { color: var(--muted); font-weight: 600; line-height: 1.35; }
.ig-bar { display: flex; justify-content: space-around; align-items: center; background: #F2F2F7; border-radius: 14px; padding: 8px 6px; color: #007AFF; font-size: 1.6rem; font-weight: 700; }
.ig-dim { color: #B5C3D6; line-height: 1; }
.ig-share { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px #007AFF; animation: ig-pulse 1.6s ease-in-out infinite; }
.ig-share .icon { width: 28px; height: 28px; }
@keyframes ig-pulse { 50% { box-shadow: 0 0 0 3px #007AFF, 0 0 0 9px rgba(0, 122, 255, .2); } }
.ig-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #F2F2F7; border-radius: 12px; padding: 10px 14px; font-weight: 700; color: #000; box-shadow: inset 0 0 0 3px #007AFF; }
.ig-row small { display: block; color: #8E8E93; font-weight: 600; font-size: .8rem; }
.ig-row .icon { width: 26px; height: 26px; color: #000; }
.ig-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #F2F2F7; border-radius: 12px; padding: 10px; font-weight: 700; font-size: .92rem; color: #000; white-space: nowrap; }
.ig-link { color: #007AFF; font-weight: 600; }
.ig-add { color: #007AFF; font-weight: 800; padding: 3px 10px; border-radius: 999px; box-shadow: 0 0 0 3px #007AFF; animation: ig-pulse 1.6s ease-in-out infinite; }
.ig-home { display: flex; justify-content: center; background: linear-gradient(135deg, #6D8BFF, #9FD3FF); border-radius: 14px; padding: 12px; }
.ig-app { display: grid; justify-items: center; gap: 4px; color: #fff; font-weight: 700; font-size: .85rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.ig-code { display: grid; gap: 6px; justify-items: start; }
.ig-code:empty { display: none; }
.ig-code small { color: var(--muted); font-weight: 600; }
.ig-app img { width: 60px; height: 60px; border-radius: 14px; box-shadow: 0 4px 10px rgba(0, 0, 0, .2); }
.code-big { font-family: var(--display); font-weight: 800; font-size: 2.4rem; letter-spacing: .12em; background: #fff; color: var(--grape-ink); padding: 6px 20px; border-radius: var(--radius-m); }
.code-big.sm { font-size: 1.8rem; text-align: center; }
.code-input { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: .14em; text-align: center; text-transform: uppercase; width: 100%; max-width: 320px; padding: 12px; border-radius: var(--radius-m); border: 3px solid var(--line); background: #fff; color: var(--ink); }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .9rem; }

/* ---------- páginas y formularios ---------- */
.page { max-width: 680px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(40px + var(--safe-b)); }
.page-head { display: flex; align-items: center; gap: 12px; padding: 6px 0 16px; }
.page-head h1 { font-size: 1.7rem; }
.form, .stack { display: grid; gap: 14px; }
.form h2 { margin-top: 10px; }
.field { display: grid; gap: 6px; font-weight: 800; font-size: .95rem; }
.field input { font: inherit; font-weight: 600; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); min-height: 50px; width: 100%; }
.field input:focus { border-color: var(--grape); outline: none; }
.field small { color: var(--muted); font-weight: 600; }
.check { display: flex; gap: 12px; align-items: flex-start; background: #fff; padding: 14px; border-radius: 14px; border: 2px solid var(--line); font-size: .95rem; }
.check input { width: 24px; height: 24px; flex: none; accent-color: var(--grape); margin-top: 2px; }
.photo-row { display: flex; gap: 16px; align-items: center; }
.grow { flex: 1; display: grid; gap: 12px; min-width: 0; }
.photo-pick { position: relative; width: 104px; height: 104px; border-radius: 50%; flex: none; border: 4px solid var(--grape); }
.photo-pick .cam-chip { width: 34px; height: 34px; right: -2px; bottom: -2px; }
.photo-pick .cam-chip .icon { width: 18px; height: 18px; }
.center-screen .photo-pick { width: 150px; height: 150px; }
.center-screen .photo-pick .avatar { width: 100%; height: 100%; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-weight: 800; }
.switch span { display: grid; }
.switch small { font-weight: 600; color: var(--muted); }
.switch input { appearance: none; -webkit-appearance: none; width: 54px; height: 32px; border-radius: 999px; background: #D7D3E6; position: relative; flex: none; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(22px); }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.perm { display: grid; gap: 8px; }
.perm h3 { font-size: 1.05rem; color: var(--grape-ink); }
/* Panel: caras para activar o apagar a quién puede llamar cada persona */
.pick-faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px 8px; }
.pick-face { display: grid; justify-items: center; gap: 6px; padding: 4px; border-radius: 16px; font-weight: 800; touch-action: manipulation; }
.pick-ring { position: relative; width: 74px; height: 74px; border-radius: 50%; padding: 4px; background: var(--green); transition: filter .2s, opacity .2s, background .2s; }
.pick-ring .avatar { border: 3px solid #fff; font-size: 1.8rem; }
.pick-mark { position: absolute; right: -3px; bottom: -3px; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; background: var(--green); color: #fff; display: grid; place-items: center; font-size: .85rem; }
.pick-mark::after { content: '✓'; }
.pick-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-face[aria-pressed="false"] .pick-ring { background: #D7D3E6; filter: grayscale(1); opacity: .5; }
.pick-face[aria-pressed="false"] .pick-mark::after { content: '✕'; }
.pick-face[aria-pressed="false"] .pick-name { color: var(--muted); text-decoration: line-through; }
.bullets { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.me-line { display: flex; gap: 12px; align-items: center; }
.me-line div { display: grid; }
.me-line small { color: var(--muted); }
.tabs { display: flex; gap: 6px; background: #fff; padding: 5px; border-radius: 999px; margin-bottom: 18px; overflow-x: auto; }
.tabs button { flex: 1 0 auto; min-height: 42px; padding: 0 10px; font-size: .92rem; border-radius: 999px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--grape); color: #fff; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 10px; }
.qr { width: min(260px, 70vw); margin: 0 auto; background: #fff; padding: 10px; border-radius: 18px; border: 3px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.invite { text-align: center; justify-items: center; }
.invite .row-btns { width: 100%; }

/* ---------- hojas (modales) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 70, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--soft); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow: auto; border-radius: 28px 28px 0 0; padding: 8px 18px calc(22px + var(--safe-b)); animation: up .25s cubic-bezier(.2, .9, .3, 1.1); }
.sheet.wide { max-width: 640px; }
.sheet-head { position: sticky; top: -8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; background: var(--soft); z-index: 1; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 28px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.pin { display: grid; gap: 20px; justify-items: center; padding-bottom: 6px; }
.pin-dots { display: flex; gap: 14px; min-height: 22px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--grape); }
.pin-dots span.on { background: var(--grape); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.pin-key { height: 76px; border-radius: 50%; background: #fff; font-family: var(--display); font-size: 1.8rem; font-weight: 800; color: var(--grape-ink); }
.pin-key:active { background: var(--line); }
.pin-key.ok { background: var(--grape); color: #fff; font-size: 1.3rem; }
.pin-key.del { background: transparent; }

/* ---------- llamadas ---------- */
.call {
  position: fixed; inset: 0; z-index: 40; color: #fff; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #4C2BAE 0%, var(--grape-night) 70%);
  display: flex; flex-direction: column;
}
.pulse { position: relative; border-radius: 50%; display: inline-block; }
.pulse::before, .pulse::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .55); animation: ripple 2.2s ease-out infinite; }
.pulse::after { animation-delay: 1.1s; }
.pulse .avatar { position: relative; border: 6px solid #fff; }
@keyframes ripple { from { transform: scale(1); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }
.incoming { justify-content: space-between; padding: calc(60px + var(--safe-t)) 24px calc(48px + var(--safe-b)); text-align: center; }
.incoming-main { display: grid; justify-items: center; gap: 26px; margin-top: 4vh; }
.incoming h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); max-width: 14ch; }
.with { opacity: .85; font-weight: 700; font-size: 1.1rem; }
.incoming-actions { display: flex; justify-content: space-around; max-width: 420px; width: 100%; margin: 0 auto; }
.act { display: grid; justify-items: center; gap: 10px; font-weight: 800; }
.bounce { animation: bounce 1.2s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(-10px); } }

.tiles { position: absolute; inset: 0; display: grid; gap: 4px; background: var(--grape-night); }
.tiles[data-count="2"] { grid-template-rows: 1fr 1fr; }
.tiles[data-count="3"], .tiles[data-count="4"] { grid-template: 1fr 1fr / 1fr 1fr; }
.tiles[data-count="3"] .tile:first-child { grid-column: span 2; }
@media (orientation: landscape) { .tiles[data-count="2"] { grid-template: 1fr / 1fr 1fr; } }
.tile { position: relative; overflow: hidden; background: radial-gradient(100% 70% at 50% 30%, #5532B8, #2A1660); display: grid; place-items: center; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.tile.has-video video { opacity: 1; }
.tile-photo { display: grid; place-items: center; transition: opacity .3s; }
.tile.has-video .tile-photo { opacity: 0; }
.tile:not(.ringing) .pulse::before, .tile:not(.ringing) .pulse::after { display: none; }
.tiles[data-count="3"] .avatar.xl, .tiles[data-count="4"] .avatar.xl { width: min(28vw, 150px); height: min(28vw, 150px); font-size: 3rem; }
.tiles[data-count="2"] .avatar.xl { width: min(30vh, 200px); height: min(30vh, 200px); }
.tile-name { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; align-items: center; padding: 4px 14px; border-radius: 999px; background: rgba(20, 10, 50, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.tiles[data-count="1"] .tile-name { top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); font-size: 1.4rem; white-space: nowrap; }
.mic-off-flag .icon { width: 18px; height: 18px; color: #FFB4B4; }
.call-status { position: absolute; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 6px 16px; border-radius: 999px; background: rgba(20, 10, 50, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 800; white-space: nowrap; z-index: 3; }
.self { position: absolute; top: calc(70px + var(--safe-t)); right: 14px; width: min(26vw, 140px); aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #3A2380; border: 3px solid rgba(255, 255, 255, .85); z-index: 3; box-shadow: 0 10px 26px rgba(0, 0, 0, .3); display: grid; place-items: center; }
.self video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self .self-photo { display: none; }
.self .character.self-photo { width: 84%; height: auto; }
/* Personaje cuando alguien apaga la cámara */
.character { display: block; width: 100%; height: 100%; }
.character svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tile-char { display: none; width: min(62vw, 280px); aspect-ratio: 1; }
.tile.show-char .tile-char { display: block; }
.tile.show-char { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--who) 55%, #fff), var(--who) 75%); }
.self.cam-off { background: var(--t, #3A2380); }
.tile.show-char .tile-photo { display: none; }
.tiles[data-count="2"] .tile-char { width: min(34vh, 230px); }
.tiles[data-count="3"] .tile-char, .tiles[data-count="4"] .tile-char { width: min(34vw, 170px); }
.char-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.char-opt { display: grid; justify-items: center; gap: 2px; padding: 4px 2px 6px; border-radius: 18px; border: 3px solid transparent; background: #fff; font-weight: 800; font-size: .78rem; color: var(--muted); }
.char-opt img { width: 100%; max-width: 72px; aspect-ratio: 1; display: block; }
.char-opt[aria-pressed="true"] { border-color: var(--grape); background: #fff; color: var(--grape-ink); }
/* Llamadas: panel que baja desde arriba */
.drawer-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 70, .35); animation: fade .2s; }
.drawer { position: absolute; top: 0; left: 0; right: 0; max-width: 680px; margin: 0 auto; max-height: 85vh; display: flex; flex-direction: column; gap: 10px; background: #F6F3FF; border-radius: 0 0 28px 28px; padding: calc(16px + var(--safe-t)) 16px 4px; box-shadow: 0 20px 50px rgba(30, 18, 70, .3); animation: drop .25s ease-out; touch-action: pan-y; }
.drawer h2 { margin: 0 6px; }
.drawer h3 { margin: 6px 6px 0; font-size: 1rem; color: var(--grape-ink); }
.drawer-body { overflow-y: auto; display: grid; gap: 8px; padding-bottom: 4px; }
.drawer-grip { align-self: center; display: grid; place-items: center; width: 72px; height: 36px; color: var(--grape); }
.drawer-grip .icon { width: 30px; height: 30px; }
.drawer-wrap.closing { animation: fade .22s reverse forwards; }
.drawer-wrap.closing .drawer { animation: lift .22s ease-in forwards; }
@keyframes drop { from { transform: translateY(-100%); } }
@keyframes lift { to { transform: translateY(-100%); } }
.self.cam-off video { display: none; }
.self.cam-off .self-photo { display: grid; }
.controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 3vw, 22px); padding: 30px 10px calc(18px + var(--safe-b)); background: linear-gradient(transparent, rgba(20, 10, 50, .6)); }
.ctrl { display: grid; justify-items: center; gap: 6px; font-size: .8rem; font-weight: 800; }
.ctrl .round-btn.red { width: 72px; height: 72px; }
@media (max-width: 380px) { .round-btn { width: 56px; height: 56px; } .ctrl span { font-size: .72rem; } }
.emoji-tray { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(120px + var(--safe-b)); display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; padding: 8px 10px; border-radius: 999px; background: rgba(255, 255, 255, .95); max-width: 94vw; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.emoji-tray[hidden] { display: none; }
/* Llamada minimizada: sigue viva (se oye) y arriba queda una barra para volver */
.call.minimized { visibility: hidden; pointer-events: none; }
.call-min-btn { position: absolute; z-index: 4; top: calc(12px + var(--safe-t)); right: 14px; width: 46px; height: 46px; }
.call-min-btn .icon { width: 26px; height: 26px; }
body.call-min #app { padding-top: calc(60px + var(--safe-t)); }
body.call-min .topbar { top: calc(68px + var(--safe-t)); margin-top: 8px; }
.call-banner { position: fixed; z-index: 45; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; min-height: calc(60px + var(--safe-t)); padding: calc(6px + var(--safe-t)) 10px 6px 0; background: var(--green-deep); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.cb-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px 0 4px 16px; color: #fff; text-align: left; }
.cb-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; flex: none; animation: cb-blink 1.2s ease-in-out infinite; }
@keyframes cb-blink { 50% { opacity: .25; } }
.cb-text { display: grid; min-width: 0; line-height: 1.25; }
.cb-text span { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-text small { font-weight: 700; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-banner .round-btn { box-shadow: none; }
/* Caras arriba durante la llamada para añadir a alguien */
.add-strip { position: absolute; z-index: 3; top: calc(60px + var(--safe-t)); left: 10px; right: calc(min(26vw, 140px) + 24px); display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.add-strip:empty { display: none; }
.strip-face { flex: none; width: 72px; display: grid; justify-items: center; gap: 3px; color: #fff; font-weight: 800; font-size: .85rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.strip-face .avatar { width: 60px; height: 60px; font-size: 1.5rem; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.strip-face span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-face small { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .72rem; text-shadow: none; white-space: nowrap; }
.strip-face.no-answer .avatar { border-color: var(--red); box-shadow: 0 0 0 3px var(--red), 0 6px 16px rgba(0, 0, 0, .3); }
.call.has-strip .tiles[data-count="1"] .tile-name { top: calc(160px + var(--safe-t)); }
.add-confirm { justify-items: center; text-align: center; }
.add-name { font-family: var(--display); font-weight: 800; font-size: 2.2rem; margin: 0; }
.emoji-btn { font-size: 2.3rem; width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; transition: transform .12s; }
.emoji-btn:active { transform: scale(1.3); }
.emoji-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.big-emoji { position: absolute; bottom: 12%; font-size: min(38vmin, 260px); line-height: 1; animation: emojiPop 2.6s cubic-bezier(.2, .8, .3, 1) forwards; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .3)); }
@keyframes emojiPop {
  0% { transform: translateY(40%) scale(.2) rotate(-12deg); opacity: 0; }
  15% { transform: translateY(0) scale(1.15) rotate(6deg); opacity: 1; }
  30% { transform: translateY(-6%) scale(1) rotate(-3deg); }
  80% { opacity: 1; }
  100% { transform: translateY(-80%) scale(.9) rotate(0); opacity: 0; }
}
.ended { align-items: center; justify-content: center; text-align: center; }
.ended-box { display: grid; justify-items: center; gap: 14px; padding: 24px; }
.ended-box .avatar.dim { opacity: .5; filter: grayscale(.4); }
.ended-emoji { font-size: 4.5rem; margin-top: -70px; margin-left: 120px; }

/* ---------- avisos ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 30px); opacity: 0; z-index: 90; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 800; max-width: 90vw; text-align: center; transition: .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.in-call #toast { bottom: auto; top: calc(64px + var(--safe-t)); transform: translate(-50%, -20px); }
.in-call #toast.show { transform: translate(-50%, 0); }
.offline-banner { position: fixed; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 95; display: flex; gap: 8px; align-items: center; background: var(--red); color: #fff; font-weight: 800; padding: 8px 18px; border-radius: 999px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
.kid-empty { font-size: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  .cloud, .pulse::before, .pulse::after, .bounce, .splash img, .ig-share, .ig-add, .cb-dot, .live-dot { animation: none !important; }
  .big-emoji { animation-duration: 1.6s; }
}

.link-box { width: 100%; background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 10px 12px; font-weight: 800; color: var(--grape-ink); word-break: break-all; -webkit-user-select: all; user-select: all; }

/* ================= Diseño con recursos: fondo con personajes, píldora blanca y botones 3D (public/ui) ================= */
body.sky-on { background: #F0ECFB; }
body.sky-on #sky { display: block; background: var(--app-bg); }
body.sky-on #sky .cloud { display: none; }
/* Píldora de arriba: foto, saludo, "En línea" y botones redondos */
.topbar { min-height: 82px; padding: 10px 12px 10px 10px; margin: calc(10px + var(--safe-t)) 12px 0; top: calc(8px + var(--safe-t)); background: none; box-shadow: none; color: var(--ink); border-radius: 999px; }
.topbar::before { content: ''; position: absolute; inset: 0; z-index: -1; border-style: solid; border-width: 0 41px; border-image: url(/ui/top.png) 0 120 fill / 0 41px / 0 stretch; border-radius: 999px; box-shadow: 0 12px 26px rgba(90, 60, 160, .16); }
.topbar-title { display: grid; line-height: 1.15; min-width: 0; }
.topbar-title strong { font-family: var(--display); font-weight: 800; font-size: clamp(1.3rem, 5.4vw, 1.8rem); color: #1E1B3A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title small { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; color: #6B6880; }
.on-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.on-dot.off { background: #B9B5C8; }
.topbar .me-badge { border: 4px solid #fff; box-shadow: 0 4px 12px rgba(60, 40, 120, .18); }
.top-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #1E1B3A; transition: transform .12s; }
.top-btn:active { transform: scale(.92); }
.top-btn.gear { background: url(/ui/btn-ajustes.png) center / contain no-repeat; }
.top-btn.bell { background: radial-gradient(circle at 35% 28%, #FFFFFF, #ECE6FF 50%, #D2C8F6); box-shadow: inset 0 -4px 8px rgba(120, 100, 200, .25), 0 4px 10px rgba(90, 60, 160, .18); }
.top-btn.bell .icon { width: 24px; height: 24px; }
.top-btn .badge { top: -4px; right: -4px; background: var(--red); border-color: #fff; }
/* Caras: anillo del color de su personaje, rayitas, punto "en línea" y nombre en cápsula */
.faces > .face:nth-child(even) { margin-top: calc(var(--face) * .14); }
.face .ring { padding: 13%; background: none; box-shadow: none; }
.face .ring::before { content: ''; position: absolute; inset: 0; background: var(--ring, url(/ui/ring-azul.png)) center / contain no-repeat; filter: hue-rotate(var(--hue, 0deg)); }
.face .ring .avatar { position: relative; }
.face .presence { right: 3%; bottom: 5%; width: 25%; height: 25%; max-width: 46px; max-height: 46px; border: 0; background: url(/ui/online.png) center / contain no-repeat; }
.face .name { color: #1E1B3A; background: none; padding: 4px 6px; border-style: solid; border-width: 0 22px; border-image: url(/ui/label.png) 0 70 fill / 0 22px / 0 stretch; }
.face.add .ring { width: var(--face); height: var(--face); margin: 0; padding: 0; background: url(/ui/btn-anadir.png) center / contain no-repeat; box-shadow: none; }
.face.add .ring::before, .face.add .ring .icon { display: none; }
.sparks { top: -12%; right: -10%; width: 32%; height: 32%; background: center / contain no-repeat; }
.sparks i { display: none; }
/* Barra de la llamada con los botones 3D (el de colgar, grande en el centro) */
.controls { left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); padding: 24px 4px 8px; gap: clamp(2px, 2vw, 14px); background: url(/ui/bottom.png) center bottom / 100% 100% no-repeat; }
.ctrl { color: #1E1B3A; font-size: .78rem; }
.img-btn { position: relative; width: 58px; height: 58px; border-radius: 50%; background: center / contain no-repeat; transition: transform .12s, filter .2s; }
.img-btn:active { transform: scale(.92); }
.img-btn.k-smile { background-image: url(/ui/btn-emoji-azul.png); }
.img-btn.k-plus { background-image: url(/ui/btn-anadir.png); }
.img-btn.k-mic { background-image: url(/ui/btn-micro.png); }
.img-btn.k-video { background-image: url(/ui/btn-video.png); }
.img-btn.k-hang { background-image: url(/ui/btn-colgar.png); width: 80px; height: 80px; }
.img-btn.k-accept { background-image: url(/ui/btn-llamar.png); width: 100px; height: 100px; }
.img-btn.k-decline { background-image: url(/ui/btn-colgar.png); width: 100px; height: 100px; }
.img-btn.off { filter: grayscale(.7); }
.img-btn.off::after { content: ''; position: absolute; left: 20%; right: 20%; top: calc(50% - 3px); height: 6px; border-radius: 3px; background: #1E1B3A; transform: rotate(-45deg); box-shadow: 0 0 0 2px #fff; }
.emoji-tray { bottom: calc(150px + var(--safe-b)); }
/* Llamada entrante y terminada con el fondo nuevo (texto oscuro) */
.call.incoming, .call.ended { background: var(--app-bg); color: #1E1B3A; }
.call.incoming .act span, .call.incoming p, .call.ended p { color: #4A4666; }
.call.ended .btn.light { background: #fff; box-shadow: 0 8px 20px rgba(90, 60, 160, .18); }
/* Acomodar caras con el dedo: la que se arrastra flota encima del resto */
.face.dragging { position: relative; z-index: 30; transition: none; filter: drop-shadow(0 18px 24px rgba(60, 30, 140, .3)); }
.faces.arranging .face:not(.dragging) .ring { animation: wiggle .35s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .faces.arranging .face .ring { animation: none; } }
/* Botón Añadir con ratón: crece despacio con un rebote suave, brillo rosa tenue y las rayitas se mueven un poco */
.face.add .ring { transition: transform .55s cubic-bezier(.34, 1.35, .64, 1); }
.face.add .ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .5s ease; pointer-events: none;
  box-shadow: 0 0 0 8px rgba(255, 90, 170, .14), 0 0 34px 6px rgba(255, 90, 170, .35); }
.face.add .sparks { transition: transform .6s cubic-bezier(.34, 1.35, .64, 1); }
@media (hover: hover) {
  .face { cursor: pointer; }
  .face.add:hover .ring { transform: scale(1.06); }
  .face.add:hover .ring::after { opacity: 1; }
  .face.add:hover .sparks { transform: translate(3px, -4px) rotate(8deg) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .face.add .ring, .face.add .sparks, .face.add .ring::after { transition: none; } }
/* Dibujar con el dedo encima de la llamada */
.draw-layer { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; touch-action: none; }
.draw-layer.on { pointer-events: auto; cursor: crosshair; }
.pencil-ico { width: 58px; height: 58px; border-radius: 50%; display: block;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M16.8 3.6a2 2 0 0 1 2.8 0l.8.8a2 2 0 0 1 0 2.8L9.2 18.4l-4.6 1.3a.6.6 0 0 1-.7-.7l1.3-4.6z'/%3E%3C/svg%3E") center / 46% no-repeat,
    radial-gradient(circle at 35% 28%, #D9FBE0, #4FD677 50%, #1FA34E); box-shadow: inset 0 -6px 12px rgba(0, 110, 40, .3), inset 0 6px 10px rgba(255, 255, 255, .6), 0 8px 18px rgba(0, 90, 30, .25); }
.draw-palette { position: absolute; z-index: 5; left: 14px; right: 14px; bottom: calc(242px + var(--safe-b)); display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 10px 24px rgba(0, 0, 0, .2); width: max-content; max-width: calc(100% - 100px); }
.draw-palette[hidden] { display: none; }
.draw-color { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(30, 27, 58, .15); }
.draw-color.on { box-shadow: 0 0 0 3px #1E1B3A; transform: scale(1.1); }
/* Barra de la llamada con 6 botones (Jugar incluido): un poco más compactos */
.img-btn { width: 52px; height: 52px; }
.img-btn.k-hang { width: 74px; height: 74px; }
.img-btn.k-play { background-image: url(/ui/btn-jugar.png); }
.controls { gap: clamp(0px, 1.2vw, 10px); }
.ctrl { min-width: 54px; font-size: .72rem; }
/* Jugar: tres en raya con las caritas, encima de la llamada */
.game { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; padding: calc(70px + var(--safe-t)) 16px calc(170px + var(--safe-b)); pointer-events: none; }
.game[hidden] { display: none; }
.game-card { pointer-events: auto; width: min(92vw, 380px); display: grid; gap: 10px; justify-items: center; padding: 16px; border-radius: 28px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(30, 20, 60, .3); color: #1E1B3A; }
.game-head { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.game-head b { color: var(--muted); font-size: .9rem; }
.game-player { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.game-player img { width: 36px; height: 36px; }
.game-title { margin: 0; font-family: var(--display); font-size: 1.45rem; font-weight: 800; }
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; width: 100%; }
.ttt-cell { aspect-ratio: 1; min-width: 0; min-height: 0; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 3px #ECE6FF, inset 0 -5px 0 rgba(120, 100, 200, .14); display: grid; place-items: center; overflow: hidden; transition: transform .12s, box-shadow .2s; }
.ttt-cell:not(:disabled):active { transform: scale(.94); }
@media (hover: hover) { .ttt-cell:not(:disabled):hover { box-shadow: inset 0 0 0 3px #C9B8FF, inset 0 -5px 0 rgba(120, 100, 200, .14); } }
.ttt-cell img { width: 88%; height: 88%; object-fit: contain; animation: pop-in .3s cubic-bezier(.34, 1.56, .64, 1); }
.ttt-cell.win { box-shadow: inset 0 0 0 5px #FFC93C, 0 0 18px rgba(255, 201, 60, .7); }
.game-card .btn { white-space: nowrap; }
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } }
/* Llamada minimizada: barra verde con el punto que parpadea, la llamada en curso y el botón de colgar encima del dibujado */
.call-banner { left: 50%; right: auto; top: calc(8px + var(--safe-t)); transform: translateX(-50%); display: block; width: min(94vw, 520px); aspect-ratio: 5.762; min-height: 0; padding: 0;
  background: url(/ui/barra-llamada.png) center / 100% 100% no-repeat; border-radius: 999px; box-shadow: 0 10px 24px rgba(10, 120, 60, .28); animation: cb-in .45s cubic-bezier(.34, 1.4, .64, 1); }
@keyframes cb-in { from { transform: translate(-50%, -120%); opacity: 0; } }
.call-banner .cb-dot { position: absolute; left: 3.4%; top: 50%; width: 3.74%; aspect-ratio: 1; height: auto; transform: translateY(-50%); background: #fff; border-radius: 50%; animation: cb-pulse 1.6s ease-out infinite; }
@keyframes cb-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .85); } 100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }
.call-banner .cb-main { position: absolute; inset: 0 17% 0 0; padding: 0 2% 0 10%; display: flex; align-items: center; color: #fff; text-align: left; }
.call-banner .cb-text span { color: #fff; font-size: clamp(.86rem, 3.7vw, 1.02rem); text-shadow: 0 1px 2px rgba(0, 70, 25, .4); }
.call-banner .cb-text small { color: #fff; opacity: .95; font-size: clamp(.72rem, 3vw, .82rem); text-shadow: 0 1px 2px rgba(0, 70, 25, .4); }
.call-banner .cb-hang { position: absolute; left: 90.81%; top: 51.3%; width: 15.2%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: url(/ui/btn-colgar.png) center / contain no-repeat; animation: cb-hang 2.2s ease-in-out infinite; }
.call-banner .cb-hang:active { transform: translate(-50%, -50%) scale(.9); }
@keyframes cb-hang { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.07); } }
body.call-min #app { padding-top: calc(min(94vw, 520px) / 5.762 + 16px + var(--safe-t)); }
body.call-min .topbar { top: calc(min(94vw, 520px) / 5.762 + 16px + var(--safe-t)); margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .call-banner, .call-banner .cb-dot, .call-banner .cb-hang { animation: none; } }
/* Barra de abajo del inicio (niño y familiares) con el botón Jugar */
.home-bar { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(6px + var(--safe-b)); width: min(96vw, 520px); aspect-ratio: 3.06;
  background: url(/ui/bottom.png) center / 100% 100% no-repeat; display: grid; place-items: center; padding-top: 3%; pointer-events: none; }
.home-play { pointer-events: auto; display: grid; justify-items: center; gap: 2px; font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: #1E1B3A; }
.home-play .img-btn { display: block; width: 78px; height: 78px; animation: play-bob 2.4s ease-in-out infinite; }
.home-play:active .img-btn { transform: scale(.92); }
@keyframes play-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.kid .faces, .adult .faces { padding-bottom: calc(180px + var(--safe-b)); }
/* Jugar solo contra la Bolita */
.solo-game { position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 70, .35); animation: fade .2s; }
.solo-game .game { padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); }
.solo-game .emoji-layer { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .home-play .img-btn { animation: none; } }
/* Fondo de la app: solo el degradado de esos colores (lila arriba, claro en medio, rosa y azul abajo), sin personajes */
:root { --app-bg: radial-gradient(120% 55% at 10% 0%, #C9A2FB 0%, rgba(201, 162, 251, 0) 62%), radial-gradient(90% 45% at 100% 6%, #D8B6FF 0%, rgba(216, 182, 255, 0) 60%),
  radial-gradient(85% 45% at 0% 100%, #FFBFE0 0%, rgba(255, 191, 224, 0) 65%), radial-gradient(85% 45% at 100% 100%, #B9E0FF 0%, rgba(185, 224, 255, 0) 65%), #F1EDFC; }
/* Llamada minimalista: abajo solo Micrófono, Colgar y Cámara */
.controls { left: 50%; right: auto; transform: translateX(-50%); width: min(96vw, 420px); gap: clamp(16px, 7vw, 40px); }
.controls .img-btn { width: 60px; height: 60px; }
.controls .img-btn.k-hang { width: 82px; height: 82px; }
/* Añadir arriba a la izquierda (al lado, las caras de quien se puede añadir) */
.add-top { position: absolute; z-index: 4; top: calc(60px + var(--safe-t)); left: 10px; width: 72px; display: grid; justify-items: center; gap: 3px; color: #fff; font-weight: 800; font-size: .85rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.add-top i { display: block; width: 60px; height: 60px; background: url(/ui/btn-anadir.png) center / contain no-repeat; transition: transform .12s; }
.add-top:active i { transform: scale(.92); }
.add-strip { left: 88px; }
.active-call:not(.ghost) .tiles[data-count="1"] .tile-name { top: calc(160px + var(--safe-t)); }
/* Jugar y Emojis flotando a la derecha (se esconden mientras se dibuja, para no tapar la paleta) */
/* Burbujita "¡X entró!": sube como una pompa, se queda un momento y se revienta */
.join-bubble { position: fixed; z-index: 60; left: 50%; top: calc(104px + var(--safe-t)); display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 999px;
  background: radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .98), rgba(240, 233, 255, .95) 60%, rgba(220, 205, 255, .95)); color: #1E1B3A;
  box-shadow: 0 12px 28px rgba(90, 60, 160, .25), inset 0 -4px 10px rgba(160, 130, 230, .25), inset 0 3px 6px rgba(255, 255, 255, .9);
  animation: bubble-in .55s cubic-bezier(.34, 1.56, .64, 1) both; transform: translateX(-50%); }
.join-bubble div { display: grid; line-height: 1.2; }
.join-bubble small { color: #6B6880; font-weight: 700; }
.join-bubble .avatar { box-shadow: 0 0 0 3px #4ADE80; }
.join-bubble.burst { animation: bubble-burst .45s ease-in forwards; }
@keyframes bubble-in { 0% { transform: translate(-50%, 30px) scale(.2); opacity: 0; } 70% { transform: translate(-50%, -4px) scale(1.08); opacity: 1; } 100% { transform: translate(-50%, 0) scale(1); } }
@keyframes bubble-burst { 40% { transform: translate(-50%, -6px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -10px) scale(1.5); opacity: 0; filter: blur(4px); } }
/* Su cara da un saltito al entrar */
.face.just-in .ring { animation: just-in .7s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes just-in { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 60% { transform: scale(.96); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .join-bubble, .join-bubble.burst, .face.just-in .ring { animation: none; } .join-bubble.burst { opacity: 0; } }
.join-bubble strong, .join-bubble small { white-space: nowrap; }
/* Con la barra de Jugar abajo, los mensajitos salen por encima de ella para no taparla */
body:has(.home-bar):not(.in-call) #toast { bottom: calc(150px + var(--safe-b)); }
/* Botón flotante "Diversión" y su menú (Emojis, Jugar, Dibujar) */
.fun-btn { position: absolute; z-index: 5; right: 14px; bottom: calc(226px + var(--safe-b)); display: grid; justify-items: center; gap: 4px; font-weight: 800; font-size: .78rem; color: #1E1B3A; }
.fun-btn i { display: block; width: 64px; height: 64px; border-radius: 50%; animation: fun-glow 2.8s ease-in-out infinite;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231E1B3A' d='M11 2l2 6 6 2-6 2-2 6-2-6-6-2 6-2zM19 14l.9 2.1L22 17l-2.1.9L19 20l-.9-2.1L16 17l2.1-.9z'/%3E%3C/svg%3E") center / 52% no-repeat,
    radial-gradient(circle at 35% 28%, #FFF6C9, #FFD45E 50%, #FFAE2B); box-shadow: inset 0 -6px 12px rgba(200, 110, 0, .3), inset 0 6px 10px rgba(255, 255, 255, .6), 0 8px 18px rgba(120, 70, 0, .25); }
.fun-btn span { background: rgba(255, 255, 255, .9); padding: 1px 10px; border-radius: 999px; }
.fun-btn:active i { transform: scale(.92); }
@keyframes fun-glow { 50% { box-shadow: inset 0 -6px 12px rgba(200, 110, 0, .3), inset 0 6px 10px rgba(255, 255, 255, .6), 0 8px 26px rgba(255, 190, 40, .6); } }
.draw-palette:not([hidden]) ~ .fun-btn { display: none; }
.fun-wrap { position: absolute; inset: 0; z-index: 8; background: rgba(20, 10, 50, .25); animation: fade .2s; }
.fun-menu { position: absolute; right: 12px; bottom: calc(316px + var(--safe-b)); display: flex; gap: 14px; padding: 14px 16px 12px; border-radius: 28px; background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 40px rgba(30, 20, 60, .3); transform-origin: bottom right; animation: fun-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes fun-pop { from { transform: scale(.3); opacity: 0; } }
.fun-opt { display: grid; justify-items: center; gap: 6px; font-weight: 800; font-size: .85rem; color: #1E1B3A; }
.fun-opt i, .fun-opt .img-btn { width: 64px; height: 64px; }
.fun-opt:active i { transform: scale(.92); }
.draw-done { min-height: 34px; padding: 0 12px; border-radius: 999px; background: #1E1B3A; color: #fff; font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .fun-btn i, .fun-menu { animation: none; } }
/* Paleta de dibujar: en columna a la derecha (debajo de mi cuadrito), y al final el ✓ para terminar */
.draw-palette { left: auto; right: 12px; bottom: auto; top: calc(84px + min(26vw, 140px) * 4 / 3 + var(--safe-t)); width: auto; max-width: none;
  flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 10px 7px; border-radius: 999px; }
.draw-color { width: 34px; height: 34px; }
.draw-done { width: 42px; height: 42px; min-height: 0; padding: 0; margin-top: 4px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; line-height: 1;
  background: radial-gradient(circle at 35% 28%, #7BF0A8, #22C55E 55%, #15994A); color: #fff; box-shadow: inset 0 -4px 8px rgba(0, 90, 40, .3), 0 4px 10px rgba(20, 120, 60, .3); }
.draw-done:active { transform: scale(.92); }
/* Jugar con varios: elegir jugadores y tablero que crece (3×3, 4×4, 5×5) */
.game-head { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
.ttt:has(.ttt-cell:nth-child(16)) { gap: 6px; }
.ttt:has(.ttt-cell:nth-child(25)) { gap: 5px; }
.ttt:has(.ttt-cell:nth-child(16)) .ttt-cell { border-radius: 14px; }
.play-go:disabled { opacity: .45; }
.solo-face { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 14px 8px 8px; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); text-align: left; }
.solo-face img { width: 58px; height: 58px; }
.solo-face span { display: grid; }
.solo-face small { color: var(--muted); font-weight: 700; }
/* Mi circulito en la llamada, con el mute en una esquina */
.self { aspect-ratio: 1; border-radius: 50%; }
.self-mic { position: absolute; z-index: 4; top: calc(70px + var(--safe-t) + min(26vw, 140px) - 44px); right: calc(14px + min(26vw, 140px) - 44px);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(43, 31, 94, .85); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.self-mic .icon { width: 22px; height: 22px; }
.self-mic.off { background: #FF4D6D; }
.draw-palette { top: calc(92px + min(26vw, 140px) + var(--safe-t)); }
/* Elegir juego */
.game-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-opt { display: grid; gap: 2px; padding: 12px 10px; border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 3px var(--line); text-align: center; }
.game-opt b { font-family: var(--display); font-size: 1.15rem; }
.game-opt small { color: var(--muted); font-weight: 700; }
.game-opt[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--grape); background: #F4EEFF; }
/* Invitación a jugar */
.game-invite { display: grid; gap: 8px; justify-items: center; }
.game-invite b { font-family: var(--display); font-size: 1.6rem; color: var(--grape-ink); }
.game-count { font-weight: 800; font-size: 1.1rem; background: #fff; padding: 4px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(90, 60, 160, .18); }
/* Carrera encima de la llamada */
.race { position: absolute; inset: 0; z-index: 9; background: #BFE4FF; }
.race.solo { position: fixed; z-index: 70; }
.race[hidden] { display: none; }
.race-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.race-vc { position: absolute; z-index: 2; top: calc(62px + var(--safe-t)); right: 12px; display: grid; justify-items: center; gap: 5px; }
.race-cam { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 4px solid #fff; display: grid; place-items: center;
  background: linear-gradient(180deg, #CFE9FF, #FFE1EF); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: box-shadow .2s; }
.race-cam.talk { box-shadow: 0 0 0 4px #2FC46B, 0 6px 18px rgba(0, 0, 0, .25); }
.race-cam video { width: 100%; height: 100%; object-fit: cover; }
.race-cam.mirror video { transform: scaleX(-1); }
.race-cam .character { width: 84%; height: 84%; }
.race-name { background: rgba(43, 31, 94, .85); color: #fff; border-radius: 12px; padding: 1px 10px; font-weight: 800; font-size: .8rem; }
.race-mic { display: grid; justify-items: center; gap: 3px; }
.race-mic .icon { width: 42px; height: 42px; padding: 10px; border-radius: 50%; background: rgba(43, 31, 94, .85); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.race-mic.off .icon { background: #FF4D6D; }
.race-mic span { font-size: .7rem; font-weight: 800; color: #2B1F5E; background: rgba(255, 255, 255, .92); padding: 0 8px; border-radius: 10px; }
.race-exit { position: absolute; z-index: 2; left: 12px; bottom: calc(30px + var(--safe-b)); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(43, 31, 94, .75); }
.race-exit .icon { width: 22px; height: 22px; }
/* Fuera de la carrera (sala y resultados) el circulito baja a la derecha y la flecha de salir se esconde (el juego trae sus botones) */
.race:not(.solo):not([data-screen="race"]) .race-vc { top: auto; bottom: calc(160px + var(--safe-b)); }
.race:not(.solo):not([data-screen="race"]) .race-cam { width: 78px; height: 78px; }
.race:not(.solo):not([data-screen="race"]) .race-exit { display: none; }
/* Abajo quedan Colgar y Cámara: barra más corta */
.controls:not(:has(.ctrl:nth-child(3))) { width: min(70vw, 260px); }
/* Elegir pista de la carrera (después de aceptar, entre todos) */
.race-pick { position: absolute; inset: 0; z-index: 1; display: none; overflow-y: auto; padding: calc(16px + var(--safe-t)) 14px calc(30px + var(--safe-b)); background: var(--app-bg); }
.race[data-screen="pick"] .race-pick { display: block; }
.race[data-screen="pick"] .race-frame { visibility: hidden; }
.race-pick-card { max-width: 460px; margin: 0 auto; display: grid; gap: 12px; padding-right: 104px; }
.race-pick-card h2 { font-family: var(--display); font-size: 1.7rem; margin: 6px 0 0; color: #1E1B3A; }
.race-pick-card .fine { margin: 0; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.track-opt { position: relative; display: grid; gap: 4px; justify-items: center; font-weight: 800; font-size: .78rem; color: #4A4666; }
.track-opt img { width: 100%; aspect-ratio: 9 / 13; object-fit: cover; border-radius: 16px; border: 3px solid #fff; box-shadow: 0 6px 14px rgba(60, 40, 120, .15); transition: transform .15s, border-color .15s; }
.track-opt[aria-pressed="true"] img { border-color: var(--grape); transform: scale(1.05); box-shadow: 0 0 0 3px #fff, 0 10px 22px rgba(91, 43, 201, .35); }
.track-opt[aria-pressed="true"] { color: var(--grape-ink); }
.track-who { position: absolute; top: 6px; right: 6px; display: flex; }
.track-who .avatar { width: 26px; height: 26px; font-size: .75rem; border: 2px solid #fff; margin-left: -8px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.race-wait { text-align: center; font-weight: 800; color: #4A4666; }
.race[data-screen="pick"] .race-vc { top: calc(16px + var(--safe-t)); bottom: auto; }
.race:not(.solo)[data-screen="pick"] .race-exit { display: grid; }
.sheet .track-grid { grid-template-columns: repeat(3, 1fr); }

/* ── Llamada: mi cámara se arrastra y crece con un toque · tocar la pantalla esconde los botones · Diversión junto a Colgar ·
      «Atrás» deja la llamada en un cuadrito · hasta 8 personas ── */
.self-wrap { position: absolute; z-index: 3; top: calc(70px + var(--safe-t)); right: 14px; width: min(26vw, 140px); touch-action: none; transition: width .25s ease; }
.self-wrap .self { position: relative; top: auto; right: auto; width: 100%; cursor: grab; }
.self-wrap.moving { transition: none; }
.self-wrap.moving .self { cursor: grabbing; }
.self-wrap .self-mic { top: auto; right: -4px; bottom: -4px; }
.self-wrap.big { width: min(76vw, 420px); }
.self-wrap.big .self { aspect-ratio: 3 / 4; border-radius: 26px; }
.active-call :is(.controls, .add-top, .add-strip, .call-status, .call-min-btn, .emoji-tray, .self-mic) { transition: opacity .25s ease; }
.active-call.chrome-off :is(.controls, .add-top, .add-strip, .call-status, .call-min-btn, .emoji-tray, .self-mic) { opacity: 0; pointer-events: none; }
.controls .fun-btn { position: static; z-index: auto; display: grid; justify-items: center; gap: 6px; font-size: .78rem; }
.controls .fun-btn i { width: 60px; height: 60px; }
.controls .fun-btn span { background: none; padding: 0; }
.controls:has(.fun-btn) { width: min(94vw, 380px); gap: clamp(10px, 5vw, 30px); }
.active-call:has(.draw-palette:not([hidden])) .controls .fun-btn { visibility: hidden; }
.fun-menu { left: 12px; right: auto; bottom: calc(150px + var(--safe-b)); transform-origin: bottom left; }
.call-min-btn { display: flex; align-items: center; gap: 2px; width: auto; height: 42px; padding: 0 14px 0 6px; border-radius: 999px; color: #fff; font-weight: 800; font-size: .9rem;
  background: rgba(43, 31, 94, .72); box-shadow: 0 4px 12px rgba(0, 0, 0, .2); backdrop-filter: blur(6px); }
.call-min-btn .icon { width: 22px; height: 22px; }
.self.rear video { transform: none; } /* la de atrás no va en espejo */
.call-pip { position: fixed; z-index: 60; right: 12px; top: calc(78px + var(--safe-t)); width: min(30vw, 130px); aspect-ratio: 3 / 4; padding: 0; border-radius: 18px; overflow: hidden;
  background: #3A2380; border: 3px solid #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, .3); display: grid; place-items: center; }
.call-pip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-pip .avatar { display: none; }
.call-pip.no-video video { display: none; }
.call-pip.no-video .avatar { display: grid; }
.tiles[data-count="5"], .tiles[data-count="6"] { grid-template: repeat(3, 1fr) / 1fr 1fr; }
.tiles[data-count="5"] .tile:first-child { grid-column: span 2; }
.tiles[data-count="7"] { grid-template: repeat(4, 1fr) / 1fr 1fr; }
.tiles[data-count="7"] .tile:first-child { grid-column: span 2; }
@media (orientation: landscape) {
  .tiles[data-count="5"], .tiles[data-count="6"] { grid-template: 1fr 1fr / repeat(3, 1fr); }
  .tiles[data-count="5"] .tile:first-child { grid-column: auto; grid-row: span 2; }
  .tiles[data-count="7"] { grid-template: 1fr 1fr / repeat(4, 1fr); }
  .tiles[data-count="7"] .tile:first-child { grid-column: auto; grid-row: span 2; }
}
:is(.tiles[data-count="5"], .tiles[data-count="6"], .tiles[data-count="7"]) .avatar.xl { width: min(22vw, 110px); height: min(22vw, 110px); font-size: 2.4rem; }
:is(.tiles[data-count="5"], .tiles[data-count="6"], .tiles[data-count="7"]) .tile-char { width: min(26vw, 130px); }
:is(.tiles[data-count="5"], .tiles[data-count="6"], .tiles[data-count="7"]) .tile-name { font-size: .8rem; }
/* Llamada en espera: quien llama, bien grande, con «Añadir a la llamada» */
.call-waiting { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(20, 10, 50, .55); backdrop-filter: blur(4px); animation: fade .2s; }
.cw-card { width: min(92vw, 380px); display: grid; justify-items: center; gap: 12px; padding: 26px 20px 18px; border-radius: 32px; background: #fff; text-align: center;
  box-shadow: 0 24px 60px rgba(20, 10, 50, .4); animation: fun-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
.cw-card h2 { margin: 4px 0 0; font-size: 1.35rem; color: #1E1B3A; }
.cw-card p { margin: 0 0 6px; color: var(--muted); font-weight: 700; }
.cw-card .btn { width: 100%; }
.cw-card .avatar.xl { width: min(46vw, 180px); height: min(46vw, 180px); font-size: 4rem; }
/* Contactos hablando entre ellos: juntos, con «Unirse» */
.call-group { display: flex; align-items: center; gap: 12px; margin: 10px 14px 4px; padding: 10px 12px; border-radius: 24px; background: rgba(255, 255, 255, .92); box-shadow: 0 8px 22px rgba(60, 30, 120, .14); position: relative; z-index: 2; }
.cg-faces { display: flex; flex-shrink: 0; }
.cg-faces .avatar { width: 50px; height: 50px; border: 3px solid #fff; }
.cg-faces .avatar + .avatar { margin-left: -16px; }
.cg-text { flex: 1; min-width: 0; display: grid; }
.cg-text strong { color: #1E1B3A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-text small { display: flex; align-items: center; gap: 6px; color: #16A34A; font-weight: 800; }
.cg-text .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }
.cg-join { flex-shrink: 0; min-height: 42px; padding: 0 18px; }
/* Llamando… (mientras suena o conecta, sin video todavía): el mismo fondo del inicio, no violeta */
.active-call, .active-call .tiles { background: var(--app-bg); }
.active-call .tile:not(.has-video):not(.show-char) { background: transparent; }
/* La pantalla se divide entre todos, contándome (sin círculo en la esquina):
   2 → uno arriba y yo abajo · 3 → dos arriba y yo abajo · 4 → en cuatro · 5–8 → de dos en dos (el último, ancho) */
.tiles .self { position: relative; inset: auto; top: auto; right: auto; width: auto; height: auto; aspect-ratio: auto; border-radius: 0; border: 0; box-shadow: none; z-index: auto; cursor: default; }
.tiles .self.cam-off { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--t, #3A2380) 55%, #fff), var(--t, #3A2380) 75%); }
.tiles .self .character.self-photo { width: min(46vw, 220px); }
.tiles .self .self-mic { position: absolute; top: 12px; right: 12px; bottom: auto; }
.tiles .tile .tile-name { top: auto; bottom: 12px; }
.tiles .self .tile-name, .tiles[data-count="4"] .tile:nth-child(3) .tile-name, .tiles[data-count="6"] .tile:nth-child(5) .tile-name,
.tiles[data-count="8"] .tile:nth-child(7) .tile-name { top: 12px; bottom: auto; }
.tiles[data-count="3"] .tile:first-child, .tiles[data-count="5"] .tile:first-child, .tiles[data-count="7"] .tile:first-child { grid-column: auto; grid-row: auto; }
.tiles[data-count="3"] > :last-child, .tiles[data-count="5"] > :last-child, .tiles[data-count="7"] > :last-child { grid-column: span 2; }
.tiles[data-count="8"] { grid-template: repeat(4, 1fr) / 1fr 1fr; }
@media (orientation: landscape) {
  .tiles[data-count="3"] { grid-template: 1fr / repeat(3, 1fr); }
  .tiles[data-count="3"] > :last-child { grid-column: auto; }
  .tiles[data-count="8"] { grid-template: 1fr 1fr / repeat(4, 1fr); }
}
.tiles[data-count="8"] .avatar.xl { width: min(22vw, 110px); height: min(22vw, 110px); font-size: 2.4rem; }
.tiles[data-count="8"] .tile-char { width: min(26vw, 130px); }
.tiles[data-count="8"] .tile-name { font-size: .8rem; }
/* ¿A qué jugamos?: cada juego con su dibujo; las caras sin elegir se ven normales (con +), elegidas con ✓ verde */
.game-choose { gap: 12px; }
.game-opt { gap: 4px; padding: 8px 8px 12px; border-radius: 24px; transition: transform .12s, box-shadow .2s, background .2s; }
.game-opt:active { transform: scale(.97); }
.game-art { display: block; height: 92px; margin-bottom: 4px; border-radius: 17px; overflow: hidden; background: #EFE8FF; }
.game-art > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ttt-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; height: 100%; padding: 8px 20%; box-sizing: border-box;
  background: linear-gradient(160deg, #FFE7F4, #E5F1FF); }
.ttt-art i { display: grid; place-items: center; border-radius: 7px; background: rgba(255, 255, 255, .85); }
.ttt-art img { width: 82%; height: 82%; object-fit: contain; }
.game-opt[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--grape), 0 10px 22px rgba(90, 50, 200, .18); }
.game-opt[aria-pressed="true"] .game-art { box-shadow: 0 0 0 2px #fff; }
.solo-face { padding: 10px 16px 10px 10px; box-shadow: 0 8px 20px rgba(80, 50, 150, .08), inset 0 0 0 2px var(--line); }
.solo-face::after { content: '›'; margin-left: auto; font-size: 1.8rem; line-height: 1; color: var(--grape); font-weight: 800; }
.play-faces { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px 10px; margin: 2px 0 6px; }
.play-faces .pick-ring { width: 84px; height: 84px; background: #fff; box-shadow: 0 8px 18px rgba(80, 50, 150, .14); transition: box-shadow .2s, transform .15s; }
.play-faces .pick-face:active .pick-ring { transform: scale(.94); }
.play-faces .pick-face[aria-pressed="false"] .pick-ring { background: #fff; filter: none; opacity: 1; }
.play-faces .pick-face[aria-pressed="false"] .pick-name { color: #1E1B3A; text-decoration: none; }
.play-faces .pick-face[aria-pressed="false"] .pick-mark { background: #fff; color: var(--grape); box-shadow: inset 0 0 0 2px #D9CFF5; font-size: 1.1rem; font-weight: 900; }
.play-faces .pick-face[aria-pressed="false"] .pick-mark::after { content: '+'; }
.play-faces .pick-face[aria-pressed="true"] .pick-ring { background: #22C55E; box-shadow: 0 0 0 3px #fff, 0 0 0 6px #22C55E, 0 10px 22px rgba(34, 197, 94, .35); }
.play-faces .pick-face[aria-pressed="true"] .pick-mark { background: #22C55E; }
.play-faces .pick-face.online .pick-ring::before { content: ''; position: absolute; left: 4px; top: 4px; z-index: 1; width: 16px; height: 16px; border-radius: 50%; background: #22C55E; border: 3px solid #fff; }
.play-go { width: 100%; }
.btn.big.play-go { font-size: 1.5rem; }
/* ¿A qué jugamos?: títulos en el violeta del botón */
.play-sheet .sheet-head h2, .play-sheet .family-wrap h3 { color: var(--grape); }
.play-go:disabled { opacity: 1; background: #E7E1F8; color: #7A6FA5; box-shadow: none; }
/* El banner del juego: pequeñito arriba del menú «¿A qué jugamos?»; al tocar ¡Jugar! crece a pantalla completa con el logo FAM (la carga) */
.play-banner { height: clamp(110px, 17vh, 150px); border-radius: 22px; overflow: hidden; box-shadow: 0 10px 24px rgba(90, 50, 180, .18); }
.play-banner img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 44%; display: block; }
.play-intro { position: fixed; inset: 0; z-index: 100; background: #F6D9EE; transition: opacity .45s ease; }
.play-intro img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.play-intro.out { opacity: 0; pointer-events: none; }
.play-intro-dots { position: absolute; left: 50%; bottom: calc(38px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 10px; }
.play-intro-dots i { width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(90, 50, 180, .35); animation: intro-dot 1s ease-in-out infinite; }
.play-intro-dots i:nth-child(2) { animation-delay: .15s; }
.play-intro-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes intro-dot { 50% { transform: translateY(-10px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .play-intro-dots i { animation: none; } }
/* Billar en el menú de juegos: tres juegos en fila y la mesita dibujada */
.game-choose.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.game-choose.three .game-opt { padding: 6px 6px 10px; }
.game-choose.three .game-art { height: 78px; }
.game-choose.three .game-opt b { font-size: 1rem; }
.game-choose.three .game-opt small { font-size: .72rem; }
.pool-art { display: block; width: 100%; height: 100%; padding: 8px; background: linear-gradient(160deg, #A787F7, #7350E4); box-sizing: border-box; }
.pool-felt { position: relative; display: block; width: 100%; height: 100%; border-radius: 10px; background: radial-gradient(circle at 50% 45%, #6EE2C6, #38B897); }
.pool-felt i { position: absolute; width: 14%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: inset -2px -2px 3px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .2); }
.pool-felt i.pool-cue { left: 50%; top: 82%; background: #FFFDF8; }
.family-wrap > .stack[hidden] { display: none; }
.race.solo.billar { background: #F3EEFF; }
.race.solo.popup { background: #A5C1FA; }
.billar-exit { top: calc(12px + var(--safe-t)); bottom: auto; right: 12px; left: auto; }
/* Carrusel de juegos: el banner completo y grande; se desliza de lado (o con las flechas); el del centro es el elegido */
.gc { display: grid; gap: 8px; margin: 0 -18px; }
.gc-stage { position: relative; }
.gc-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 15% 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gc-track::-webkit-scrollbar { display: none; }
.gc-card { position: relative; flex: 0 0 70%; max-width: 330px; aspect-ratio: 941 / 1672; padding: 0; border-radius: 28px; overflow: hidden; scroll-snap-align: center;
  background: #EFE8FF; box-shadow: 0 14px 30px rgba(80, 50, 160, .22); transform: scale(.9); opacity: .65; transition: transform .3s ease, opacity .3s ease, box-shadow .3s; }
.gc-card.on { transform: scale(1); opacity: 1; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--grape), 0 18px 36px rgba(80, 50, 160, .3); }
.gc-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gc-label { position: absolute; left: 10px; right: 10px; bottom: 10px; display: grid; padding: 8px 12px; border-radius: 18px; background: rgba(255, 255, 255, .92); text-align: center; box-shadow: 0 6px 16px rgba(60, 30, 120, .18); }
.gc-label b { font-family: var(--display); font-size: 1.2rem; color: #1E1B3A; line-height: 1.15; }
.gc-label small { color: var(--muted); font-weight: 800; font-size: .8rem; }
.gc-arrow { position: absolute; top: 50%; z-index: 2; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; display: grid; place-items: center; color: var(--grape);
  background: rgba(255, 255, 255, .95); box-shadow: 0 6px 16px rgba(60, 30, 120, .22); transition: opacity .2s; }
.gc-arrow .icon { width: 24px; height: 24px; }
.gc-arrow.prev { left: 10px; }
.gc-arrow.next { right: 10px; }
.gc-arrow.next .icon { transform: scaleX(-1); }
.gc-arrow:disabled { opacity: 0; pointer-events: none; }
.gc-dots { display: flex; justify-content: center; gap: 8px; }
.gc-dots button { width: 9px; height: 9px; padding: 0; border-radius: 999px; background: #D5CBF2; transition: width .25s, background .25s; }
.gc-dots button.on { width: 26px; background: var(--grape); }
/* El nombre «Carrera» encima de su banner, inflado como los logos de BILLAR y XERITO */
.gc-title { position: absolute; left: 0; right: 0; top: 6%; text-align: center; font-family: var(--display); font-weight: 800; line-height: 1; letter-spacing: .01em;
  font-size: clamp(2rem, 10.5vw, 3rem); color: #FFF7EC; -webkit-text-stroke: .1em #6F6CE9; paint-order: stroke fill; transform: rotate(-3deg);
  text-shadow: 0 .05em 0 #F58A70, 0 .09em 0 #F58A70, 0 .13em 0 #E46D5A, 0 .2em .3em rgba(80, 40, 140, .35); pointer-events: none; }
.gc-label { display: none; }
/* el logo FAM RACE encima del banner de la Carrera (en el carrusel y en la carga) */
.gc-card img.gc-logo, .play-intro .pi-card img.gc-logo { position: absolute; left: 6%; top: 3%; width: 88%; height: auto; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(60, 30, 140, .3)); }
/* La pantalla de carga: el banner entero en una tarjeta vertical redondeada, sobre el fondo del inicio */
.play-intro { background: none; }
.play-intro .pi-bg { position: absolute; inset: 0; background: var(--app-bg); }
.play-intro .pi-wrap { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 22px; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); }
.play-intro .pi-card { position: relative; height: min(74vh, calc(84vw * 1672 / 941)); aspect-ratio: 941 / 1672; border-radius: 32px; overflow: hidden; transform-origin: top left;
  box-shadow: 0 0 0 4px #fff, 0 24px 50px rgba(80, 40, 160, .32); }
.play-intro .pi-card img { position: static; width: 100%; height: 100%; object-fit: cover; display: block; }
.play-intro .play-intro-dots { position: static; transform: none; }
.play-intro .play-intro-dots i { background: var(--grape); }
/* Invitación a jugar: el banner del juego, quién te invita y Aceptar invitación / Rechazar */
.call.game-invite { display: grid; grid-template-rows: 1fr auto auto; justify-items: center; align-items: center; gap: 16px; padding: calc(18px + var(--safe-t)) 18px calc(20px + var(--safe-b)); }
.gi-card { position: relative; height: min(58vh, calc(80vw * 1672 / 941)); aspect-ratio: 941 / 1672; border-radius: 30px; overflow: hidden;
  box-shadow: 0 0 0 4px #fff, 0 22px 48px rgba(80, 40, 160, .3); animation: fun-pop .45s cubic-bezier(.34, 1.56, .64, 1); }
.gi-card > img:first-child { width: 100%; height: 100%; object-fit: cover; display: block; }
.gi-card img.gc-logo { position: absolute; left: 6%; top: 3%; width: 88%; height: auto; filter: drop-shadow(0 6px 10px rgba(60, 30, 140, .3)); }
.gi-who { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 8px 20px rgba(80, 50, 150, .14); }
.gi-who div { display: grid; }
.gi-who strong { color: #1E1B3A; font-size: 1.05rem; }
.gi-who small { color: var(--muted); font-weight: 800; }
.gi-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; width: min(100%, 440px); }
.gi-actions .btn.green { animation: bounce 1.6s ease-in-out infinite; }

/* ---------- video de las caritas detrás de la entrada (código, invitación y primeros pasos) ---------- */
#intro-video { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: #DDD7D8; }
body.intro-on { background: linear-gradient(180deg, #E6DFD9, #C9C3C6) fixed; }
body.intro-on #sky { display: none; }
/* el texto y los botones en una tarjeta de vidrio abajo; arriba se ven las caritas moviéndose */
body.intro-on #app { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100vh; min-height: 100dvh; padding-top: calc(16px + var(--safe-t)); }
body.intro-on .center-screen { min-height: 0; justify-content: flex-start; width: 100%; max-width: 520px; margin: 0 auto; gap: 16px;
  padding: 26px 24px calc(24px + var(--safe-b)); border-radius: 30px 30px 0 0;
  background: rgba(250, 248, 253, .86); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 -10px 40px rgba(43, 36, 64, .14); }
body.intro-on .center-screen > .logo { display: none; }
@media (min-width: 600px) { body.intro-on .center-screen { border-radius: 30px; margin-bottom: 28px; } }
/* computadora o tableta acostada: el video completo en el centro, sin cortarlo, y las caritas borrosas a los lados */
@media (min-aspect-ratio: 4/5) {
  #intro-video { object-fit: contain; background: transparent; }
  body.intro-on::before { content: ''; position: fixed; inset: -60px; z-index: 0; background: url(/ui/fondo-entrada.jpg) center / cover; filter: blur(48px) saturate(1.1); opacity: .7; }
}

/* ---------- web (computadora): que todo quepa y se vea centrado ---------- */
/* inicio: las caras centradas aunque sean pocas (3 por fila en tableta, 4 en computadora) */
@media (min-width: 640px) {
  .faces:not(.small) { grid-template-columns: repeat(auto-fit, calc(var(--face) + 28px)); justify-content: center; max-width: calc(3 * var(--face) + 128px); }
}
@media (min-width: 1100px) {
  .faces:not(.small) { max-width: calc(4 * var(--face) + 164px); }
}
/* ¿A qué jugamos?: el botón «¡Jugar!» siempre a la vista y el banner más bajito si la ventana es baja */
.play-sheet .play-go { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 0 0 12px var(--soft); }
.play-sheet .gc-card { flex-basis: min(70%, 330px, calc(52dvh * .563)); }
/* computadora: el juego a la izquierda; la familia y «¡Jugar!» a la derecha */
@media (min-width: 760px) {
  .play-sheet .sheet { max-width: 920px; }
  .play-sheet .sheet-body > .stack { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 28px; row-gap: 18px; align-items: center; }
  .play-sheet .gc { grid-row: 1 / 3; margin: 0 0 0 -18px; }
  .play-sheet .family-wrap { align-self: end; }
  .play-sheet .play-go { align-self: start; position: static; box-shadow: none; }
  .play-sheet .gc-card { flex-basis: min(78%, 330px, calc((100dvh - 190px) * .563)); }
}
/* entrada en computadora: el video a la izquierda y la tarjeta a la derecha */
@media (min-width: 900px) and (min-aspect-ratio: 4/5) {
  #intro-video { right: auto; width: 52%; }
  body.intro-on #app { flex-direction: row; align-items: center; justify-content: flex-end; padding: 24px max(40px, calc(24vw - 220px)) 24px 0; }
  body.intro-on .center-screen { width: min(440px, 42vw); margin: 0; border-radius: 30px; }
}
