/* ---------- Phone player app ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding-top: var(--safe-t); }

/* Join */
#join { padding: 24px 22px calc(24px + var(--safe-b)); justify-content: center; gap: 4px; }
.join-hero { height: 150px; display: grid; place-items: center; margin-bottom: 10px; }
.fan { position: relative; width: 220px; height: 150px; }
.fan .card { position: absolute; width: 86px; left: 67px; top: 10px; transform-origin: 50% 120%; }
.fan .card:nth-child(1) { transform: rotate(-16deg) translateX(-34px); }
.fan .card:nth-child(2) { transform: translateY(-6px); z-index: 1; }
.fan .card:nth-child(3) { transform: rotate(16deg) translateX(34px); }
@keyframes fanIn { from { transform: translateY(40px) rotate(0); opacity: 0; } }
.fan .card { animation: fanIn .7s cubic-bezier(.2, .9, .3, 1.1) both; }
.fan .card:nth-child(2) { animation-delay: .08s; }
.fan .card:nth-child(3) { animation-delay: .16s; }
.wordmark {
  font-family: var(--display); font-weight: 400; text-align: center; margin: 0;
  font-size: clamp(2.8rem, 14vw, 4.2rem); line-height: 1; color: var(--marigold);
  text-shadow: 3px 3px 0 var(--rosa), 6px 6px 0 var(--ink);
  letter-spacing: -.01em;
}
.tagline { text-align: center; color: var(--muted); margin: 10px 0 22px; font-size: 1.05rem; }
.join-form { display: grid; gap: 14px; }
.code-in { text-transform: uppercase; letter-spacing: .4em; font-family: var(--display); font-size: 1.6rem; text-align: center; padding-left: calc(16px + .4em); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-err { color: var(--danger); min-height: 1.4em; margin: 0; text-align: center; font-weight: 600; }
.join-foot { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 18px; }
.join-foot a { color: var(--marigold-2); }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 60px; }
.topbar-spacer { flex: 1; }
.codechip {
  display: inline-flex; align-items: baseline; gap: 8px; height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--night-2);
}
.codechip-label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.codechip b { font-family: var(--display); font-weight: 400; font-size: 1.25rem; letter-spacing: .12em; color: var(--marigold-2); }
.gstat { flex: 1; display: grid; text-align: center; line-height: 1.15; }
.gstat b { font-size: .95rem; }
.gstat span { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Lobby */
.lobby-body { flex: 1; padding: 4px 12px 12px; display: grid; gap: 12px; align-content: start; }
.panel { background: var(--night-2); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.count { color: var(--muted); font-size: .85rem; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.plist li button.prow { all: unset; display: flex; align-items: center; gap: 10px; flex: 1; min-height: 44px; cursor: pointer; border-radius: 10px; }
.plist .pname { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .off { opacity: .45; }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--night-3); color: var(--text); white-space: nowrap; }
.tag.host { background: var(--marigold); color: var(--ink); }
.tag.mc { background: var(--rosa); color: #fff; }
.tag.you { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tabla.preview { width: min(100%, 300px); margin: 0 auto 12px; }
.markers { display: flex; justify-content: center; gap: 8px; }
.markers button { width: 52px; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--night); padding: 8px; }
.markers button[aria-checked="true"] { border-color: var(--marigold); background: var(--night-3); box-shadow: 0 0 0 2px var(--marigold) inset; }
.lobby-foot { position: sticky; bottom: 0; padding: 12px 12px calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--night) 30%); }
.btn.big { min-height: 58px; font-size: 1.15rem; }
.waiting { text-align: center; color: var(--muted); margin: 6px 0 0; }

/* Rules form */
.rule { padding: 12px 0; border-top: 1px solid rgba(75, 71, 168, .6); }
.rule:first-child { border-top: 0; padding-top: 0; }
.rule > h3 { margin: 0 0 4px; font-size: .98rem; }
.rule > p { margin: 0 0 10px; color: var(--muted); font-size: .86rem; }
.pats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pat {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 10px;
  border-radius: 12px; border: 1.5px solid var(--line); background: transparent; text-align: left;
}
.pat[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.pat[aria-pressed="true"] .mini i { background: rgba(42, 21, 51, .15); }
.pat[aria-pressed="true"] .mini i.on { background: var(--rosa); }
.pat b { display: block; font-size: .92rem; line-height: 1.15; }
.pat small { display: block; font-size: .75rem; opacity: .75; line-height: 1.2; }
.pat:disabled { opacity: 1; }
.subrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.subrow > span { color: var(--muted); font-size: .85rem; margin-right: 4px; }
.custom-grid { display: grid; grid-template-columns: repeat(4, 38px); gap: 5px; margin-top: 10px; }
.custom-grid button { width: 38px; height: 46px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--night); }
.custom-grid button[aria-pressed="true"] { background: var(--rosa); border-color: var(--ink); }
.pts { display: grid; gap: 6px; margin-top: 10px; }
.pts > div { display: flex; align-items: center; gap: 10px; }
.pts > div > span { flex: 1; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.ro .stepper button, .ro .seg button, .ro .pat, .ro .custom-grid button { pointer-events: none; }
.ro .switch input { pointer-events: none; }
.vote-q { margin: 0 0 8px; font-weight: 700; font-size: .95rem; }
.vote-opts { display: grid; gap: 6px; margin-bottom: 14px; }
.vote-opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; text-align: left; overflow: hidden; }
.vote-opt .bar { position: absolute; inset: 0 auto 0 0; background: rgba(242, 162, 12, .22); transition: width .3s; }
.vote-opt span { position: relative; flex: 1; font-weight: 600; font-size: .92rem; }
.vote-opt em { position: relative; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.vote-opt[aria-pressed="true"] { border-color: var(--marigold); box-shadow: 0 0 0 1.5px var(--marigold) inset; }

/* Game */
#game { height: 100dvh; min-height: 0; overflow: hidden; }
.now { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 2px 14px 6px; min-height: 120px; }
.now-card { all: unset; width: 78px; cursor: pointer; }
.now-card .card { width: 78px; }
.now-card .empty-card { width: 78px; aspect-ratio: 5/7; border-radius: 6px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: .75rem; text-align: center; padding: 6px; }
.now-text { min-width: 0; }
.now-intro { margin: 0; color: var(--marigold-2); font-weight: 700; font-size: .85rem; }
.now-name { margin: 0; font-family: var(--display); font-size: 1.6rem; line-height: 1.05; }
.now-verse { margin: 4px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.now-name.hidden-name { color: transparent; text-shadow: 0 0 14px rgba(255, 243, 214, .7); }
.paused-pill { display: inline-block; margin-left: 6px; font-family: var(--ui); font-size: .7rem; font-weight: 800; background: var(--rosa); color: #fff; padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.goal { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 0 12px 6px; font-size: .82rem; color: var(--muted); min-height: 26px; }
.goal b { color: var(--text); }
.goal .g { display: inline-flex; align-items: center; gap: 5px; }

.board-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 12px; container-type: size; }
.tabla {
  --gap: clamp(4px, 1.4vw, 7px);
  width: min(100cqw, calc((100cqh - 6px) * 0.705), 520px);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap);
  padding: var(--gap); border-radius: 14px;
  background: var(--night-3); border: 2px solid var(--ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .3);
}
.tabla.preview { --gap: 4px; width: min(100%, 300px); }
.cell { position: relative; padding: 0; border: 0; background: none; display: block; border-radius: 6%/4.3%; touch-action: manipulation; }
.cell .card { width: 100%; transition: filter .2s, transform .12s; }
.cell:active .card { transform: scale(.96); }
.cell.called-hint .card { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--marigold-2), 0 0 18px 4px rgba(255, 194, 75, .6); animation: hint 1.4s ease-in-out infinite; }
@keyframes hint { 50% { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--marigold), 0 0 6px 1px rgba(255, 194, 75, .3); } }
.cell.marked .card { filter: saturate(.55) brightness(.82); }
.cell.win .card { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--rosa), 0 0 22px 6px rgba(228, 0, 124, .7); filter: none; }
.cell.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.marker { position: absolute; left: 50%; top: 46%; width: 54%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); pointer-events: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.marker svg { width: 100%; height: 100%; display: block; }
@keyframes plop { 0% { transform: translate(-50%, -140%) rotate(var(--rot)) scale(1.3); opacity: 0; } 70% { transform: translate(-50%, -46%) rotate(var(--rot)) scale(.95); opacity: 1; } }
.marker.new { animation: plop .28s cubic-bezier(.3, .8, .4, 1.3); }

