/* ---------- 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(--accent); }

/* 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(--accent); }
.codechip-label { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.panel { min-width: 0; }
.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 var(--line); }
.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(--sel); color: var(--sel-ink); border-color: var(--sel); }
.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(--accent); 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 var(--text); }
.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(--board); 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(--accent); }
#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: var(--scrim); 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(--accent); }
.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 auto auto 1fr auto auto; max-width: none; }
  #game .topbar { grid-column: 1 / -1; grid-row: 1; min-height: 50px; padding: 4px 12px; }
  #game .now { grid-column: 1; grid-row: 2; }
  #game .timer { grid-column: 1; grid-row: 3; }
  #game .goal-row { grid-column: 1; grid-row: 4; }
  #game .dots { grid-column: 1; grid-row: 6; }
  #game .board-wrap { grid-column: 2; grid-row: 2 / 8; padding-bottom: 8px; min-width: 45vw; }
  #game .game-foot { grid-column: 1; grid-row: 7; }
  #game .mc-wrap { grid-column: 1 / -1; grid-row: 3 / 8; }
}
@media (min-width: 900px) { .screen { max-width: 620px; } }

/* ---------- Join: you, nearby rooms ---------- */
.me-row { display: flex; gap: 10px; align-items: center; }
.avatar-edit { flex: none; width: 52px; height: 52px; padding: 0; border: 0; background: none; border-radius: 50%; position: relative; }
.avatar-edit .avatar { width: 52px; height: 52px; font-size: 1rem; }
.avatar-edit::after { content: '✎'; position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); font-size: .7rem; display: grid; place-items: center; }
.nearby-box { border: 1.5px dashed var(--line); border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 8px; margin-top: 4px; }
.nearby-title { margin: 0; font-weight: 800; }
.nearby-box .note { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nearby-banner { display: grid; gap: 8px; margin-bottom: 12px; padding: 12px; border-radius: var(--r-md); background: var(--night-2); border: 2px solid var(--jade); animation: rise .3s; }
.nb-title { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); }
.nb-title svg, .note svg, .btn svg { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.room-list { display: grid; gap: 8px; margin: 6px 0 12px; justify-items: start; }
.room-row { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; background: var(--night-3); border: 1.5px solid var(--line); }
.room-row:focus-visible { outline: 3px solid var(--marigold-2); }
.room-meta { flex: 1; min-width: 0; display: grid; }
.room-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta small { color: var(--muted); font-size: .8rem; }
.room-row .btn { pointer-events: none; }
.theme-pick { display: flex; justify-content: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.theme-pick button { min-height: 34px; padding: 4px 12px; border-radius: 99px; border: 1.5px solid var(--line); background: transparent; font-size: .82rem; font-weight: 600; color: var(--muted); }
.theme-pick button[aria-pressed="true"] { color: var(--text); border-color: var(--text); }

/* ---------- Top bar fits more buttons ---------- */
.topbar .iconbtn { flex: none; }
#game .topbar { gap: 6px; padding: 8px 10px; }
#game .topbar .iconbtn { width: 40px; height: 40px; }
#game .topbar .iconbtn svg { width: 20px; height: 20px; }
#game .codechip .codechip-label { display: none; }
#game .gstat { min-width: 0; }
@media (max-width: 370px) { .topbar .iconbtn { width: 38px; height: 38px; } .codechip { padding: 0 10px; } #lobby .codechip-label { display: none; } }

/* ---------- QR full screen ---------- */
.qr-full { position: fixed; inset: 0; z-index: 90; background: #FFFBF2; color: #2A1533; display: grid; place-items: center; padding: 24px; animation: fade .2s; cursor: pointer; }
.qr-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.qr-title { margin: 0; font-family: var(--display); font-size: clamp(1.5rem, 7vw, 2.4rem); line-height: 1.05; max-width: 16ch; }
.qr-big { width: min(82vw, 62vh, 520px); aspect-ratio: 1; }
.qr-big svg { width: 100%; height: 100%; display: block; }
.qr-code { margin: 0; font-family: var(--display); font-size: clamp(2.4rem, 12vw, 4rem); letter-spacing: .14em; color: #E4007C; line-height: 1; }
.qr-url { margin: 0; font-weight: 700; word-break: break-all; }
.qr-close { margin: 4px 0 0; color: #6B5A6E; font-size: .9rem; }

/* ---------- Lobby: tablas, decks, house rules ---------- */
.count-row { margin: 0 0 12px; }
.tcount { color: var(--muted); font-weight: 700; }
.previews { display: grid; gap: 10px; margin-bottom: 12px; justify-items: center; }
.previews.n2, .previews.n3, .previews.n4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pv { position: relative; width: 100%; min-width: 0; display: grid; justify-items: center; gap: 6px; }
.previews:not(.n1) .tabla.preview { --gap: 2.5px; width: 100%; padding: 3px; border-radius: 8px; }
.pv-shuffle { border: 1.5px solid var(--line); background: transparent; border-radius: 99px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.decks { margin: 0 -16px; }
.deck-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 16px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.decks .note { margin: 0 16px; }
.deck-tile { flex: 0 0 104px; scroll-snap-align: start; display: grid; justify-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: transparent; text-align: center; position: relative; }
.deck-tile[aria-pressed="true"] { border-color: var(--marigold); box-shadow: 0 0 0 2px var(--marigold) inset; background: var(--night-3); }
.deck-cover { width: 58px; display: block; }
.deck-cover .card { width: 100%; }
.deck-tile b { font-size: .8rem; line-height: 1.15; }
.deck-tile small { font-size: .7rem; color: var(--muted); }
.deck-tile .tag { position: absolute; top: 4px; right: 4px; font-size: .6rem; padding: 2px 6px; }
.ro .deck-tile { pointer-events: none; }
.deck-row.ro .deck-tile { flex-basis: 100%; grid-template-columns: 58px 1fr; justify-items: start; text-align: left; align-items: center; column-gap: 12px; }
.deck-row.ro .deck-cover { grid-row: span 2; }
.house { margin-bottom: 6px; }
.select { appearance: none; padding-right: 40px; font-size: 1rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.house-hint { margin: 0 0 6px; }
.house-ro { margin-bottom: 8px; }
.house-ro .note { margin: 4px 0 0; }
.num-step input.num { width: 4.2em; height: 36px; border: 0; background: transparent; text-align: center; font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.num-step input.num::-webkit-inner-spin-button, .num-step input.num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-step input.num:focus { outline: 2px solid var(--marigold); outline-offset: -2px; border-radius: 6px; }
.ro .num-step input { pointer-events: none; }

/* ---------- Profile / avatar builder ---------- */
.av-hero { display: grid; place-items: center; margin: 4px 0 12px; }
.av-hero .avatar { width: 120px; height: 120px; font-size: 2rem; border-width: 3px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); padding: 0; position: relative; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--night-2), 0 0 0 5px var(--text); }
.swatch.taken::after { content: ''; position: absolute; inset: 40% -2px; background: var(--ink); opacity: .35; transform: rotate(-35deg); border-radius: 2px; }
.av-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; margin-top: 12px; }
.av-tabs { position: sticky; top: -10px; z-index: 2; background: var(--night-2); padding: 8px 0; margin-top: 10px; }
.av-tabs button { flex: 1; }
.av-actions { margin-top: 16px; position: sticky; bottom: -24px; background: var(--night-2); padding: 10px 0; }
.av-actions .btn { flex: 1; }
.av-opt { display: grid; justify-items: center; gap: 4px; padding: 6px 4px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; }
.av-opt .avatar { width: 46px; height: 46px; }
.av-opt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.av-opt small { font-size: .7rem; color: var(--muted); }
.av-opt[aria-pressed="true"] { border-color: var(--marigold); box-shadow: 0 0 0 2px var(--marigold) inset; }

/* ---------- Game: several tablas ---------- */
.goal-row { display: flex; align-items: center; gap: 6px; padding-right: 10px; }
.goal-row .goal { flex: 1; }
.view-toggle { display: flex; border: 1.5px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.view-toggle button { width: 38px; height: 30px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); padding: 0; }
.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button[aria-pressed="true"] { background: var(--sel); color: var(--sel-ink); }
.tablas { width: 100%; height: 100%; display: grid; place-items: center; }
.tablas .slide { display: grid; place-items: center; min-width: 0; min-height: 0; }
.tablas .tabla { position: relative; }
.tnum { position: absolute; z-index: 2; top: -8px; left: -8px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font-weight: 800; font-size: .8rem; padding: 0; display: grid; place-items: center; box-shadow: 0 2px 0 var(--ink); }
/* grid: all tablas at once */
.tablas.grid { gap: 12px 10px; align-content: center; }
.tablas.grid.n2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tablas.grid.n3, .tablas.grid.n4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.tablas.grid .tabla { --gap: 2.5px; padding: 3px; border-radius: 9px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.tablas.grid.n2 .tabla { width: min(calc(50cqw - 8px), calc((100cqh - 6px) * .705)); }
.tablas.grid.n3 .tabla, .tablas.grid.n4 .tabla { width: min(calc(50cqw - 8px), calc((50cqh - 12px) * .705)); }
.tablas.grid .cell .card { box-shadow: 0 0 0 1px var(--ink); }
.tablas.grid .marker { width: 62%; }
@container (min-aspect-ratio: 7/4) {
  .tablas.grid.n3 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
  .tablas.grid.n4 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; }
  .tablas.grid.n3 .tabla { width: min(calc(33cqw - 10px), calc((100cqh - 6px) * .705)); }
  .tablas.grid.n4 .tabla { width: min(calc(25cqw - 10px), calc((100cqh - 6px) * .705)); }
}
/* swipe: one big tabla at a time */
.tablas.swipe { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; place-items: initial; }
.tablas.swipe::-webkit-scrollbar { display: none; }
.tablas.swipe .slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.tablas.swipe .tabla { width: min(calc(100cqw - 8px), calc((100cqh - 6px) * .705), 520px); }
.dots { display: flex; justify-content: center; gap: 8px; padding: 6px 0 0; }
.dots button { min-width: 44px; height: 26px; border-radius: 99px; border: 1.5px solid var(--line); background: transparent; font-size: .78rem; font-weight: 800; color: var(--muted); padding: 0 10px; position: relative; }
.dots button[aria-current="true"] { background: var(--sel); color: var(--sel-ink); border-color: var(--sel); }
.dots button.hint::after { content: ''; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--marigold-2); box-shadow: 0 0 6px var(--marigold-2); }
.dots button.ready { border-color: var(--rosa); color: var(--text); box-shadow: 0 0 0 2px var(--rosa); }
.tablas.shake { animation: shake .4s; }
.board-wrap { padding: 0 8px; }

.topbar .codechip { min-width: 0; flex: 0 1 auto; overflow: hidden; }
#lobby .codechip-label { max-width: 7.5em; }
html, body { overflow-x: hidden; }
