@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../brand/fonts/Outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../brand/fonts/Outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Brand tokens: see brand/README.md */
:root {
  --bg: #f6efe4;
  --surface: #fffaf2;
  --surface-2: #efe5d5;
  --text: #2a211b;
  --muted: #6b5d51;
  --border: #dccdb8;
  --red: #c8102e;
  --gold: #f2b705;
  --navy: #1d3557;
  --accent: #c8102e;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #dff3e6;
  --bad: #b3261e;
  --bad-bg: #fbe3e0;
  --panot: rgba(60, 40, 20, .055);
  --shadow: 0 2px 0 rgba(60, 40, 20, .1), 0 12px 28px rgba(60, 40, 20, .1);
  --radius: 22px;
  --cat: var(--red);
  --display: 'Outfit', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f;
    --surface: #231d17;
    --surface-2: #30271f;
    --text: #f5ece0;
    --muted: #bcab97;
    --border: #45392d;
    --accent: #ff5a6e;
    --accent-text: #1a0f0b;
    --ok: #6fd89a;
    --ok-bg: #173524;
    --bad: #ff8f85;
    --bad-bg: #40201c;
    --panot: rgba(255, 240, 220, .04);
    --shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17130f;
  --surface: #231d17;
  --surface-2: #30271f;
  --text: #f5ece0;
  --muted: #bcab97;
  --border: #45392d;
  --accent: #ff5a6e;
  --accent-text: #1a0f0b;
  --ok: #6fd89a;
  --ok-bg: #173524;
  --bad: #ff8f85;
  --bad-bg: #40201c;
  --panot: rgba(255, 240, 220, .04);
  --shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  /* Barcelona's flower paving tile ("panot") as a faint pattern. */
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 16px 32px, transparent 9px, var(--panot) 9.5px, var(--panot) 11px, transparent 11.5px),
    radial-gradient(circle at 48px 32px, transparent 9px, var(--panot) 9.5px, var(--panot) 11px, transparent 11.5px),
    radial-gradient(circle at 32px 16px, transparent 9px, var(--panot) 9.5px, var(--panot) 11px, transparent 11.5px),
    radial-gradient(circle at 32px 48px, transparent 9px, var(--panot) 9.5px, var(--panot) 11px, transparent 11.5px),
    radial-gradient(circle at 32px 32px, var(--panot) 4px, transparent 4.5px),
    linear-gradient(var(--panot) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--panot) 1.5px, transparent 1.5px);
  background-size: 64px 64px;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#app:focus, #q-text:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 720px; margin: 0 auto; padding: 12px 16px 8px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px; border-radius: 10px; }
.logo { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; }
.logo b { color: var(--accent); font-weight: 900; }
.brand-logo { display: block; height: 34px; width: auto; color: var(--text); }
.brand-logo .brand-cat { stroke: var(--accent); }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn { min-width: 44px; height: 44px; padding: 0 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; font-size: 1.15rem; line-height: 1; }

main { max-width: 720px; margin: 0 auto; padding: 4px 16px 40px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.screen { animation: screen-in .35s cubic-bezier(.2, .8, .2, 1); }
.stack > * + * { margin-top: 16px; }
.card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* ---------- Rajola (category tile): the game's collectible ---------- */
.rajola {
  position: relative; display: grid; place-items: center; aspect-ratio: 1;
  background: var(--cat); color: #fff; border-radius: 22%;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22), inset 0 2px 0 rgba(255, 255, 255, .28);
  overflow: hidden;
}
.rajola svg { width: 62%; height: 62%; fill: currentColor; position: relative; }
.rajola::before {
  /* trencadís cracks */
  content: ""; position: absolute; inset: 0; opacity: .22;
  background:
    linear-gradient(115deg, transparent 47%, #fff 47.5%, #fff 49.5%, transparent 50%),
    linear-gradient(28deg, transparent 61%, #fff 61.5%, #fff 63.5%, transparent 64%),
    linear-gradient(160deg, transparent 27%, #fff 27.5%, #fff 29.5%, transparent 30%);
}

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--size, 96px) * .06); width: var(--size, 96px); height: var(--size, 96px); flex: none; padding: calc(var(--size, 96px) * .08); background: var(--surface-2); border-radius: 18%; }
/* With ten themes (picant included) the 3×3 grid falls short: four per row. */
.mosaic:has(.slot:nth-child(10)) { grid-template-columns: repeat(4, 1fr); align-content: center; }
.mosaic .slot { position: relative; aspect-ratio: 1; border-radius: 22%; }
.mosaic .slot .rajola { width: 100%; }
.mosaic .slot:not(.won) .rajola { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--border); opacity: .55; }
.mosaic .slot:not(.won) .rajola::before { display: none; }
.mosaic .slot.out .rajola { opacity: .18; }
.mosaic .slot.pop .rajola { animation: slot-pop .55s cubic-bezier(.2, 1.6, .4, 1); }
.mosaic.complete { background: var(--gold); animation: glow 1.2s ease-in-out 2; }
.fly { position: fixed; z-index: 30; margin: 0; pointer-events: none; }
/* A rajola won: which one, big in the middle, before it flies into the token (board.js, winRajola). */
.rj-win { position: fixed; inset: 0; z-index: 29; display: grid; place-items: center; pointer-events: none; background: rgba(20, 12, 6, .55); animation: rj-in .25s ease-out both; }
.rj-win.out { animation: rj-out .45s ease-in both; }
.rj-rays { position: absolute; left: 50%; top: 50%; width: 150vmax; height: 150vmax; translate: -50% -50%; opacity: .55;
  background: repeating-conic-gradient(from 0deg, var(--cat) 0 9deg, transparent 9deg 18deg);
  -webkit-mask: radial-gradient(closest-side, #000 0, #000 18%, transparent 62%); mask: radial-gradient(closest-side, #000 0, #000 18%, transparent 62%);
  animation: rj-spin 9s linear infinite; }
.rj-card { position: relative; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 0 24px; }
.rj-top { margin: 0; font-family: var(--display); font-weight: 850; font-size: clamp(1.6rem, 8vw, 2.3rem); color: #fff6e0; text-shadow: 0 3px 0 rgba(0, 0, 0, .35); animation: rj-drop .5s cubic-bezier(.2, 1.5, .4, 1) .05s both; }
.rj-tile { width: 128px; animation: rj-pop .7s cubic-bezier(.2, 1.6, .35, 1) .1s both; }
.rj-tile .rajola { width: 128px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .22), inset 0 4px 0 rgba(255, 255, 255, .3), 0 0 0 5px #fff6e0, 0 10px 30px rgba(0, 0, 0, .45); }
.rj-name { margin: 0; padding: 7px 16px; border-radius: 99px; background: var(--cat); color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.2; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); max-width: 300px; animation: rj-drop .5s cubic-bezier(.2, 1.5, .4, 1) .3s both; }
.rj-win.out .rj-top, .rj-win.out .rj-name, .rj-win.out .rj-rays { animation: rj-out .3s ease-in both; }
@keyframes rj-in { from { opacity: 0; } }
@keyframes rj-out { to { opacity: 0; } }
@keyframes rj-spin { to { rotate: 360deg; } }
@keyframes rj-pop { from { transform: scale(.2) rotate(-200deg); opacity: 0; } }
@keyframes rj-drop { from { transform: translateY(-18px) scale(.8); opacity: 0; } }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; padding: 0; }
.hero-text { padding: 20px 20px 8px; }
.logo { font-size: clamp(3rem, 15vw, 4.6rem); line-height: .95; display: inline-block; position: relative; }
.logo b { position: relative; }
.logo b::after {
  /* four bars under "Cat" */
  content: ""; position: absolute; left: 2%; right: 2%; bottom: -.14em; height: .13em; border-radius: 99px;
  background: repeating-linear-gradient(90deg, var(--red) 0 16%, var(--gold) 16% 28%);
  transform-origin: left; animation: bars-in .7s .25s cubic-bezier(.2, .8, .2, 1) both;
}
.hero-text p { margin-top: 16px; color: var(--muted); font-size: 1.05rem; max-width: 34ch; }
.hero-art { display: block; width: 100%; height: auto; margin-top: 4px; }
.hero-art .rays { transform-origin: 200px 150px; animation: rays 7s ease-in-out infinite alternate; }
.hero-art .sun { animation: sun-up 1s .1s cubic-bezier(.2, .8, .2, 1) both; }
.trencadis { display: block; width: 100%; height: 26px; }
.trencadis polygon { stroke: var(--surface); stroke-width: 2.2; stroke-linejoin: round; animation: tile-in .5s both; animation-delay: calc(var(--i) * 12ms); transform-box: fill-box; transform-origin: center; }