.game-foot { display: flex; gap: 10px; align-items: stretch; padding: 10px 12px calc(12px + var(--safe-b)); position: relative; }
.loteria-btn {
  flex: 1; min-height: 66px; border-radius: 20px; border: 2.5px solid var(--ink);
  background: var(--rosa); color: #fff; box-shadow: 0 6px 0 var(--ink);
  font-family: var(--display); font-size: 1.9rem; letter-spacing: .01em;
  text-shadow: 2px 2px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.loteria-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.loteria-btn.ready { background: var(--marigold); color: var(--ink); text-shadow: 2px 2px 0 #fff6; animation: ready 1s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 6px rgba(242, 162, 12, .35); } }
.loteria-btn:disabled { background: var(--night-3); color: var(--muted); text-shadow: none; box-shadow: 0 6px 0 rgba(0, 0, 0, .4); }
.reacts { display: flex; }
.react-toggle { width: 66px; min-height: 66px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--night-2); font-size: 1.6rem; }
.react-tray {
  position: absolute; bottom: calc(100% - 4px); left: 12px; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 52px); gap: 6px; padding: 8px;
  background: var(--night-2); border: 1.5px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: rise .18s;
}
.react-tray button { height: 52px; border-radius: 12px; border: 0; background: var(--night-3); font-size: 1.6rem; }
.reacts-float { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.floaty { position: absolute; bottom: 0; font-size: 2rem; animation: floatUp 2.2s ease-out forwards; }
.floaty small { display: block; font-size: .7rem; font-weight: 700; text-align: center; color: var(--text); }
@keyframes floatUp { from { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-20px) scale(1); } to { transform: translateY(-140px); opacity: 0; } }

