/* Lotería Duo · live game player page (juega.loteriaduo.com). Phone-first; also fine on tablets. */
@font-face { font-family: 'OpenSans'; font-weight: 800; src: url('fonts/OpenSans_800ExtraBold.ttf'); font-display: swap; }
@font-face { font-family: 'OpenSans'; font-weight: 700; src: url('fonts/OpenSans_700Bold.ttf'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 400; src: url('fonts/Lato_400Regular.ttf'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 700; src: url('fonts/Lato_700Bold.ttf'); font-display: swap; }
:root {
  --bg: #0F0A1F; --surface: #160F2E; --surface2: #1E1640; --line: rgba(249, 239, 231, 0.12);
  --cream: #F9EFE7; --muted: #A99FC7; --teal: #14B8B8; --teal-ink: #062B2B; --gold: #FEB500; --gold-ink: #2A1A00; --coral: #F2685C;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--cream); font-family: 'Lato', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

#app { position: relative; max-width: 560px; height: 100%; margin: 0 auto; }
section { display: none; height: 100%; }
.s-code .code, .s-joining .joining, .s-join .join, .s-ended .ended { display: flex; }
.s-game .game { display: flex; }

/* ---------- centered screens ---------- */
.code, .joining, .join, .ended { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b)); }
.logo { width: 96px; height: 96px; border-radius: 24px; }
.rooster { width: 120px; height: auto; }
h1 { font: 800 28px/1.15 'OpenSans', sans-serif; }
h2 { font: 800 22px/1.2 'OpenSans', sans-serif; }
form { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.field { width: 100%; height: 54px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface2); padding: 0 16px; font-size: 18px; outline: none; }
.field:focus { border-color: var(--teal); }
.field.big { text-align: center; font: 800 28px 'OpenSans', sans-serif; letter-spacing: 0.12em; height: 64px; text-transform: uppercase; }
.field::placeholder { color: rgba(169, 159, 199, 0.6); letter-spacing: 0.05em; }
.hint { font-size: 13px; color: var(--muted); text-align: left; margin-top: -4px; }
.err { color: var(--coral); font-weight: 700; font-size: 15px; min-height: 1px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.45; margin-top: 8px; max-width: 340px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 26px; font: 800 17px 'OpenSans', sans-serif; text-decoration: none; width: 100%; }
.btn svg { width: 22px; height: 22px; }
.btn.gold { background: var(--gold); color: var(--gold-ink); }
.btn.teal { background: var(--teal); color: var(--teal-ink); }
.btn.coral { background: var(--coral); color: #fff; }
.btn.outline { border: 1.5px solid var(--line); color: var(--cream); }
.btn:disabled { opacity: 0.55; }
.lang { margin-top: 8px; color: var(--teal); font: 700 15px 'Lato', sans-serif; padding: 8px 12px; }
.lang.small { margin: 0; padding: 6px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.chips { display: flex; gap: 8px; justify-content: center; }
.live { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(242, 104, 92, 0.16); color: var(--coral); font: 800 13px 'OpenSans', sans-serif; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(20, 184, 184, 0.25); border-top-color: var(--teal); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#notFound { display: flex; flex-direction: column; gap: 14px; width: 100%; margin-top: 6px; }

/* ---------- game ---------- */
.game { flex-direction: column; position: relative; }
.top { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 16px 8px; }
.icon { width: 38px; height: 38px; border-radius: 19px; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon svg { width: 18px; height: 18px; }
.title { flex: 1; min-width: 0; font: 800 17px 'OpenSans', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offline { margin: 0 16px 6px; padding: 8px 12px; border-radius: 12px; background: rgba(254, 181, 0, 0.12); color: var(--gold); font-weight: 700; font-size: 14px; text-align: center; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(150px + var(--safe-b)); }

.waiting { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 0 18px; }
.waiting img { width: 110px; }
.waiting .deck { color: var(--teal); font: 800 18px 'OpenSans', sans-serif; }

.cur { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.cur .c { position: relative; width: 38%; max-width: 170px; aspect-ratio: 0.7; border-radius: 12px; background: #fff; padding: 5px; border: 3px solid var(--gold); flex: 0 0 auto; box-shadow: 0 0 22px rgba(254, 181, 0, 0.22); }
.cur .c img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; display: block; }
.cur .c.flip { animation: flipIn 0.6s cubic-bezier(.2, .8, .25, 1); }
@keyframes flipIn { 0% { transform: rotateY(-90deg) scale(0.94); opacity: 0.2; } 60% { transform: rotateY(8deg) scale(1.02); opacity: 1; } 100% { transform: none; } }
.cur .tag, .grid .tag { position: absolute; top: -9px; left: -6px; background: var(--gold); color: var(--gold-ink); font: 700 10px 'Lato', sans-serif; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; z-index: 2; }
.ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 800 26px 'OpenSans', sans-serif; color: rgba(15, 10, 31, 0.35); }
.has-img > .ph, .has-img .ph { display: none; }
.cur-text { flex: 1; min-width: 0; }
.cur .num { color: var(--muted); font: 800 13px 'OpenSans', sans-serif; }
.cur .nm { font: 800 26px/1.05 'OpenSans', sans-serif; overflow-wrap: anywhere; }
.cur .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.cur .n { margin-top: 12px; display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.cur .n b { font: 800 22px 'OpenSans', sans-serif; }
.cur .n span { color: var(--muted); font-size: 14px; }
.paused { font-style: normal; color: var(--gold); border: 1px solid rgba(254, 181, 0, 0.5); border-radius: 999px; padding: 1px 8px; font: 800 11px 'OpenSans', sans-serif; letter-spacing: 0.1em; text-transform: uppercase; }
.track { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); margin-top: 6px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.5s ease; }

.search { margin-top: 16px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--muted); }
.search svg { width: 19px; height: 19px; flex: 0 0 auto; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; color: var(--cream); font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.answer { margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(20, 184, 184, 0.14); }
.answer.no { background: rgba(242, 104, 92, 0.14); }
.answer.none { background: var(--surface2); }
.answer img { width: 36px; aspect-ratio: 0.7; object-fit: cover; border-radius: 4px; background: #fff; }
.answer .a1 { font: 800 15px 'OpenSans', sans-serif; } .answer .a2 { font-size: 13px; color: var(--muted); }
.answer .dot { margin-left: auto; width: 28px; height: 28px; border-radius: 14px; background: var(--teal); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.answer.no .dot { background: var(--coral); }
.answer .dot svg { width: 16px; height: 16px; }

.seg { margin-top: 14px; display: flex; background: var(--surface2); border-radius: 14px; padding: 4px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 10px; font: 700 14px 'Lato', sans-serif; color: var(--muted); }
.seg .on { background: var(--teal); color: var(--teal-ink); }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (min-width: 480px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.grid .t { position: relative; }
.grid .f { position: relative; aspect-ratio: 0.7; border-radius: 6px; overflow: hidden; background: #fff; border: 2px solid transparent; }
.grid .f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .t.latest .f { border-color: var(--gold); }
.grid .t.hit .f { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.grid .o { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: rgba(15, 10, 31, 0.85); font: 700 10px 'Lato', sans-serif; display: flex; align-items: center; justify-content: center; padding: 0 4px; color: #fff; }
.grid.rest .f { opacity: 0.6; }
.grid .ph { font-size: 16px; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; }

.bottom { position: absolute; left: 0; right: 0; bottom: calc(44px + var(--safe-b)); padding: 14px 16px 10px; background: linear-gradient(0deg, var(--bg) 72%, rgba(15, 10, 31, 0)); }
.web { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + var(--safe-b)); background: var(--surface2); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; text-decoration: none; }
.web b { color: var(--teal); }

/* ---------- overlays ---------- */
.sheet-wrap { position: absolute; inset: 0; z-index: 20; background: rgba(8, 6, 15, 0.7); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 26px 26px 0 0; border-top: 1px solid var(--line); padding: 22px 22px calc(26px + var(--safe-b)); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.sheet-rooster { width: 90px; }
.two { display: flex; gap: 10px; width: 100%; margin-top: 6px; }
.big-overlay { position: absolute; inset: 0; z-index: 15; background: rgba(15, 10, 31, 0.96); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; overflow: hidden; }
.big-overlay .hop { width: 130px; animation: hop 0.9s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px); } }
.lot { font: 800 52px 'OpenSans', sans-serif; color: var(--gold); }
.winner-names { font: 800 24px 'OpenSans', sans-serif; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -5%; width: 8px; height: 14px; border-radius: 2px; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.tie { justify-content: flex-start; padding-top: calc(70px + var(--safe-t)); overflow-y: auto; }
.tie-status { color: var(--gold); font: 800 17px 'OpenSans', sans-serif; }
.tie-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; margin-top: 8px; align-items: start; }
.tie-grid .tt { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.tie-grid .f { width: 100%; aspect-ratio: 0.7; border-radius: 8px; overflow: hidden; background: linear-gradient(160deg, #1d3d8c, #0B2353); border: 2px solid rgba(249, 239, 231, 0.2); display: flex; align-items: center; justify-content: center; }
.tie-grid .f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tie-grid .f .back { width: 55%; height: auto; object-fit: contain; }
.tie-grid .lead .f { border-color: var(--gold); box-shadow: 0 0 16px rgba(254, 181, 0, 0.5); }
.tie-grid .who { text-align: center; min-height: 16px; font: 700 13px 'Lato', sans-serif; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tie-grid .lead .who { color: var(--gold); }

@media (prefers-reduced-motion: reduce) { .cur .c.flip, .big-overlay .hop, .confetti i, .live i, .spinner { animation: none; } }