.progress-line { display: flex; align-items: center; gap: 10px; padding: 12px 20px 16px; font-size: .92rem; color: var(--muted); }
.progress-line strong { color: var(--text); }
.meter { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .label { padding: 0; margin-bottom: 10px; font-weight: 750; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.legend-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--accent); font-weight: 700; font-size: .9rem; text-decoration: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg label, .tile { position: relative; display: block; }
.seg input, .tile input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 6px 8px; font-weight: 700; background: var(--surface-2); border: 2px solid transparent; border-radius: 14px; transition: background .15s, color .15s, transform .1s; }
.seg input:checked + span { background: var(--text); color: var(--bg); }
.seg input:active + span, .tile input:active + .tile-body { transform: scale(.96); }
.seg input:focus-visible + span, .tile input:focus-visible + .tile-body { outline: 3px solid var(--gold); outline-offset: 2px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile-body { display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 18px; background: var(--surface-2); border: 2px solid transparent; text-align: center; transition: transform .12s, border-color .15s, background .15s; }
.tile-body .rajola { width: min(58px, 62%); transition: filter .2s, transform .25s cubic-bezier(.2, 1.6, .4, 1); }
.tile-name { font-weight: 700; font-size: .84rem; line-height: 1.15; }
/* Room for two lines in every tile, so a long name (Música i cinema) doesn't make its tile taller than the rest. */
.tile-name { display: grid; place-items: center; min-height: 2.3em; }
.tile-count { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-bar { width: 80%; height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.tile-bar i { display: block; height: 100%; background: var(--cat); border-radius: 99px; }
.tile input:checked + .tile-body { background: var(--surface); border-color: var(--cat); box-shadow: 0 3px 0 var(--cat); }
.tile input:not(:checked) + .tile-body .rajola { filter: grayscale(1) opacity(.45); transform: scale(.88) rotate(-6deg); }
.tile input:not(:checked) + .tile-body .tile-name { color: var(--muted); }
.tile-check { position: absolute; top: -6px; right: -4px; z-index: 2; display: none; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cat); color: #fff; font-size: .78rem; font-weight: 900; border: 2px solid var(--surface); }
.tile input:checked ~ .tile-check { display: grid; animation: slot-pop .35s cubic-bezier(.2, 1.6, .4, 1); }

.names { display: grid; gap: 8px; }
.name-row { display: flex; align-items: center; gap: 10px; }
.shirt { flex: none; width: 26px; height: 26px; border-radius: 8px 8px 10px 10px; background: var(--shirt); box-shadow: inset 0 -7px 0 #1a1512; }
.names input { flex: 1; min-width: 0; min-height: 48px; padding: 8px 14px; background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row small { display: block; color: var(--muted); font-size: .88rem; }
.switch { position: relative; flex: none; width: 56px; height: 32px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .2s cubic-bezier(.2, 1.4, .4, 1); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(24px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 60px; padding: 12px 20px; border: 0; border-radius: 18px;
  background: var(--accent); color: var(--accent-text);
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: 0 5px 0 var(--border); font-family: inherit; font-size: 1.05rem; font-weight: 750; }
.cta { position: sticky; bottom: 0; z-index: 5; margin: 16px -18px -18px; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--surface) 28%); border-radius: 0 0 var(--radius) var(--radius); }
.cta .btn { position: relative; overflow: hidden; }
.cta .btn:not([disabled])::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 12%; background: linear-gradient(100deg, transparent, rgba(255, 210, 50, .12) 40%, rgba(255, 228, 110, .95) 50%, rgba(255, 210, 50, .12) 60%, transparent); animation: shine 3.2s ease-in-out infinite; }
.hint { color: var(--muted); font-size: .9rem; text-align: center; margin-bottom: 10px; }
.hint.warn { color: var(--bad); font-weight: 650; }
.record-line { text-align: center; color: var(--muted); font-size: .95rem; margin-top: 10px; }
.record-line strong { color: var(--text); }
.footer { text-align: center; color: var(--muted); font-size: .88rem; }
.footer a { color: inherit; font-weight: 650; }
details.card summary { cursor: pointer; font-weight: 750; }
details.card[open] summary { margin-bottom: 14px; }

/* ---------- Game ---------- */
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: .95rem; }
.hud-top .quit { background: none; border: 0; color: var(--muted); font-weight: 650; padding: 8px 4px; text-decoration: none; }
.steps { display: flex; gap: 4px; margin-top: 6px; }
.steps i { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-2); transition: background .3s; }
.steps i.ok { background: var(--ok); }
.steps i.ko { background: var(--bad); }
.steps i.now { background: var(--text); animation: blink 1.2s ease-in-out infinite; }

.board { display: flex; gap: 10px; }
.player { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 2px solid var(--border); border-radius: 20px; transition: border-color .2s, transform .25s, box-shadow .2s; }
.player.multi { flex-direction: column; gap: 6px; padding: 10px 6px 8px; text-align: center; opacity: .7; }
.player.multi.active { opacity: 1; border-color: var(--shirt); box-shadow: 0 4px 0 var(--shirt); transform: translateY(-3px); }
.player .info { min-width: 0; }
.player .pts { display: block; font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.player.multi .pts { font-size: 1.35rem; }
.player .pts.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
.player .who { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player.multi .who { font-weight: 700; color: var(--text); max-width: 100%; }
.streak { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); font-size: .82rem; font-weight: 750; }
.streak.hot { background: var(--gold); color: #221a15; animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }

.question { border-top: 10px solid var(--cat); animation: card-in .4s cubic-bezier(.2, .9, .2, 1); }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.q-meta .rajola { width: 44px; flex: none; }
.q-cat { font-weight: 800; line-height: 1.15; }
.q-cat small { display: block; font-weight: 600; font-size: .82rem; color: var(--muted); }
.turn { margin-left: auto; padding: 5px 12px; border-radius: 99px; background: var(--shirt); color: #fff; font-weight: 750; font-size: .88rem; }
.question h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.35rem, 5.2vw, 1.75rem); line-height: 1.22; letter-spacing: -.012em; }

.timer { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.timer-bar { flex: 1; height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: var(--cat); border-radius: 99px; transform-origin: left; }
.timer.low .timer-bar i { background: var(--bad); }
.timer.low .timer-num { color: var(--bad); animation: blink .5s ease-in-out infinite; }
.timer-num { min-width: 2.2ch; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.options { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 620px) { .options { grid-template-columns: 1fr 1fr; } }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 62px; padding: 10px 14px;
  background: var(--surface); border: 2px solid var(--border); border-radius: 18px;
  font-weight: 600; line-height: 1.3; box-shadow: 0 4px 0 var(--border);
  transition: transform .08s, box-shadow .08s, border-color .12s;
  animation: option-in .35s cubic-bezier(.2, .9, .2, 1) both; animation-delay: calc(120ms + var(--i) * 60ms);
}
.option:not([disabled]):hover { border-color: var(--cat); }
.option:not([disabled]):active { transform: translateY(4px); box-shadow: none; }
.option .key { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-2); font-weight: 800; }
.option[disabled] { cursor: default; box-shadow: none; opacity: .55; }
.option.correct, .option.wrong { opacity: 1; }
.option.correct { background: var(--ok-bg); border-color: var(--ok); animation: correct .5s cubic-bezier(.2, 1.6, .4, 1); }
.option.correct .key { background: var(--ok); color: var(--ok-bg); }
.option.wrong { background: var(--bad-bg); border-color: var(--bad); border-style: dashed; animation: shake .4s; }
.option.wrong .key { background: var(--bad); color: var(--bad-bg); }
.option .mark { margin-left: auto; flex: none; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.option.correct .mark { color: var(--ok); }
.option.wrong .mark { color: var(--bad); }

.feedback { margin-top: 16px; animation: card-in .35s cubic-bezier(.2, .9, .2, 1); }
.feedback .verdict { font-family: var(--display); font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .points { margin-top: 4px; font-weight: 700; font-size: .95rem; }
.feedback .won { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 750; }
.feedback .won .rajola { width: 30px; }
.feedback .explain { margin: 12px 0 16px; padding: 12px 14px; background: var(--surface-2); border-radius: 14px; border-left: 5px solid var(--cat); }
.feedback .explain b { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* ---------- Results ---------- */
.results-head { text-align: center; overflow: hidden; padding-bottom: 20px; }
.results-head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.1; letter-spacing: -.02em; margin-top: 10px; }
.results-head .big { font-family: var(--display); font-size: clamp(3rem, 14vw, 4.4rem); font-weight: 850; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 12px; }
.results-head .big small { display: block; font-family: system-ui, sans-serif; font-size: .9rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.results-head .sub { color: var(--muted); margin-top: 8px; }
.badge { display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 99px; background: var(--gold); color: #221a15; font-weight: 800; animation: bump .6s 1.2s cubic-bezier(.2, 1.6, .4, 1) both; }
.results-row { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 14px; flex-wrap: wrap; }

/* Castell: one floor per 10% of correct answers */
.castell { display: flex; flex-direction: column-reverse; align-items: center; min-height: 60px; padding-top: 8px; }
.castell .pis { display: flex; justify-content: center; margin-top: -7px; animation: pis-in .5s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(300ms + var(--i) * 170ms); }
.castell .pis.pinya .p { margin: 0 -3px; }
.p { position: relative; width: 18px; height: 30px; margin: 0 1px; }
.p::before { content: ""; position: absolute; left: 50%; top: 0; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #f3d9b8; box-shadow: inset 0 3px 0 #3a2a20; }
.p::after { content: ""; position: absolute; left: 1px; right: 1px; top: 9px; bottom: 0; border-radius: 6px 6px 3px 3px; background: linear-gradient(var(--shirt) 0 46%, #1a1512 46% 64%, #fbf7ee 64%); }
.p.small { transform: scale(.78); transform-origin: bottom center; }
.p.aleta i { position: absolute; right: -3px; top: -6px; width: 5px; height: 16px; border-radius: 3px; background: var(--shirt); transform: rotate(18deg); transform-origin: bottom; animation: aleta .5s 2.4s cubic-bezier(.2, 1.6, .4, 1) both; }
.castell.wobble { animation: wobble 2.5s 2.2s ease-in-out infinite; transform-origin: bottom center; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ranking li { display: grid; grid-template-columns: 34px auto 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-radius: 18px; animation: card-in .45s both; animation-delay: calc(var(--i) * 140ms); }
.ranking li.first { background: var(--gold); color: #221a15; }
.ranking li.first .mosaic { background: rgba(255, 255, 255, .5); }
.ranking .pos { font-family: var(--display); font-size: 1.6rem; font-weight: 850; text-align: center; }
.ranking .who { font-weight: 750; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ranking .who small { display: block; font-weight: 500; opacity: .8; }
.ranking .pts { font-family: var(--display); font-weight: 850; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.breakdown { display: grid; gap: 12px; }
.bd-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 10px; align-items: center; font-size: .95rem; }
.bd-row .rajola { grid-row: span 2; width: 34px; }
.bd-row .bd-name { font-weight: 650; }
.bd-row .bd-num { font-weight: 750; font-variant-numeric: tabular-nums; }
.bd-row .bd-bar { grid-column: 2 / -1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bd-row .bd-bar i { display: block; height: 100%; background: var(--cat); border-radius: 99px; transform-origin: left; animation: grow .7s .4s cubic-bezier(.2, .8, .2, 1) both; }
.actions { display: grid; gap: 12px; }

/* ---------- Effects ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
html.pf-open #fx { z-index: 95; } /* messages stay visible over the shop and the profile */
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: confetti linear forwards; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 10px 18px; border-radius: 99px; background: var(--text); color: var(--bg); font-weight: 700; animation: toast 2.2s both; white-space: nowrap; }
.callout { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); padding: 10px 22px; border-radius: 18px; background: var(--gold); color: #221a15; font-family: var(--display); font-weight: 850; font-size: clamp(1.5rem, 7vw, 2.2rem); text-align: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); animation: callout 1.7s cubic-bezier(.2, 1.4, .4, 1) both; white-space: nowrap; }

@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes option-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes tile-in { from { opacity: 0; transform: scale(.2) rotate(40deg); } to { opacity: 1; transform: none; } }
@keyframes bars-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rays { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes sun-up { from { transform: translateY(40px); } to { transform: none; } }
@keyframes shine { 0%, 55% { left: -40%; } 100% { left: 120%; } }
@keyframes blink { 50% { opacity: .45; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes slot-pop { 0% { transform: scale(.3) rotate(-25deg); } 60% { transform: scale(1.25) rotate(6deg); } 100% { transform: none; } }
@keyframes glow { 50% { box-shadow: 0 0 0 8px rgba(249, 200, 14, .45); } }
@keyframes correct { 40% { transform: scale(1.04); } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
@keyframes pis-in { from { opacity: 0; transform: translateY(-30px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes aleta { from { transform: rotate(120deg) scaleY(.2); } to { transform: rotate(18deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.2deg); } 75% { transform: rotate(1.2deg); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes confetti { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 12%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes callout { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-8deg); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(-3deg); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(.9) rotate(-3deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.steps i.done { background: var(--muted); }
.still { animation: none !important; }
.results-head .stats { text-align: left; margin: 0; }
.ranking { text-align: left; }

/* Online rooms */
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.join-row input {
  min-width: 0; padding: 12px 14px; background: var(--surface-2); border: 2px solid var(--border); border-radius: 13px;
  font-weight: 800; font-size: 1.2rem; letter-spacing: .3em; text-transform: uppercase; text-align: center;
}
.join-row input::placeholder { letter-spacing: 0; font-weight: 600; text-transform: none; }
.join-row .btn { width: auto; }
.join-row + .hint { margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; font-weight: 650; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }
.room { text-align: center; }
.room-code { font-family: var(--display); font-size: clamp(3rem, 16vw, 4.6rem); font-weight: 850; line-height: 1; letter-spacing: .14em; margin-right: -.14em; font-variant-numeric: tabular-nums; }
.room-code:focus { outline: none; }
.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; background: var(--surface-2); border-radius: 14px; font-weight: 750; }
.roster .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster small { font-weight: 500; color: var(--muted); }
.roster .tags { display: flex; align-items: center; gap: 6px; flex: none; }
.roster .tag { padding: 3px 9px; border-radius: 99px; background: var(--surface); font-size: .78rem; font-weight: 800; }
.roster .tag.bot { background: var(--gold); color: #221a15; }
.o-unbot { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--surface); color: inherit; font: inherit; font-weight: 800; cursor: pointer; }
.o-unbot:hover, .o-unbot:focus-visible { background: var(--bad, #c0392b); color: #fff; }
.option.chosen { opacity: 1; border-color: var(--text); }
.option.chosen .key { background: var(--text); color: var(--bg); }
.score-pill.away { opacity: .5; }
.score-pill .gain { margin-left: 4px; font-style: normal; font-size: .8rem; color: var(--ok); }
.waiting { margin-top: 16px; }
.feedback .hint { margin-top: 10px; }
.still-card .question, .still .feedback, .still .option.wrong { animation: none; }

/* ---------- Board game ("Tauler") ---------- */
fieldset > .hint { margin: 8px 0 0; text-align: left; }

.b-players { display: flex; gap: 10px; }
.b-player { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 2px solid var(--border); border-radius: 20px; transition: border-color .2s, transform .25s, box-shadow .2s, opacity .2s; }
.b-player.multi { flex-direction: column; gap: 4px; padding: 10px 6px 8px; text-align: center; opacity: .7; }
.b-player.active { opacity: 1; border-color: var(--shirt); box-shadow: 0 4px 0 var(--shirt); transform: translateY(-3px); }
.b-player .b-tk { width: 64px; height: 64px; }
.b-player.multi .b-tk { width: 56px; height: 56px; }
.b-player .info { min-width: 0; }
.b-player .pts { display: block; font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.b-player.multi .pts { font-size: 1.25rem; }
.b-player .pts.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
.b-player .who { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-player.multi .who { font-weight: 700; color: var(--text); max-width: 100%; }
.b-count { display: block; font-size: .78rem; color: var(--muted); font-weight: 650; }
.b-count b { color: var(--text); }
@media (max-width: 480px) { .b-player.multi .b-word { display: none; } .b-players { gap: 6px; } }

/* The token: a medallion with one wedge per category */
.b-tk { display: block; flex: none; overflow: visible; }
.b-tk.big { width: 104px; height: 104px; }
.b-tk.rank { width: 46px; height: 46px; }
.b-tk.pop { animation: slot-pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.tk-rim { fill: var(--shirt); }
.tk-base { fill: var(--surface); }
.tk-hub { fill: var(--shirt); stroke: var(--surface); stroke-width: .06; }
.w { fill: var(--cat); fill-opacity: .17; stroke: var(--surface); stroke-width: .07; stroke-linejoin: round; transition: fill-opacity .3s; }
.w.won { fill-opacity: 1; }
.w.new { animation: wedge-new 1s ease-out; }

/* Board */
.b-board { padding: 10px; }
.b-svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; overflow: visible; touch-action: manipulation; }
.b-base { fill: var(--surface-2); }
.b-inner { fill: var(--surface); }
.shard { stroke: var(--surface); stroke-width: 1.6; stroke-linejoin: round; opacity: .7; animation: shard-in .5s both; animation-delay: calc(300ms + var(--i) * 8ms); }
.plaça { animation: plaça-in .7s cubic-bezier(.2, 1.4, .4, 1) .15s both; transform-box: fill-box; transform-origin: center; }
.plaça-ring { fill: var(--surface); }
.plaça-disc { fill: var(--gold); }
.plaça rect { fill: var(--red); }
.cas { transform-box: fill-box; transform-origin: center; animation: cas-in .45s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 14ms); outline: none; }
.cas-shape { fill: var(--cat); stroke: var(--surface-2); stroke-width: 1; transition: filter .15s; }
.cas-cat .cas-shape { filter: saturate(.85); }
.cas-icon { fill: #fff; opacity: .6; pointer-events: none; }
.cas-hq .cas-shape { stroke: var(--gold); stroke-width: 3; }
.hq-disc { fill: #fff; pointer-events: none; }
.hq-icon { fill: var(--cat); pointer-events: none; }
.cas-tira .cas-shape { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.tira-die { pointer-events: none; }
.tira-die rect { fill: #f2b705; stroke: #d9a300; stroke-width: 1.4; }
.tira-die path { fill: #c8102e; }
.cas.dest { cursor: pointer; }
.cas.dest .cas-shape { stroke: var(--text); stroke-width: 4; animation: dest 1s ease-in-out infinite; }
.cas.dest:hover .cas-shape, .cas.dest:focus-visible .cas-shape { filter: brightness(1.2); stroke-width: 6; }
.cas.spin .cas-shape { filter: brightness(1.3); stroke: var(--text); stroke-width: 6; }

.fitxa.glide { transition: transform .45s cubic-bezier(.2, .9, .3, 1.2); }
.fitxa-shadow { fill: rgba(0, 0, 0, .25); }
.fitxa-tk { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3)); }
.halo { fill: none; stroke: var(--shirt); stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fitxa.active .halo { animation: halo 1.3s ease-out infinite; }
.fitxa.winner .fitxa-in { animation: winner 1s cubic-bezier(.2, 1.6, .4, 1) infinite alternate; }

/* Die and controls */
.b-panel { display: flex; align-items: center; gap: 18px; min-height: 120px; }
.b-ctrl { flex: 1; min-width: 0; }
.b-ctrl.in { animation: card-in .3s cubic-bezier(.2, .9, .2, 1); }
.b-msg { font-weight: 650; margin-bottom: 10px; }
.b-roll-num { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; border-radius: 8px; background: var(--text); color: var(--bg); font-family: var(--display); font-weight: 850; animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
.b-choices { display: grid; gap: 8px; }
@media (min-width: 520px) { .b-choices { grid-template-columns: 1fr 1fr; } }
.b-go { font-size: 1.05rem; border-left: 10px solid var(--cat, var(--border)); }

.dau-scene { position: relative; flex: none; width: 76px; height: 76px; display: grid; place-items: center; perspective: 420px; }
.dau-tilt { transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(24deg); }
.dau { position: relative; width: 52px; height: 52px; transform-style: preserve-3d; }
.cara {
  position: absolute; inset: 5px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 2px; gap: 1px; background: #f2b705; backface-visibility: hidden;
}
/* Rounded edges and corners (see DIE_ROUND in board.js): every piece is centred on the cube's
   centre and pushed out along its own direction. */
.dau .vora, .dau .punta, .dau .nucli { position: absolute; left: 50%; top: 50%; translate: -50% -50%; backface-visibility: hidden; }
.dau .vora { background: linear-gradient(var(--across, 90deg), #f2b705, #e9ad02 30%, #dfa300 50%, #e9ad02 70%, #f2b705); }
.dau .vora.h { --across: 180deg; }
.dau .nucli { background: #e3a700; }
/* The corners: little triangles 7.07px a side, centred on their middle point. */
.dau .punta { width: 7.071px; height: 6.124px; --mid: 50% 33.333%; background: radial-gradient(circle at var(--mid), #dfa300 0, #e2a601 2px, #f2b705 4.2px); }
.dau .punta.dalt { --mid: 50% 66.667%; }
.dau .punta.baix { clip-path: polygon(0 0, 100% 0, 50% 100%); translate: -50% -33.333%; transform-origin: 50% 33.333%; }
.dau .punta.dalt { clip-path: polygon(50% 0, 100% 100%, 0 100%); translate: -50% -66.667%; transform-origin: 50% 66.667%; }
/* The points are little red stars, in the logo's yellow and red. */
.cara i.on {
  background: #c8102e; transform: scale(.9);
  clip-path: polygon(50% 0, 61.8% 35.4%, 99% 35.4%, 69% 57.3%, 80.4% 92.7%, 50% 70.8%, 19.6% 92.7%, 31% 57.3%, 1% 35.4%, 38.2% 35.4%);
}
.cara.c1 i.on { transform: scale(1.5); }
.c1 { transform: translateZ(26px); }
.c6 { transform: rotateY(180deg) translateZ(26px); }
.c3 { transform: rotateY(90deg) translateZ(26px); }
.c4 { transform: rotateY(-90deg) translateZ(26px); }
.c2 { transform: rotateX(90deg) translateZ(26px); }
.c5 { transform: rotateX(-90deg) translateZ(26px); }
/* The die drawn as a real rounded cube (js/dau3d.js) over the CSS one, which then hides. */
.dau-gl { position: absolute; left: 50%; top: 50%; translate: -50% -50%; pointer-events: none; z-index: 1; }
.dau-scene.gl .dau-tilt { visibility: hidden; }
.dau-shadow { position: absolute; left: 14px; right: 14px; bottom: -4px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, .18); filter: blur(2px); }

/* Question sheet */
.b-sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; background: rgba(23, 19, 15, .5); backdrop-filter: blur(3px); animation: fade-in .25s both; }
.b-sheet.out { animation: fade-out .26s both; }
.b-sheet-in { width: 100%; max-width: 680px; margin: auto; }
.b-sheet .question { box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.b-tag { padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: .8rem; font-weight: 800; }
.b-tag.final { background: var(--gold); color: #221a15; }

.b-banner {
  position: fixed; left: 50%; top: 38%; z-index: 25; display: flex; align-items: center; gap: 12px; padding: 10px 26px 10px 12px;
  border-radius: 99px; background: var(--shirt); color: #fff; font-family: var(--display); font-weight: 850; font-size: clamp(1.4rem, 6vw, 2rem);
  white-space: nowrap; box-shadow: 0 8px 0 rgba(0, 0, 0, .22); animation: banner 1.45s cubic-bezier(.3, .9, .3, 1) both; pointer-events: none;
}
.b-banner .b-tk { width: 48px; height: 48px; }

@keyframes cas-in { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes shard-in { from { opacity: 0; } to { opacity: .7; } }
@keyframes plaça-in { from { opacity: 0; transform: scale(.3) rotate(-90deg); } to { opacity: 1; transform: none; } }
@keyframes dest { 50% { stroke-width: 7; filter: brightness(1.18); } }
@keyframes halo { 0% { opacity: .9; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes winner { from { transform: scale(1); } to { transform: scale(1.35); } }
@keyframes wedge-new { 0% { fill: #fff; } 30% { fill: #fff; } 100% { fill: var(--cat); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes banner {
  0% { opacity: 0; transform: translate(-160%, -50%) skewX(-12deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) skewX(4deg); }
  30%, 75% { opacity: 1; transform: translate(-50%, -50%) skewX(0); }
  100% { opacity: 0; transform: translate(60%, -50%) skewX(-12deg); }
}

/* ---------- Duros and advantages (js/perks.js) ---------- */
.duro { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.18em; }
.preu { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.icon-btn.purse { display: inline-flex; align-items: center; gap: 6px; font-size: .98rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.icon-btn.purse .duro { width: 1.3em; height: 1.3em; }
.icon-btn.purse.bump .duro { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }

.shop-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; text-align: left; }
.shop-card-coin .duro { display: block; width: 40px; height: 40px; }
.shop-card-text { flex: 1; min-width: 0; }
.shop-card-text b { display: block; font-family: var(--display); font-size: 1.2rem; font-weight: 800; }
.shop-card-text small { display: block; color: var(--muted); font-size: .88rem; line-height: 1.3; }
.shop-card-go { flex: none; color: var(--accent); font-weight: 800; white-space: nowrap; }

.perk-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin-top: 16px; }
@media (min-width: 620px) { .perk-bar { grid-template-columns: repeat(6, 1fr); } }
.perk {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 8px 4px 6px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 14px;
  transition: transform .08s, border-color .12s;
}
.perk:not([disabled]):hover { border-color: var(--cat); }
.perk:not([disabled]):active { transform: translateY(2px); }
.perk[disabled] { cursor: not-allowed; }
.perk[disabled] .perk-ico, .perk[disabled] .perk-name { opacity: .4; }
.perk-ico { font-size: 1.25rem; line-height: 1.1; }
.perk-name { font-size: .72rem; font-weight: 700; line-height: 1.15; text-align: center; }
.perk-n {
  position: absolute; top: -8px; right: -4px; display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px;
  border-radius: 99px; background: var(--text); color: var(--bg); font-size: .72rem; font-weight: 800; line-height: 1;
}
.perk-n.buy { background: var(--gold); color: #221a15; }
.perk-n.used { background: var(--ok); color: var(--ok-bg); }
.perk[disabled] .perk-n.buy { background: var(--border); color: var(--muted); }
.perk.used { border-color: var(--ok); }
.perk.used .perk-ico, .perk.used .perk-name { opacity: .75; }

.option.gone { opacity: .3; text-decoration: line-through; animation: none; }
.option.voted { background-image: linear-gradient(90deg, color-mix(in srgb, var(--cat) 20%, transparent) var(--vote), transparent var(--vote)); }
.option .vote { margin-left: auto; flex: none; font-weight: 800; font-variant-numeric: tabular-nums; }
.option .vote + .mark { margin-left: 0; }
.option.tried { opacity: .6; animation: shake .4s; }

.feedback .coins { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-weight: 800; }
.feedback .coins span { font-weight: 650; color: var(--muted); }

.b-roll-row { display: grid; gap: 10px; }
@media (min-width: 520px) { .b-roll-row:has(.perk-die) { grid-template-columns: 1.2fr 1fr; } }
.perk-die .perk-n { position: static; }
.b-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 8px; }
.b-pick .btn { min-height: 48px; padding: 6px 0; font-family: var(--display); font-size: 1.25rem; font-weight: 850; }

.shop-head h1 { flex: 1; }
.shop-purse { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.shop-purse .duro { width: 1.3em; height: 1.3em; }
.shop-sub { margin-top: 8px; color: var(--muted); font-size: .93rem; }
.shop-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.shop-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 16px; }
.shop-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface); font-size: 1.45rem; }
.shop-text { min-width: 0; }
.shop-text b { display: block; font-weight: 800; line-height: 1.2; }
.shop-text span { display: block; font-size: .9rem; line-height: 1.3; }
.shop-text small { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
.shop-buy { width: auto; min-height: 46px; padding: 8px 14px; border-radius: 14px; font-size: 1.05rem; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.shop-block { display: grid; gap: 4px; }
.shop-block .shop-sub { margin-top: 0; }
.shop-block .shop-list { margin-top: 8px; }
.shop-packs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-pack {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; text-align: center;
  background: var(--surface-2); border-radius: 16px;
}
.shop-pack:nth-child(2) { box-shadow: inset 0 0 0 2px #f2b705; }
.shop-pack-coins { display: flex; justify-content: center; height: 34px; margin-bottom: 4px; }
.shop-pack-coins .duro { width: 30px; height: 30px; margin: 0 -7px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .18)); }
.shop-pack-n { font-family: var(--display); font-size: 1.05rem; font-weight: 850; line-height: 1.1; white-space: nowrap; }
@media (max-width: 380px) { .shop-pack-n { font-size: .95rem; } }
.shop-pack-name { font-size: .85rem; font-weight: 750; line-height: 1.2; }
.shop-pack small { color: var(--muted); font-size: .74rem; line-height: 1.25; margin-bottom: 8px; }
.shop-pack-buy { width: 100%; min-height: 40px; margin-top: auto; padding: 6px 4px; font-size: .95rem; }
.shop-soon { margin-top: 8px; color: var(--muted); font-size: .82rem; text-align: center; }
.shop-confirm { margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--gold); display: grid; gap: 10px; }
.shop-confirm p { margin: 0; }
.shop-consent { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; line-height: 1.35; cursor: pointer; }
.shop-consent input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--red, #c8102e); }
.shop-minor { color: var(--muted); font-size: .8rem; }
.shop-minor a, .shop-soon a { color: inherit; font-weight: 750; }
.shop-confirm-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.shop-confirm-row .btn { min-height: 44px; }
.shop-how { font-size: .93rem; }
.shop-how summary { font-weight: 750; cursor: pointer; }
.shop-how ul { margin: 8px 0; padding-left: 20px; }
.shop-how p { color: var(--muted); }
@media (max-width: 430px) {
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .brand-logo { height: 24px; }
  .topbar-actions { gap: 6px; flex: none; }
  .topbar .icon-btn { min-width: 40px; padding: 0 8px; }
}

/* ---------- The board game fits one screen, without scrolling (js/board.js fit()) ----------
   A one-line scoreboard on top, the board taking all the height left, and the
   dice with its buttons side by side at the bottom. */
main:has(.b-game) { padding-bottom: 10px; } /* the body already keeps clear of the home bar */
.stack.b-game { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.b-game > * { flex: none; }
.b-game .hud-top { font-size: .9rem; }
.b-game .hud-top .quit { padding: 4px; }

.b-game .b-players { gap: 6px; }
.b-game .b-player { gap: 10px; padding: 6px 12px; border-radius: 16px; }
.b-game .b-player .b-tk { width: 40px; height: 40px; }
.b-game .b-player .info { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.b-game .b-player .pts { font-size: 1.5rem; }
.b-game .b-player .b-count { font-size: .85rem; }
.b-game .b-player .who::after { content: " ·"; }
.b-game .b-player.multi { flex-direction: row; justify-content: center; gap: 6px; padding: 5px 6px; }
.b-game .b-player.multi .b-tk { width: 30px; height: 30px; }
.b-game .b-player.multi .info { flex-direction: column; align-items: flex-start; gap: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.b-game .b-player.multi .pts { font-size: 1.05rem; }
.b-game .b-player.multi .who { font-size: .75rem; max-width: 100%; }
.b-game .b-player.multi { min-width: 0; overflow: hidden; }
.b-game .b-player.multi .who::after, .b-game .b-player.multi .b-count { display: none; }
/* In a game with rivals each box shows the token and the points on top and the name underneath,
   across the whole box, so long names fit. */
.b-game .b-player.multi { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 6px; row-gap: 3px; padding: 7px 7px 6px; }
.b-game .b-player.multi .info { display: contents; }
.b-game .b-player.multi .b-tk { width: 32px; height: 32px; }
.b-game .b-player.multi .pts { text-align: center; font-size: 1.2rem; }
.b-game .b-player.multi .who { grid-column: 1 / -1; text-align: center; font-size: .8rem; line-height: 1.15; }
.b-game .b-player.active { transform: translateY(-2px); }

.b-game .b-board { position: relative; flex: 1 1 auto; min-height: 0; padding: 0; }
/* The board drawing fills its box and keeps its round shape, whatever the box's size. */
.b-game .b-svg { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); max-width: none; margin: 0; }

.b-game .b-panel {
  display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 8px 12px;
  min-height: 0; padding: 10px 12px;
}
/* The die and the message share a row; the buttons get the full width below. */
.b-game .b-ctrl { display: contents; }
.b-game .dau-scene { grid-column: 1; grid-row: 1; width: 58px; height: 58px; }
.b-game .dau-tilt { scale: .78; }
.b-game .b-msg { grid-column: 2; grid-row: 1; margin: 0; font-size: .95rem; line-height: 1.3; }
.b-game .b-ctrl > :not(.b-msg) { grid-column: 1 / -1; }
.b-game .b-roll-row:has(.perk-die), .b-game .b-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
/* Long destinations ("Llengua i literatura · rajola") wrap onto two lines inside the button instead of leaving the screen. */
.b-go { min-width: 0; }
.b-go-txt { min-width: 0; white-space: normal; overflow-wrap: break-word; text-wrap: balance; text-align: center; line-height: 1.15; }
.b-game .b-ctrl .btn { min-height: 48px; padding: 8px 10px; font-size: 1rem; white-space: nowrap; }
.b-game .b-ctrl .b-go { white-space: normal; padding-left: 10px; padding-right: 10px; font-size: .98rem; }
.b-game .perk-die { font-size: .9rem; gap: 5px; }
.b-game .b-pick { margin-bottom: 0; }
.b-game .b-pick .btn { min-height: 42px; }

/* Drawn advantages (js/dibuixos.js) */
.perk-ico .art { display: block; width: 1.5rem; height: 1.5rem; overflow: visible; }
.shop-ico .art { width: 34px; height: 34px; overflow: visible; }
.perk-die .art { width: 1.4em; height: 1.4em; overflow: visible; flex: none; }
.perk-die { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Leaving a game: a back arrow at the left, before the round or turn. */
.hud-top:has(.quit-btn), .hud:has(.quit-btn) { justify-content: flex-start; gap: 12px; }
.quit-btn { display: grid; place-items: center; flex: none; width: 44px; min-width: 44px; height: 44px; padding: 0; }
.quit-btn svg { width: 22px; height: 22px; }
.b-game .hud-top .quit-btn { padding: 0; }

/* Link-style buttons ("Ara no", "Desmarca-les totes"…): no underline, just a press. */
.link-btn:active, .ix-link:active { opacity: .6; }

/* ---------- Settings: text size and fewer animations (js/ajustos.js) ---------- */
html[data-text="gran"] .question h2 { font-size: clamp(1.55rem, 6vw, 2rem); }
html[data-text="gran"] .option { font-size: 1.12em; }
html[data-text="gran"] .feedback, html[data-text="gran"] .q-cat { font-size: 1.08em; }
html[data-text="enorme"] .question h2 { font-size: clamp(1.8rem, 7.2vw, 2.3rem); }
html[data-text="enorme"] .option { font-size: 1.28em; }
html[data-text="enorme"] .feedback, html[data-text="enorme"] .q-cat { font-size: 1.18em; }
/* "Menys animacions": everything moves at once, like the system's reduced motion. */
html.calm *, html.calm *::before, html.calm *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
  transition-duration: .01ms !important; scroll-behavior: auto !important;
}

/* ---------- Advantages folded behind an «Ajudes» button (js/perks.js) ---------- */
.perk-wrap { margin-top: 14px; }
.perk-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 12px;
  border-radius: 14px; border: 2px dashed #b88a00; background: rgba(242, 183, 5, .16);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.perk-toggle:active { transform: translateY(2px); }
.perk-toggle-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #f2b705; box-shadow: 0 2px 0 #b88a00; }
.perk-toggle-ico .art { width: 22px; height: 22px; overflow: visible; }
.perk-toggle-text { flex: 1; min-width: 0; display: grid; line-height: 1.15; }
.perk-toggle-text b { font-family: var(--display); font-weight: 800; font-size: 1.02rem; }
.perk-toggle-text small { color: var(--muted); font-size: .78rem; font-weight: 600; }
.perk-toggle-icons { display: flex; gap: 2px; }
.perk-toggle-used .art { display: block; width: 22px; height: 22px; overflow: visible; }
.perk-chev { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); transition: transform .25s; }
.perk-chev svg { width: 18px; height: 18px; }
.perk-wrap.open .perk-chev { transform: rotate(180deg); }
.perk-wrap .perk-bar { margin-top: 12px; }
.perk-wrap.open .perk-bar { animation: perk-open .25s cubic-bezier(.2, .9, .2, 1) both; }
.perk-bar[hidden] { display: none; }
@keyframes perk-open { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- A question fits on one screen: the four answers without scrolling ---------- */
main:has(.q-screen) { padding-bottom: 12px; }
.q-screen.stack > * + * { margin-top: 10px; }
.q-screen .steps { margin-top: 14px; }
.q-screen.tight .steps { margin-top: 10px; }
.q-screen .player:not(.multi) { padding: 6px 12px; gap: 12px; }
.q-screen .player:not(.multi) .info { flex: 1; display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
.q-screen .player:not(.multi) .pts { font-size: 1.7rem; }
/* The streak: a small pill beside the points, not a row of its own. */
.q-screen .player:not(.multi) .streak { margin: 0 0 0 auto; padding: 2px 8px; font-size: .74rem; gap: 3px; }
.question.q-card { padding: 14px 16px 16px; }
.q-card .q-meta { margin-bottom: 8px; }
.q-card .q-meta .rajola { width: 38px; }
.q-card h2 { font-size: clamp(1.2rem, 5vw, 1.5rem); line-height: 1.2; }
.q-card .timer { margin-top: 10px; }
.q-card .perk-wrap { margin-top: 10px; }
.q-card .perk-toggle { min-height: 44px; padding: 4px 10px; }
.q-card .options { gap: 8px; margin-top: 10px; }
.q-card .option { min-height: 52px; padding: 7px 12px; }
.q-card .option .key { width: 32px; height: 32px; }
/* Still too tall (a long question on a small phone): js/app.js adds .tight. */
.q-screen.tight .player:not(.multi) { padding: 4px 10px; }
:is(.tight .q-card, .q-card.tight) h2 { font-size: clamp(1.08rem, 4.4vw, 1.3rem); }
:is(.tight .q-card, .q-card.tight) .q-cat small { display: none; }
:is(.tight .q-card, .q-card.tight) .q-meta .rajola { width: 32px; }
:is(.tight .q-card, .q-card.tight) .option { min-height: 46px; padding: 5px 10px; line-height: 1.2; }
:is(.tight .q-card, .q-card.tight) .options { gap: 6px; }
html[data-text] :is(.tight .q-card, .q-card.tight) h2 { font-size: clamp(1.25rem, 5.2vw, 1.55rem); }
.hud-pts { display: none; margin-left: auto; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.q-screen.tight .quit-btn { width: 38px; min-width: 38px; height: 38px; }
.q-screen.tight .mosaic { --size: 48px !important; }
.q-screen.tight .player:not(.multi) .pts { font-size: 1.4rem; }
:is(.tight .q-card, .q-card.tight) .perk-toggle { min-height: 40px; }
:is(.tight .q-card, .q-card.tight) .perk-toggle-text small { display: none; }
:is(.tight .q-card, .q-card.tight) .timer { margin-top: 6px; }
/* Last resort on the smallest phones: the score moves up next to the question count. */
.q-screen.tighter .board { display: none; }
.q-screen.tighter .hud-pts { display: inline-block; }

/* Open advantages: one row of six small buttons in the same strip as «Ajudes»,
   so the answers don't move down (the name shows when one is used). */
.perk-wrap.open { display: flex; align-items: center; gap: 6px; padding: 10px 6px 6px 8px; border-radius: 14px; border: 2px dashed #b88a00; background: rgba(242, 183, 5, .16); }
.perk-wrap.open .perk-toggle { order: 2; flex: none; width: auto; min-height: 0; padding: 0; border: 0; background: none; }
.perk-wrap.open .perk-toggle > :not(.perk-chev) { display: none; }
.perk-wrap.open .perk-bar { flex: 1; min-width: 0; margin-top: 0; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.perk-wrap.open .perk { min-height: 40px; padding: 4px 2px; border-radius: 11px; background: var(--surface); }
.perk-wrap.open .perk-name { display: none; }
.perk-wrap.open .perk-ico .art { width: 1.35rem; height: 1.35rem; }
.perk-wrap.open .perk-n { top: -9px; right: 50%; translate: 50% 0; min-height: 16px; padding: 0 5px; font-size: .62rem; white-space: nowrap; }
.perk-wrap.open .perk-n .duro, .perk-wrap.open .perk-n svg { width: 10px; height: 10px; }

/* ---------- Countdown before a quick game ---------- */
.countdown {
  min-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: grid; place-content: center; justify-items: center; gap: 26px; text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cd-tip { max-width: 22ch; color: #efe1c9; font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; }
.cd-num {
  display: grid; place-items: center; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe27a, #f2b705 55%, #c98f00);
  border: 5px solid #2b1a0e; box-shadow: 0 8px 0 #8a6400, inset 0 0 0 6px rgba(255, 255, 255, .3);
  color: #2b1a0e; font-family: var(--display); font-weight: 900; font-size: 5.6rem; line-height: 1;
}
.cd-num.go { width: auto; min-width: 170px; height: 120px; margin: 25px 0; padding: 0 30px; border-radius: 60px; background: #c8102e; color: #efe1c9; box-shadow: 0 8px 0 #8e0b20; font-size: 2.8rem; }
.cd-num.pop { animation: cd-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.cd-skip { color: var(--muted); font-size: .9rem; font-weight: 650; }
@keyframes cd-pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }

/* ---------- After answering: only the right answer (and yours, if wrong) stays ---------- */
.option.away, .timer.away { display: none; }
.q-card .feedback, .question .feedback { margin-top: 12px; }
.q-card .feedback .verdict, .question .feedback .verdict { font-size: 1.4rem; }
.q-card .feedback .won { margin-top: 6px; }
.q-card .feedback .explain, .question .feedback .explain { margin: 10px 0 12px; padding: 10px 12px; line-height: 1.35; }
:is(.tight .q-card, .q-card.tight) .feedback .verdict { font-size: 1.2rem; }
:is(.tight .q-card, .q-card.tight) .feedback .explain { margin: 8px 0 10px; padding: 8px 10px; font-size: .95em; }
/* Points and duros share a line; on small phones the button gets slimmer too. */
.feedback .gains { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; row-gap: 2px; margin-top: 4px; }
.feedback .gains > * { margin: 0; }
.q-card .feedback .won { font-size: .95rem; line-height: 1.2; }
.q-card .feedback .won .rajola { width: 26px; flex: none; }
:is(.tight .q-card, .q-card.tight) .feedback .btn { min-height: 50px; padding: 8px 16px; }
/* Smallest phones with a long explanation: the category line and the «Sabies que…» label step aside. */
.q-card.snug .q-meta, .q-card.snug .feedback .explain b { display: none; }

/* No yellow focus ring after a tap (Safari shows it when a sheet opens or a
   button gets focus); it comes back as soon as someone uses the keyboard. */
html:not(.kbd) :focus-visible,
html:not(.kbd) :focus-visible + span,
html:not(.kbd) :focus-visible + .tile-body { outline: none !important; }

/* ---------- Results: everything on one screen, no scrolling ---------- */
.stack.results { gap: 10px; }
.results .card { padding: 12px 16px; }
.results .results-head { padding-bottom: 14px; }
.results .castell { zoom: .6; }
.results .results-head h1 { font-size: clamp(1.45rem, 6vw, 1.9rem); margin-top: 4px; }
.results .results-head .sub { margin-top: 4px; font-size: .92rem; line-height: 1.3; }
.results .results-head .big { font-size: clamp(2.4rem, 11vw, 3.2rem); margin-top: 6px; }
.results .results-head .big small { display: inline; margin: 0 0 0 6px; font-size: .78rem; }
.results .results-row { margin-top: 8px; gap: 14px; }
.results .results-head .stats { font-size: .9rem; line-height: 1.35; }
.results .badge { margin-top: 8px; padding: 4px 12px; font-size: .92rem; }
.results .ranking { gap: 6px; }
.results .ranking li { padding: 6px 12px; }
.results .pf-gain { gap: 6px; }
.results .pf-gain-top { gap: 12px; }
.results .pf-ring.small { --size: 52px; }
.results .pf-plus { font-size: 1.35rem; }
.results .pf-sub { font-size: .88rem; }
.results .pf-bar-text { font-size: .8rem; }
.results .pf-up { padding: 4px 10px; font-size: .9rem; }
.results .pf-new { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.results .pf-new .label { display: none; }
.results .pf-chip { margin: 0; padding: 3px 9px 3px 5px; font-size: .8rem; }
.results .pf-chip i { width: 18px; height: 18px; }
.results .actions { gap: 10px; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions-row .btn { min-height: 50px; padding: 8px 10px; font-size: .98rem; }
/* Still too tall (js/app.js fitResults): first the small print and a smaller castell, then the castell and the joke go. */
.results.tight .pf-bar-text, .results.tight .pf-up { display: none; }
.results.tight .castell { zoom: .46; }
.results.tight .results-row { margin-top: 4px; }
.results.tighter .castell, .results.tighter .results-head > .sub { display: none; }
.results.tighter .badge { margin-top: 6px; }
.results.tighter .results-head .big { font-size: 2.2rem; margin-top: 2px; }
.results.tighter .results-row .mosaic { --size: 64px !important; }
.results.tighter .pf-ring.small { --size: 44px; }
.results.tighter .btn { min-height: 52px; }
.results.tighter .actions-row .btn { min-height: 44px; }

/* Yes/no questions in the game's style (js/app.js askYesNo), instead of the system alert. */
dialog.ask {
  width: min(380px, calc(100% - 40px)); padding: 20px 18px 18px; margin: auto;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4); text-align: center;
}
dialog.ask[open] { animation: card-in .3s cubic-bezier(.2, .9, .2, 1); }
dialog.ask::backdrop { background: rgba(23, 19, 15, .6); backdrop-filter: blur(3px); }
dialog.ask h2 { font-family: var(--display); font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
dialog.ask p { margin-top: 8px; color: var(--muted); line-height: 1.35; }
.ask-btns { display: grid; gap: 10px; margin-top: 18px; }
.ask-btns .btn { min-height: 52px; }
.ask-link { width: 100%; margin-top: 14px; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; text-align: center; }

/* ---------- Rivals of the computer ("Contra la IA") ---------- */
.ia-thinking {
  margin: 0;
  font-weight: 700;
  color: var(--shirt, inherit);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ia-thinking .dots { display: inline-flex; gap: 4px; }
.ia-thinking .dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: ia-dot 1s infinite ease-in-out;
}
.ia-thinking .dots i:nth-child(2) { animation-delay: .15s; }
.ia-thinking .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ia-dot {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .ia-thinking .dots i { animation: none; opacity: .6; }
}

/* Invite to an online room through WhatsApp (js/online.js). */
.btn.whatsapp { gap: 10px; text-decoration: none; background: #1fa855; color: #fff; font-size: 1.1rem; box-shadow: 0 5px 0 #127a3c; }
.btn.whatsapp:hover { background: #198f48; }
.btn.whatsapp svg { width: 22px; height: 22px; flex: none; }

/* ---------- "Qui contra qui": the presentation before a game with rivals (js/versus.js) ---------- */
html.vs-open body { overflow: hidden; }
.vs {
  position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: 1fr auto; gap: 10px;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: #1c1814; color: #3a2715; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: fade-in .2s ease-out both;
}
.vs.out { animation: fade-in .25s ease-in reverse both; }
.vs:focus { outline: none; }
.vs-bg {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse 90% 70% at 50% 45%, #dc3a4f 0%, #cf1f38 45%, #b80e29 100%);
  animation: vs-bg-in .5s cubic-bezier(.2, .9, .2, 1) both;
}
/* The rays, turning slowly. */
.vs-bg::before {
  content: ''; position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; translate: -50% -50%;
  background: repeating-conic-gradient(#f5c11c 0 7deg, transparent 7deg 14deg);
  animation: vs-spin 40s linear infinite;
}
/* A soft yellow glow behind the VS, breathing. */
.vs-bg::after {
  content: ''; position: absolute; left: 50%; top: 45%; width: 130vmin; height: 130vmin; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 228, 140, .55) 0%, rgba(255, 214, 110, .26) 28%, rgba(255, 200, 90, .08) 52%, transparent 70%);
  animation: vs-glow 2.6s ease-in-out infinite alternate;
}
/* Characters of the game wandering behind the cards (js/versus.js moves them). */
.vs-walker {
  position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); will-change: transform;
  filter: drop-shadow(0 3px 0 rgba(80, 0, 10, .35));
}
.vs-walker svg { display: block; width: 100%; height: 100%; overflow: visible; animation: vs-bob var(--bob, .9s) ease-in-out infinite alternate; }
.vs-stage { position: relative; display: grid; align-content: center; gap: 14px; width: 100%; max-width: 520px; margin: 0 auto; }
.vs-foot { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 10px 16px; border-radius: 18px; background: rgba(58, 39, 21, .72); justify-self: center; max-width: 100%; }
.vs-note { max-width: 30ch; font-family: var(--serif); font-size: 1.05rem; line-height: 1.3; color: #fbf3e2; text-shadow: 0 1px 2px rgba(80, 0, 10, .35); animation: fade-in .4s 1s both; }
.vs-skip { color: rgba(255, 238, 200, .8); font-size: .85rem; font-weight: 700; }

.vs-card {
  position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px;
  padding: 12px 14px; background: #fbf3e2; border: 3px solid #3a2715; border-radius: 22px; box-shadow: 0 6px 0 #3a2715;
  --float: 0s;
  animation: vs-in-left .55s cubic-bezier(.2, 1.25, .4, 1) calc(var(--i) * .12s) both, vs-float 2.6s ease-in-out calc(.7s + var(--i) * .45s) infinite alternate;
  rotate: -1.5deg;
}
.vs-card:nth-child(even), .duo .vs-card:last-child, .quad .vs-card:nth-child(5) { animation-name: vs-in-right, vs-float; }
.quad .vs-card:nth-child(4) { animation-name: vs-in-left, vs-float; }
/* No two cards alike: uneven corners and tilts, like cut out by hand. */
.vs-card.s0 { border-radius: 34px 14px 30px 10px / 16px 30px 14px 28px; rotate: -3deg; }
.vs-card.s1 { border-radius: 12px 36px 14px 32px / 30px 12px 32px 16px; rotate: 2.5deg; }
.vs-card.s2 { border-radius: 28px 24px 10px 36px / 12px 34px 26px 14px; rotate: -1.5deg; }
.vs-card.s3 { border-radius: 14px 32px 34px 12px / 32px 14px 12px 30px; rotate: 3deg; }
.vs-card.s1 .vs-av, .vs-card.s3 .vs-av { border-radius: 46% 54% 50% 50% / 52% 46% 54% 48%; }
.vs-card.s0 .vs-av, .vs-card.s2 .vs-av { border-radius: 54% 46% 48% 52% / 46% 54% 46% 54%; }
.vs-stat:nth-child(1) { rotate: -2deg; border-radius: 14px 8px 12px 9px; }
.vs-stat:nth-child(2) { rotate: 1.5deg; border-radius: 9px 14px 8px 13px; }
.vs-stat:nth-child(3) { rotate: -1deg; border-radius: 12px 9px 14px 8px; }
.quad .vs-stat { rotate: 0deg; }
.vs-av {
  grid-row: span 2; display: block; width: 84px; height: 84px; border-radius: 50%; overflow: hidden;
  background: var(--bg); border: 3px solid #3a2715;
}
.vs-av svg { display: block; width: 100%; height: 100%; }
.vs-who { display: grid; min-width: 0; }
.vs-name { font-family: var(--display); font-size: 1.45rem; font-weight: 850; line-height: 1.05; overflow-wrap: anywhere; }
.vs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vs-stat {
  display: grid; justify-items: center; padding: 4px 2px; border-radius: 12px; background: #f1e2c3;
  animation: cd-pop .45s cubic-bezier(.3, 1.6, .5, 1) calc(.75s + var(--i) * .12s + var(--k) * .1s) both;
}
.vs-stat b { font-family: var(--display); font-size: 1.15rem; font-weight: 850; line-height: 1.1; white-space: nowrap; }
.vs-stat small { color: #7a5a3a; font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.vs-you {
  position: absolute; top: -12px; left: 18px; padding: 2px 10px; border-radius: 99px; border: 2px solid #3a2715;
  background: #c8102e; color: #fbf3e2; font-family: var(--display); font-size: .8rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase;
}

.vs-badge {
  justify-self: center; display: grid; place-items: center; z-index: 2;
  min-width: 104px; height: 104px; padding: 0 18px; border-radius: 52px;
  background: #3a2715; border: 4px solid #f2b705; box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 0 6px rgba(200, 16, 46, .9);
  color: #f2b705; font-family: var(--display); font-size: 3rem; font-weight: 900; line-height: 1;
  animation: vs-slam .45s cubic-bezier(.3, 1.5, .5, 1) .42s both;
}
.vs-badge.go { background: #c8102e; color: #fbf3e2; border-color: #fbf3e2; font-size: 2.2rem; box-shadow: 0 6px 0 #8e0b20; }
.vs-badge.pop { animation: cd-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }

/* Three or four players: two by two, the badge in the middle. */
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.quad .vs-card { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 6px; padding: 14px 8px 10px; }
.quad .vs-av { grid-row: auto; width: 66px; height: 66px; }
.quad .vs-name { font-size: 1.12rem; }
.quad .vs-stats { width: 100%; grid-template-columns: 1fr; gap: 3px; }
.quad .vs-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 9px; border-radius: 8px; }
.quad .vs-stat b { order: 2; font-size: .95rem; }
.quad .vs-stat small { order: 1; font-size: .6rem; }
.quad .vs-grid { row-gap: 10px; }
.quad .vs-badge { grid-column: 1 / -1; min-width: 76px; height: 76px; font-size: 2.1rem; margin: 2px 0; }
.quad .vs-badge.go { font-size: 1.6rem; }
.quad .vs-card:last-child:nth-child(4) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 6px); } /* three players: the third one alone, in the middle */
/* Five or more (online): small cards. */
.crowd .vs-grid { gap: 10px; }
.crowd .vs-card { grid-template-columns: auto 1fr; padding: 8px 10px; gap: 8px; border-radius: 16px; }
.crowd .vs-av { grid-row: auto; width: 44px; height: 44px; border-width: 2px; }
.crowd .vs-name { font-size: 1rem; }
.crowd .vs-stats { display: none; }
.crowd .vs-you { top: -9px; left: 10px; font-size: .65rem; }

@media (max-height: 700px) {
  .vs-av { width: 68px; height: 68px; }
  .vs-name { font-size: 1.25rem; }
  .vs-badge { min-width: 88px; height: 88px; font-size: 2.5rem; }
  .quad .vs-av { width: 54px; height: 54px; }
  .vs-note { font-size: .95rem; }
}

@keyframes vs-in-left { from { transform: translateX(-120vw) rotate(-8deg); } }
@keyframes vs-in-right { from { transform: translateX(120vw) rotate(8deg); } }
@keyframes vs-slam { from { transform: scale(3.2) rotate(-20deg); opacity: 0; } }
@keyframes vs-spin { to { rotate: 360deg; } }
@keyframes vs-glow { from { opacity: .75; scale: .94; } to { opacity: 1; scale: 1.06; } }
@keyframes vs-float { from { translate: 0 -3px; } to { translate: 0 4px; } }
@keyframes vs-bob { from { transform: translateY(-3px) rotate(-6deg); } to { transform: translateY(3px) rotate(6deg); } }
@keyframes vs-bg-in { from { opacity: 0; transform: scale(1.3); } }
@media (prefers-reduced-motion: reduce) {
  .vs-bg, .vs-bg::before, .vs-bg::after, .vs-walker svg { animation: none; }
  .vs-card, .vs-stat, .vs-badge, .vs-badge.pop { animation-duration: .01s; animation-delay: 0s; }
}