/* MC view */
.mc-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 16px; overflow: auto; }
.mc-deck { color: var(--muted); font-variant-numeric: tabular-nums; }
.mc-deck span { color: var(--text); font-weight: 800; }
.mc-draw { width: min(100%, 360px); min-height: 92px; font-size: 1.5rem; font-family: var(--display); font-weight: 400; border-radius: 26px; }
.mc-row { display: flex; gap: 8px; }
.mc-tip { color: var(--muted); font-size: .88rem; text-align: center; margin: 0; max-width: 34ch; }
.close-list { list-style: none; padding: 0; margin: 0; width: min(100%, 360px); display: grid; gap: 6px; }
.close-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--night-2); }
.close-list li b { flex: 1; }
.close-list .need { font-weight: 800; color: var(--marigold-2); }
#game.mc .board-wrap, #game.mc .goal, #game.mc #claimBtn { display: none; }
#game.mc .now { grid-template-columns: 1fr; justify-items: center; text-align: center; min-height: 0; }
#game.mc .now-card, #game.mc .now-card .card, #game.mc .now-card .empty-card { width: 150px; }

/* Overlay (claims & wins) */
#overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(12, 10, 45, .86); padding: 24px; text-align: center; animation: fade .2s; }
.ov { display: grid; gap: 14px; justify-items: center; max-width: 420px; }
.ov-title { font-family: var(--display); font-size: clamp(3rem, 16vw, 4.6rem); line-height: 1; margin: 0; color: var(--marigold); text-shadow: 3px 3px 0 var(--rosa), 6px 6px 0 var(--ink); }
.ov-title.small { font-size: 2.2rem; }
.ov-sub { font-size: 1.15rem; margin: 0; }
.ov-sub b { color: var(--marigold-2); }
.winners { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wchip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--paper); color: var(--ink); font-weight: 800; border: 2px solid var(--ink); }
.wchip em { font-style: normal; color: var(--rosa); }
.ov-pat { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.ov-pat .mini { width: 30px; height: 30px; }
.ov .countdown { font-variant-numeric: tabular-nums; color: var(--muted); }
.board-score { width: 100%; display: grid; gap: 6px; text-align: left; }
.board-score > div { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--night-2); }
.board-score > div b { flex: 1; }
.board-score > div em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.board-score > div.lead { background: var(--paper); color: var(--ink); }

/* Sheets content */
.hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.menu-list { display: grid; gap: 4px; }
.menu-list > button, .menu-list > a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 12px; border: 0; background: transparent; text-align: left; font-weight: 600; text-decoration: none; color: var(--text); }
.menu-list > button:active { background: var(--night-3); }
.menu-list .danger { color: var(--danger); }
.vlist { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.vlist li { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.vlist li b { flex: 1; }
.vlist .speaking .avatar { box-shadow: 0 0 0 3px var(--jade), 0 0 14px var(--jade); }
.ptt { width: 100%; min-height: 78px; border-radius: 22px; border: 2px solid var(--ink); background: var(--jade); color: #fff; font-weight: 800; font-size: 1.1rem; box-shadow: 0 5px 0 var(--ink); user-select: none; -webkit-user-select: none; }
.ptt.down { background: var(--rosa); transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.note { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* Landscape phones: card + board side by side */
@media (orientation: landscape) and (max-height: 560px) {
  #game { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr auto; max-width: none; }
  #game .topbar { grid-column: 1 / -1; min-height: 50px; padding: 4px 12px; }
  #game .now { grid-column: 1; grid-row: 2; }
  #game .goal { grid-column: 1; grid-row: 3; align-self: start; }
  #game .board-wrap { grid-column: 2; grid-row: 2 / 5; padding-bottom: 8px; }

  #game .game-foot { grid-column: 1; grid-row: 4; }
  #game .mc-wrap { grid-column: 1 / -1; grid-row: 3 / 5; }
}
@media (min-width: 900px) { .screen { max-width: 620px; } }
