/* Hexalia: estilos de la interfaz (sobre el lienzo 3D). */
:root {
  --bg: #0d3442; --panel: #134a5c; --panel2: #1b6076; --line: rgba(190,240,255,.18); --text: #f4fdff; --muted: #a9d3de;
  --accent: #ffd23f; --accent-text: #2a1a05; --mint: #47d96b; --mint2: #22a84a; --sky: #4fc3ff; --sky2: #2a8fd6; --danger: #ff5a5a;
  --font: 'Fredoka', 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --glass: rgba(9,42,54,.84);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow: hidden; }
#app { position: fixed; inset: 0; overflow: hidden; background: #2bb3c9; touch-action: none; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
input, select { font-family: inherit; }

/* ---------- botones ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 50px; padding: .45em 1.2em; border-radius: 17px; font-size: 1.08rem; font-weight: 700; letter-spacing: .01em; color: var(--accent-text); text-decoration: none;
  background: linear-gradient(180deg, #fff1a6, var(--accent) 55%, #f2a922); box-shadow: 0 5px 0 #b77812, 0 10px 22px rgba(0,0,0,.22), inset 0 2px 0 rgba(255,255,255,.6); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b77812, inset 0 2px 0 rgba(255,255,255,.6); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.btn small { font-size: .62em; font-weight: 600; opacity: .85; letter-spacing: 0; margin-top: .15em; }
.btn.mint { color: #06301a; background: linear-gradient(180deg, #b9ffc9, var(--mint) 55%, var(--mint2)); box-shadow: 0 5px 0 #157233, 0 10px 22px rgba(0,0,0,.22), inset 0 2px 0 rgba(255,255,255,.6); }
.btn.mint:active { box-shadow: 0 1px 0 #157233, inset 0 2px 0 rgba(255,255,255,.6); }
.btn.sky { color: #04263d; background: linear-gradient(180deg, #c8f0ff, var(--sky) 55%, var(--sky2)); box-shadow: 0 5px 0 #1d6aa3, 0 10px 22px rgba(0,0,0,.22), inset 0 2px 0 rgba(255,255,255,.6); }
.btn.sky:active { box-shadow: 0 1px 0 #1d6aa3, inset 0 2px 0 rgba(255,255,255,.6); }
.btn.ghost { color: var(--text); background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:active { transform: translateY(2px); }
.btn.big { min-height: 60px; font-size: 1.32rem; padding: .4em 1.4em; border-radius: 21px; }
.btn.small { min-height: 40px; font-size: .92rem; padding: .3em .85em; border-radius: 13px; box-shadow: 0 3px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.5); }
.btn.small.ghost { box-shadow: inset 0 0 0 2px var(--line); }
.btn[disabled], .btn.dim { filter: grayscale(.75) brightness(.8); }
.btn[disabled] { pointer-events: none; }
.icon-btn { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: var(--text); background: var(--glass); box-shadow: inset 0 0 0 2px var(--line), 0 4px 12px rgba(0,0,0,.18); flex: none; }
.icon-btn svg { width: 25px; height: 25px; }
.icon-btn.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; }
.icon-btn.sm svg { width: 21px; height: 21px; }
.icon-btn:active { transform: scale(.94); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.row.two > .btn { flex: 1 1 0; min-width: 0; padding: .4em .7em; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.x { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.08); }
.x svg { width: 18px; height: 18px; }
.spin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; vertical-align: -2px; margin-right: .4em; }
@keyframes spin { to { transform: rotate(360deg); } }
.cdot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--pc, #888); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.7); flex: none; }

/* iconos de recurso (fondo SVG inyectado por ui.js) */
.ri { display: inline-block; width: 1.5em; height: 1.5em; background-size: contain; background-repeat: no-repeat; background-position: center; vertical-align: middle; flex: none; }
.ri.sm { width: 1.25em; height: 1.25em; vertical-align: -.3em; }
.ri.tiny { width: 13px; height: 13px; margin: 0 -1px; }
.ri.fly { width: 36px; height: 36px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.cardback { display: inline-block; width: 26px; height: 36px; border-radius: 5px; background: repeating-linear-gradient(45deg, #2b7c93 0 4px, #236a7f 4px 8px); box-shadow: inset 0 0 0 2px #f6e3b4, 0 3px 6px rgba(0,0,0,.3); }
.cardback.mini { width: 9px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px #f6e3b4; vertical-align: -1px; }
.pn { color: var(--pc); filter: brightness(1.25); }

/* ---------- pantallas ---------- */
#screens { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; animation: in .25s ease-out both; padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); }
.screen.out { animation: out .2s ease-in both; pointer-events: none; }
@keyframes in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes out { to { opacity: 0; transform: scale(.98); } }
.overlay { justify-content: center; background: rgba(4,24,32,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.card { width: min(430px, 100%); max-height: 100%; overflow: auto; padding: 20px 18px; border-radius: 26px; background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: inset 0 0 0 2px var(--line), 0 20px 50px rgba(0,0,0,.4); text-align: center; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 1.8rem; line-height: 1.1; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.sub { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.3; }
.sub.small { font-size: .85rem; }
.sub.big { font-size: 1.15rem; color: var(--text); }
.card.scroll { max-height: min(88vh, 760px); }

/* portada */
.title-screen { justify-content: space-between; }
.logo { text-align: center; margin-top: 1.5vh; filter: drop-shadow(0 6px 0 rgba(0,0,0,.12)); }
.logo .lg { display: inline-block; font-size: clamp(3.3rem, 16vw, 6.2rem); font-weight: 700; line-height: .9; color: #ffe36a; -webkit-text-stroke: 3px #8a4a0a; paint-order: stroke fill; text-shadow: 0 6px 0 #8a4a0a, 0 12px 24px rgba(0,0,0,.28); transform: rotate(-3deg); letter-spacing: -.01em; }
.logo p { margin: .6em auto 0; display: inline-block; padding: .3em .9em; border-radius: 99px; background: var(--glass); font-weight: 600; font-size: 1.02rem; }
.title-bottom { display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: min(380px, 100%); margin-bottom: .5vh; max-height: 100%; }
.title-bottom .btn.big { justify-content: flex-start; }
.join-row { display: flex; gap: 8px; }
.join-row .code { flex: 1; min-width: 0; height: 44px; border-radius: 13px; border: 0; padding: 0 14px; font-size: 1.15rem; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--text); background: var(--glass); box-shadow: inset 0 0 0 2px var(--line); }
.join-row .code::placeholder { color: var(--muted); letter-spacing: .12em; font-weight: 600; }
.online-count { margin: -4px 0 0; text-align: center; font-size: .85rem; font-weight: 600; color: #fff; min-height: 1em; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.online-count .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5bff7a; margin-right: 6px; box-shadow: 0 0 8px #5bff7a; }
.portal-link { position: absolute; left: calc(12px + var(--safe-l)); top: calc(12px + var(--safe-t)); display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--glass); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.portal-link svg { width: 28px; height: 28px; }

/* hojas inferiores */
.sheet-wrap { position: absolute; inset: 0; z-index: 25; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.sheet-wrap.modal { pointer-events: auto; background: rgba(4,24,32,.42); animation: fade .2s both; }
.sheet-wrap.out { animation: fadeout .2s both; pointer-events: none; }
@keyframes fade { from { opacity: 0; } } @keyframes fadeout { to { opacity: 0; } }
.sheet { pointer-events: auto; width: min(480px, 100%); max-height: 88%; overflow: auto; border-radius: 24px 24px 0 0; padding: 14px 16px calc(16px + var(--safe-b)); background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: 0 -10px 40px rgba(0,0,0,.35), inset 0 0 0 2px var(--line); animation: up .25s cubic-bezier(.2,.9,.3,1.05) both; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet header h3 { flex: 1; margin: 0; font-size: 1.35rem; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-body > .btn { align-self: stretch; }
.confirm-sheet .sheet-body { text-align: center; padding-top: 6px; }

/* opciones de partida */
.opts { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; text-align: left; }
.opts label { font-weight: 600; color: var(--muted); font-size: .95rem; }
.opts.compact { gap: 8px 10px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.25); }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-weight: 700; font-size: .95rem; color: var(--muted); padding: 0 6px; }
.seg button.on { background: var(--accent); color: var(--accent-text); box-shadow: 0 2px 0 #b77812; }
.seg.ro button.on { background: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.colors { display: flex; gap: 10px; }
.colors .cdot { width: 34px; height: 34px; }
.colors .cdot.on { box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 0 0 3px #fff, 0 0 0 6px var(--accent); }
.nick-form { display: flex; gap: 8px; }
.nick-form .nick, .setting input { flex: 1; min-width: 0; height: 48px; border-radius: 13px; border: 0; padding: 0 14px; font-size: 1.1rem; font-weight: 600; color: var(--text); background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 2px var(--line); }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* sala de espera */
.lobby .card { gap: 10px; }
.code-big { display: flex; justify-content: center; gap: 6px; }
.code-big b { width: 48px; height: 58px; display: grid; place-items: center; border-radius: 12px; font-size: 2rem; background: #fff7dc; color: #3b2a1c; box-shadow: 0 4px 0 #c9a45a, inset 0 2px 0 #fff; }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.seat { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 14px; background: rgba(255,255,255,.07); }
.seat.me { background: rgba(255,210,63,.14); box-shadow: inset 0 0 0 2px rgba(255,210,63,.4); }
.seat .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.empty .nm { color: var(--muted); font-weight: 500; font-style: italic; }
.seat.empty .cdot { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.seat .cdot { width: 26px; height: 26px; }
.seat .cdot.pick { cursor: pointer; animation: pulse 1.6s ease-in-out infinite; }
.seat em { font-style: normal; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.14); display: inline-flex; align-items: center; gap: 3px; }
.seat em.you { background: var(--accent); color: var(--accent-text); }
.seat em svg { width: 14px; height: 14px; }
.seat em.off { background: rgba(255,90,90,.3); }
.addbot-level { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.addbot-level .seg { flex: 1; }
.countdown { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--accent); }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---------- marcador de la partida ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.players { position: absolute; top: calc(6px + var(--safe-t)); left: calc(6px + var(--safe-l)); right: calc(6px + var(--safe-r)); display: flex; gap: 5px; }
.pl { position: relative; flex: 1 1 0; min-width: 0; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "av st" "nm nm"; gap: 2px 6px; align-items: center; padding: 5px 7px 4px; border-radius: 15px; background: var(--glass); box-shadow: inset 0 0 0 2px rgba(255,255,255,.07); transition: box-shadow .2s, transform .2s, background .2s; }
.pl.me { background: rgba(20,70,86,.9); }
.pl.turn { box-shadow: inset 0 0 0 2.5px var(--pc), 0 0 16px var(--pc); transform: translateY(1px); }
.pl.acting { box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.pl.away { opacity: .62; }
.pl.bump { animation: bump .35s; }
.av { grid-area: av; position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--pc); display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.av .ini { font-weight: 700; font-size: 1.05rem; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); display: grid; place-items: center; }
.av .ini svg { width: 20px; height: 20px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.av .vp { position: absolute; right: -7px; bottom: -6px; min-width: 21px; height: 21px; padding: 0 4px; border-radius: 11px; background: var(--accent); color: var(--accent-text); font-size: .82rem; display: grid; place-items: center; box-shadow: 0 2px 0 #b77812; }
.ring { position: absolute; inset: -4px; width: 42px; height: 42px; transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; opacity: 0; transition: stroke-dashoffset .25s linear; }
.pl.timed .ring circle { opacity: .95; }
.pl.late .ring circle { stroke: #ff5a5a; }
.pi { display: contents; }
.pi .nm { grid-area: nm; font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.pi .st { grid-area: st; display: flex; flex-wrap: wrap; gap: 1px 6px; font-size: .78rem; font-weight: 700; color: var(--muted); align-items: center; min-width: 0; }
.st i { font-style: normal; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.st .dc.zero { opacity: .45; }
.scroll-mini { display: inline-block; width: 10px; height: 13px; border-radius: 2px; background: #f6e3b4; box-shadow: inset 0 2px 0 #c98b3a, inset 0 -2px 0 #c98b3a; vertical-align: -1px; }
.st .bd { gap: 1px; font-size: .78rem; }
.st .bd .gd { font-size: .7rem; opacity: .85; }
.bub { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 3; padding: 5px 10px; border-radius: 12px; background: #fff; color: #183453; font-style: normal; font-weight: 700; font-size: .85rem; white-space: nowrap; box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.bub::before { content: ''; position: absolute; left: 50%; top: -6px; margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: #fff; }
.bub.emoji { font-size: 1.5rem; padding: 2px 8px; }
.bub.pop, .offer-pop.pop, .confirm-pop.pop { animation: popin .3s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes popin { from { transform: translateX(-50%) scale(.5); opacity: 0; } }

.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px calc(6px + var(--safe-r)) calc(6px + var(--safe-b)) calc(6px + var(--safe-l)); display: flex; flex-direction: column; gap: 6px; background: linear-gradient(180deg, rgba(9,42,54,0), rgba(9,42,54,.55) 18%, rgba(9,42,54,.9)); }
.status { display: flex; align-items: center; gap: 6px; min-height: 38px; }
.hint { flex: 1; min-width: 0; font-size: .9rem; font-weight: 600; line-height: 1.15; padding: 5px 10px; border-radius: 12px; background: var(--glass); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hint.mine { background: rgba(255,210,63,.92); color: var(--accent-text); }
.dice-mini { display: flex; gap: 3px; }
.die { width: 24px; height: 24px; border-radius: 7px; background: #fffaf0; color: #2a2320; font-style: normal; font-weight: 700; font-size: .95rem; display: grid; place-items: center; box-shadow: 0 2px 0 #c8bba0; }
.hand { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rc { position: relative; height: 46px; border-radius: 11px; background: linear-gradient(180deg, #fff9e8, #f1e2bd); box-shadow: 0 3px 0 #b99a5c, inset 0 0 0 2px rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; gap: 2px; color: #3b2a1c; }
.rc .ri { width: 30px; height: 30px; }
.rc svg { width: 28px; height: 28px; }
.rc b { font-size: 1.15rem; min-width: .8em; }
.rc.zero { filter: grayscale(.85) brightness(.75); opacity: .75; }
.rc.dev.playable { box-shadow: 0 3px 0 #b99a5c, 0 0 0 3px var(--mint), 0 0 12px var(--mint); }
.rc.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.16); } }
.actions { display: grid; grid-template-columns: repeat(5, 1fr) 1.35fr; gap: 5px; }
.act { position: relative; height: 60px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 2px var(--line); }
.act svg { width: 24px; height: 24px; color: #ffe9a8; }
.act span { font-size: .68rem; font-weight: 700; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act em { display: flex; height: 13px; }
.act.ready { background: rgba(71,217,107,.28); box-shadow: inset 0 0 0 2px rgba(120,255,150,.55); }
.act.on { background: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 2px #fff, 0 0 16px var(--accent); }
.act.on svg { color: var(--accent-text); }
.act.dim { opacity: .55; }
.act:active { transform: scale(.95); }
.act.main { background: linear-gradient(180deg, #c8f0ff, var(--sky) 55%, var(--sky2)); color: #04263d; box-shadow: 0 4px 0 #1d6aa3; flex-direction: row; gap: 6px; }
.act.main[data-k="roll"] { background: linear-gradient(180deg, #fff1a6, var(--accent) 55%, #f2a922); color: var(--accent-text); box-shadow: 0 4px 0 #b77812; animation: glow 1.4s ease-in-out infinite; }
.act.main[data-k="end"] { background: linear-gradient(180deg, #b9ffc9, var(--mint) 55%, var(--mint2)); color: #06301a; box-shadow: 0 4px 0 #157233; }
.act.main:disabled { background: rgba(255,255,255,.1); color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.act.main .mi svg { width: 26px; height: 26px; color: inherit; }
.act.main .ml { font-size: .92rem; white-space: normal; text-align: left; line-height: 1.05; }
.act.main .hg { font-style: normal; font-size: 1.2rem; }
@keyframes glow { 50% { box-shadow: 0 4px 0 #b77812, 0 0 18px rgba(255,210,63,.9); } }

.confirm-pop { position: absolute; z-index: 8; transform: translate(-50%, calc(-100% - 26px)); display: flex; gap: 10px; padding: 6px; border-radius: 99px; background: var(--glass); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.confirm-pop.pop { animation: cpop .25s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes cpop { from { transform: translate(-50%, calc(-100% - 10px)) scale(.5); opacity: 0; } }
.cb { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; }
.cb svg { width: 26px; height: 26px; }
.cb.yes { background: var(--mint); color: #06301a; box-shadow: 0 3px 0 #157233; }
.cb.no { background: rgba(255,255,255,.16); color: #fff; }
.offer-pop { position: absolute; z-index: 9; left: 50%; top: calc(76px + var(--safe-t)); transform: translateX(-50%); width: min(380px, calc(100% - 16px)); padding: 12px; border-radius: 20px; background: linear-gradient(180deg, #fff9e8, #f6e7c2); color: #3b2a1c; box-shadow: 0 14px 34px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 8px; }
.op-head { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.op-head b { flex: 1; }
.op-clock { font-style: normal; font-weight: 700; color: #b8302a; }
.offer-line { display: flex; gap: 8px; justify-content: center; font-weight: 700; }
.offer-line > span { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 12px; background: rgba(0,0,0,.06); }
.offer-line small { font-size: .75rem; color: #7a6040; }
.offer-pop .sub { color: #8a5a2a; }
.offer-pop .btn.ghost { color: #3b2a1c; background: rgba(0,0,0,.08); box-shadow: none; }
.offer-pop .row .btn { flex: 1; }
.away-bar { position: absolute; z-index: 9; left: 50%; top: calc(76px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 99px; background: #b8302a; font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,.3); white-space: nowrap; }
.netpill { position: absolute; z-index: 9; left: 50%; top: calc(70px + var(--safe-t)); transform: translateX(-50%); padding: 6px 14px; border-radius: 99px; background: rgba(0,0,0,.7); font-weight: 600; font-size: .9rem; }

.drawer { position: absolute; z-index: 20; top: 0; bottom: 0; right: 0; width: min(340px, 88%); padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) 12px; background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: -10px 0 30px rgba(0,0,0,.35); display: flex; flex-direction: column; animation: slidein .22s both; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer header { display: flex; align-items: center; } .drawer h3 { flex: 1; margin: 0; font-size: 1.3rem; }
.drawer ol { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; flex: 1; font-size: .9rem; line-height: 1.35; touch-action: pan-y; }
.drawer li { padding: 4px 6px; border-radius: 8px; }
.drawer li.turn { margin-top: 6px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--line); padding-top: 8px; }
.drawer li.dim, .drawer li.chat { color: var(--muted); }
.drawer li.good { background: rgba(71,217,107,.14); } .drawer li.bad { background: rgba(255,90,90,.16); } .drawer li.award { background: rgba(255,210,63,.18); }

/* hojas de la partida */
.steppers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stp { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 14px; background: rgba(0,0,0,.2); }
.stp.on { background: rgba(255,210,63,.2); box-shadow: inset 0 0 0 2px rgba(255,210,63,.5); }
.stp button { width: 100%; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.stp button svg { width: 18px; height: 18px; }
.stp button:disabled { opacity: .3; }
.stp .sv { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.stp .sv .ri { width: 34px; height: 34px; }
.stp .sv b { font-size: 1.2rem; } .stp .sv small { font-size: .72rem; color: var(--muted); }
.count { margin: 0; text-align: center; font-weight: 700; font-size: 1.1rem; }
.lbl { margin: 2px 0 -4px; font-weight: 700; color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.res-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 14px; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 2px var(--line); font-size: .74rem; font-weight: 700; }
.rp .ri { width: 36px; height: 36px; }
.rp b { position: absolute; top: 3px; right: 5px; font-size: .78rem; color: var(--accent); }
.rp.on { background: rgba(255,210,63,.25); box-shadow: inset 0 0 0 2.5px var(--accent); }
.rp:disabled { opacity: .35; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.25); }
.tabs button { flex: 1; height: 40px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tabs button.on { background: var(--sky); color: #04263d; }
.to-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; font-weight: 700; font-size: .9rem; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 2px var(--line); opacity: .55; }
.chip.on { opacity: 1; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 2px var(--pc); }
.my-offer { display: flex; flex-direction: column; gap: 8px; }
.my-offer .offer-line > span { background: rgba(255,255,255,.08); }
.resp { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.resp li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.07); }
.resp .nm { font-weight: 700; } .resp em { font-style: normal; font-size: .9rem; flex: 1; }
.resp .rej { color: #ff9a8f; } .resp .ctr { color: var(--accent); }
.devs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.devs li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.08); text-align: left; }
.devs .di { font-size: 1.8rem; }
.devs li div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.devs small { color: var(--muted); font-size: .82rem; line-height: 1.25; } .devs .why { color: var(--accent); }
.buy-row .btn { width: 100%; justify-content: flex-start; }
.buy-row .btn small { display: flex; align-items: center; gap: 2px; }
.victims { display: flex; flex-direction: column; gap: 8px; }
.vic { justify-content: flex-start; } .vic span { flex: 1; } .vic em { font-style: normal; display: flex; align-items: center; gap: 4px; }
.chat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.emoji-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.em { font-size: 1.6rem; height: 48px; border-radius: 12px; background: rgba(255,255,255,.08); }

/* final */
.final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.final li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: rgba(255,255,255,.07); }
.final li:first-child { background: rgba(255,210,63,.2); box-shadow: inset 0 0 0 2px rgba(255,210,63,.55); }
.final li.me .nm { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.final .pos { width: 2em; font-weight: 700; color: var(--muted); }
.final .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final .brk { display: flex; gap: 6px; font-size: .85rem; }
.final b { font-size: 1.4rem; color: var(--accent); min-width: 1.4em; text-align: right; }
.end-p.win .card h2 { color: var(--accent); }

/* avisos */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.flyer { position: absolute; left: 0; top: 0; z-index: 31; }
.spark { position: absolute; width: 9px; height: 9px; border-radius: 50%; }
.conf { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear both; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 700; color: #fff; -webkit-text-stroke: 3px rgba(0,0,0,.45); paint-order: stroke fill; text-align: center; white-space: nowrap; animation: banner 1.7s ease-out forwards; z-index: 32; }
.banner.gold { color: var(--accent); } .banner.mint { color: #8affa0; } .banner.red { color: #ff7a7a; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }
#toasts { position: absolute; left: 0; right: 0; top: calc(78px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 40; }
.toast { padding: 8px 16px; border-radius: 14px; background: rgba(9,42,54,.94); box-shadow: inset 0 0 0 2px var(--line), 0 6px 16px rgba(0,0,0,.3); font-weight: 600; animation: in .25s both; max-width: 92vw; text-align: center; }
.toast.gold { background: linear-gradient(180deg, #fff1a6, var(--accent)); color: var(--accent-text); }
.toast.gold .pn { filter: brightness(.8); }
.toast.red { background: #b8302a; }
.toast.dim { background: rgba(9,42,54,.85); color: #dff; }
.toast.out { animation: out .3s both; }

/* ajustes, cómo se juega */
.settings { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.06); font-weight: 600; }
.setting select { font-size: 1rem; font-weight: 600; padding: 7px 10px; border-radius: 10px; border: 0; background: #0b2c38; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); max-width: 55%; }
.setting input { height: 40px; font-size: 1rem; max-width: 55%; }
.tog { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; background: rgba(0,0,0,.3); font-weight: 700; min-width: 74px; }
.tog i { width: 26px; height: 26px; border-radius: 50%; background: #5a6b7d; transition: .2s; }
.tog.on i { background: var(--mint); transform: translateX(2px); }
.links { margin-top: 6px; }
.howto-body { text-align: left; }
.howto-body .t1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 .4em; color: var(--accent); }
.howto-body h2 { font-size: 1.12rem; margin: 1em 0 .3em; }
.howto-body ul { padding-left: 1.2em; margin: .3em 0; }
.howto-body li { margin: .25em 0; line-height: 1.35; }
.howto-body p { line-height: 1.4; }
.screen.ov { z-index: 2; }

/* anuncio de prueba */
.dev-ad { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.75); }
.dev-ad-box { width: min(340px, 90%); padding: 20px; border-radius: 20px; background: #111; color: #fff; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.dev-ad-tag { font-size: .8rem; color: #aaa; }
.dev-ad-art { width: 100%; aspect-ratio: 16/9; border-radius: 12px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #333 0 12px, #2a2a2a 12px 24px); font-size: 2rem; font-weight: 700; }

/* carga */
#loader { position: absolute; inset: 0; display: grid; place-items: center; z-index: 60; background: var(--bg); transition: opacity .4s; }
#loader.out { opacity: 0; pointer-events: none; }
.loader-hex { width: 64px; height: 64px; border-radius: 50%; border: 8px solid rgba(79,195,255,.25); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }
.howto-src { display: none; }

/* ---------- horizontal: jugadores a la izquierda, mano y acciones a la derecha ---------- */
body.land .players { right: auto; bottom: calc(6px + var(--safe-b)); width: 152px; flex-direction: column; gap: 5px; justify-content: flex-start; }
body.land .pl { flex: 0 0 auto; grid-template-columns: auto 1fr; grid-template-areas: "av nm" "av st"; padding: 6px 8px; }
body.land .dock { left: auto; top: 0; width: 226px; gap: 5px; padding: calc(6px + var(--safe-t)) calc(6px + var(--safe-r)) calc(6px + var(--safe-b)) 6px; justify-content: flex-end; background: linear-gradient(90deg, rgba(9,42,54,0), rgba(9,42,54,.45) 16%, rgba(9,42,54,.7)); }
body.land .status { gap: 5px; }
body.land .dice-mini { display: none; }
body.land .hint { font-size: .82rem; padding: 4px 8px; }
body.land .hand { grid-template-columns: repeat(3, 1fr); }
body.land .actions { grid-template-columns: 1fr 1fr; }
body.land .act { height: 50px; }
body.land .rc { height: 42px; }
body.land .act.b-trade { grid-column: span 2; height: 38px; flex-direction: row; gap: 8px; }
body.land .act.main { grid-column: span 2; height: 50px; }
body.land .offer-pop, body.land .away-bar, body.land .netpill { top: calc(10px + var(--safe-t)); left: calc(50% - 37px); }
body.land #toasts { top: calc(64px + var(--safe-t)); right: 230px; left: 160px; }
body.land .confirm-pop { }
body.land .sheet-wrap { align-items: center; }
body.land .sheet { border-radius: 24px; max-height: 96%; width: min(520px, 96%); }
body.land .bub { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
body.land .bub::before { left: -6px; top: 50%; margin: -6px 0 0; border: 6px solid transparent; border-left: 0; border-right-color: #fff; }
body.land .bub.pop { animation: popside .3s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes popside { from { transform: translateY(-50%) scale(.5); opacity: 0; } }

@media (max-height: 520px) {
  .logo .lg { font-size: 3.2rem; } .logo p { font-size: .9rem; }
  .title-screen { flex-direction: row; align-items: center; justify-content: space-around; }
  .title-bottom { overflow-y: auto; padding: 4px; }
  .btn.big { min-height: 50px; font-size: 1.15rem; }
  .card { padding: 14px; gap: 8px; } .card h2 { font-size: 1.45rem; }
  .code-big b { width: 38px; height: 44px; font-size: 1.5rem; }
  .seat { min-height: 40px; padding: 4px 10px; }
  .lobby .card { width: min(780px, 100%); display: block; columns: 2; column-gap: 18px; }
  .lobby .card > * { break-inside: avoid; margin: 0 0 8px; }
  .lobby .card > .btn { display: flex; width: 100%; }
  .lobby .card > .seats { break-before: column; }
  .lobby .card { position: relative; }
  .lobby .card > .b-leave { position: absolute; left: 18px; bottom: 16px; width: calc(50% - 30px); margin: 0; }
  .title-screen .logo { align-self: flex-start; margin-top: 4vh; }
}
@media (min-width: 1000px) and (min-height: 640px) {
  body.land .players { width: 200px; }
  body.land .pl { padding: 8px 10px; }
  body.land .av { width: 42px; height: 42px; } body.land .ring { width: 50px; height: 50px; }
  body.land .pi .nm { font-size: .92rem; } body.land .pi .st { font-size: .88rem; }
  body.land .dock { width: 290px; }
  body.land .rc { height: 54px; } body.land .rc .ri { width: 36px; height: 36px; }
  body.land .act { height: 62px; } body.land .act span { font-size: .8rem; } body.land .act svg { width: 28px; height: 28px; }
  body.land .act.main { height: 64px; } body.land .act.main .ml { font-size: 1.1rem; }
  body.land .hint { font-size: 1rem; }
  body.land .dice-mini { display: flex; }
  body.land #toasts { right: 300px; left: 210px; }
}
@media (prefers-reduced-motion: reduce) { .act.main[data-k="roll"], .seat .cdot.pick { animation: none; } }
.trade-body, .dev-body, .my-offer { display: flex; flex-direction: column; gap: 10px; }
.trade-body > .btn, .my-offer > .btn { align-self: stretch; }
.offer-line .ri.sm { width: 1.9em; height: 1.9em; }

/* fichas.py: ficha del juego bajo la pantalla de juego (visible al desplazarse; al jugar la página vuelve arriba y no se mueve) */
html, body { height: auto !important; min-height: 100%; overflow-x: hidden !important; overflow-y: auto !important; }
html:has(body.playing), body.playing { overflow: hidden !important; }
body:not(.playing) { touch-action: pan-y; }
body:not(.playing) #wrap, body:not(.playing) #app, body:not(.playing) #app canvas, body:not(.playing) #app .screen { touch-action: pan-y !important; }   /* fuera de la partida se puede bajar a la ficha deslizando sobre el juego */
#wrap, #app { position: relative !important; inset: auto !important; width: 100% !important; height: 100vh !important; height: 100dvh !important; }
.game-info { max-width: 860px; margin: 0 auto; padding: 26px 18px 40px; font-family: Fredoka, ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif; color: #f4f0ff; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.game-info .crumbs { font-size: .92rem; color: #b9b0d8; margin-bottom: 10px; } .game-info .crumbs a { color: #b9b0d8; } .game-info .crumbs span { margin: 0 6px; opacity: .6; }
.game-info .howto-src { display: block; } .game-info .howto { background: none; color: inherit; padding: 0; border-radius: 0; box-shadow: none; border: 0; }
.game-info h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.15; margin: 0 0 10px; color: #fff; }
.game-info h2 { font-size: 1.3rem; margin: 26px 0 8px; color: #ffd23f; }
.game-info p, .game-info li { color: #e8e2fa; } .game-info ul { padding-left: 1.2em; } .game-info a { color: #ffd23f; }
.game-info details { margin: 8px 0; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); }
.game-info summary { cursor: pointer; font-weight: 600; } .game-info details p { margin: 6px 0 0; }
.game-info .more { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.game-info .more a { display: block; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); text-decoration: none; color: #fff; }
.game-info .more img { display: block; width: 100%; height: auto; aspect-ratio: 40 / 21; object-fit: cover; } .game-info .more b { display: block; padding: 8px 10px 0; } .game-info .more span { display: block; padding: 0 10px 10px; font-size: .88rem; color: #c9c0e6; }
.game-info .foot { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 34px; padding-top: 16px; border-top: 1px solid rgba(190,160,255,.22); font-size: .92rem; } .game-info .foot a { color: #b9b0d8; }
.howto .t1 { font-size: 1.25rem; font-weight: 700; margin: .67em 0; }
