:root {
  --paper: #f3e6cf;
  --paper-2: #e7d3b0;
  --card: rgba(255, 250, 241, 0.78);
  --ink: #241910;
  --soft: #5c4c3c;
  --line: rgba(36, 25, 16, 0.16);
  --red: #b4232c;
  --red-deep: #7c1420;
  --gold: #e0b03a;
  --green: #1d6a42;
  --loaded: #9a5a12;
  --shadow: 4px 4px 0 rgba(36, 25, 16, 0.12);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --dock-h: 0px;
  --league-h: 0px;
  --top-h: 0px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* No zoom on phones: no double-tap zoom (taps and scrolling still work). */
html, body { touch-action: manipulation; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 380;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(224, 176, 58, 0.28), transparent 50%),
    radial-gradient(900px 500px at 110% 0%, rgba(180, 35, 44, 0.12), transparent 46%),
    var(--paper);
  color-scheme: light;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* Avís quan el servidor no respon: el client no ha de quedar en blanc. */
.boot-error {
  position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px)); padding: 18px 20px; text-align: center;
  border: 2px solid var(--ink); border-radius: 16px; background: var(--paper, #f3e6cf);
  box-shadow: 0 8px 0 rgba(34, 23, 15, 0.22);
  font-family: var(--serif); font-size: 1rem;
}
.boot-error p { margin: 0 0 12px; }
.boot-error button {
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--ink); background: var(--red, #b4232c); color: #fff7e8;
  font: inherit; font-weight: 700; cursor: pointer;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: var(--league-h);
  padding-bottom: var(--dock-h);
}
header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px 8px;
}
.brand { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.brand strong {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: -0.03em;
  display: block;
  line-height: 1;
}
.brand small, .muted { color: var(--soft); }
.seal {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: var(--gold);
  border: 2px solid var(--gold);
  font-family: var(--serif); font-weight: 680;
  box-shadow: var(--shadow);
}
.phases { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.phases span {
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--soft);
  font-size: 0.86rem;
}
.phases span.now { border-color: var(--ink); color: var(--ink); background: #fffaf2; }
.phases span.soon { border-color: var(--gold); color: var(--ink); background: #fffaf2; }
.phases span.done { color: var(--green); }
.clock { min-width: 92px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
#top .account-top { margin-left: 10px; }
.top-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin-left: 8px;
  border-radius: 999px;
  line-height: 0;
}
.top-icon svg { width: 22px; height: 22px; }
.league-bar .league-account.league-icon { padding: 5px 7px; line-height: 0; }
.league-bar .league-account.league-icon svg { width: 19px; height: 19px; }
.settings-box { padding: 2px 0; max-width: 460px; }
.settings-aa { margin: 14px 0 4px; }
.clock b {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
}
.clock b.long { font-size: 1.15rem; }
button.extend {
  margin-top: 6px;
  border: 2px solid var(--ink);
  background: #fffaf2;
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 640;
  line-height: 1.2;
}
button.extend.on { background: var(--ink); color: var(--paper); }
.bar { height: 6px; background: rgba(36, 25, 16, 0.12); border-radius: 99px; margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); }
button.leave,
button.home {
  border: 2px solid var(--ink);
  background: #fffaf2;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 640;
  flex: none;
}
button.leave.armed { background: var(--red); color: #fffaf2; border-color: var(--red-deep); }
.langs {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.langs button {
  border: 0;
  background: #fffaf2;
  padding: 6px 10px;
  border-radius: 0;
}
.langs button.on { background: var(--ink); color: var(--paper); }
.poster .langs, .wait .langs { position: absolute; top: 14px; right: 14px; }
.poster .lang-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px auto;
}
.poster .lang-stack .langs { position: static; margin: 0; }
.lobby-top {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  pointer-events: none;
}
.lobby-top > * { pointer-events: auto; }
.lobby-top .langs { position: static; margin: 0; }
.poster .lang-stack .ghost {
  padding: 6px 12px;
  font-weight: 640;
  text-align: center;
}
.pace {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 12px;
}
.pace > span { font-weight: 520; }
.paces {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}
.paces button {
  border: 0;
  background: #fffaf2;
  padding: 6px 10px;
  border-radius: 0;
}
.paces button.on { background: var(--ink); color: var(--paper); }
.faixa {
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--red) 0 12px, var(--gold) 12px 24px);
}
.notice {
  margin: 0;
  min-height: 0;
  padding: 0 16px;
  color: var(--red-deep);
  font-weight: 520;
}
.notice.show { padding: 6px 16px 0; white-space: pre-line; }
.local-globe {
  position: fixed;
  z-index: 6;
  left: 0;
  top: 0;
  margin: 0;
  max-width: calc(100vw - 16px);
  width: max-content;
  box-sizing: border-box;
  padding: 7px 10px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: #fff6df;
  color: var(--ink);
  font-weight: 640;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  filter: drop-shadow(3px 3px 0 rgba(36, 25, 16, 0.12));
}
.local-globe.show {
  visibility: visible;
  animation: local-globe-life 3.4s ease forwards;
}
@keyframes local-globe-life {
  0% { opacity: 0; transform: translateY(6px) scale(0.94); }
  6% { opacity: 1; transform: none; }
  74% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .local-globe.show { animation: none; opacity: 1; transform: none; }
}
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
}
.layout > #side[hidden], .layout > #rank[hidden] { display: none; }
.layout:has(> #side[hidden]) { grid-template-columns: minmax(0, 1fr) 300px; }
.layout:has(> #rank[hidden]) { grid-template-columns: 280px minmax(0, 1fr); }
.layout:has(> #side[hidden]):has(> #rank[hidden]) { grid-template-columns: minmax(0, 1fr); }
aside, #stage {
  min-height: 0;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
aside { overflow: auto; padding: 14px; }
#stage { overflow: auto; position: relative; }
#stage.bare {
  overflow: hidden;
  padding: 0;
  background: #1c140f;
  display: flex;
  flex-direction: column;
}
#stage.bare .diada { flex: 1; height: auto; min-height: 0; }
h2, h3 { font-family: var(--serif); font-weight: 680; letter-spacing: -0.03em; margin: 0 0 8px; }
.identity { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.swatch, .shirt-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ink); display: inline-block; flex: none;
}
.identity .swatch { width: 42px; height: 42px; border-radius: 14px; }
.identity h2 { font-size: 1.25rem; }
.cap-line { margin: 0; color: var(--soft); font-size: 0.9rem; }
.league-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fffaf2;
}
.league-line span { color: var(--soft); font-size: 0.86rem; }
.league-line b {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.achieved-label, .achieved-note {
  margin: 0 0 8px;
  color: var(--soft);
  font-size: 0.86rem;
}
.achieved {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.achieved li {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  background: #fff;
  font-size: 0.78rem;
}
.achieved li.loaded { color: var(--loaded); border-color: var(--loaded); }
.stats { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.stats li { display: grid; grid-template-columns: 72px 1fr 32px; gap: 6px; align-items: center; font-size: 0.86rem; }
.track { display: flex; height: 8px; background: rgba(36, 25, 16, 0.1); border-radius: 99px; overflow: hidden; }
.track i { display: block; flex: none; height: 100%; background: var(--ink); }
.track.good i { background: var(--green); }
.track.bad i { background: var(--red); }
.track.gold i { background: var(--gold); }
/* El tram que ha crescut durant la setmana actual. */
.track i.gain { background: #2f7da8; box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.55); }
.note {
  margin: 12px 0 0;
  padding: 8px 10px;
  background: rgba(224, 176, 58, 0.2);
  border-radius: 10px;
  font-size: 0.86rem;
}
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li {
  display: grid;
  grid-template-columns: 22px 16px 1fr auto;
  gap: 8px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.rank li.me strong { text-decoration: underline; text-decoration-thickness: 2px; }
.rank small { display: block; color: var(--soft); }
.rank em { font-style: normal; font-variant-numeric: tabular-nums; font-weight: 640; }
.forecast { display: grid; gap: 6px; margin-top: 8px; }
.forecast article {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fffaf2;
}
.forecast strong { display: block; }
.forecast span { color: var(--soft); font-size: 0.82rem; }
details { margin-top: 14px; color: var(--soft); font-size: 0.86rem; }
details p { margin: 8px 0; }
footer {
  min-height: 36px;
  padding: 6px 16px 10px;
  color: var(--soft);
  font-size: 0.86rem;
}
footer ol { margin: 0; padding-left: 18px; }
.stage-pad { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.coach {
  background: #fffaf2;
  border-left: 4px solid var(--red);
  padding: 8px 10px;
  border-radius: 8px;
  margin: 0;
}
.hall { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
.building {
  position: relative;
  width: 236px;
  height: 268px;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background:
    radial-gradient(70px 28px at 18% 18%, rgba(255, 250, 241, 0.95), transparent 70%),
    radial-gradient(90px 32px at 82% 12%, rgba(255, 250, 241, 0.72), transparent 72%),
    linear-gradient(#b7dcea 0 62%, #d5e4ef 100%);
  box-shadow: var(--shadow);
}
.building.worn {
  background:
    radial-gradient(70px 28px at 24% 16%, rgba(255, 250, 241, 0.55), transparent 70%),
    linear-gradient(#c3d0d6 0 62%, #d5dce1 100%);
}
.building.poor {
  background:
    radial-gradient(60px 22px at 30% 14%, rgba(255, 250, 241, 0.28), transparent 70%),
    linear-gradient(#8ea4ad 0 64%, #a9b7be 100%);
}
.yard {
  position: absolute;
  left: 0; right: 0; bottom: 20px; height: 34px;
  background: linear-gradient(#d7e38f, #b7c96a);
}
.building.worn .yard { background: linear-gradient(#d2d48a, #b5b66e); }
.building.poor .yard { background: linear-gradient(#b7b892, #8f9868); }
.roof-back, .roof {
  position: absolute;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.roof-back {
  z-index: 2;
  left: 8px; right: 8px; top: 14px; height: 92px;
  background: var(--ink);
}
.roof {
  z-index: 2;
  left: 14px; right: 14px; top: 20px; height: 82px;
  background:
    repeating-linear-gradient(180deg, rgba(36, 25, 16, 0.28) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, rgba(255, 236, 214, 0.28) 0 2px, transparent 2px 18px),
    linear-gradient(#d15a3e, #9a2c22);
}
.chimney {
  position: absolute;
  z-index: 3;
  right: 46px; top: 28px;
  width: 18px; height: 40px;
  background:
    repeating-linear-gradient(180deg, transparent 0 5px, rgba(36, 25, 16, 0.28) 5px 6px),
    linear-gradient(#c44932, #7c1420);
  border: 2px solid var(--ink);
  border-bottom: 0;
}
.chimney::before {
  content: "";
  position: absolute;
  left: -4px; right: -4px; top: -5px; height: 6px;
  background: #5c4c3c;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
}
.ridge {
  position: absolute;
  z-index: 3;
  left: 50%; top: 14px;
  width: 11px; height: 11px;
  margin-left: -6px;
  background: var(--gold);
  border: 1.5px solid var(--ink);
  transform: rotate(45deg);
}
.facade {
  position: absolute;
  z-index: 1;
  left: 28px; right: 28px; top: 96px; bottom: 22px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-top: 0;
  background:
    radial-gradient(rgba(36, 25, 16, 0.05) 0.6px, transparent 0.7px) 0 0 / 8px 10px,
    linear-gradient(180deg, rgba(255, 250, 241, 0.55), transparent 26%),
    linear-gradient(#fbf6ec, #eadcc4);
}
.facade::before {
  content: "";
  position: absolute;
  left: -8px; right: -8px; top: 0; height: 9px;
  background: #6b3a24;
  border-bottom: 2px solid var(--ink);
}
.facade::after {
  content: "";
  position: absolute;
  inset: 9px 0 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, #cbb89a 0 8px, #a89070 8px 10px, transparent 10px 20px) left / 7px 100% no-repeat,
    repeating-linear-gradient(180deg, #cbb89a 0 8px, #a89070 8px 10px, transparent 10px 20px) right / 7px 100% no-repeat;
}
.building.worn .facade {
  background:
    radial-gradient(circle at 72% 42%, rgba(36, 25, 16, 0.1) 0 16px, transparent 26px),
    linear-gradient(#efe2cc, #d9c6a6);
}
.building.worn .roof {
  background:
    repeating-linear-gradient(180deg, rgba(36, 25, 16, 0.28) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, rgba(255, 236, 214, 0.16) 0 2px, transparent 2px 18px),
    linear-gradient(#b55242, #7a342c);
}
.building.poor .roof {
  background:
    repeating-linear-gradient(180deg, rgba(36, 25, 16, 0.34) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, rgba(255, 236, 214, 0.1) 0 2px, transparent 2px 18px),
    linear-gradient(#8d5348, #5c302c);
}
.building.poor .facade {
  background:
    linear-gradient(180deg, rgba(90, 110, 120, 0.18), transparent 46%),
    linear-gradient(#ddd4c6, #c9bba8);
}
.window {
  position: absolute;
  z-index: 1;
  top: 16px; width: 38px; height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 2px 2px;
  background:
    linear-gradient(#6b3a24, #6b3a24) center / 2px 100% no-repeat,
    linear-gradient(#6b3a24, #6b3a24) center / 100% 2px no-repeat,
    linear-gradient(155deg, rgba(255, 250, 241, 0.85), transparent 42%),
    linear-gradient(#f7fbff, #8ec3d6);
  box-shadow: inset 0 0 0 3px #8a5a34;
}
.window.l { left: 12px; }
.window.r { right: 12px; }
.building.worn .window { background: linear-gradient(#6b3a24, #6b3a24) center / 2px 100% no-repeat, linear-gradient(#6b3a24, #6b3a24) center / 100% 2px no-repeat, linear-gradient(#d5e4ea, #8aa8b4); }
.building.poor .window { background: linear-gradient(#5c5146, #5c5146) center / 2px 100% no-repeat, linear-gradient(#5c5146, #5c5146) center / 100% 2px no-repeat, linear-gradient(#9aabaf, #5d737c); box-shadow: inset 0 0 0 3px #5c5146; }
.box {
  position: absolute;
  z-index: 2;
  top: 48px; width: 42px; height: 8px;
  background: #6b3a24;
  border: 1.5px solid var(--ink);
  border-radius: 0 0 4px 4px;
}
.box.l { left: 10px; }
.box.r { right: 10px; }
.box::before {
  content: "";
  position: absolute;
  left: 3px; right: 3px; bottom: 5px; height: 14px;
  background:
    radial-gradient(circle at 4px 12px, #1d6a42 0 5px, transparent 6px),
    radial-gradient(circle at 16px 10px, #2f8a52 0 5px, transparent 6px),
    radial-gradient(circle at 28px 12px, #1d6a42 0 4px, transparent 5px),
    radial-gradient(circle at 12px 6px, #c44932 0 2.5px, transparent 3px),
    radial-gradient(circle at 24px 5px, #e0b03a 0 2.5px, transparent 3px);
}
.building.worn .box::before {
  height: 10px;
  background:
    linear-gradient(#6d6240, #6d6240) 6px 2px / 2px 10px no-repeat,
    linear-gradient(#8a7a42, #8a7a42) 16px 0 / 2px 12px no-repeat,
    linear-gradient(#6d6240, #6d6240) 26px 3px / 2px 8px no-repeat;
}
.building.poor .box { background: #5c5146; }
.building.poor .box::before { content: none; }
.lamp {
  position: absolute;
  z-index: 2;
  left: 50%; top: 14px;
  width: 10px; height: 12px;
  margin-left: -5px;
  background: var(--gold);
  border: 1.5px solid var(--ink);
  border-radius: 1px 1px 5px 5px;
}
.lamp::before {
  content: "";
  position: absolute;
  left: 3px; top: -8px;
  width: 2px; height: 8px;
  background: var(--ink);
}
.building.poor .lamp { background: #8a7a42; }
.rail {
  position: absolute;
  z-index: 2;
  left: 8px; right: 8px; top: 64px; height: 4px;
  background: #6b3a24;
  border-radius: 2px;
  box-shadow: 0 1px 0 var(--ink);
}
.pegs {
  position: absolute;
  z-index: 2;
  left: 10px; right: 10px; top: 66px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.peg {
  position: relative;
  width: 14px; height: 26px;
  border: 1.5px solid var(--ink);
  border-radius: 2px 2px 4px 4px;
}
.peg:nth-child(odd) { height: 30px; }
.peg:nth-child(3n) { height: 22px; margin-top: 3px; }
.peg::before {
  content: "";
  position: absolute;
  left: 2px; right: 2px; top: 5px; height: 5px;
  background: rgba(255, 250, 241, 0.42);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.peg::after {
  content: "";
  position: absolute;
  left: 1px; right: 1px; top: 0; height: 5px;
  background: rgba(36, 25, 16, 0.28);
  border-radius: 1px 1px 4px 4px;
}
.bench {
  position: absolute;
  z-index: 2;
  left: 8px; bottom: 8px;
  width: 36px; height: 10px;
  background: #a56b3c;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
}
.bench::before, .bench::after {
  content: "";
  position: absolute;
  bottom: -6px; width: 3px; height: 6px;
  background: var(--ink);
}
.bench::before { left: 3px; }
.bench::after { right: 3px; }
.building.poor .bench { display: none; }
.door {
  position: absolute;
  z-index: 2;
  left: 50%; bottom: 0;
  width: 42px; height: 62px;
  margin-left: -21px;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background:
    repeating-linear-gradient(90deg, var(--red) 0 5px, var(--gold) 5px 10px) center 8px / 28px 6px no-repeat,
    linear-gradient(#241910, #241910) center 28px / 2px 26px no-repeat,
    linear-gradient(#f6efe2, #f6efe2) left 6px top 20px / 11px 18px no-repeat,
    linear-gradient(#f6efe2, #f6efe2) right 6px top 20px / 11px 18px no-repeat,
    linear-gradient(#a56b3c, #6b3a24);
}
.door::after {
  content: "";
  position: absolute;
  right: 6px; top: 34px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  border: 1px solid var(--ink);
}
.mats {
  position: absolute;
  z-index: 2;
  right: 6px; bottom: 4px;
  width: 48px; height: 28px;
}
.mats::before, .mats::after {
  content: "";
  position: absolute;
  height: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
}
.mats::before {
  left: 0; bottom: 0; width: 42px;
  background: repeating-linear-gradient(90deg, #c4553a 0 6px, #f3e6cf 6px 9px);
}
.mats::after {
  left: 8px; bottom: 11px; width: 38px;
  background: repeating-linear-gradient(90deg, #9a2c22 0 6px, #e7d3b0 6px 9px);
}
.building.poor .mats::before, .building.poor .mats::after { filter: saturate(0.55) brightness(0.86); }
.hole, .crack, .drip, .bucket, .stain { display: none; }
.building.worn .hole, .building.poor .hole {
  display: block;
  position: absolute;
  left: 22%; top: 66%;
  width: 16px; height: 11px;
  background: #1a120e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #f6efe2;
}
.building.poor .hole { left: 16%; top: 64%; width: 24px; height: 14px; box-shadow: 0 0 0 2px #e7d3b0; }
.building.worn .crack, .building.poor .crack {
  display: block;
  position: absolute;
  z-index: 3;
  left: 46%; top: 26px;
  width: 18px; height: 28px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 28'><path d='M9 1 L7 8 L11 11 L6 18 L10 21 L5 27' fill='none' stroke='%23241910' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/><path d='M11 11 L16 15' fill='none' stroke='%23241910' stroke-width='1.5' stroke-linecap='round'/></svg>") center / 100% 100% no-repeat;
}
.building.poor .drip {
  display: block;
  position: absolute;
  z-index: 3;
  left: 22px; top: 0; bottom: 16px;
  width: 2px;
  background: linear-gradient(#6e8c99, rgba(110, 140, 153, 0.05));
}
.building.poor .bucket {
  display: block;
  position: absolute;
  z-index: 3;
  left: 12px; bottom: 2px;
  width: 22px; height: 14px;
  background: linear-gradient(#e7f2f5, #8aa0a8);
  border: 1.5px solid var(--ink);
  border-radius: 2px 2px 6px 6px;
}
.bucket::before {
  content: "";
  position: absolute;
  left: 2px; right: 2px; top: -7px; height: 8px;
  border: 1.5px solid var(--ink);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.bucket::after {
  content: "";
  position: absolute;
  left: 3px; right: 3px; top: 3px; height: 4px;
  background: rgba(120, 168, 182, 0.85);
  border-radius: 2px;
}
.building.poor .stain {
  display: block;
  position: absolute;
  z-index: 5;
  left: 30px; bottom: 5px;
  width: 34px; height: 8px;
  background: rgba(70, 104, 116, 0.42);
  border-radius: 50%;
}
.ground {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; bottom: 0; height: 20px;
  background:
    repeating-linear-gradient(90deg, rgba(36, 25, 16, 0.16) 0 1px, transparent 1px 20px),
    #d2b48c;
  border-top: 2px solid var(--ink);
}
.ground::before, .ground::after {
  content: "";
  position: absolute;
  bottom: 14px;
  width: 20px; height: 16px;
  background: radial-gradient(circle at 50% 100%, #1d6a42 0 9px, transparent 10px);
}
.ground::before { left: 4px; }
.ground::after { right: 4px; }
.building.worn .ground::before, .building.worn .ground::after {
  background: radial-gradient(circle at 50% 100%, #6d7a3e 0 8px, transparent 9px);
}
.building.poor .ground::before, .building.poor .ground::after {
  background: radial-gradient(circle at 50% 100%, #5d6844 0 8px, transparent 9px);
}
.actions { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readybar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.readybar p { margin: 0; flex: 1; min-width: 12rem; }
button.ready {
  border: 2px solid var(--ink);
  background: var(--red);
  color: #fffaf2;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 640;
}
button.ready.on { background: var(--ink); color: var(--paper); }
button.ready:disabled { background: #fffaf2; color: var(--ink); }
.act, .place, .castell button, .primary, .ghost {
  border: 2px solid var(--ink);
  background: #fffaf2;
  border-radius: 12px;
  text-align: left;
}
.act { padding: 10px; }
.act:hover:not(:disabled), .place:hover, .primary:hover { background: var(--ink); color: var(--paper); }
.act b, .place strong { display: block; font-size: 1rem; }
.act span, .place p { display: block; color: inherit; opacity: 0.8; font-size: 0.82rem; margin: 4px 0 0; }
.primary {
  background: var(--red); color: #fffaf2; border-color: var(--red-deep);
  padding: 10px 14px; font-weight: 640;
}
.ghost { padding: 8px 10px; background: transparent; }
.split {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}
.split > div { min-height: 0; overflow: auto; display: flex; flex-direction: column; }
/* Assaig: the tower needs room to breathe, so its column is wider than the
   narrow places column of the ronda. */
.split:has(> .preview-wrap) { grid-template-columns: clamp(280px, 30%, 340px) minmax(0, 1fr); }
.split.no-preview { grid-template-columns: minmax(0, 1fr); }
.preview-wrap { display: flex; flex-direction: column; min-height: 0; }
.preview-wrap canvas {
  flex: 1;
  width: 100%;
  border-radius: 18px;
  background: #e7d3b0;
  min-height: 220px;
  box-shadow: 0 0 0 2px var(--ink), 0 5px 0 var(--ink), 0 16px 30px rgba(36, 25, 16, 0.16);
}
#preview-cap {
  margin: 10px 2px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 8px;
}
#preview-cap b {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 680;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#preview-cap .cap-num {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--red-deep);
  font-variant-numeric: tabular-nums;
}
#preview-cap .cap-bar {
  grid-column: 1 / -1;
  height: 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fffaf2;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(36, 25, 16, 0.12);
}
#preview-cap .cap-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #c9962a);
  border-radius: inherit;
  transition: width 0.3s ease;
}
@media (prefers-reduced-motion: reduce) {
  #preview-cap .cap-bar i { transition: none; }
}
.catalog { overflow: auto; display: grid; gap: 8px; padding-right: 4px; flex: 1; min-height: 0; align-content: start; }
/* Assaig: what today's castells are made of */
.sessions-extra {
  margin: 8px 0 4px; padding: 8px 10px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fffaf2; box-shadow: 0 3px 0 rgba(36, 25, 16, 0.08);
}
.sess-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sess-line b { font-family: var(--serif); font-size: 0.98rem; }
.sess-pills { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.sess-pill {
  padding: 2px 8px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; font-size: 0.72rem; font-weight: 650; line-height: 1.5;
}
.sess-pill.base { background: var(--paper); }
.sess-pill.card { border-color: var(--green); color: var(--green); }
.sess-pill.drill { border-color: #3c6fae; color: #3c6fae; }
.sess-pill.none { border-style: dashed; color: var(--soft); font-weight: 600; }
.sess-note { margin: 6px 0 0; font-size: 0.8rem; color: var(--soft); }
/* Assaig: members only see the castells the tècnica has chosen. */
.assaig-picks {
  margin: 8px 0 6px; padding: 9px 11px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fffaf2; box-shadow: 0 3px 0 rgba(36, 25, 16, 0.08);
}
.assaig-picks .picks-title { margin: 0 0 6px; font-family: var(--serif); font-size: 0.98rem; }
.picks-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.picks-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.picks-list li.done { opacity: 0.55; }
.picks-list li.next b { color: #1f5d3a; }
.picks-list b { flex: 1 1 auto; overflow-wrap: anywhere; }
.pick-kind {
  flex: none; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; font-size: 0.72rem; font-weight: 650;
}
.pick-kind.hard { background: var(--gold); }
.picks-list em { flex: none; font-style: normal; font-weight: 700; color: var(--green); }
.pick-progress { flex: none; font-size: 0.72rem; color: #6b5842; }
.pick-next {
  flex: none; padding: 1px 7px; border: 2px solid #1f5d3a; border-radius: 999px;
  background: #e8f5ec; color: #1f5d3a; font-size: 0.68rem; font-weight: 700;
}
.plan-line { margin: 5px 0 0; font-size: 0.76rem; font-weight: 650; color: #6b5842; }
.plan-line.done { color: #1f5d3a; }
.castellers-avail { margin: 6px 0 10px; font-size: 0.82rem; color: #6b5842; }
/* Assaig: castells que no es poden aixecar per falta de camises. */
.castell.nofield { opacity: 0.8; }
.castell .nofield-note { margin: 6px 0 0; font-size: 0.76rem; }
.row-actions button.off { opacity: 0.55; cursor: not-allowed; }
.row-actions button.on { background: var(--gold); color: var(--ink); border-color: var(--ink); }
.assaig-run { margin: 8px 0 6px; padding: 9px 11px; border: 2px solid var(--ink); border-radius: 12px; background: #eef7f0; box-shadow: 0 3px 0 rgba(36, 25, 16, 0.08); }
.assaig-run b { font-family: var(--serif); font-size: 0.98rem; }
.assaig-run p { margin: 4px 0 0; }
.picks-list li.blocked b { color: #8b1f27; }
.pick-block { flex: 1 1 100%; font-size: 0.72rem; font-weight: 650; color: #8b1f27; }
/* Assaig: the graller rehearses songs, never castells. */
.assaig-gralla {
  margin: 8px 0 6px; padding: 9px 11px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #f3f7ff; box-shadow: 0 3px 0 rgba(36, 25, 16, 0.08);
}
.assaig-gralla.done { background: #fffaf2; }
.assaig-gralla .ag-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.assaig-gralla .ag-head b { font-family: var(--serif); font-size: 0.98rem; }
.assaig-gralla .ag-song {
  padding: 1px 8px; border: 2px solid #3c6fae; border-radius: 999px;
  background: #fff; color: #3c6fae; font-size: 0.72rem; font-weight: 650;
}
.assaig-gralla .muted { margin: 2px 0 6px; font-size: 0.8rem; }
.assaig-gralla .coach { margin: 4px 0 0; }
.assaig-gralla.live .act-live { margin: 4px 0 0; }
.assaig-gralla .act-hint { display: none; }
.sess-spend {
  margin-top: 6px; min-height: 40px; padding: 6px 12px;
  border: 2px solid var(--ink); border-radius: 10px;
  background: var(--gold); color: var(--ink); font-weight: 700; font-size: 0.86rem;
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.sess-spend:hover { background: var(--gold-soft, #f6e2b0); }
.sess-spend:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
@media (max-width: 620px) {
  .sessions-extra { margin-top: 6px; }
  .sess-line b { font-size: 0.92rem; }
}
.castell {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fffaf2;
}
.castell.selected { border-color: var(--ink); }
.castell.reckless { background: #f8e4d8; }
.castell.locked { opacity: 0.72; }
.castell header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.castell header b { font-size: 1rem; }
.dom { display: flex; height: 6px; background: rgba(36,25,16,0.1); border-radius: 99px; margin: 6px 0; overflow: hidden; }
.dom i { display: block; flex: none; height: 100%; background: var(--green); }
.dom i.gain { background: var(--gold); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.row-actions button { padding: 6px 8px; border-radius: 9px; border: 1.5px solid var(--ink); background: #fff; }
.odds { margin: 0; color: var(--soft); font-size: 0.8rem; }
.ronda { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
.places { display: grid; gap: 8px; }
.place { padding: 10px; }
.place.selected { background: var(--ink); color: var(--paper); }
.place .going { display: flex; gap: 4px; margin-top: 6px; }
.slots { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.slots li {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  border: 1.5px dashed var(--soft); border-radius: 10px; padding: 6px 8px; min-height: 42px;
}
.slots li.filled { border-style: solid; border-color: var(--ink); background: #fffaf2; }
.ronda-full { color: var(--red); font-weight: 600; margin: 0 0 8px; }
.diada { position: relative; height: 100%; min-height: 100%; }
.diada canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud { position: absolute; top: 14px; left: 14px; right: 14px; color: #fffaf2; text-shadow: 0 2px 0 rgba(0,0,0,0.35); pointer-events: none; }
.hud h2 { font-size: clamp(1.6rem, 3vw, 2.6rem); margin: 0; }
.hud p { margin: 2px 0; }
#hurry {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 999px; padding: 8px 12px;
}
.stamp {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border: 4px solid currentColor;
  font-family: var(--serif);
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-8deg);
  background: rgba(255, 250, 242, 0.92);
  text-shadow: none;
  color: var(--ink);
}
.stamp.descarregat { color: var(--green); }
.stamp.carregat { color: var(--loaded); }
.stamp.llenya { color: var(--red); }
.stamp.desmuntat { color: var(--soft); }
.stamp.in { animation: slam 0.35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes slam {
  from { transform: scale(1.35) rotate(-16deg); opacity: 0; }
  to { transform: scale(1) rotate(-8deg); opacity: 1; }
}
.resum, .final { padding: 14px; display: grid; gap: 10px; }
.play-cards { margin: 0 0 12px; min-width: 0; }
.play-cards h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin: 0 0 4px;
}
.cards-hint { margin: 0 0 8px; }
.cards-points {
  display: inline-flex; margin: 2px 0 8px; padding: 3px 10px;
  border: 2px solid #d8a62a; border-radius: 999px; background: #fff3c4;
  font-size: 0.76rem; font-weight: 700;
}
.card-reward { margin: 2px 0 0 !important; font-size: 0.72rem !important; font-weight: 700; color: #8a6410; }
.play-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; min-width: 0; }
.play-card {
  flex: 1 1 240px;
  max-width: 100%;
  min-width: 0;
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fffaf2;
}
.play-card.has-pair { background: #fffdf5; }
.card-need { color: #8b1f27; font-size: 0.84rem; font-weight: 650; }
/* The pair rule: 2 identical copies per play */
.pair-rule {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 8px; padding: 6px 10px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fff6e2; font-size: 0.82rem; font-weight: 600; line-height: 1.35;
}
.pair-demo { display: inline-flex; gap: 2px; flex: none; }
.pair-demo b {
  width: 17px; height: 25px; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 4px;
  background: #fffaf2; color: var(--ink); font-size: 0.68rem; font-weight: 780;
}
.pair-demo b + b { transform: rotate(7deg); }
.pair-rule-txt { min-width: 0; }
.card-pair {
  position: absolute; top: 8px; right: 9px;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 999px;
  border: 2px dashed rgba(36, 25, 16, 0.45);
  background: #fffaf2; color: var(--soft);
  font-size: 0.72rem; font-weight: 720; line-height: 1.3;
}
.card-pair i { display: block; width: 8px; height: 12px; border: 1.5px solid currentColor; border-radius: 2px; background: transparent; }
.card-pair i.on { background: currentColor; }
.card-pair em { font-style: normal; margin-left: 2px; }
.card-pair.one { border-style: solid; border-color: #b0801f; background: #fdf3dd; color: #8a6410; }
.card-pair.full { border-style: solid; border-color: var(--green); background: #eef6ea; color: var(--green); }
.card-ready { color: var(--green); font-size: 0.84rem; font-weight: 650; }
.play-card.bonus { box-shadow: inset 5px 0 0 var(--green); }
.play-card.malus { box-shadow: inset 5px 0 0 var(--red); }
.play-card h3 { font-family: var(--serif); font-size: 1.25rem; margin: 0; }
.play-card p { margin: 4px 0 8px; }
.card-kind { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 640; margin: 0; }
.play-card.bonus .card-kind { color: var(--green); }
.play-card.malus .card-kind { color: var(--red); }
.card-ico { display: block; width: 36px; height: 36px; margin: 0 0 6px; color: var(--ink); }
.card-ico svg { width: 100%; height: 100%; display: block; }
.play-card.malus .card-ico { color: var(--red-deep); }
.free-play { margin: 12px 0; display: grid; gap: 8px; }
.stage-activities {
  margin: 14px 14px 8px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.96);
}
.stage-activities h2 { margin-top: 8px; }
#stage.bare .stage-activities {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 62px;
  z-index: 2;
  margin: 0;
  max-height: 42%;
  overflow: auto;
}
.free-track { position: relative; height: 46px; border: 2px solid var(--ink); border-radius: 999px; background: #fffaf2; }
.free-note {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border: 2px solid var(--ink); border-radius: 50%; background: #fff;
}
.free-note.hot { background: var(--gold); transform: scale(1.25); }
.free-head {
  position: absolute; top: 4px; bottom: 4px; width: 4px; margin-left: -2px;
  background: var(--red); border-radius: 4px;
}
/* Bar: tarda al bar — el got, l'aixeta i la franja verda */
.free-scene.bar-scene {
  position: relative; width: 100%; max-width: 560px; height: 300px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -12%, rgba(255, 227, 160, 0.95), transparent 62%),
    repeating-linear-gradient(90deg, rgba(36, 25, 16, 0.035) 0 22px, transparent 22px 44px),
    linear-gradient(180deg, #f8e7c6 0 62%, #eddcc0 62%);
  box-shadow: inset 0 -12px 0 rgba(36, 25, 16, 0.05);
}
.bar3d-wrap {
  position: absolute; inset: 0; z-index: 0; background: #241812;
}
.bar3d-wrap canvas { display: block; width: 100%; height: 100%; }
.bar3d-fail {
  position: absolute; inset: 0; display: grid; place-items: center;
  margin: 0; padding: 18px; text-align: center;
  color: #ffe8b0; font-weight: 700;
}
.bar3d-fail[hidden] { display: none; }
.free-scene-pati {
  position: relative; width: 100%; max-width: 560px; height: 320px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 18px; overflow: hidden;
  background: #b9d7e8;
}
.pati3d-wrap { position: absolute; inset: 0; z-index: 0; }
.pati3d-wrap canvas { display: block; width: 100%; height: 100%; }
.pati3d-fail {
  position: absolute; inset: 0; display: grid; place-items: center;
  margin: 0; padding: 18px; text-align: center;
  color: #2a1a12; font-weight: 700; background: #c9dce9;
}
.pati3d-fail[hidden] { display: none; }
.pati-hud {
  position: absolute; left: 10px; top: 10px; z-index: 4;
  display: flex; align-items: center; gap: 7px;
  padding: 4px 9px; border: 2px solid var(--ink); border-radius: 999px;
  background: rgba(255,250,242,.94); font-size: .72rem; font-weight: 650;
  color: #2a1a12;
}
.pati-dots { display: flex; gap: 4px; }
.pati-dots i { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.pati-dots i.hit { background: var(--green); }
.pati-dots i.miss { background: var(--red); }
.pati-dots i.now { background: var(--gold); }
.pati-warn {
  position: absolute; left: 50%; top: 54px; transform: translateX(-50%); z-index: 5;
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff7e0; color: #2a1a12; font-weight: 700; font-size: .82rem; white-space: nowrap;
  box-shadow: 0 3px 0 rgba(36,25,16,.18);
}
.pati-warn[hidden] { display: none; }
/* Result over the 3D scene: big shiny 3D letters, no panel. */
.free-scene { position: relative; }
.fx-result {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 16px; text-align: center; border-radius: inherit;
  background: radial-gradient(ellipse at 50% 42%, rgba(18,10,6,.04) 0%, rgba(18,10,6,.46) 62%, rgba(18,10,6,.72) 100%);
  animation: fx-fade .3s ease-out both;
}
.fx-3d.is-fail {
  color: #ffd0c8;
  text-shadow:
    1px 1px 0 #fff0ec, 2px 2px 0 #ff9d8f, 3px 3px 0 #e0533f,
    4px 4px 0 #b4232c, 5px 5px 0 #8a1a22, 6px 6px 0 #5e1018,
    8px 9px 16px rgba(0,0,0,.55), 0 0 26px rgba(255,110,90,.8);
}
.fx-3d {
  display: block; margin: 0;
  font-size: clamp(2rem, 8.5vw, 3.4rem); line-height: .95; letter-spacing: .04em;
  text-transform: uppercase; color: #ffe08a; font-weight: 900;
  text-shadow:
    1px 1px 0 #fff6c8, 2px 2px 0 #ffd76a, 3px 3px 0 #e0a21f,
    4px 4px 0 #c67d10, 5px 5px 0 #a97434, 6px 6px 0 #8a5a2b,
    7px 7px 0 #6b4a32, 8px 9px 16px rgba(0,0,0,.55),
    0 0 26px rgba(255,215,106,.85);
  animation: fx-pop .42s cubic-bezier(.2,.9,.3,1.5) both, fx-glow 1.5s ease-in-out infinite alternate .42s;
}
.fx-score { margin: 0; color: #fff3d6; font-weight: 700; font-size: .95rem; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.fx-again {
  margin-top: 4px; padding: 10px 20px; border: 2px solid #211409; border-radius: 999px;
  background: linear-gradient(180deg, #ffd76a, #e0a21f); color: #2a1a12;
  font-weight: 800; font-size: .95rem; cursor: pointer;
  box-shadow: 0 5px 0 #211409, 0 10px 18px rgba(0,0,0,.35);
}
.fx-again:active { transform: translateY(4px); box-shadow: 0 1px 0 #211409; }
@keyframes fx-fade { from { opacity: 0; } }
@keyframes fx-pop { from { transform: scale(.55) rotate(-3deg); opacity: 0; } }
@keyframes fx-glow { to { filter: brightness(1.2) drop-shadow(0 0 12px rgba(255,215,106,.9)); } }
.bar-back { position: absolute; inset: 0; }
.bar-shelf {
  position: absolute; left: 7%; right: 7%; top: 62px; height: 7px;
  background: linear-gradient(180deg, #a97434, #7d4f22);
  border-radius: 3px; box-shadow: 0 4px 0 rgba(36, 25, 16, 0.18);
}
.bar-bottle {
  position: absolute; width: 16px; border: 2px solid var(--ink);
  border-radius: 5px 5px 3px 3px; opacity: 0.9;
  bottom: calc(100% - 62px);
}
.bar-bottle::before {
  content: ''; position: absolute; left: 50%; top: -12px; width: 6px; height: 12px;
  margin-left: -3px; background: inherit; border: 2px solid var(--ink); border-bottom: 0;
  border-radius: 3px 3px 0 0;
}
.bar-bottle.b1 { left: 13%; height: 40px; background: #6f9a6a; }
.bar-bottle.b2 { left: 19%; height: 32px; background: #b4232c; }
.bar-bottle.b3 { right: 15%; height: 36px; background: #d9a441; }
.bar-counter {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px;
  background: linear-gradient(180deg, #b57f40, #8a5a2b);
  border-top: 3px solid var(--ink);
  box-shadow: inset 0 7px 0 rgba(255, 255, 255, 0.16);
}
.bar-stand {
  position: absolute; left: 50%; bottom: 38px; width: 96px; height: 156px;
  transform: translateX(-50%);
}
.bar-glass {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  border: 3px solid var(--ink); border-radius: 6px 6px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.35));
  box-shadow: inset 0 -8px 0 rgba(36, 25, 16, 0.09), 0 7px 12px rgba(36, 25, 16, 0.18);
}
.bar-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  background: linear-gradient(180deg, #f7cb5c 0, #e6a92c 26%, #c67d10 100%);
}
.bar-foam {
  position: absolute; left: 0; right: 0; top: -8px; height: 14px;
  background: #fff8e8; border-radius: 9px 9px 3px 3px;
  box-shadow: inset 0 -4px 0 #f1e1bd, 0 2px 0 rgba(36, 25, 16, 0.14);
}
.bar-sweet {
  position: absolute; left: 0; right: 0; bottom: 58%; height: 20%;
  border-top: 2px dashed var(--green); border-bottom: 2px dashed var(--green);
  background:
    repeating-linear-gradient(45deg, rgba(29, 106, 66, 0.3) 0 6px, rgba(29, 106, 66, 0.14) 6px 12px);
  box-shadow: inset 0 0 0 1px rgba(255, 250, 242, 0.45);
}
.bar-shine {
  position: absolute; left: 11px; top: 12px; bottom: 18px; width: 11px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
}
.bar-tap {
  position: absolute; right: 31%; top: 4px; width: 20px; height: 76px;
  border: 2px solid var(--ink); border-radius: 4px 4px 9px 9px;
  background: linear-gradient(90deg, #97a4af, #eef3f7 46%, #8d99a4);
}
.bar-spout {
  position: absolute; left: -54px; bottom: 2px; width: 58px; height: 12px;
  border: 2px solid var(--ink); border-radius: 8px;
  background: linear-gradient(180deg, #eef3f7, #9aa6b1);
}
.bar-spout::after {
  content: ''; position: absolute; left: 3px; bottom: -7px; width: 11px; height: 7px;
  background: #b3bdc6; border: 2px solid var(--ink); border-top: 0;
  border-radius: 0 0 3px 3px;
}
.bar-stream {
  position: absolute; left: -49px; bottom: -34px; width: 7px; height: 36px;
  border-radius: 4px; opacity: 0;
  background: linear-gradient(180deg, #f8cf63, #d99a1f);
}
.bar-scene.is-pouring .bar-stream { opacity: 1; animation: bar-pour 0.42s linear infinite; }
@keyframes bar-pour { 0% { transform: scaleY(0.9); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0.9); } }
.bar-glass.in-band { box-shadow: inset 0 -8px 0 rgba(36, 25, 16, 0.09), 0 0 0 3px rgba(29, 106, 66, 0.55), 0 0 22px rgba(242, 182, 50, 0.85); }
.bar-band-label {
  position: absolute; left: calc(100% + 10px); bottom: 58%; margin-bottom: 3%;
  white-space: nowrap; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--green);
  background: #fffaf2; border: 2px solid var(--green); border-radius: 999px;
  padding: 3px 9px;
}
.bar-count {
  position: absolute; left: 12px; bottom: 8px;
  font-size: 0.8rem; font-weight: 650;
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 999px;
  padding: 3px 11px;
}
.bar-stop { min-width: 190px; }

/* Bar feedback: every tap leaves a mark on the glass and a word on the scene,
   and the last glass ends with its own card and animation. */
.bar-sweet { z-index: 2; }
.bar-tick {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 4;
  background: var(--green); border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 250, 242, 0.9);
}
.bar-tick.miss { background: var(--red); }
.bar-tick::after {
  content: ''; position: absolute; right: 3px; top: -3px;
  width: 7px; height: 7px; border-radius: 50%;
  background: inherit; border: 1px solid rgba(36, 25, 16, 0.35);
}
.bar-glass.fx-good { animation: bar-good 0.44s ease-out; }
.bar-glass.fx-miss { animation: bar-miss 0.44s ease-in-out; }
@keyframes bar-good {
  0% { transform: scale(1); }
  38% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes bar-miss {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-5px); }
  52% { transform: translateX(5px); }
  78% { transform: translateX(-2px); }
}
.bar-pop {
  position: absolute; left: 50%; top: 88px; z-index: 5;
  transform: translate(-50%, -6px); opacity: 0; pointer-events: none;
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fffaf2; font-size: 0.84rem; font-weight: 700; white-space: nowrap;
}
.bar-pop.good { color: var(--green); border-color: var(--green); }
.bar-pop.miss { color: var(--red); border-color: var(--red); }
.bar-pop.show { animation: bar-pop 0.95s ease-out forwards; }
@keyframes bar-pop {
  0% { opacity: 0; transform: translate(-50%, 5px) scale(0.86); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.07); }
  68% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -11px) scale(1); }
}
.bar-hud {
  position: absolute; left: 10px; top: 10px; z-index: 4;
  display: flex; align-items: center; gap: 7px;
  padding: 4px 9px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fffaf2; font-size: 0.72rem; font-weight: 650;
}
.bar-dots { display: inline-flex; gap: 3px; }
.bar-dots i {
  display: block; width: 9px; height: 9px;
  border: 2px solid var(--ink); border-radius: 50%; background: #fff;
}
.bar-dots i.now { background: var(--gold); transform: scale(1.18); }
.bar-dots i.hit { background: var(--green); border-color: var(--green); }
.bar-dots i.lost { background: var(--red); border-color: var(--red); }
.bar-splash { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; z-index: 3; pointer-events: none; }
.bar-splash b {
  position: absolute; bottom: calc(var(--level, 60%) - 4px);
  width: 6px; height: 6px; border-radius: 50% 50% 50% 0;
  background: #f2b632; opacity: 0;
  animation: bar-droplet 0.72s ease-out forwards;
}
.bar-splash.good b { background: #f7d072; }
@keyframes bar-droplet {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  18% { opacity: 1; }
  55% { opacity: 1; transform: translate(var(--dx, 0), -20px) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), 28px) scale(0.8); }
}
.bar-result {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 8;
  display: grid; gap: 2px; padding: 9px 12px 10px; text-align: center;
  border: 2px solid var(--ink); border-radius: 14px;
  background: rgba(255, 250, 242, 0.965);
  box-shadow: 0 6px 0 rgba(36, 25, 16, 0.12);
}
.bar-result[hidden] { display: none; }
.bar-result.show { animation: bar-card-in 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes bar-card-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.bar-result.win { box-shadow: inset 0 0 0 3px rgba(29, 106, 66, 0.4), 0 6px 0 rgba(36, 25, 16, 0.12); }
.bar-result.miss { box-shadow: inset 0 0 0 3px rgba(180, 35, 44, 0.35), 0 6px 0 rgba(36, 25, 16, 0.12); }
.bar-result-kicker {
  margin: 0; font-size: 0.64rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--soft); font-weight: 650;
}
.bar-result-line { display: flex; align-items: center; justify-content: center; gap: 10px; }
.bar-score { font-family: var(--serif); font-size: 1.55rem; line-height: 1; }
.bar-result h3 { margin: 0; font-size: 0.98rem; }
.bar-result-dots { display: flex; justify-content: center; gap: 4px; }
.bar-result-dots i { width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%; }
.bar-result-dots i.hit { background: var(--green); border-color: var(--green); }
.bar-result-dots i.lost { background: var(--red); border-color: var(--red); }
.bar-result-need { margin: 0; font-size: 0.72rem; color: var(--soft); }
.bar-scene.ended .bar-band-label { opacity: 0.4; }
.bar-scene.flash-good { box-shadow: inset 0 0 0 4px rgba(29, 106, 66, 0.55), inset 0 -12px 0 rgba(36, 25, 16, 0.05); }
.bar-scene.flash-miss { box-shadow: inset 0 0 0 4px rgba(180, 35, 44, 0.45), inset 0 -12px 0 rgba(36, 25, 16, 0.05); }
.bar-scene.won .bar-glass {
  box-shadow: inset 0 -8px 0 rgba(36, 25, 16, 0.09), 0 0 0 3px rgba(29, 106, 66, 0.55), 0 0 26px rgba(242, 182, 50, 0.85);
}
.bar-confetti { position: absolute; inset: 0; z-index: 9; overflow: hidden; pointer-events: none; }
.bar-confetti i {
  position: absolute; top: -14px; width: 7px; height: 12px; border-radius: 2px;
  animation-name: crida-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
.bar-cheers {
  position: absolute; right: 16%; top: 54%; z-index: 10;
  font-size: 2.3rem; opacity: 0;
  animation: bar-cheers 0.95s ease-out 2;
}
@keyframes bar-cheers {
  0% { opacity: 0; transform: translateY(6px) scale(0.7) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(0) scale(1.16) rotate(6deg); }
  100% { opacity: 0; transform: translateY(-14px) scale(1) rotate(0); }
}
.bar-scene.spilling .bar-glass {
  transform: rotate(-7deg) translateY(4px); transform-origin: 50% 100%;
  transition: transform 0.42s ease;
}
.bar-scene.spilling .bar-fill { animation: bar-slosh 0.9s ease-in-out; }
@keyframes bar-slosh {
  0%, 100% { transform: none; }
  30% { transform: skewX(-5deg) scaleX(1.03); }
  65% { transform: skewX(4deg) scaleX(1.02); }
}
.bar-puddle {
  position: absolute; left: 50%; bottom: 30px; z-index: 6;
  width: 12px; height: 10px; margin-left: -6px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #f7cb5c, #d99a1f);
  box-shadow: 0 0 0 2px rgba(36, 25, 16, 0.16);
  animation: bar-puddle 1.3s ease-out forwards;
}
@keyframes bar-puddle {
  to { width: 210px; height: 22px; margin-left: -105px; bottom: 26px; opacity: 0.92; }
}
.bar-drops { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.bar-drops i {
  position: absolute; top: 46%; width: 7px; height: 11px;
  border-radius: 0 0 50% 50%; background: #e6a92c;
  animation: bar-drip 0.85s ease-in forwards;
}
@keyframes bar-drip {
  to { transform: translateY(92px) scaleY(1.3); opacity: 0; }
}

/* La paradeta: el taulell, el client i els encerts */
.free-scene.parada-scene {
  position: relative; width: 100%; max-width: 440px; height: 300px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(115% 72% at 50% 0, rgba(255, 241, 209, 0.92), transparent 62%),
    repeating-linear-gradient(90deg, rgba(36, 25, 16, 0.03) 0 26px, transparent 26px 52px),
    linear-gradient(180deg, #f8ecd6 0 58%, #efdcc0 58%);
  box-shadow: inset 0 -10px 0 rgba(36, 25, 16, 0.05);
}
.parada-awning {
  position: absolute; left: 0; right: 0; top: 0; height: 38px;
  background: repeating-linear-gradient(90deg, var(--red) 0 24px, #fff4dd 24px 48px);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 5px 0 rgba(36, 25, 16, 0.14);
}
.parada-hang {
  position: absolute; top: 50px; width: 52px; height: 56px;
  display: grid; place-items: center;
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 3px 0 rgba(36, 25, 16, 0.22);
}
.parada-hang::before {
  content: ''; position: absolute; left: 50%; top: -13px; width: 2px; height: 13px;
  background: var(--ink);
}
.parada-hang svg { width: 36px; height: 36px; display: block; }
.parada-hang.h1 { left: 7%; transform: rotate(-5deg); }
.parada-hang.h2 { left: 27%; transform: rotate(4deg); }

.parada-client { position: absolute; left: 18%; bottom: 44px; width: 92px; height: 128px; }
.client-body {
  position: absolute; left: 10px; bottom: 0; width: 66px; height: 74px;
  border: 3px solid var(--ink); border-radius: 26px 26px 8px 8px;
  background: linear-gradient(180deg, #c9353e, #9c1f28);
}
.client-body::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 18px; height: 9px;
  background: var(--gold); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
}
.client-head {
  position: absolute; left: 24px; bottom: 68px; width: 36px; height: 36px;
  border: 3px solid var(--ink); border-radius: 50%; background: #f2c9a2;
}
.client-head::before {
  content: ''; position: absolute; left: -3px; right: -3px; top: -3px; height: 13px;
  background: #4a3324; border-radius: 18px 18px 4px 4px;
}
.client-face { position: absolute; inset: 0; }
.client-face::before {
  content: ''; position: absolute; left: 7px; top: 13px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--ink); box-shadow: 12px 0 0 var(--ink);
}
.client-face::after {
  content: ''; position: absolute; left: 8px; top: 20px; width: 12px; height: 0;
  border-bottom: 3px solid var(--ink);
}
.parada-client.happy .client-face::after {
  top: 16px; height: 5px; border-radius: 0 0 9px 9px;
}
.parada-client.sad .client-face::after {
  top: 19px; height: 5px; border-bottom: 0; border-top: 3px solid var(--ink);
  border-radius: 9px 9px 0 0;
}
.client-arm {
  position: absolute; left: 58px; bottom: 42px; width: 28px; height: 12px;
  border: 3px solid var(--ink); border-radius: 10px; background: #f2c9a2;
  transform: rotate(-10deg);
}

.parada-bubble {
  position: absolute; left: 46%; bottom: 148px; z-index: 2;
  min-width: 82px; min-height: 78px; margin: 0; padding: 8px 10px;
  display: flex; align-items: center; justify-content: center;
  background: #fffaf2; border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(36, 25, 16, 0.25);
}
.parada-bubble::after {
  content: ''; position: absolute; left: -9px; bottom: 16px; width: 14px; height: 14px;
  background: #fffaf2; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}
.parada-bubble svg { width: 52px; height: 52px; display: block; }
.parada-bubble.hot {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(29, 106, 66, 0.22), 0 4px 0 rgba(36, 25, 16, 0.25);
  animation: parada-ask 1s ease-in-out infinite;
}
@keyframes parada-ask { 50% { transform: translateY(-3px); } }

.parada-counter {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44px;
  border-top: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(36, 25, 16, 0.12) 0 2px, transparent 2px 68px),
    linear-gradient(180deg, #c08a4a, #8a5a2b);
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.15);
}
.parada-dots {
  position: absolute; right: 10px; top: 48px; z-index: 4;
  display: flex; gap: 6px;
}
.parada-dots i {
  width: 15px; height: 15px; border: 2px solid var(--ink); border-radius: 50%;
  background: #fffaf2; box-shadow: 0 2px 0 rgba(36, 25, 16, 0.2);
}
.parada-dots i.now { background: var(--gold); transform: scale(1.14); }
.parada-dots i.hit { background: var(--green); border-color: var(--green); }
.parada-dots i.miss { background: var(--red); border-color: var(--red); }
.parada-count {
  position: absolute; left: 12px; bottom: 9px; z-index: 3;
  font-size: 0.8rem; font-weight: 650;
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 999px;
  padding: 3px 10px;
}
.parada-scene .free-pop { top: auto; right: auto; left: 34%; bottom: 96px; z-index: 6; }

.free-actions .parada-serve {
  flex: 1 1 140px; width: auto; height: auto; min-height: 64px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 8px 12px; border-radius: 13px;
}
.parada-serve .serve-ico { display: grid; place-items: center; width: 42px; height: 42px; }
.parada-serve svg { width: 38px; height: 38px; display: block; }
.parada-serve b { font-family: var(--serif); font-size: 1rem; }
#free-stage.flash-good .parada-scene { box-shadow: inset 0 0 0 4px rgba(46, 107, 74, 0.55), inset 0 -10px 0 rgba(36, 25, 16, 0.05); }
#free-stage.flash-miss .parada-scene { box-shadow: inset 0 0 0 4px rgba(180, 35, 44, 0.45), inset 0 -10px 0 rgba(36, 25, 16, 0.05); }
@media (prefers-reduced-motion: reduce) {
  .bar-glass.fx-good, .bar-glass.fx-miss, .bar-pop.show, .bar-result.show,
  .bar-confetti i, .bar-cheers, .bar-splash b, .bar-scene.spilling .bar-fill,
  .bar-puddle, .bar-drops i { animation: none !important; transition: none !important; }
  .parada-bubble.hot { animation: none; }
  .bar-confetti, .bar-cheers, .bar-splash, .bar-drops { display: none; }
  .bar-puddle { width: 180px; height: 18px; margin-left: -90px; }
}
@media (max-width: 380px) {
  /* The band is still dashed on the glass; the badge would leave the scene. */
  .bar-band-label { display: none; }
}

/* Prep: five seconds before the clock starts */
#free-stage { position: relative; }
.play-prep {
  position: absolute; inset: 0; z-index: 6; display: none;
  place-items: center; align-content: center; gap: 6px;
  padding: 18px; text-align: center; border-radius: 18px;
  background: rgba(243, 230, 207, 0.91);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.play-prep.show { display: grid; }
.play-prep .prep-kicker {
  margin: 0; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--red); font-weight: 650; font-size: 0.82rem;
}
.play-prep .prep-count {
  font-family: var(--serif); font-size: clamp(3.4rem, 13vw, 5.4rem);
  line-height: 0.95; color: var(--ink); font-variant-numeric: tabular-nums;
}
.play-prep .prep-count.tick { animation: prep-tick 0.9s ease-out; }
.play-prep .prep-note { margin: 0; max-width: 36ch; color: var(--soft); font-size: 0.92rem; }
.play-prep .prep-bar {
  display: block; width: min(220px, 72%); height: 7px; margin-top: 4px;
  border: 2px solid var(--ink); border-radius: 999px; overflow: hidden;
  background: rgba(36, 25, 16, 0.1);
}
.play-prep .prep-bar::after {
  content: ''; display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transform: scaleX(var(--prep, 0)); transform-origin: left center;
}
@keyframes prep-tick { from { transform: scale(1.18); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
#free-actions.is-prep { opacity: 0.38; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .play-prep .prep-count, .play-prep .prep-count.tick, .bar-scene.is-pouring .bar-stream { animation: none; }
}
.free-yard { height: 140px; display: flex; align-items: flex-end; justify-content: center; }
.free-yard i {
  width: 36px; height: 110px; border: 3px solid var(--ink); border-radius: 18px 18px 6px 6px;
  background: var(--red); transform-origin: 50% 100%;
}
.free-yard i.lean-l { transform: rotate(-16deg); }
.free-yard i.lean-r { transform: rotate(16deg); }
.free-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.free-actions button { min-height: 48px; }
.free-shaft {
  position: relative; width: 72px; height: 150px;
  border: 3px solid var(--ink); border-radius: 12px; background: #fffaf2; overflow: hidden;
}
.free-coin {
  position: absolute; left: 18px; width: 28px; height: 28px; margin-top: -14px;
  border: 3px solid var(--ink); border-radius: 50%; background: var(--gold);
}
.free-box {
  position: absolute; left: 0; right: 0; top: 62%; height: 22%;
  border-top: 2px dashed var(--green); border-bottom: 2px dashed var(--green);
  background: rgba(46, 120, 70, 0.12);
}
.purse-call {
  margin: 0; min-height: 2.6rem;
  font-family: var(--serif); font-size: 1.8rem;
}
.purse-call.goods {
  display: flex; align-items: center; justify-content: center; min-height: 76px;
}
.purse-call.goods svg { width: 64px; height: 64px; display: block; }
.purse-call.hot { color: var(--green); }
.purse-good {
  width: 76px; height: 76px; padding: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 12px; background: #fffaf2;
}
.purse-good svg { width: 44px; height: 44px; display: block; }
.purse-good:hover { background: var(--ink); color: var(--paper); }
.purse-dock {
  position: absolute; left: 14px; right: 14px; bottom: 62px; z-index: 2;
  display: flex; justify-content: center; pointer-events: none;
}
.purse-dock .free-play {
  pointer-events: auto; width: min(440px, 100%); margin: 0;
  background: rgba(255, 250, 242, 0.94); border: 2px solid var(--ink);
  border-radius: 16px; padding: 8px 10px;
}
.purse-dock .free-play h2 { font-size: 1.15rem; margin: 0; }
.purse-dock .free-play p { margin: 2px 0; }
.boon-bar {
  position: absolute; left: 14px; bottom: 14px; z-index: 2; max-width: min(420px, calc(100% - 150px));
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.boon-bar p { margin: 0; color: #fffaf2; text-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.boon-bar button {
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 999px; padding: 8px 12px;
}
.play-card > button, .card-targets button {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  max-width: 100%;
}
.card-targets { display: flex; flex-wrap: wrap; gap: 6px; }
.card-targets button { display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.card-targets button span { min-width: 0; overflow-wrap: anywhere; }
.card {
  background: #fffaf2;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.attempts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.attempts li { display: flex; justify-content: space-between; gap: 8px; }
.tag {
  font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1.5px solid currentColor; border-radius: 999px; padding: 1px 6px;
}
.tag.descarregat { color: var(--green); }
.tag.carregat { color: var(--loaded); }
.tag.llenya { color: var(--red); }
.tag.desmuntat { color: var(--soft); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; }
.podium .pod:nth-child(1) { grid-column: 2; }
.podium .pod:nth-child(2) { grid-column: 1; grid-row: 1; }
.podium .pod:nth-child(3) { grid-column: 3; grid-row: 1; }
.pod {
  background: #fffaf2; border: 2px solid var(--ink); border-radius: 16px; padding: 12px; text-align: center;
}
.pod.first { background: #fff6df; min-height: 280px; }
.pod .big { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 8px; border: 2px solid var(--ink); }
.story { margin: 0; padding-left: 18px; }
#lobby,
#handbook,
#float-panel {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 5;
  height: 100%;
  height: 100svh;
  max-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
#handbook, #float-panel { z-index: 8; background: rgba(36, 25, 16, 0.46); }
#lobby {
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(224, 176, 58, 0.35), transparent 60%),
    rgba(243, 230, 207, 0.96);
}
#lobby.hidden, #handbook.hidden, #float-panel.hidden { display: none; }
/* Spacers center a short card. They collapse when the card is taller than the
   screen, so iPhone Safari can scroll to the real top instead of rubber-banding
   over a clipped title and snapping back on touch end. */
#lobby::before,
#lobby::after,
#handbook::before,
#handbook::after,
#float-panel::before,
#float-panel::after {
  content: "";
  flex: 1 0 auto;
  width: 0;
  min-height: 0;
}
@supports (-webkit-touch-callout: none) {
  #lobby, #handbook, #float-panel {
    height: -webkit-fill-available;
    height: 100svh;
    max-height: -webkit-fill-available;
    max-height: 100svh;
  }
  body:has(#lobby:not(.hidden)) {
    position: fixed;
    inset: 0;
    width: 100%;
  }
}
body:has(#lobby:not(.hidden)) {
  height: 100%;
  overflow: hidden;
}
.handbook-card {
  width: min(640px, 100%);
  max-width: 100%;
  flex: none;
  margin: 0;
  background: #fffaf2;
  border: 2px solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 rgba(36, 25, 16, 0.18);
  padding: 22px;
}
.handbook-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.handbook-card h2 {
  font-family: var(--serif);
  font-weight: 680;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.handbook-card h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin: 16px 0 4px;
}
.handbook-card p { margin: 0; }
.handbook-row {
  margin: 4px 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.handbook-row button { font-weight: 640; text-align: center; white-space: nowrap; }
.install-help { margin: -6px 0 14px; font-weight: 520; }
.poster, .wait {
  position: relative;
  width: min(640px, 100%);
  max-width: 100%;
  flex: none;
  margin: 0;
  background: #fffaf2;
  border: 2px solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 rgba(36, 25, 16, 0.14);
  padding: 22px;
}
.kicker { letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); font-weight: 640; margin: 0 0 6px; }
.poster h1, .wait h2 {
  font-family: var(--serif);
  font-weight: 680;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  margin: 0 0 10px;
}
.lede { font-size: 1.05rem; max-width: 46ch; }
.account {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fff;
}
.account p { margin: 0; }
.account-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 680;
  margin: 0;
}
.account-hello { overflow-wrap: anywhere; }
.account-note {
  margin: 0;
  color: var(--red-deep);
  font-weight: 520;
}
.account .primary,
.account .ghost,
.account-gate-card .primary { text-align: center; }
.account-links { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.account-links button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--red-deep);
  font-weight: 640;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#account-gate {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(36, 25, 16, 0.46);
  overflow: auto;
}
#account-gate.hidden { display: none; }
.account-gate-card { width: min(440px, 100%); display: grid; gap: 8px; }
.account-gate-card p { margin: 0; }
#lobby {
  top: calc(var(--league-h) + var(--top-h, 0px));
  bottom: var(--dock-h);
  height: auto;
  max-height: none;
}
#lobby::before,
#lobby::after {
  content: none;
}
/* The opening poster takes all the room between the league bar and the fixed
   dock below, without ever covering it. */
#lobby > .poster,
#lobby > .wait {
  flex: 1 0 auto;
}
/* While the opening menu is on screen it is the only section: the league page
   behind it (stage, colla and ranking panels, log) stays out of sight, so no
   other section's panel shows under the current one. */
body:has(#lobby:not(.hidden)) #top {
  visibility: hidden;
}
body.barri-topless #top {
  visibility: hidden;
}
body:has(#lobby:not(.hidden)) .faixa,
body:has(#lobby:not(.hidden)) .layout,
body:has(#lobby:not(.hidden)) #log {
  visibility: hidden;
}
.play-sheet {
  position: fixed;
  z-index: 6;
  top: calc(var(--league-h) + var(--top-h, 0px));
  right: 0;
  left: 0;
  bottom: var(--dock-h);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(224, 176, 58, 0.35), transparent 60%),
    rgba(243, 230, 207, 0.98);
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    16px
    max(16px, env(safe-area-inset-left));
}
.play-sheet.hidden { display: none; }
.map-sheet {
  position: fixed;
  z-index: 6;
  top: calc(var(--league-h) + var(--top-h, 0px));
  right: 0;
  left: 0;
  bottom: var(--dock-h);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(224, 176, 58, 0.35), transparent 60%),
    rgba(243, 230, 207, 0.98);
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    16px
    max(16px, env(safe-area-inset-left));
}
.map-sheet.hidden { display: none; }
/* Estadístiques: the two old side panels, now a section of their own. */
body.in-league .layout { grid-template-columns: minmax(0, 1fr); }
body.in-league .layout > #side, body.in-league .layout > #rank { display: none; }
.stats-sheet {
  position: fixed;
  z-index: 6;
  top: calc(var(--league-h) + var(--top-h, 0px));
  right: 0;
  left: 0;
  bottom: var(--dock-h);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(224, 176, 58, 0.35), transparent 60%),
    rgba(243, 230, 207, 0.98);
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    16px
    max(16px, env(safe-area-inset-left));
}
.stats-sheet.hidden { display: none; }
.stats-wrap {
  width: min(1000px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.stats-wrap.solo { grid-template-columns: minmax(0, 1fr); max-width: 680px; }
.stats-col {
  min-width: 0;
  padding: 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 18px;
}
@media (max-width: 760px) {
  .stats-wrap { grid-template-columns: minmax(0, 1fr); }
}
.map-wrap { width: min(720px, 100%); margin: 0 auto; }
.map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.map-head h2 { margin: 0 0 6px; }
.map-close { flex: 0 0 auto; white-space: nowrap; }
.map-wrap h2 { font-family: var(--serif); font-weight: 680; margin: 0 0 6px; }
.map-wrap > .muted { margin: 0 0 12px; }
.map-frame { width: min(440px, 100%); margin: 0 auto 8px; }
.map-box {
  position: relative;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 18px;
  overflow: visible;
  background: #d5e4ef;
}
.map-box::before {
  content: "";
  display: block;
  padding-top: var(--map-ratio, 121.9178%);
}
.map-land {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 16px;
}
.map-pin {
  position: absolute;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  line-height: 1.15;
  overflow: visible;
  transform: translate(-50%, -50%);
}
.map-pin .map-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fffaf2;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(36, 25, 16, 0.16);
}
.map-pin .map-dot svg { width: 20px; height: 20px; display: block; }
.map-pin .map-copy {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: max-content;
  max-width: 6.4rem;
  padding: 2px 6px 3px;
  background: rgba(255, 250, 242, 0.94);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  text-align: center;
}
.map-pin .map-copy strong { font-size: 0.74rem; font-weight: 680; }
.map-pin .map-copy small,
.map-pin .map-copy em {
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 520;
  color: var(--soft);
}
.map-pin.lab-n .map-copy {
  top: auto;
  bottom: 38px;
}
.map-pin.lab-w .map-copy {
  top: 0;
  left: auto;
  right: 40px;
  transform: none;
  align-items: flex-end;
  text-align: right;
}
.map-pin.lab-e .map-copy {
  top: 0;
  left: 40px;
  transform: none;
  align-items: flex-start;
  text-align: left;
}
.map-pin.now .map-dot { background: var(--gold); }
.map-pin.past .map-dot { background: #e7f4ec; }
.map-pin.on .map-copy { outline: 3px solid var(--gold); outline-offset: 1px; }
.map-pin.future .map-copy { background: rgba(255, 250, 242, 0.78); }
button.map-pin:disabled { opacity: 1; }
.map-card { display: grid; gap: 8px; margin-top: 14px; }
.map-card h3 { font-family: var(--serif); font-weight: 680; margin: 0; }
.map-card .card.you { outline: 3px solid var(--gold); outline-offset: 1px; }
.map-card .muted { margin: 0; }
.play-sheet-card { width: min(720px, 100%); margin: 0 auto; }
.read-tips { padding: 2px 4px 6px; }
.read-tips-lead { margin: 2px 0 12px; color: #4a3a28; }
.read-tips-list { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; }
.read-tips-list li { line-height: 1.5; padding-left: 2px; }
.read-tips-list li::marker { color: #b4232c; font-weight: 700; }
.read-sign-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.read-sign-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(34, 23, 15, 0.16); padding-bottom: 6px; }
.read-sign-list li b { font-family: var(--serif); }
.read-sign-close { margin: 14px 0 0; text-align: right; }
.mail-field { display: block; margin: 0 0 12px; }
.mail-field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.mail-field select,
.mail-field textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1.5px solid rgba(34, 23, 15, 0.28); background: #fffaf0; color: inherit; }
.mail-field textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.mail-hint { margin: -4px 0 12px; }
.mail-cost { margin: -2px 0 12px; font-weight: 700; color: #7a1f1f; }
.mayor-box { margin: 14px 0 18px; display: grid; gap: 10px; }
.mayor-money { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0; font-weight: 700; }
.mayor-sub { margin: 6px 0 8px; font-family: var(--serif); }
.town-shops { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.town-shop { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(34, 23, 15, 0.14); padding-bottom: 8px; }
.town-shop b { font-family: var(--serif); }
.town-shop.open { opacity: 0.75; }
.town-shop-state { font-size: 0.82em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #2f6b45; }
.town-shop-act { white-space: nowrap; }
.mail-letter-head { margin: 0 0 2px; }
.mail-letter-date { margin: 0 0 12px; }
.mail-letter-body { white-space: pre-wrap; line-height: 1.5; }
.mail-read-chip { animation: mail-pulse 1.8s ease-in-out infinite; }
@keyframes mail-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { .mail-read-chip { animation: none; } }
.coin-chip { border-color: #d8ab45; color: #7a5312; background: #fff6dc; animation: coin-pulse 1.6s ease-in-out infinite; }
.coin-chip svg { color: #b8862a; }
@keyframes coin-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(216, 171, 69, 0.55); } 55% { box-shadow: 0 0 0 6px rgba(216, 171, 69, 0); } }
@media (prefers-reduced-motion: reduce) { .coin-chip { animation: none; } }
.car-chip { border-color: #7c9db5; color: #24465c; background: #eef7fc; }
.car-chip svg { color: #3d6c8a; }
.play-sheet h2 { font-family: var(--serif); font-weight: 680; margin: 0 0 12px; }
.play-sheet h3 { margin: 16px 0 8px; }
.sheet-tresor {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  padding: 5px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--ink);
}
.sheet-tresor span { font-size: 0.86em; text-transform: uppercase; letter-spacing: 0.04em; }
.sheet-tresor b { font-family: var(--serif); font-size: 1.1rem; }
.boon-bar.in-sheet {
  position: static;
  left: auto;
  bottom: auto;
  max-width: none;
  margin: 8px 0 0;
}
.boon-bar.in-sheet p { color: var(--ink); text-shadow: none; }
.stage-boon {
  margin: 14px 14px 8px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.96);
}
.stage-boon > button,
.stage-boon .boon-bar button {
  background: #fffaf2;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
}
.stage-boon .boon-bar {
  position: static;
  left: auto;
  bottom: auto;
  max-width: none;
}
.stage-boon .boon-bar p { color: var(--ink); text-shadow: none; }
#stage.bare .stage-boon {
  position: absolute;
  left: 14px;
  right: 150px;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  max-width: none;
}
#stage.bare .stage-boon .boon-bar p {
  color: #fffaf2;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.home-panels {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: #fffaf2;
  border-top: 2px solid var(--ink);
}
.home-panels button {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 14px;
  padding: 8px 4px;
  font-weight: 680;
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
}
.home-panels button svg {
  width: 26px;
  height: 26px;
  flex: none;
}
.home-panels button span { display: block; max-width: 100%; }
.home-panels button.on {
  background: var(--ink);
  color: var(--paper);
}
.home-panels.hidden { display: none; }
.league-bar {
  position: fixed;
  z-index: 7;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  padding:
    max(8px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    8px
    max(12px, env(safe-area-inset-left));
  background: #fffaf2;
  border-bottom: 2px solid var(--ink);
}
.league-bar.hidden { display: none; }
.league-bar strong {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 680;
  letter-spacing: 0.03em;
}
.league-bar .league-week,
.league-bar .league-festa {
  color: var(--soft);
  font-weight: 640;
}
.league-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.league-bar .league-out,
.league-bar .league-account,
.league-bar .league-chat,
.league-bar .leave {
  align-self: center;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 680;
  flex: none;
  white-space: nowrap;
}
.league-bar .league-chat.on {
  background: var(--ink);
  color: var(--paper);
}
.league-bar .league-tresor,
.league-bar .league-crew {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: center; padding: 3px 10px; border: 2px solid var(--ink);
  border-radius: 999px; font-weight: 720; white-space: nowrap;
}
.league-bar .league-tresor { background: var(--gold); color: var(--ink); }
.league-bar .league-crew { background: var(--card-solid); color: var(--ink); }
.league-bar .league-ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.league-bar .league-ico svg { width: 100%; height: 100%; display: block; }
.league-bar .leave.armed {
  background: var(--red);
  color: #fffaf2;
  border-color: var(--red-deep);
}
.rooms-head {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 680;
  margin: 8px 0 0;
}
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 10px;
  background: #fff;
}
.room-row.here { outline: 3px solid var(--gold); outline-offset: 1px; }
.room-row.mine-row { cursor: pointer; }
.room-row .room-leave.armed { background: var(--red); color: #fffaf2; border-color: var(--red-deep); }
.room-copy { flex: 1; min-width: 0; }
.room-copy strong { font-family: var(--serif); font-size: 1.2rem; }
.room-copy p { margin: 2px 0 0; }
.room-min { margin: 4px 0 0; font-size: 0.95rem; font-weight: 650; }
.room-min.none { color: var(--soft); font-weight: 500; }
.who-mini {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--soft);
  font-size: 0.86rem;
}
.who-mini li { display: flex; gap: 6px; align-items: center; }
.no-league-stats .who-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px 14px; }
.no-league-stats .who-row {
  align-items: center; gap: 8px; padding: 6px 8px;
  border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.5);
}
.no-league-stats .who-row .casteller-thumb { width: 42px; height: 42px; flex: none; }
.no-league-stats .who-copy { display: grid; gap: 1px; min-width: 0; }
.no-league-stats .who-copy b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-league-stats .who-copy small { color: var(--muted, #6b6258); font-size: 0.76rem; }
.no-league-stats .who-row.mine .who-copy b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.no-league-stats .who-row.mine { border-color: #a87512; box-shadow: 0 2px 0 #a87512; }
.room-row button { flex: none; }
.room-row .room-actions {
  margin-left: auto;
  flex: 0 0 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}
.room-row .room-actions button { white-space: nowrap; text-align: center; }
.room-row .room-actions button.primary {
  white-space: normal;
  line-height: 1.15;
  max-width: 9.5rem;
}
button.primary.due {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
}
button.primary.full,
button.primary.full:hover,
button.primary.full:disabled,
button.primary.full:disabled:hover {
  background: #efe6d6;
  color: var(--ink);
  border-color: var(--ink);
  opacity: 1;
  cursor: not-allowed;
}
.room-stats {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-stat {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fffaf2;
}
.room-stat-id { display: flex; gap: 8px; align-items: center; padding: 0; }
.room-stat h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.1;
}
.room-stat p { margin: 4px 0 0; }
.room-stat .vals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
}
.room-stat .vals li { display: flex; justify-content: space-between; gap: 8px; }
.mine-stats .mine-leagues-title { font-family: var(--serif); font-size: 1rem; margin: 6px 0 0; }
.rooms-hint { margin: 0; }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.room-actions button { flex: none; }
form { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 0.9rem; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: 1.15rem; height: 1.15rem; margin: 0; }
input[type="text"],
input[type="password"],
input[type="email"],
select {
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  /* Below 16px, iPhone Safari zooms on focus and leaves the title clipped after blur. */
  font-size: 16px;
}
select { width: 100%; }
.shirts { display: flex; gap: 8px; flex-wrap: wrap; }
.shirts button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--ink); padding: 0;
}
.shirts button.picked { outline: 3px solid var(--gold); outline-offset: 2px; }
.mini-tower { display: flex; justify-content: center; gap: 8px; margin: 8px 0 14px; }
.mini-tower i { width: 22px; border-radius: 8px 8px 3px 3px; background: var(--red); display: block; }
.who { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.who li { display: flex; gap: 8px; align-items: center; }
.share { display: flex; gap: 8px; align-items: center; min-width: 0; }
.share code {
  background: var(--paper);
  padding: 6px 8px;
  border-radius: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}
#stage.shake { animation: hit 0.4s linear; }
@keyframes hit {
  10% { transform: translateX(-3px); }
  30% { transform: translateX(4px); }
  50% { transform: translateX(-2px); }
  70% { transform: translateX(1px); }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.in, #stage.shake { animation: none; }
}
@media (max-width: 980px) {
  body { height: auto; }
  #app { height: auto; }
  .layout { grid-template-columns: 1fr; }
  #stage { min-height: 70vh; }
  .split, .hall, .ronda, .podium { grid-template-columns: 1fr; }
  .split:has(> .preview-wrap) { grid-template-columns: 1fr; }
  /* One column means a very wide, short canvas, which shrinks the castell to a
     stamp. Give the tower a portrait frame instead. */
  .split > .preview-wrap canvas { flex: none; aspect-ratio: 4 / 5; height: auto; }
  .podium .pod:nth-child(1),
  .podium .pod:nth-child(2),
  .podium .pod:nth-child(3) { grid-column: auto; grid-row: auto; }
  .split { height: auto; overflow: visible; min-height: 70vh; }
  .catalog { max-height: 70vh; }
  header { flex-wrap: wrap; }
  .poster .langs, .wait .langs {
    position: static;
    margin: 0 0 10px auto;
  }
}
html:has(.admin-body) { height: auto; }
.admin-body { height: auto; min-height: 100%; }
.admin-wrap {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}
.admin-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.admin-wrap h1 {
  font-family: var(--serif);
  font-weight: 680;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
}
.admin-wrap h2 { font-family: var(--serif); font-size: 1.35rem; margin: 18px 0 8px; }
.admin-choice {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 8px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fffaf2;
  padding: 14px;
  box-shadow: var(--shadow);
}
.admin-choice b { display: block; font-family: var(--serif); font-size: 1.25rem; }
.admin-choice span { display: block; color: var(--soft); margin-top: 4px; }
.admin-links { margin: 18px 0 0; }
.admin-prompt { display: grid; gap: 12px; margin-top: 14px; }
.admin-prompt label { display: grid; gap: 6px; font-weight: 640; }
.admin-prompt textarea {
  width: 100%;
  min-height: 170px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fffaf2;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  resize: vertical;
}
.admin-log li { align-items: flex-start; flex-wrap: wrap; gap: 4px 10px; }
.admin-log-time { color: var(--soft); font-size: 0.78rem; min-width: 120px; }
.admin-log-tool { display: flex; gap: 6px; align-items: baseline; min-width: 160px; }
.admin-log-tool small { color: var(--soft); }
.admin-log-args {
  flex: 1 1 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  color: var(--soft);
  word-break: break-all;
}
.admin-league {
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fffaf2;
  padding: 12px 14px;
  margin-top: 10px;
}
.admin-league h2 { margin: 0; }
.admin-league .notice { margin: 8px 0 0; }
.admin-people { list-style: none; padding: 0; margin: 8px 0 0; }
.admin-people li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.admin-people li span { flex: 1; min-width: 0; }
.admin-people button { flex: none; }
.admin-day-block { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.admin-day-lead { margin: 0; color: var(--soft); font-size: 0.82rem; }
.admin-day-now { margin: 4px 0 8px; font-weight: 650; font-size: 0.86rem; }
.admin-days { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-day {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffaf2;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}
.admin-day.on { background: var(--ink); color: #fffaf2; }
.admin-day-note { margin: 10px 0 0; color: var(--soft); font-size: 0.82rem; }
.admin-body a.ghost { display: inline-block; text-decoration: none; color: inherit; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-stat {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fffaf2;
  padding: 10px 12px;
}
.admin-stat span { color: var(--soft); font-size: 0.86rem; }
.admin-stat b { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.admin-table { overflow-x: auto; }
.ag-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.ag-card { display: grid; gap: 8px; align-items: start; }
.ag-card .ag-card-desc {
  display: block;
  font-family: var(--sans, inherit) !important;
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
}
.ag-play {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--red);
  color: #fffaf2;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--ink);
}
.ag-play:hover { transform: translateY(-1px); }
.ag-play:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.ag-frame-box {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: #f6ead3;
}
.ag-frame-box.hidden { display: none; }
.ag-frame-box header { display: flex; align-items: center; gap: 10px; }
.ag-frame-box header b { font-family: var(--serif); font-size: 1.1rem; }
.ag-frame-box header button { margin-left: auto; }
.ag-frame-stage { flex: 1; min-height: 0; display: flex; justify-content: center; }
.ag-frame-stage { position: relative; }
.ag-frame-stage iframe { width: min(480px, 100%); height: 100%; border: 2px solid var(--ink); border-radius: 16px; background: #fff; }
.ag-frame-cover {
  position: absolute; inset: 0; margin: 0 auto; width: min(480px, 100%);
  display: grid; place-items: center; padding: 20px; text-align: center;
  background: #f3e6cf; color: var(--soft); font-weight: 650;
  border: 2px solid var(--ink); border-radius: 16px;
}
.ag-frame-cover.hidden { display: none; }
/* Inside the admin frame: the real activity panel only, no game chrome. */
html.embed-live #top,
html.embed-live .faixa,
html.embed-live .layout,
html.embed-live #log,
html.embed-live #lobby,
html.embed-live #handbook,
html.embed-live #float-panel,
html.embed-live #play-sheet,
html.embed-live #map-sheet,
html.embed-live #league-bar,
html.embed-live #home-dock,
html.embed-live #chat,
html.embed-live #splash,
html.embed-live #account-gate,
html.embed-live #toasts { display: none !important; }
html.embed-live .act-panel {
  top: 8px; right: 8px; bottom: 8px; left: 8px;
}
/* Admin sandbox: only the real activity panel, with no game or league behind. */
html.sandbox #top,
html.sandbox .faixa,
html.sandbox .layout,
html.sandbox #log,
html.sandbox #lobby,
html.sandbox #handbook,
html.sandbox #float-panel,
html.sandbox #play-sheet,
html.sandbox #map-sheet,
html.sandbox #league-bar,
html.sandbox #home-dock,
html.sandbox #chat,
html.sandbox #splash,
html.sandbox #account-gate,
html.sandbox #toasts,
html.sandbox #act-panel { display: none !important; }
html.sandbox { background: #f3e6cf; }
html.sandbox body { background: #f3e6cf !important; }
html.sandbox #app { min-height: 100vh; }
html.sandbox #sandbox-panel.act-panel { top: 8px; right: 8px; bottom: 8px; left: 8px; }
.ag-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(30, 20, 12, 0.55); padding: 16px; }
.ag-modal.hidden { display: none; }
.ag-card-modal { width: min(560px, 100%); background: #fffaf2; border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2); padding: 14px; }
.ag-card-modal header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ag-card-modal header b { font-family: var(--serif); font-size: 1.1rem; }
.ag-x { margin-left: auto; width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 50%; background: #fff; }
.ag-stage { position: relative; height: 260px; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: #efe4cf; }
.ag-row { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.ag-hit { min-width: 120px; }
.ag-hud { text-align: center; font-weight: 700; margin: 8px 0 0; }
.ag-again { display: block; margin: 10px auto 0; }
.ag-track { position: absolute; left: 6%; right: 6%; top: 45%; height: 8px; background: #7a4a22; border-radius: 999px; }
.ag-head { position: absolute; top: -10px; width: 6px; height: 28px; margin-left: -3px; background: #22170f; border-radius: 3px; }
.ag-note { position: absolute; top: -6px; width: 14px; height: 20px; margin-left: -7px; border: 2px solid #22170f; border-radius: 4px; background: #e0b03a; }
.ag-note.hit { background: #2f7a55; }
.ag-glass { position: absolute; left: 50%; bottom: 14px; width: 110px; height: 200px; margin-left: -55px; border: 3px solid #22170f; border-radius: 8px 8px 14px 14px; background: #fffaf2; overflow: hidden; }
.ag-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #e0b03a; }
.ag-band { position: absolute; left: 0; right: 0; bottom: 58%; height: 20%; background: rgba(47, 122, 85, 0.35); border-top: 2px solid #2f7a55; border-bottom: 2px solid #2f7a55; }
.ag-yard { position: absolute; inset: 0; }
.ag-pillar { position: absolute; left: 50%; bottom: 40px; width: 18px; height: 150px; margin-left: -9px; background: #b4232c; border: 2px solid #22170f; border-radius: 6px; transform-origin: 50% 100%; transition: transform 0.18s ease; }
.ag-pillar.lean-l { transform: rotate(-18deg); }
.ag-pillar.lean-r { transform: rotate(18deg); }
.ag-ground { position: absolute; left: 10%; right: 10%; bottom: 30px; height: 6px; background: #7a4a22; border-radius: 999px; }
.ag-street { position: absolute; inset: 0; background: linear-gradient(180deg, #ecca9e, #c99560); }
.ag-lane { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 246, 228, 0.5); }
.ag-coin { position: absolute; top: 0; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #e0b03a; border: 2px solid #22170f; }
.ag-coin.gone { opacity: 0; }
.ag-plate { position: absolute; bottom: 16px; width: 74px; height: 16px; margin-left: -37px; background: #d9a94f; border: 2px solid #22170f; border-radius: 50%; }
.admin-days { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-days th, .admin-days td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
@media (max-width: 640px) {
  .admin-grid { grid-template-columns: 1fr; }
}
.chat {
  position: fixed;
  z-index: 7;
  left: 0;
  right: 0;
  top: calc(var(--league-h) + var(--top-h, 0px));
  bottom: var(--dock-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  margin: 0;
}
.chat.hidden { display: none; }
body.chat-open {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.chat-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  box-sizing: border-box;
  background: #efe4cf;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 0 rgba(36, 25, 16, 0.10);
  overflow: hidden;
  padding: 0;
}
.chat-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--red-deep, #7c1420);
  color: #fffaf2;
}
.chat-top-copy { min-width: 0; }
.chat-top-copy b { display: block; font-family: var(--serif); font-size: 1rem; line-height: 1.15; }
.chat-top-copy small { display: block; font-size: 0.72rem; opacity: 0.82; }
.chat-close {
  margin-left: auto;
  flex: none;
  width: 34px;
  height: 34px;
  border: 2px solid #fffaf2;
  border-radius: 50%;
  background: transparent;
  color: #fffaf2;
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.chat-close svg { width: 17px; height: 17px; display: block; }
.chat-log {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.32), transparent 42%),
    repeating-linear-gradient(45deg, rgba(120, 90, 50, 0.035) 0 10px, transparent 10px 20px),
    #efe4cf;
}
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.chat-msg.mine { margin-left: auto; flex-direction: row-reverse; }
.chat-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--ink); background: #efe8dc;
}
.chat-avatar svg { display: block; width: 100%; height: 100%; }
.chat-bubble {
  min-width: 0;
  background: #fffaf2;
  border: 2px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  padding: 6px 9px 7px;
  box-shadow: 0 2px 0 rgba(36, 25, 16, 0.10);
}
.chat-msg.mine .chat-bubble { background: #fbe9a8; border-radius: 14px 14px 4px 14px; }
.chat-bubble header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  font-size: 0.72rem; color: var(--soft);
}
.chat-bubble header b { font-size: 0.78rem; color: var(--ink); }
.chat-colla { font-size: 0.68rem; }
.chat-role { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.chat-escut { display: inline-flex; width: 16px; height: 16px; }
.chat-escut svg { display: block; width: 16px; height: 16px; }
.chat-bubble time { margin-left: auto; font-size: 0.64rem; color: var(--soft); }
.chat-bubble p { margin: 3px 0 0; overflow-wrap: anywhere; }
.chat-empty { margin: 0; text-align: center; }
.chat-form {
  flex: none;
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  background: #fffaf2;
  border-top: 2px solid var(--ink);
}
.chat-form input { flex: 1; min-width: 0; width: auto; }
.chat-send {
  border: 2px solid var(--red-deep);
  background: var(--red);
  color: #fffaf2;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 640;
  flex: none;
}

/* ==========================================================================
   Millora visual v2 (octubre 2026)
   Només capa visual: paleta, tipografia, contrast, icones, fons per fase.
   Per desfer-ho, esborra des d'aquest comentari fins al final del fitxer.
   ========================================================================== */
:root {
  --paper: #fbf4e6;
  --paper-2: #e9dcc4;
  --stone: #e9dcc4;
  --card: rgba(251, 244, 230, 0.96);
  --card-solid: #fbf4e6;
  --ink: #22170f;
  --soft: #4d3f31;
  --line: rgba(34, 23, 15, 0.18);
  --red: #b4232c;
  --red-deep: #6e1420;
  --gold: #f2b632;
  --gold-soft: #f6e2b0;
  --green: #2e6b4a;
  --night: #1f2a44;
  --dusk: #e9876b;
  --water: #7fa7cf;
  --shadow: 0 3px 0 rgba(34, 23, 15, 0.22), 0 12px 26px rgba(34, 23, 15, 0.14);
}

/* Fons general i fons per fase (sense JS: :has() mira què hi ha a l'escenari) */
body {
  font-weight: 400;
  background:
    radial-gradient(1200px 520px at 12% -12%, rgba(242, 182, 50, 0.30), transparent 52%),
    radial-gradient(900px 520px at 108% 0%, rgba(180, 35, 44, 0.14), transparent 46%),
    var(--stone);
}
body:has(#stage .hall),
body:has(#stage .split:not(.ronda)) {
  background:
    linear-gradient(rgba(31, 42, 68, 0.50), rgba(31, 42, 68, 0.62)),
    url("/img/fons-local.webp") center / cover no-repeat fixed,
    var(--night);
}
body:has(#stage .ronda),
body:has(#stage .diada),
body:has(#stage .resum),
body:has(#stage .final),
body:has(#lobby:not(.hidden)) {
  background:
    linear-gradient(rgba(251, 244, 230, 0.30), rgba(233, 220, 196, 0.55)),
    url("/img/fons-placa.webp") center 30% / cover no-repeat fixed,
    var(--stone);
}
#lobby {
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(242, 182, 50, 0.30), transparent 60%),
    rgba(233, 220, 196, 0.62);
}

/* Capçalera de lliga: blau del cartell d'inici, amb la faixa daurada */
.league-bar {
  background: #056eee;
  color: #fffaf2;
  border-bottom: 0;
  box-shadow: inset 0 -4px 0 var(--gold), 0 2px 0 var(--ink);
}
.league-bar strong { color: #fff8ea; }
.league-bar .league-week,
.league-bar .league-festa { color: #eaf5ff; }
.league-bar .league-out,
.league-bar .league-account,
.league-bar .league-chat,
.league-bar .leave {
  background: #fffaf2;
  color: #073a63;
  border-color: #064f9e;
  box-shadow: 0 2px 0 #064f9e;
}
.league-bar .league-chat.on { background: var(--gold); color: var(--ink); }
/* A l'escena 3D: blau del cartell d'inici i escena a sang, sense marge. */
body.barri-3d .league-bar {
  background: #056eee;
  color: #fffaf2;
  border-bottom: 0;
  box-shadow: inset 0 -4px 0 var(--gold), 0 2px 0 var(--ink);
}
body.barri-3d .league-bar strong { color: #fff8ea; }
body.barri-3d .league-bar .league-week,
body.barri-3d .league-bar .league-festa { color: #eaf5ff; }
body.barri-3d .league-bar .league-out,
body.barri-3d .league-bar .league-account,
body.barri-3d .league-bar .league-chat,
body.barri-3d .league-bar .leave {
  background: #fffaf2;
  color: #073a63;
  border-color: #064f9e;
  box-shadow: 0 2px 0 #064f9e;
}
body.barri-3d .league-bar .league-chat.on { background: var(--gold); color: var(--ink); }
body.barri-3d .layout { padding: 0; gap: 0; }
body.barri-3d #stage {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #cfe4f0;
}
body.barri-3d .barri-sheet { width: 100%; max-width: none; margin: 0; }
body.barri-3d .barri-stage {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Barra de fases i rellotge */
header#top {
  display: none;
  background: rgba(251, 244, 230, 0.94);
  border-bottom: 2px solid var(--ink);
  padding: 10px 16px;
}
.phases { gap: 8px; align-items: center; }
.phases span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  color: var(--soft);
  font-size: 0.95rem;
  font-weight: 640;
}
.phases span::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--ph) center / contain no-repeat;
  mask: var(--ph) center / contain no-repeat;
}
.phases span:nth-child(1) { --ph: url("/img/ico/ph-local.svg"); }
.phases span:nth-child(2) { --ph: url("/img/ico/ph-assaig.svg"); }
.phases span:nth-child(3) { --ph: url("/img/ico/ph-ronda.svg"); }
.phases span:nth-child(4) { --ph: url("/img/ico/ph-diada.svg"); }
.phases span:nth-child(5) { --ph: url("/img/ico/ph-resum.svg"); }
.phases span.now {
  background: var(--gold);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}
.phases span.soon { background: var(--gold-soft); border: 2px dashed var(--ink); color: var(--ink); }
.phases span.done { color: var(--green); border-color: rgba(46, 107, 74, 0.45); background: rgba(46, 107, 74, 0.08); }
.clock b { font-size: 2rem; line-height: 1; }
.bar { height: 7px; }
.bar i { background: var(--red); }
button.extend { background: var(--card-solid); box-shadow: 0 2px 0 var(--ink); }

/* Franja de faixa més visible */
.faixa {
  height: 10px;
  background: repeating-linear-gradient(135deg, var(--red) 0 10px, var(--gold) 10px 20px);
  border-bottom: 2px solid var(--ink);
}

/* Panells: paper opac sobre el fons il·lustrat */
aside, #stage {
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
}
#stage.bare { background: #1c140f; }
footer {
  margin: 0 12px 10px;
  padding: 8px 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  color: var(--soft);
  font-size: 0.9rem;
}
footer:empty { display: none; }

/* Text llegible */
.brand small, .muted { color: var(--soft); }
.stats { gap: 8px; }
.stats li { grid-template-columns: 78px 1fr 34px; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.stats li b, .stats li em { font-variant-numeric: tabular-nums; }
.track { height: 10px; background: rgba(34, 23, 15, 0.10); box-shadow: inset 0 0 0 1px rgba(34, 23, 15, 0.12); }
.note { font-size: 0.9rem; background: var(--gold-soft); border: 1.5px solid rgba(34, 23, 15, 0.15); }
.rank em, .league-line b { font-variant-numeric: tabular-nums; }
.rank small, .forecast span, details { font-size: 0.86rem; }
.forecast article, .coach, .castell, .slots li.filled, .row-actions button { background: var(--card-solid); }
.coach { border-left-width: 5px; font-size: 0.95rem; }
.odds { font-size: 0.84rem; }

/* Cartes d'acció del local amb icona */
.act {
  position: relative;
  padding: 12px 12px 12px 62px;
  min-height: 78px;
  background: var(--card-solid);
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.act b { font-family: var(--serif); font-weight: 680; font-size: 1.06rem; letter-spacing: -0.01em; }
.act span { font-size: 0.86rem; opacity: 0.85; }
.act::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 12px;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--gold-soft) var(--ai, none) center / 28px no-repeat;
}
.act[data-id="repair"] { --ai: url("/img/ico/repair.svg"); }
.act[data-id="faixa"] { --ai: url("/img/ico/faixa.svg"); }
.act[data-id="captacio"] { --ai: url("/img/ico/captacio.svg"); }
.act[data-id="dinar"] { --ai: url("/img/ico/dinar.svg"); }
.act[data-id="rest"] { --ai: url("/img/ico/rest.svg"); }
.act[data-id="pinya"] { --ai: url("/img/ico/pinya.svg"); }
.act:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 var(--red-deep); }
.act:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.act:disabled {
  opacity: 1;
  color: #6b5d4c;
  border-color: rgba(34, 23, 15, 0.35);
  box-shadow: none;
  background:
    repeating-linear-gradient(135deg, rgba(34, 23, 15, 0.05) 0 6px, transparent 6px 12px),
    #eee4d2;
}
.act:disabled::before { filter: grayscale(1); opacity: 0.55; border-color: rgba(34, 23, 15, 0.35); }

/* Botons principals amb aire de joc */
button.ready {
  padding: 11px 24px;
  font-size: 1.05rem;
  border-color: var(--red-deep);
  box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--red-deep);
}
button.ready:hover:not(:disabled) { filter: brightness(1.06); }
button.ready:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--gold), 0 2px 0 var(--red-deep); }
button.ready.on { background: var(--ink); color: var(--gold); box-shadow: 0 4px 0 #000; }
button.ready:disabled {
  opacity: 1;
  background: transparent;
  color: var(--soft);
  border: 2px dashed var(--soft);
  box-shadow: none;
}
.primary { box-shadow: 0 3px 0 var(--red-deep); }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-deep); }
.act, .place, .castell button, .primary, .ghost { border-radius: 13px; }

/* Assaig i ronda */
.castell { border-width: 2px; }
.castell.selected { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
.castell header b { font-family: var(--serif); font-weight: 680; font-size: 1.05rem; }
.dom { height: 8px; }
.row-actions button { border-width: 2px; font-weight: 640; box-shadow: 0 2px 0 var(--ink); }
.row-actions button:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
/* Un castell ja afegit a la ronda: el botó de treure'l va en vermell. */
.row-actions button.out {
  background: var(--red); color: #fffaf2; border-color: var(--red-deep);
  box-shadow: 0 2px 0 var(--red-deep);
}
.row-actions button.out:hover:not(:disabled) { background: var(--red-deep); }
.row-actions button.out:active { box-shadow: 0 1px 0 var(--red-deep); }
.place { background: var(--card-solid); box-shadow: 0 3px 0 var(--ink); }
.place strong { font-family: var(--serif); font-weight: 680; }
.place.selected { background: var(--ink); color: var(--card-solid); box-shadow: inset 5px 0 0 var(--gold), 0 3px 0 var(--ink); }
.preview-wrap canvas { background: var(--stone); }

/* Diada */
.hud { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 14px rgba(0, 0, 0, 0.35); }
#hurry { background: var(--card-solid); box-shadow: 0 3px 0 var(--ink); font-weight: 640; }

/* Cartes de joc i icones duotò */
.play-card { background: var(--card-solid); box-shadow: 0 3px 0 rgba(34, 23, 15, 0.25); }
.play-card.bonus { box-shadow: inset 6px 0 0 var(--green), 0 3px 0 rgba(34, 23, 15, 0.25); }
.play-card.malus { box-shadow: inset 6px 0 0 var(--red), 0 3px 0 rgba(34, 23, 15, 0.25); }
.card-ico {
  width: 46px;
  height: 46px;
  padding: 5px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--gold-soft);
}
.play-card.malus .card-ico { background: #f6d9d2; }
svg.duo .d0 { fill: var(--card-solid); }
svg.duo .d1 { fill: var(--red); }
svg.duo .d2 { fill: var(--gold); }
svg.duo .d3 { fill: var(--water); }
.purse-good { background: var(--card-solid); box-shadow: 0 3px 0 var(--ink); }

/* Lobby */
.poster, .wait { background: var(--card-solid); box-shadow: 0 4px 0 var(--ink), 0 18px 40px rgba(34, 23, 15, 0.22); }
.kicker { color: var(--red); }

/* (El cartell d'inici ja no porta imatge: la coberta horitzontal fa aquest paper.) */

/* Mapa de festes */
.map-sheet {
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(242, 182, 50, 0.30), transparent 60%),
    rgba(233, 220, 196, 0.98);
}
.map-box { background: #c9dce6; box-shadow: 0 4px 0 var(--ink); }
.map-land rect { fill: #c9dce6; }
.map-land path { fill: #f3e4c2; stroke-width: 2.5; filter: drop-shadow(0 3px 0 rgba(34, 23, 15, 0.18)); }

/* Dock inferior més compacte */
.home-panels { background: var(--card-solid); }
.home-panels button { background: #fff; font-size: 0.84rem; box-shadow: 0 2px 0 var(--ink); }
.home-panels button.on { background: var(--ink); color: var(--gold); }
@media (min-width: 981px) {
  .home-panels button { flex-direction: row; gap: 8px; padding: 8px 6px; }
  .home-panels button svg { width: 22px; height: 22px; }
}

@media (max-width: 980px) {
  body:has(#stage .hall),
  body:has(#stage .split:not(.ronda)),
  body:has(#stage .ronda),
  body:has(#stage .diada),
  body:has(#stage .resum),
  body:has(#stage .final),
  body:has(#lobby:not(.hidden)) { background-attachment: scroll; }
  .phases span { font-size: 0.86rem; padding: 5px 10px 5px 8px; }
  .phases span::before { width: 15px; height: 15px; }
}
@media (max-width: 640px) {
  .phases span { padding: 5px 8px; }
  .phases span:not(.now) { font-size: 0; gap: 0; }
  .act { padding-left: 56px; }
  .act::before { width: 36px; height: 36px; background-size: 24px; left: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .act, button.ready { transition: none; }
}

/* Moneda de cost a les cartes d'acció */
.act .coin {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fbe39a 0 30%, var(--gold) 31% 100%);
  box-shadow: inset 0 -2px 0 rgba(110, 20, 32, 0.35), 0 2px 0 var(--ink);
  color: var(--ink);
  font: 800 0.92rem/1 var(--sans);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.act:has(.coin) { padding-right: 50px; }
.act:disabled .coin { background: #e0d3bb; color: var(--red-deep); box-shadow: none; border-color: rgba(34, 23, 15, 0.45); }
.act .local-votes {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  gap: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold-soft, #f6e2b0);
  box-shadow: 0 2px 0 var(--ink);
  color: var(--ink);
  font: 800 0.9rem/1 var(--sans);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.act .local-votes svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.act .local-votes b { font-weight: 800; }
.act.act-row:has(.local-votes) { padding-right: 64px; }

/* Escriptori: els apartats ocupen tot l'ample (afegit el 25/10/2026) */
@media (min-width: 981px) {
  #lobby { align-items: stretch; padding: 16px 20px; }
  #lobby > .poster,
  #lobby > .wait,
  #handbook > .handbook-card {
    width: auto;
    align-self: stretch;
    max-width: none;
    padding: 26px clamp(24px, 3vw, 48px);
  }
  #handbook { align-items: stretch; }
  #lobby > .poster > p,
  #lobby > .wait > p,
  #handbook p { max-width: 88ch; }
  #lobby #join-form {
    display: block;
    columns: 2 380px;
    column-gap: 44px;
  }
  #lobby #join-form > * { break-inside: avoid; margin: 0 0 12px; }
  #lobby #join-form .room-actions { column-span: all; }
  #lobby .who { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }

  /* Fulls d'Activitats i Cartes */
  .play-sheet-card { width: 100%; }
  .play-sheet-card .play-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    overflow: visible;
  }
  .play-sheet-card .actions { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .play-sheet-card > p, .play-sheet-card .cards-hint { max-width: 88ch; }

  /* Mapa de festes: mapa a l'esquerra i consulta a la dreta */
  .map-wrap {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    column-gap: 32px;
    align-items: start;
  }
  .map-wrap > h2, .map-wrap > .muted, .map-wrap > .map-head { grid-column: 1 / -1; }
  .map-frame { width: min(560px, calc((100svh - 300px) / 1.25)); min-width: 320px; margin: 0; }
  .map-card { margin-top: 0; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
  .map-card > h3, .map-card > p { grid-column: 1 / -1; }
  .map-wrap:not(:has(.map-card)) { grid-template-columns: minmax(0, 1fr); }
  .map-wrap:not(:has(.map-card)) .map-frame { justify-self: center; }
}

/* Escriptori: els apartats omplen tota l'alçada lliure entre els panells de dalt i de baix (afegit el 25/10/2026) */
@media (min-width: 981px) {
  /* Escenari: la primera franja (activitats) mida natural, la fase omple la resta */
  #stage:not(.bare) { display: flex; flex-direction: column; }
  #stage:not(.bare) > * { flex: 0 0 auto; }
  #stage:not(.bare) > :last-child { flex-grow: 1; }
  #stage:not(.bare) { container-type: size; }
  /* Assaig i ronda: una sola barra, la de l'escenari; la fase omple l'alçada lliure */
  #stage:not(.bare) > .split { flex: 1 0 auto; height: auto; min-height: 0; overflow: visible; }
  #stage .split > div { overflow: visible; }
  #stage .split .catalog { flex: none; overflow: visible; }
  #stage .split > .preview-wrap { position: sticky; top: 12px; max-height: calc(100cqh - 24px); }
  #stage:not(.bare) > .stage-pad { min-height: 0; }

  /* Lobby, sala d'espera i manual: la targeta arriba fins al dock */
  #lobby > .poster,
  #lobby > .wait { flex: 1 0 auto; }
  #handbook::before,
  #handbook::after { content: none; }
  #handbook > .handbook-card { flex: 1 0 auto; }

  /* Fulls d'Activitats, Cartes i mapa */
  .play-sheet:not(.hidden),
  .map-sheet:not(.hidden) { display: flex; flex-direction: column; }
  .play-sheet > .play-sheet-card,
  .map-sheet > .map-wrap { flex: 1 0 auto; align-content: start; }
  .map-frame { width: min(720px, calc((100dvh - var(--league-h) - var(--top-h, 0px) - var(--dock-h) - 130px) / 1.25)); }
}

/* Mòbil i escriptori: el desplaçament deixa sempre l'últim element per sobre del dock (afegit el 25/10/2026) */
html { scroll-padding-top: calc(var(--league-h) + var(--top-h, 0px)); scroll-padding-bottom: calc(var(--dock-h) + 8px); }
.play-sheet, .map-sheet, #lobby, aside, #stage, .catalog { scroll-padding-bottom: 12px; }
@media (max-width: 980px) {
  /* Marge final perquè l'última línia de cada full no quedi enganxada al dock */
  .play-sheet, .map-sheet { padding-bottom: 24px; }
  #lobby { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* Mòbil: les cartes ocupen l'ample disponible i el full es desplaça en vertical (afegit el 25/10/2026) */
@media (max-width: 980px) {
  .play-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 12px;
    overflow: visible;
    padding-bottom: 4px;
  }
  .play-row > .play-card { max-width: none; min-width: 0; }
}

/* Activities: medals, levels and wind */
.free-tier { display: flex; align-items: baseline; gap: .6em; margin: .4em 0; }
.free-tier b { padding: .15em .7em; border-radius: 999px; color: #fff; letter-spacing: .03em; }
.free-tier.tier-bronze b { background: #a0612b; }
.free-tier.tier-plata b { background: #8a929c; }
.free-tier.tier-or b { background: var(--gold, #d4a017); color: #2a1a00; }
.free-level { margin: .2em 0 .4em; }
.free-yard i.gust.lean-l { transform: rotate(-24deg); }
.free-yard i.gust.lean-r { transform: rotate(24deg); }
@keyframes free-wind { from { background-position: 0 0; } to { background-position: 40px 0; } }

/* Minijocs v2: fitxa d'activitats, medalles, gralla i pilar */
.free-play .actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 12px;
}
.free-play .actions .free-pick {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  text-align: left;
  padding: 14px 16px;
  min-height: 92px;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card-solid, #fbf4e6);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.free-play .actions .free-pick:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.free-play .actions .free-pick:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.free-play .actions .free-pick::before { content: none; }
.free-play .actions .free-pick:hover:not(:disabled) { background: var(--card-solid, #fbf4e6); color: var(--ink); }
.free-pick .free-ico {
  grid-row: 1 / span 2;
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--gold-soft, #f6e2b0); color: var(--ink);
  border: 2px solid var(--ink);
}
.free-pick-gralla .free-ico { background: #f3d9b4; }
.free-pick-bar .free-ico { background: #e8eef5; }
.free-pick-pati .free-ico { background: #f6d4cf; }
.free-pick .free-ico svg { width: 40px; height: 40px; }
.free-pick b { font-family: var(--serif); font-size: 1.12rem; line-height: 1.15; }
.free-pick span { font-size: .9rem; color: var(--soft); line-height: 1.3; }
.free-left { margin: 0; font-weight: 600; }

/* Medalles */
.free-tier {
  align-items: center; gap: .75em; margin: .5em 0;
  padding: 10px 14px; border: 2px solid var(--ink); border-radius: 14px;
  background: var(--card-solid, #fbf4e6);
  animation: tier-in .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
.free-medal {
  position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff8 0 18%, transparent 19%), var(--medal, #c98a4b);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.35), 0 3px 0 var(--ink);
}
.free-medal::before {
  content: ""; position: absolute; left: 50%; top: -14px; width: 22px; height: 16px; margin-left: -11px;
  background: linear-gradient(90deg, var(--red) 0 50%, var(--red-deep) 50%);
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
  z-index: -1;
}
.free-medal::after {
  content: "★"; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(34,23,15,.55); font-size: 20px; line-height: 1;
}
.free-tier b { font-family: var(--serif); font-size: 1.05rem; padding: .2em .8em; color: var(--ink); background: var(--medal-soft, #f0d2b3); }
.free-tier span { color: var(--soft); }
.free-tier.tier-bronze { --medal: linear-gradient(135deg, #e0a26a, #9b5a24); --medal-soft: #f0d2b3; }
.free-tier.tier-plata { --medal: linear-gradient(135deg, #f4f6f8, #9aa3ad); --medal-soft: #e4e8ec; }
.free-tier.tier-or { --medal: linear-gradient(135deg, #ffe58a, #d29a12); --medal-soft: #f9e3a2; }
.free-tier.tier-bronze b, .free-tier.tier-plata b, .free-tier.tier-or b { color: var(--ink); }
.free-tier.tier-or .free-medal { animation: tier-shine 2.4s ease-in-out infinite; }
@keyframes tier-in { from { transform: scale(.6) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tier-shine { 0%, 100% { filter: none; } 50% { filter: brightness(1.18) drop-shadow(0 0 6px #ffd76a); } }

/* Escena comuna */
#free-stage { position: relative; border-radius: 16px; }
.free-pop {
  position: absolute; z-index: 3; right: 14px; top: 10px;
  padding: .25em .8em; border: 2px solid var(--ink); border-radius: 999px;
  background: #fffaf2; font-family: var(--serif); font-size: 1rem;
  opacity: 0; transform: translateY(6px) scale(.8); pointer-events: none;
}
.free-pop.good { color: var(--green); }
.free-pop.miss { color: var(--red); }
.free-pop.show { animation: pop-fx .7s ease-out both; }
@keyframes pop-fx {
  0% { opacity: 0; transform: translateY(8px) scale(.7); }
  20% { opacity: 1; transform: translateY(0) scale(1.08); }
  70% { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-12px) scale(.95); }
}
#free-stage.flash-miss { animation: stage-shake .25s ease-in-out; }
@keyframes stage-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Gralla: assaig al local */
.gralla3d-wrap {
  height: 260px; max-width: 560px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 14px; overflow: hidden;
  background: #1d1420;
}
.gralla3d-wrap canvas { display: block; width: 100%; height: 100%; }
.free-scene-gralla {
  position: relative; padding: 10px;
  border: 2px solid var(--ink); border-radius: 16px;
  background: #1d1420;
}
.gralla3d-fail {
  position: absolute; inset: 0; display: grid; place-items: center;
  margin: 0; padding: 18px; text-align: center;
  color: #ffe8b0; font-weight: 700;
}
.gralla3d-fail[hidden] { display: none; }
.gralla-lane {
  flex: 1 1 0; min-height: 62px;
  border: 2px solid var(--ink); border-radius: 14px;
  font-weight: 800; font-size: 1.1rem; color: #22170f;
  touch-action: none; user-select: none; -webkit-user-select: none;
  background: linear-gradient(180deg, #fffaf2, #efe0c8);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 6px 0 #8a5a2b,
    0 10px 16px rgba(36, 25, 16, 0.35);
  transform: translateY(0) perspective(240px) rotateX(9deg);
  transition: transform .05s ease, box-shadow .05s ease, filter .12s ease;
}
.gralla-lane.lane-0 { background: linear-gradient(180deg, #ffe9e4, #ffc4bb); }
.gralla-lane.lane-1 { background: linear-gradient(180deg, #fff6d6, #ffe08f); }
.gralla-lane.lane-2 { background: linear-gradient(180deg, #e7f0ff, #c3d9ff); }
.gralla-lane:active, .gralla-lane.pressed {
  transform: translateY(5px) perspective(240px) rotateX(9deg);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 #8a5a2b,
    0 3px 8px rgba(36, 25, 16, 0.35);
}
.gralla-lane.hit {
  filter: brightness(1.4) saturate(1.35);
  box-shadow:
    inset 0 3px 0 #fff,
    0 6px 0 #2f7a55,
    0 0 24px rgba(110, 224, 138, 0.9),
    0 10px 16px rgba(36, 25, 16, 0.3);
}
.gralla-progress {
  height: 10px; max-width: 560px; margin: 9px auto 0;
  border: 2px solid var(--ink); border-radius: 999px;
  background: #2a1a12; overflow: hidden;
}
.gralla-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #ffd76a, #e0a21f);
  box-shadow: 0 0 10px rgba(255, 215, 106, 0.8);
  transition: width .12s linear;
}
.free-actions.gralla-actions { flex-wrap: nowrap; gap: 8px; }
.act-panel .free-actions.gralla-actions > .gralla-lane {
  flex: 1 1 0; min-width: 0; max-width: none; padding: 0 4px;
}
.free-scene-bossa {
  position: relative; padding: 70px 18px 26px; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 50% 100%, rgba(242,182,50,.45), transparent 70%),
    linear-gradient(180deg, rgba(31,22,14,.55), rgba(31,22,14,.15)),
    url("img/fons-local.webp") center / cover, #5a3a22;
}
.free-scene-bossa { background: linear-gradient(180deg, #3b2a1c, #6b4a2c); }
.free-scene-bossa .free-track {
  height: 14px; border: 2px solid #22170f; border-radius: 999px;
  background: linear-gradient(180deg, #8a5a30, #5b3518);
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
}
.free-scene-bossa .free-note {
  top: -30px; width: 20px; height: 20px; margin: 0 0 0 -10px;
  border: 2px solid #22170f; background: var(--gold); transition: transform .08s ease, background .15s ease;
}
.free-scene-bossa .free-note::after {
  content: ""; position: absolute; left: 50%; top: 18px; width: 2px; height: 16px; margin-left: -1px; background: #22170f;
}
.free-scene-bossa .free-note.hot {
  background: #fff3c4; transform: scale(1.35); box-shadow: 0 0 0 4px rgba(242,182,50,.55), 0 0 18px #ffd76a;
}
.free-scene-bossa .free-note.done { background: var(--green); transform: scale(1.1); }
.free-scene-bossa .free-head {
  top: -8px; bottom: auto; width: 34px; height: 26px; margin-left: -17px;
  border: 2px solid #22170f; border-radius: 999px;
  background: linear-gradient(180deg, #ffd76a, #e0a21f);
  box-shadow: 0 3px 0 #22170f;
}
.free-actions .free-big {
  width: 92px; height: 92px; min-height: 92px; border-radius: 50%; padding: 0; margin: 4px auto 0;
  border: 3px solid var(--ink); background: radial-gradient(circle at 40% 35%, #e0464f, var(--red) 55%, var(--red-deep));
  display: grid; place-items: center; text-align: center;
  color: #fff; font-weight: 700; font-size: 1rem; box-shadow: 0 6px 0 var(--ink);
  transition: transform .06s ease, box-shadow .06s ease;
}
.free-actions .free-big:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.free-actions:has(.free-big) { justify-content: center; }

/* Pilar al pati */
.free-yard {
  position: relative; height: 300px; padding-bottom: 34px; overflow: hidden;
  border: 2px solid var(--ink); border-radius: 16px;
  background:
    radial-gradient(circle at 20% 22%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 72% 14%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 86% 36%, #fff 0 1px, transparent 2px),
    linear-gradient(180deg, transparent 0 calc(100% - 46px), #8a6a48 calc(100% - 46px)),
    linear-gradient(180deg, #1f2a44, #3c4a72 70%, #e9876b);
}
.free-yard::before {
  content: ""; position: absolute; left: -5%; right: -5%; top: 30px; height: 30px;
  background: radial-gradient(circle, #ffd76a 0 3px, transparent 4px) 0 0 / 34px 30px repeat-x;
  border-top: 1px solid rgba(255,255,255,.25); border-radius: 50%;
  opacity: .9; pointer-events: none;
}
.free-yard i#free-pillar {
  position: relative; z-index: 1; width: 34px; height: auto; padding: 0; border: 0; border-radius: 0; background: none;
  display: flex; flex-direction: column-reverse; align-items: center;
  transform-origin: 50% 100%; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1);
}
.free-yard .pp {
  position: relative; display: block; width: 26px; height: 28px; margin-top: 13px;
  border: 2px solid var(--ink); border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--red) 0 58%, #22170f 58% 68%, #fffaf2 68%);
}
.free-yard .pp::before {
  content: ""; position: absolute; left: 50%; top: -14px; width: 14px; height: 14px; margin-left: -7px;
  border: 2px solid var(--ink); border-radius: 50%; background: #f1c9a0;
  box-shadow: inset 0 4px 0 #4a2e1c;
}
.free-yard .pp.top::after {
  content: ""; position: absolute; left: -9px; top: -18px; width: 4px; height: 16px;
  background: var(--ink); border-radius: 3px; transform: rotate(-20deg);
}
.free-yard i#free-pillar.lean-l { transform: rotate(-12deg); }
.free-yard i#free-pillar.lean-r { transform: rotate(12deg); }
.free-yard i#free-pillar.gust.lean-l { transform: rotate(-20deg); }
.free-yard i#free-pillar.gust.lean-r { transform: rotate(20deg); }
.free-base {
  position: absolute; z-index: 2; left: 50%; bottom: 14px; width: 120px; height: 30px; margin-left: -60px;
  background:
    radial-gradient(circle at 10% 30%, #f1c9a0 0 6px, transparent 7px),
    radial-gradient(circle at 30% 20%, #f1c9a0 0 6px, transparent 7px),
    radial-gradient(circle at 70% 20%, #f1c9a0 0 6px, transparent 7px),
    radial-gradient(circle at 90% 30%, #f1c9a0 0 6px, transparent 7px),
    linear-gradient(180deg, transparent 0 40%, var(--red) 40%);
  border-radius: 14px 14px 6px 6px;
}
.free-yard.windy { animation: none; }
.free-yard.windy::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(ellipse 46px 1.6px at 50% 50%, rgba(255,255,255,.75), transparent) 0 0 / 220px 54px repeat,
    radial-gradient(ellipse 30px 1.2px at 30% 70%, rgba(255,255,255,.5), transparent) 0 0 / 160px 38px repeat;
  animation: free-gust .5s linear infinite;
}
@keyframes free-gust { from { background-position: -220px 0, -160px 0; } to { background-position: 0 0, 0 0; } }
.free-actions .free-side {
  flex: 1 1 140px; min-height: 58px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--ink); border-radius: 14px;
  background: linear-gradient(180deg, #fffaf2, #efe0c8);
  color: #2a1a12;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 6px 0 #8a5a2b,
    0 10px 16px rgba(36, 25, 16, 0.3);
  transform: translateY(0) perspective(240px) rotateX(9deg);
  transition: transform .06s ease, box-shadow .06s ease;
}
.free-actions .free-side svg { width: 24px; height: 24px; flex: none; }
.free-actions .free-side span { font-size: 1rem; }
.free-actions .free-side:active {
  transform: translateY(5px) perspective(240px) rotateX(9deg);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 #8a5a2b,
    0 3px 8px rgba(36, 25, 16, 0.3);
}
#free-stage.flash-good .free-yard { box-shadow: inset 0 0 0 4px rgba(46,107,74,.7); }

@media (prefers-reduced-motion: reduce) {
  .free-tier, .free-tier.tier-or .free-medal, .free-yard.windy::after, .free-pop.show, #free-stage.flash-miss { animation: none; }
  .free-pop.show { opacity: 1; transform: none; }
}

/* ===== Mapa de festes v2: Catalunya reconeixible i segell de festa feta (afegit el 25/10/2026) ===== */
.map-box { background: #bfd5e6; }
.map-land { overflow: hidden; }
.map-land .ml-sea { fill: #bfd5e6; }
.map-land .ml-waves { fill: none; stroke: #7fa7cf; stroke-width: 1.4; stroke-linecap: round; opacity: 0.85; filter: none; }
.map-land .ml-coast path { fill: none; stroke: #e4eef5; stroke-width: 7; stroke-linejoin: round; filter: none; }
.map-land .ml-neigh { fill: #e8dcc2; stroke: rgba(34, 23, 15, 0.38); stroke-width: 1; stroke-linejoin: round; filter: none; }
.map-land .ml-shadow { fill: #22170f; opacity: 0.16; stroke: none; filter: none; }
.map-land .ml-cat { fill: #f6e6c0; stroke: var(--ink, #22170f); stroke-width: 2; stroke-linejoin: round; filter: none; }
.map-land .ml-delta { fill: #cfdcae; stroke: none; filter: none; }
.map-land .ml-peaks { fill: #e6d2a6; stroke: rgba(34, 23, 15, 0.7); stroke-width: 1; stroke-linejoin: round; filter: none; }
.map-land .ml-snow { fill: #fffaf2; stroke: none; filter: none; }
.map-land .ml-rivers path { fill: none; stroke: #7fa7cf; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: none; }
.map-land .ml-rivers .ml-ebre { stroke-width: 2.8; }
.map-land text { font-family: var(--serif); fill: var(--ink, #22170f); text-anchor: middle; }
.map-land .ml-region { font-size: 8px; font-weight: 600; letter-spacing: 2px; opacity: 0.45; }
.map-land .ml-region.ml-small { font-size: 5.5px; letter-spacing: 1px; text-anchor: start; }
.map-land .ml-sea-label { font-size: 9px; font-style: italic; fill: #3f6688; }
.map-land .ml-river-label { font-size: 7px; font-style: italic; fill: #3f6688; }
.map-land .ml-compass text { font-family: var(--sans); font-size: 7px; font-weight: 700; }
.map-land .ml-compass path, .map-land .ml-compass circle { stroke-width: 1.2; filter: none; }

/* Segell de festa feta */
.map-pin.past .map-dot { background: rgba(251, 244, 230, 0.92); border-color: rgba(34, 23, 15, 0.55); box-shadow: none; }
.map-pin.past .map-dot svg.map-stamp {
  width: 48px; height: 48px;
  margin: -7px;
  transform: rotate(-14deg);
  overflow: visible;
  mix-blend-mode: multiply;
}
.map-stamp .map-stamp-ink { fill: var(--red, #b4232c); stroke: var(--red, #b4232c); opacity: 0.9; }
.map-stamp .ms-ring, .map-stamp .ms-dots { stroke: none; }
.map-stamp .ms-check { fill: none; }
.map-stamp .ms-wear { stroke: #fbf4e6; opacity: 0.9; }
.map-pin.past:hover .map-stamp, .map-pin.past.on .map-stamp { filter: drop-shadow(0 0 2px rgba(242, 182, 50, 0.9)); }
.map-pin.past.stamp-in .map-stamp {
  animation: map-stamp-thump 520ms cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
.map-pin.past.stamp-in .map-dot { animation: map-stamp-hit 520ms ease-out both; }
.map-pin.past.stamp-in:nth-of-type(2) .map-stamp, .map-pin.past.stamp-in:nth-of-type(2) .map-dot { animation-delay: 140ms; }
.map-pin.past.stamp-in:nth-of-type(3) .map-stamp, .map-pin.past.stamp-in:nth-of-type(3) .map-dot { animation-delay: 280ms; }
.map-pin.past.stamp-in:nth-of-type(4) .map-stamp, .map-pin.past.stamp-in:nth-of-type(4) .map-dot { animation-delay: 420ms; }
.map-pin.past.stamp-in:nth-of-type(5) .map-stamp, .map-pin.past.stamp-in:nth-of-type(5) .map-dot { animation-delay: 560ms; }
@keyframes map-stamp-thump {
  0% { opacity: 0; transform: rotate(-24deg) scale(1.6); }
  55% { opacity: 1; transform: rotate(-12deg) scale(0.92); }
  78% { transform: rotate(-15deg) scale(1.04); }
  100% { opacity: 1; transform: rotate(-14deg) scale(1); }
}
@keyframes map-stamp-hit {
  0%, 50% { transform: scale(1); }
  62% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .map-pin.past.stamp-in .map-stamp, .map-pin.past.stamp-in .map-dot { animation: none; }
}
.map-land .ml-hatch { fill: url(#ml-hatch); stroke: none; filter: none; }
.map-land .ml-neigh { fill: #e2d4b6; }

/* ===== Mapa de festes v3: relleu realista, rius reals i boscos (afegit el 25/10/2026) ===== */
.map-land path { fill: none; stroke: none; filter: none; }
.map-land .ml-cat-fill { fill: #f6e6c0; }
.map-land .ml-cat-line { fill: none; stroke: var(--ink, #22170f); stroke-width: 2; stroke-linejoin: round; }
.map-land .ml-shadow { fill: #22170f; opacity: 0.16; }
.map-land .ml-band0 { fill: #efdcb0; }
.map-land .ml-band1 { fill: #e7cf9d; }
.map-land .ml-band2 { fill: #dcc08c; }
.map-land .ml-band3 { fill: #e9e2d2; }
.map-land .ml-hill { fill: #5a3f22; }
.map-land .ml-hill0 { opacity: 0.10; }
.map-land .ml-hill1 { opacity: 0.12; }
.map-land .ml-hill-light { fill: #fffaf0; opacity: 0.35; }
.map-land .ml-riv { fill: none; stroke: #5f93c4; stroke-linecap: round; stroke-linejoin: round; }
.map-land .ml-pk-lit { fill: #f1e3c2; }
.map-land .ml-pk-shd { fill: #b99a6b; }
.map-land .ml-pk-snow { fill: #fffdf8; }
.map-land .ml-pk-ridge { fill: none; stroke: rgba(34, 23, 15, 0.45); stroke-width: 0.6; stroke-linecap: round; }
.map-land .ml-pk-line { fill: none; stroke: var(--ink, #22170f); stroke-width: 1; stroke-linejoin: round; }
.map-land .ml-cmp-a { fill: #fbf4e6; stroke: #22170f; stroke-width: 1.2; }
.map-land .ml-cmp-b { fill: var(--red, #b4232c); }
.map-land .ml-river-label { font-size: 7px; }

/* Accions del dia al local: una per línia, efectes amb icones, un sol ús (26/10/2026) */
.actions.local-actions,
.play-sheet-card .actions.local-actions { grid-template-columns: 1fr; gap: 10px; }
.act.act-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  column-gap: 8px;
  row-gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 12px 12px 10px 66px;
}
.act.act-row::before { top: 50%; transform: translateY(-50%); }
.act.act-row:has(.coin) { padding-right: 52px; }
.act.act-row b { grid-column: 1; margin: 0; }
.act.act-row .act-d { grid-column: 1 / -1; margin: 0; }
.act.act-row .coin { top: 50%; transform: translateY(-50%); }
.act .act-fx {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  opacity: 1 !important;
}
.act-fx .fx {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px 2px 3px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fffaf2;
  color: var(--ink);
  font-style: normal;
  line-height: 1;
}
.act-fx .fx svg { width: 20px; height: 20px; display: block; }
.act-fx .fx em {
  font: 800 0.84rem/1 var(--sans);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.act-fx .fx-good em { color: var(--green); }
.act-fx .fx-bad em { color: var(--red-deep); }
.act-fx .fx-same { padding: 3px 8px; font-size: 0.8rem; font-weight: 600; }
.act.act-row:hover:not(:disabled) .act-fx .fx { background: var(--paper); }
.act-done {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--green);
  color: #fffaf2;
  font: 700 0.74rem/1.3 var(--sans);
  font-style: normal;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.act.used,
.act.used:disabled { cursor: default; }
.act.used b { text-decoration: line-through; text-decoration-thickness: 2px; }
.act.used::before { filter: grayscale(1); opacity: 0.45; }
.act.used .act-fx { filter: grayscale(1); opacity: 0.6 !important; }
.act.pending { pointer-events: none; }
@media (max-width: 640px) {
  .act.act-row { padding-left: 58px; }
  .act-fx .fx svg { width: 18px; height: 18px; }
}

/* Botó d'Activitats amb una activitat pendent */
.home-panels button.due { position: relative; }
.home-panels button.due::after {
  content: "";
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

/* Icones de valors al quadre de la colla: llegenda de les fitxes d'efectes (26/10/2026) */
.stats li { grid-template-columns: minmax(104px, max-content) 1fr 34px; }
.stats .stat-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.stats .stat-name > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.stat-ico { display: inline-flex; flex: none; width: 20px; height: 20px; }
.stat-ico svg { width: 100%; height: 100%; display: block; }
.act-fx .fx .stat-ico { width: 20px; height: 20px; }
@media (max-width: 640px) {
  .stats li { grid-template-columns: minmax(98px, max-content) 1fr 32px; }
  .stat-ico, .act-fx .fx .stat-ico { width: 18px; height: 18px; }
}

/* Plaça del diumenge: es tria dilluns al mapa (26/10/2026) */
.place-call {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-left-width: 6px;
  border-left-color: var(--red);
  border-radius: 13px;
  background: var(--card-solid);
}
.place-call.done { border-left-color: var(--green); }
.place-call p { margin: 0; flex: 1 1 14rem; }
.place-call button { flex: none; }
.extra-call { position: relative; padding-right: 44px; }
.call-close {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card-solid); color: var(--ink);
  font-size: 0.85rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.call-close:hover { background: var(--ink); color: var(--card-solid); }
.call-close:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.map-places { gap: 10px; }
.place-card {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card-solid);
  box-shadow: 0 3px 0 var(--ink);
  overflow: hidden;
}
.place-card.chosen { box-shadow: inset 5px 0 0 var(--gold), 0 3px 0 var(--ink); }
.place-card header,
.place-card .place-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.place-card .place-head { cursor: pointer; }
.place-card .place-head:hover { background: rgba(224, 176, 58, 0.18); }
.place-card strong { grid-column: 1; font-family: var(--serif); font-weight: 680; font-size: 1.04rem; }
.place-card header > span,
.place-card .place-head > span { grid-column: 1; font-size: 0.84rem; color: var(--soft); }
.place-badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--green);
  color: #fffaf2;
  font: 700 0.74rem/1.4 var(--sans);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.place-card.open { padding-bottom: 12px; }
.place-card.open > p,
.place-card .place-facts,
.place-card .place-going,
.place-card.open > .primary { margin: 0 12px 8px; }
.place-card.open > p { font-size: 0.9rem; }
.place-facts {
  display: grid;
  grid-template-columns: minmax(7.5rem, max-content) 1fr;
  gap: 4px 10px;
  padding: 8px 0 0;
  border-top: 1.5px dashed rgba(34, 23, 15, 0.3);
  font-size: 0.86rem;
}
.place-facts dt { font-weight: 700; }
.place-facts dd { margin: 0; }
.place-going { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 0.84rem; }
.place-going span { margin-right: 6px; }
.place-card.open > .primary { display: block; width: calc(100% - 24px); text-align: center; }
.place-card.open > .primary:disabled { background: var(--ink); color: var(--gold); border-color: var(--ink); opacity: 1; }
.map-leave { margin-top: 10px; padding-top: 10px; border-top: 1.5px solid var(--line); }
.map-leave .leave { width: 100%; }
.map-place-ring {
  position: absolute;
  z-index: 1;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid var(--red);
  border-radius: 50%;
  background: rgba(194, 59, 46, 0.12);
  pointer-events: none;
  animation: map-ring 1.8s ease-in-out infinite;
}
@keyframes map-ring { 50% { transform: scale(1.18); opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) { .map-place-ring { animation: none; } }
.ronda .places .place-card { margin-bottom: 8px; }
@media (max-width: 640px) {
  .place-facts { grid-template-columns: 1fr; gap: 0 0; }
  .place-facts dd { margin-bottom: 6px; }
}

/* Plaça obligatòria: local tancat, places fetes i places amb candau (26/10/2026) */
.place-call.gate {
  border-left-color: var(--red);
  background: #fff3dc;
  box-shadow: 0 3px 0 var(--ink);
}
.place-call.gate .place-ico { width: 30px; height: 30px; color: var(--red-deep); }
.place-call.gate .primary { font-size: 1rem; }
.place-ico { display: inline-flex; flex: none; width: 22px; height: 22px; }
.place-ico svg { width: 100%; height: 100%; display: block; }
.place-card header .place-ico { grid-row: 1 / span 2; grid-column: 1; margin-right: 2px; }
.place-card.done header,
.place-card.locked header { grid-template-columns: auto 1fr auto; }
.place-card.done header strong,
.place-card.done header > span,
.place-card.locked header strong,
.place-card.locked header > span { grid-column: 2; }
.place-card.done header .place-badge,
.place-card.locked header .place-badge { grid-column: 3; }
.place-card.done {
  box-shadow: none;
  border-color: rgba(34, 23, 15, 0.45);
  background: #e7f4ec;
}
.place-card.done .place-ico { color: var(--green); }
.place-card.locked {
  box-shadow: none;
  border-color: rgba(34, 23, 15, 0.4);
  color: #6b5d4c;
  background:
    repeating-linear-gradient(135deg, rgba(34, 23, 15, 0.05) 0 6px, transparent 6px 12px),
    #eee4d2;
}
.place-card.locked .place-ico { color: var(--ink); }
.place-badge.done { background: var(--green); }
.place-badge.locked { background: var(--soft); }
@media (max-width: 640px) {
  .place-card.done header,
  .place-card.locked header { column-gap: 6px; }
  .place-badge { font-size: 0.68rem; padding: 2px 7px; }
}

/* Pins del mapa com a places del diumenge: sense marca ni candau fins a triar (26/10/2026) */
.map-pin.place-pin.open .map-dot { background: #fffaf2; }
.map-pin.place-pin.open.on .map-copy { outline: 3px solid var(--red); outline-offset: 1px; }
.map-pin.place-pin.chosen .map-dot { background: var(--gold); }
.map-pin.place-pin.chosen .map-copy { outline: 3px solid var(--gold); outline-offset: 1px; }
.map-pin.place-pin.done .map-dot { background: #e7f4ec; }
.map-pin.place-pin.locked .map-copy { background: rgba(255, 250, 242, 0.78); }
.map-pin.place-pin.concurs { opacity: 0.85; }
span.map-pin { cursor: default; }

/* Passar el plat v2: a plaça at dusk, the crowd on the balconies throws coins,
   a copper plate catches them in three lanes. */
.plat-scene { position: relative; max-width: 340px; margin: 0 auto; }
.plat-scene .free-pop { top: auto; bottom: 64px; z-index: 6; }
.plat3d-wrap {
  position: relative; width: 100%; max-width: 340px; height: 270px; margin: 0 auto;
  border: 3px solid var(--ink); border-radius: 14px; overflow: hidden;
  background: #e9cfa4; box-shadow: inset 0 -10px 24px rgba(60, 30, 10, .18);
}
.plat3d-wrap canvas { display: block; width: 100%; height: 100%; }
.plat-scene.has3d .plat-field { display: none; }
.plat-field {
  position: relative; height: 270px; max-width: 340px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 3px solid var(--ink); border-radius: 14px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(60, 38, 20, .10) 22px 24px) bottom / 100% 46px no-repeat,
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(60, 38, 20, .12) 14px 16px) bottom / 100% 46px no-repeat,
    linear-gradient(180deg, #ecca9e 0%, #e2b47e 45%, #c99560 100%);
  box-shadow: inset 0 -10px 24px rgba(60, 30, 10, .25);
}
.plat-lane { position: relative; z-index: 1; border-right: 2px dashed rgba(255, 246, 228, .35); }
.plat-lane:nth-child(3) { border-right: 0; }

/* Facade with three balconies and the crowd leaning over the railings. */
.plat-facade {
  position: absolute; left: 0; right: 0; top: 0; height: 74px; z-index: 2;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  background: linear-gradient(180deg, #c98b55, #b8763f);
  border-bottom: 3px solid var(--ink);
}
.plat-facade b {
  position: relative; margin: 10px 18% 0; border: 3px solid var(--ink); border-bottom: 0;
  border-radius: 40px 40px 0 0; background: linear-gradient(180deg, #3b2a1c, #5b3f27);
}
.plat-facade b::after {
  content: ""; position: absolute; left: -12px; right: -12px; bottom: 0; height: 16px;
  border: 3px solid var(--ink); border-radius: 3px;
  background: repeating-linear-gradient(90deg, #2a1c12 0 3px, transparent 3px 9px), #d9a86e;
}
.plat-crowd { position: absolute; left: 0; right: 0; top: 18px; height: 50px; z-index: 3; pointer-events: none; }
.plat-fan {
  position: absolute; top: 8px; width: 22px; height: 22px; margin-left: -11px;
  border: 3px solid var(--ink); border-radius: 50%; background: #f1c9a0;
  transform-origin: 50% 100%;
}
.plat-fan::after { /* shirt, the colla colour */
  content: ""; position: absolute; left: -7px; top: 16px; width: 30px; height: 16px;
  border: 3px solid var(--ink); border-radius: 12px 12px 0 0; background: var(--red, #c0392b);
}
.plat-fan.f0 { left: 16.667%; }
.plat-fan.f1 { left: 33.333%; top: 14px; background: #d9a77a; }
.plat-fan.f2 { left: 50%; }
.plat-fan.f3 { left: 66.667%; top: 14px; background: #e8b98c; }
.plat-fan.f4 { left: 83.333%; }
.plat-fan.f1::after, .plat-fan.f3::after { background: #2f6f4e; }
.plat-fan.throw { animation: plat-throw .35s ease-out; }
@keyframes plat-throw { 0% { transform: translateY(0); } 40% { transform: translateY(-7px) rotate(-6deg); } 100% { transform: none; } }

/* Catch band at the bottom: where the plate meets the coins. */
.plat-zone {
  position: absolute; left: 0; right: 0; bottom: 6px; height: 34px; z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(255, 233, 160, .35));
  border-top: 2px dashed rgba(255, 246, 228, .6);
}
.plat-field.combo .plat-zone { background: linear-gradient(180deg, transparent, rgba(255, 210, 70, .6)); animation: plat-glow .6s ease-in-out infinite alternate; }
@keyframes plat-glow { to { filter: brightness(1.25); } }

/* Coins and stones. The outer node moves, the inner <b> spins.
   Coins are flat discs: a raised rim, a sunken field and the value stamped in the middle,
   with a darker edge that shows as they turn. */
.plat-item {
  position: absolute; top: 0; z-index: 4; width: 32px; height: 32px; margin-left: -16px; margin-top: -16px;
  opacity: 0; transition: transform .15s, opacity .2s;
}
.plat-item > b {
  position: relative; display: grid; place-items: center;
  width: 100%; height: 100%; border: 2px solid var(--ink); border-radius: 50%;
  box-sizing: border-box; animation: plat-spin 1s linear infinite;
  font: 900 15px/1 var(--serif, Georgia, serif); font-style: normal;
}
.plat-item > b::before { /* sunken field inside the rim */
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 1.5px dashed rgba(40, 20, 8, .35);
}
@keyframes plat-spin {
  0%, 100% { transform: scaleX(1); box-shadow: 0 2px 0 var(--edge, #6b3512); }
  25% { transform: scaleX(.55); box-shadow: 3px 1px 0 var(--edge, #6b3512); }
  50% { transform: scaleX(.12); box-shadow: 4px 0 0 var(--edge, #6b3512); }
  75% { transform: scaleX(.55); box-shadow: -3px 1px 0 var(--edge, #6b3512); }
}
.plat-c > b { --edge: #7a3d14; color: #6b3512;
  background: linear-gradient(135deg, #f0a46a 0%, #d0803f 45%, #a85a24 100%);
  box-shadow: 0 2px 0 var(--edge); }
.plat-c > b::after { content: "1"; position: relative; text-shadow: 0 1px 0 #f6c08f; }
.plat-s > b { --edge: #6f7880; color: #59626b;
  background: linear-gradient(135deg, #ffffff 0%, #d4dae0 45%, #a2abb4 100%); }
.plat-s > b::after { content: "2"; position: relative; text-shadow: 0 1px 0 #fff; }
.plat-g { width: 36px; height: 36px; margin-left: -18px; margin-top: -18px; }
.plat-g > b { --edge: #8a5c08; color: #7a4f05; font-size: 17px;
  background: linear-gradient(135deg, #fff1a8 0%, #f0c33c 45%, #c28a12 100%);
  filter: drop-shadow(0 0 6px rgba(255, 196, 40, .85)); animation-duration: .6s; }
.plat-g > b::after { content: "5"; position: relative; text-shadow: 0 1px 0 #fff4c2; }
.plat-g::before { /* falling trail for the fast gold coin */
  content: ""; position: absolute; left: 50%; bottom: 60%; width: 8px; height: 40px; margin-left: -4px;
  background: linear-gradient(0deg, rgba(255, 210, 70, .7), transparent); border-radius: 4px;
}
.plat-r > b {
  border-radius: 42% 58% 46% 54% / 55% 45% 55% 45%;
  background: radial-gradient(circle at 35% 30%, #a39e97, #6d6a66 60%, #45423e); animation: plat-tumble 1s linear infinite;
}
.plat-r > b::before { display: none; }
@keyframes plat-tumble { to { transform: rotate(360deg); } }
.plat-item.caught { transform: translateY(14px) scale(.35); opacity: 0 !important; }
.plat-item.missed { transform: translateY(18px) scale(1.15); filter: grayscale(.6); }
.plat-r.caught { transform: translateY(10px) scale(1.2); opacity: 1 !important; }

/* The plate: a hammered copper dish with the coins piling up inside. */
.plat-plate {
  position: absolute; bottom: 10px; z-index: 5; width: 84px; height: 20px; margin-left: -42px;
  border: 3px solid var(--ink); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #f6c89a, #c7743a 60%, #8d4a1e);
  box-shadow: 0 5px 0 rgba(40, 20, 8, .35);
  transition: left .09s ease-out;
}
.plat-plate.tilt-l { animation: plat-tilt-l .2s ease-out; }
.plat-plate.tilt-r { animation: plat-tilt-r .2s ease-out; }
@keyframes plat-tilt-l { 40% { transform: rotate(-9deg); } }
@keyframes plat-tilt-r { 40% { transform: rotate(9deg); } }
.plat-plate.clink { animation: plat-clink .22s ease-out; }
@keyframes plat-clink { 40% { transform: translateY(3px) scaleX(1.06); } }
.plat-pile {
  position: absolute; left: 12px; right: 12px; bottom: 9px; height: 18px;
  display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; gap: 0 1px;
}
.pc { width: 13px; height: 6px; border: 2px solid var(--ink); border-radius: 50%; margin-top: -3px; box-shadow: 0 2px 0 rgba(40, 20, 8, .5); }
.pc-c { background: #c7743a; }
.pc-s { background: #d9dde2; }
.pc-g { background: var(--gold, #d6a01e); }
.plat-field.hit-stone { animation: stage-shake .25s ease-in-out; }
.plat-field.hit-stone .plat-plate { filter: brightness(.7); }

.plat-score { text-align: center; font-weight: 700; }
.plat-move {
  min-width: 104px; font-size: 1.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 14px;
  background: linear-gradient(180deg, #fffaf2, #efe0c8);
  color: #2a1a12;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 6px 0 #8a5a2b,
    0 10px 16px rgba(36, 25, 16, 0.3);
  transform: translateY(0) perspective(240px) rotateX(9deg);
  transition: transform .06s ease, box-shadow .06s ease;
}
.plat-move svg { width: 28px; height: 28px; display: block; }
.plat-move:active {
  transform: translateY(5px) perspective(240px) rotateX(9deg);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 #8a5a2b,
    0 3px 8px rgba(36, 25, 16, 0.3);
}
@media (max-width: 420px) {
  .plat-field { height: 250px; }
  .plat-move { min-width: 42%; min-height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .plat-plate, .plat-item { transition: none; }
  .plat-item > b, .plat-fan.throw, .plat-plate.tilt-l, .plat-plate.tilt-r, .plat-plate.clink, .plat-field.combo .plat-zone { animation: none; }
}

/* Etiqueta de la setmana: la plaça triada; si encara no n'hi ha, crida a triar-la (afegit el 26/10/2026) */
.league-bar button.league-festa.pending {
  appearance: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 640;
  color: var(--gold);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Plaça triada de cada colla al panell Temporada (afegit el 26/10/2026) */
.rank small.rank-place { display: flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; }
.rank small.rank-place svg { width: 13px; height: 13px; flex: 0 0 13px; }
.rank small.rank-place.none { color: var(--soft); font-weight: 400; font-style: italic; }

/* Llistat de lligues: cada lliga ocupa tot l'ample disponible, una per fila (afegit el 26/10/2026).
   A escriptori el formulari va a dues columnes; la llista les travessa totes dues. */
#room-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
#lobby #join-form > #room-list { column-span: all; }
#room-list > .room-row { width: 100%; box-sizing: border-box; }

/* Notificacions Web Push a la pantalla inicial (afegit el 26/10/2026) */
.push-box:empty { display: none; }
.push-box { margin: 10px 0 0; display: grid; gap: 6px; justify-items: start; }
.push-box p { margin: 0; }
.push-state { font-weight: 650; }
.push-state.denied { color: var(--soft); }
.push-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Administració: enviar notificacions (afegit el 26/10/2026) */
.admin-push-field { display: grid; gap: 4px; margin: 10px 0 0; }
.admin-push-field textarea { font: inherit; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; resize: vertical; }
.admin-push-users { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.admin-push-user { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; cursor: pointer; }
.admin-push-user.on { outline: 3px solid var(--gold); outline-offset: 1px; }
.admin-push-user span { display: grid; min-width: 0; }
.admin-push-user small { color: var(--soft); overflow-wrap: anywhere; }
.notice.show.ok { background: #e3f1e4; border-color: #2f6b45; color: #1f4a2f; }

/* Phones: fields at 16px or more so iPhone Safari does not zoom on focus. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* Plaça feta: botó per veure els resultats d'aquella setmana. */
.place-card.done .place-results { display: block; margin: 0 12px 10px auto; padding: 4px 12px; font-size: 0.84rem; }

/* Temporada: notificació a una altra colla (una per colla i dia). */
.rank .rank-nudge { display: inline-block; margin-top: 4px; padding: 2px 8px; min-height: 0; font-size: 0.8rem; line-height: 1.4; }
.rank .rank-nudge.sent { opacity: 0.7; cursor: default; }
#rank .nudge-left { margin: -4px 0 8px; font-size: 0.85rem; }
.rank .nudge-form { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; margin: 0; }
.rank .nudge-form input { flex: 1; min-width: 0; padding: 6px 10px; }
.rank .nudge-form .primary { padding: 6px 12px; }
.rank .nudge-form .ghost { padding: 6px 10px; }

/* La meva colla: nom, colla i camisa (només es poden editar fora de lliga). */
.colla-id { display: grid; gap: 10px; }
.colla-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; align-items: center; }
.colla-facts dt { font-weight: 700; font-size: 0.9rem; }
.colla-facts dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.colla-lock { margin: 0; font-size: 0.86rem; }

/* Escut de la colla (La meva colla) */
svg.escut { display: block; flex: none; }
.escut-box { border: 2px solid var(--ink); border-radius: 14px; background: var(--card-solid, #fffaf2); padding: 12px; }
.escut-panel .escut-box { width: min(680px, 100%); margin: 0 auto; }
.castellers-panel .castellers-box,
.account-panel .castellers-box,
.rooms-panel .rooms-in { width: min(760px, 100%); margin: 0 auto; }
.escut-view { display: flex; align-items: center; gap: 14px; }
.escut-view > div { display: grid; gap: 4px; min-width: 0; }
.escut-view small { display: block; font-size: 0.84rem; }
.escut-view .room-actions { margin-top: 4px; }
.escut-editor { display: grid; gap: 12px; }
.escut-preview { display: flex; justify-content: center; padding: 6px 0; }
.escut-groups { display: grid; gap: 10px; }
.escut-group > span { display: block; font-weight: 700; font-size: 0.86rem; margin-bottom: 4px; }
.escut-row { display: flex; flex-wrap: wrap; gap: 6px; }
.escut-opt { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 3px; border: 2px solid rgba(34, 23, 15, 0.25); border-radius: 10px; background: #fff; cursor: pointer; }
.escut-opt:hover { border-color: var(--ink); }
.escut-opt.picked { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
.escut-swatch { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #22170f; }
.escut-letter { max-width: 9rem; }
.escut-letter input { text-align: center; text-transform: uppercase; font-weight: 700; }
.rank svg.rank-escut { display: inline-block; vertical-align: -4px; margin-right: 5px; }

/* Tanca el compte (La meva colla) */
.close-box { margin-top: 18px; padding-top: 12px; border-top: 1px dashed rgba(34, 23, 15, 0.3); }
.close-start { justify-content: flex-end; }
.ghost.close-open { border-color: rgba(124, 20, 32, 0.55); color: var(--red-deep); font-size: 0.88rem; padding: 6px 10px; }
.ghost.close-open:hover { background: rgba(180, 35, 44, 0.08); }
.close-confirm { display: grid; gap: 8px; border: 2px solid var(--red-deep); border-radius: 14px; background: #fff3f1; padding: 12px; color: var(--ink); }
.close-confirm p { margin: 0; }
.close-title { font-weight: 800; color: var(--red-deep); }
.close-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 2px; font-size: 0.9rem; }
.close-never { color: var(--red-deep); }
.close-confirm label { display: grid; gap: 4px; font-size: 0.9rem; }
.close-confirm input { text-transform: uppercase; }
button.danger { border: 2px solid var(--red-deep); background: var(--red); color: #fffaf2; border-radius: 12px; padding: 9px 14px; font-weight: 700; }
button.danger:hover:not(:disabled) { background: var(--red-deep); }
button.danger:disabled { opacity: 0.6; cursor: progress; }
#lobby #join-form > #close-box { column-span: all; }
.room-actions .primary.full.left { white-space: normal; text-align: center; }

/* Crida 2.0: la plaça, el cap de colla i el castell (afegit el 27/10/2026) */
.crida-scene {
  position: relative; height: 302px; overflow: hidden; isolation: isolate;
  max-width: 620px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 16px;
  background: linear-gradient(180deg, #a9cde8 0%, #d6e9f5 51.8%, #efe4cd 52%, #e3d3b6 100%);
}
.crida-sky, .crida-sky > b { position: absolute; display: block; }
.crida-sky { inset: 0; pointer-events: none; }
.crida-sun {
  left: 15%; top: 16px; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff6c8, #e0b03a 68%);
  box-shadow: 0 0 22px rgba(224, 176, 58, 0.6);
}
.crida-cloud { top: 30px; left: 60%; width: 56px; height: 15px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
.crida-cloud::before, .crida-cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.crida-cloud::before { left: 8px; top: -9px; width: 21px; height: 21px; }
.crida-cloud::after { right: 9px; top: -6px; width: 15px; height: 15px; }
.crida-cloud.c2 { left: 78%; top: 58px; transform: scale(0.78); }
.crida-facade {
  left: 0; right: 0; bottom: 32px; height: 64px;
  background:
    repeating-linear-gradient(90deg, rgba(36, 25, 16, 0.16) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #e8d9bf, #cbb593);
  border-top: 2px solid rgba(36, 25, 16, 0.3);
}
.crida-facade::before {
  content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 15px;
  background: repeating-linear-gradient(90deg, transparent 0 13px, rgba(36, 25, 16, 0.3) 13px 26px, transparent 26px 39px);
}
.crida-crowd { left: 0; right: 0; bottom: 0; height: 42px; overflow: hidden; }
.crida-crowd i { position: absolute; bottom: -7px; width: 23px; height: 27px; border-radius: 11px 11px 0 0; background: #3a2a1c; }
.crida-crowd i::before { content: ""; position: absolute; left: 50%; top: -9px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #f1c9a0; }
.crida-crowd i:nth-child(1) { left: 3%; background: #7c1420; }
.crida-crowd i:nth-child(2) { left: 20%; background: #274d78; }
.crida-crowd i:nth-child(3) { left: 38%; background: #1d6a42; }
.crida-crowd i:nth-child(4) { left: 57%; background: #7c1420; }
.crida-crowd i:nth-child(5) { left: 75%; background: #274d78; }
.crida-crowd i:nth-child(6) { left: 91%; background: #1d6a42; }
.crida-cap { position: absolute; left: 10px; bottom: 44px; width: 68px; height: 106px; z-index: 2; }
.crida-cap b { position: absolute; display: block; }
.cap-body { left: 10px; bottom: 0; width: 32px; height: 58px; border: 2px solid var(--ink); border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--red) 0 58%, #22170f 58% 70%, #fffaf2 70%); }
.cap-head { left: 14px; bottom: 56px; width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 50%; background: #f1c9a0; box-shadow: inset 0 -6px 0 #4a2e1c; }
.cap-arm { left: 36px; bottom: 48px; width: 30px; height: 8px; border: 2px solid var(--ink); border-radius: 6px; background: #f1c9a0; transform: rotate(-26deg); transform-origin: left center; }
.cap-mega {
  left: 57px; bottom: 63px; width: 36px; height: 25px;
  background: linear-gradient(90deg, #9b6a15 0 20%, #e0b03a 20% 100%);
  clip-path: polygon(0 33%, 100% 0, 100% 100%, 0 67%);
  transform: rotate(-14deg);
  filter: drop-shadow(1px 1px 0 rgba(36, 25, 16, 0.85));
}
.crida-bubble {
  position: absolute; z-index: 4; top: 8px; left: 50%; transform: translateX(-50%);
  max-width: 74%; margin: 0; padding: 0.3em 0.85em;
  border: 2px solid var(--ink); border-radius: 14px; background: #fffaf2;
  font-size: 1.35rem; line-height: 1.1; text-align: center;
  box-shadow: 0 3px 0 var(--ink);
}
.crida-bubble::after { content: ""; position: absolute; left: 24%; bottom: -9px; width: 15px; height: 15px; background: #fffaf2; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.crida-bubble.hot { color: var(--green); box-shadow: 0 0 0 4px rgba(242, 182, 50, 0.5), 0 3px 0 var(--ink); }
.crida-bubble.idle { color: var(--soft); }
.crida-tower { position: absolute; left: 50%; bottom: 44px; z-index: 1; width: min(44%, 176px); transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
.crida-pom {
  position: relative; display: grid; place-items: center; width: 100%;
  border: 2px solid var(--ink); border-radius: 10px 10px 5px 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0 20%, transparent 20%),
    linear-gradient(180deg, var(--red) 0 62%, #22170f 62% 71%, #fffaf2 71%);
  opacity: 0.42; transform: translateY(9px) scale(0.94);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.crida-pom::before {
  content: ""; position: absolute; left: 50%; top: -10px; width: 16px; height: 16px; margin-left: -8px;
  border: 2px solid var(--ink); border-radius: 50%; background: #f1c9a0; box-shadow: inset 0 -4px 0 #4a2e1c;
}
.crida-pom span { position: relative; z-index: 1; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.crida-pom[data-side="a"] { width: 100%; height: 48px; }
.crida-pom[data-side="b"] { width: 86%; height: 42px; }
.crida-pom[data-side="c"] { width: 72%; height: 38px; }
.crida-pom[data-side="d"] { width: 58%; height: 34px; }
.crida-pom.raised { opacity: 1; transform: none; }
.crida-pom.calling { opacity: 1; box-shadow: 0 0 0 4px rgba(224, 176, 58, 0.5), 0 0 16px rgba(255, 215, 106, 0.75); animation: crida-pulse 0.55s ease-in-out infinite alternate; }
.crida-pom.pop { animation: crida-pom-pop 0.42s cubic-bezier(0.2, 1.6, 0.4, 1); }
.crida-pom.perfect { animation: crida-pom-perfect 0.7s ease-out; }
.crida-pom.wobble { animation: crida-wobble 0.34s ease-in-out; }
@keyframes crida-pulse { to { filter: brightness(1.18); } }
@keyframes crida-pom-pop { 40% { transform: translateY(-4px) scale(1.05); } }
@keyframes crida-pom-perfect { 0% { filter: brightness(1); } 35% { filter: brightness(1.9) drop-shadow(0 0 10px #ffd76a); } 100% { filter: none; } }
@keyframes crida-wobble { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.crida-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 8px auto 0; max-width: 620px; font-size: 0.92rem; font-weight: 700; }
.crida-foot span { padding: 3px 10px; border: 2px solid var(--ink); border-radius: 999px; background: #fffaf2; }
.crida-bar { position: relative; height: 16px; margin: 6px auto 0; max-width: 620px; border: 2px solid var(--ink); border-radius: 999px; background: #fffaf2; overflow: hidden; opacity: 0.45; transition: opacity 0.15s ease; }
.crida-bar.on { opacity: 1; }
.crida-perfect { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(180deg, #ffe58a, #e0b03a); }
.crida-timer { position: absolute; top: 0; bottom: 0; left: 0; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--ink); }
.crida-bar.in-perfect .crida-timer { background: var(--green); }
.crida-result {
  position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; gap: 8px;
  padding: 14px; text-align: center; border-radius: 14px; background: rgba(255, 250, 242, 0.965);
}
.crida-result[hidden] { display: none; }
.crida-result h3 { margin: 0; font-family: var(--serif); font-size: 1.05rem; }
.crida-result.win { box-shadow: inset 0 0 0 4px rgba(29, 106, 66, 0.45); }
.crida-result.miss { box-shadow: inset 0 0 0 4px rgba(180, 35, 44, 0.4); }
.crida-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.crida-stats span { min-width: 82px; padding: 7px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fffaf2; font-weight: 700; }
.crida-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.crida-summary span { padding: 5px 10px; border: 2px solid var(--ink); border-radius: 999px; background: #fffaf2; font-weight: 700; font-size: 0.9rem; }
.crida-confetti { position: absolute; inset: 0; z-index: 9; overflow: hidden; pointer-events: none; }
.crida-confetti i { position: absolute; top: -14px; width: 7px; height: 12px; border-radius: 2px; animation-name: crida-fall; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes crida-fall { to { transform: translateY(330px) rotate(560deg); opacity: 0.85; } }
.crida-applause { position: absolute; left: 50%; bottom: 86px; z-index: 10; transform: translateX(-50%); font-size: 1.7rem; letter-spacing: 0.12em; animation: crida-bravo 1.1s ease-out 2; }
@keyframes crida-bravo { 0% { transform: translate(-50%, 10px) scale(0.7); opacity: 0; } 30% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -9px) scale(1); opacity: 0; } }
.crida-puffs { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.crida-puffs i { position: absolute; bottom: 112px; width: 26px; height: 26px; border-radius: 50%; background: rgba(70, 60, 52, 0.35); animation: crida-puff 1s ease-out forwards; }
@keyframes crida-puff { to { transform: translateY(-48px) scale(2.3); opacity: 0; } }
#free-stage.flash-good .crida-scene { box-shadow: inset 0 0 0 4px rgba(29, 106, 66, 0.55); }
.crida-scene.won { box-shadow: inset 0 0 0 4px rgba(29, 106, 66, 0.55); }
.free-actions .crida-key {
  flex: 1 1 calc(50% - 4px); min-height: 56px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: #fffaf2; color: var(--ink);
  font-family: var(--serif); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.free-actions .crida-key[data-side="a"] { border-bottom: 6px solid var(--red); }
.free-actions .crida-key[data-side="b"] { border-bottom: 6px solid var(--gold); }
.free-actions .crida-key[data-side="c"] { border-bottom: 6px solid var(--green); }
.free-actions .crida-key[data-side="d"] { border-bottom: 6px solid #3c6fae; }
.free-actions .crida-key:hover { background: #fff; }
.free-actions .crida-key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .crida-pom, .crida-pom.calling, .crida-pom.pop, .crida-pom.perfect, .crida-pom.wobble,
  .crida-confetti i, .crida-applause, .crida-puffs i, #free-stage.flash-miss { animation: none !important; transition: none !important; }
  .crida-confetti, .crida-applause, .crida-puffs { display: none; }
}
@media (max-width: 420px) {
  .crida-scene { height: 286px; }
  .crida-bubble { font-size: 1.2rem; }
}

/* El pom de dalt: la memòria de la crida (afegit el 27/10/2026) */
.pom-tower { transform: translate(-50%, var(--pom-lift, 0px)); transition: transform 0.3s cubic-bezier(0.3, 1.2, 0.5, 1); }
.pom-scene .crida-tower { bottom: 34px; gap: 3px; }
.pom-bubble.prompt { font-size: 1.02rem; padding: 0.34em 0.8em; letter-spacing: 0.01em; }
/* El resum viu sota l'escena perquè el castell acabat de pujar es vegi sencer. */
.pom-result {
  position: static; inset: auto; display: grid; place-content: center; gap: 6px;
  max-width: 620px; margin: 8px auto 0; padding: 8px 12px;
  border: 2px solid var(--ink); border-radius: 14px; background: #fffaf2;
  text-align: center; box-shadow: 0 3px 0 var(--ink); z-index: auto;
}
.pom-result h3 { font-size: 0.98rem; }
.pom-result.win { box-shadow: 0 3px 0 var(--ink), inset 0 0 0 3px rgba(29, 106, 66, 0.45); }
.pom-result.miss { box-shadow: 0 3px 0 var(--ink), inset 0 0 0 3px rgba(180, 35, 44, 0.4); }
.pom-result[hidden] { display: none; }
.pom-trace {
  display: flex; justify-content: center; gap: 6px;
  max-width: 620px; margin: 8px auto 0; padding: 0; list-style: none;
}
.pom-trace li {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: 2px solid var(--ink); border-radius: 9px;
  background: #fffaf2; color: var(--soft);
  font-size: 0.78rem; font-weight: 800; line-height: 1;
  opacity: 0.42;
  transition: opacity 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.pom-trace li.on { opacity: 1; }
.pom-trace li.s-a { background: rgba(180, 35, 44, 0.16); color: var(--red-deep); }
.pom-trace li.s-b { background: rgba(224, 176, 58, 0.26); color: #6d4c07; }
.pom-trace li.s-c { background: rgba(29, 106, 66, 0.16); color: var(--green); }
.pom-trace li.s-d { background: rgba(60, 111, 174, 0.18); color: #274d78; }
.pom-trace li.right { box-shadow: 0 0 0 3px rgba(29, 106, 66, 0.5); }
.pom-trace li.wrong { box-shadow: 0 0 0 3px rgba(180, 35, 44, 0.5); animation: pom-nudge 0.3s ease-in-out; }
.pom-trace.answering li { opacity: 0.5; }
.pom-trace.answering li.on, .pom-trace li.right, .pom-trace li.wrong { opacity: 1; }
@keyframes pom-nudge { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.pom-foot { max-width: 620px; }
@media (max-width: 420px) {
  .pom-trace { gap: 5px; }
  .pom-trace li { width: 25px; height: 25px; border-radius: 8px; font-size: 0.72rem; }
  .pom-bubble.prompt { font-size: 0.95rem; max-width: 82%; }
}
@media (prefers-reduced-motion: reduce) {
  .pom-tower, .pom-trace li { transition: none !important; animation: none !important; }
}


/* ===== Activitats: apartats definits i panell propi per a cada accio (27/10/2026) ===== */
.act-sheet { width: min(980px, 100%); }
.act-sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid rgba(34, 23, 15, 0.16);
}
.act-sheet-head h2 { margin: 2px 0 6px; }
.act-sheet-head .muted { margin: 0; max-width: 62ch; }
/* El barri: the 3D neighbourhood. The local opens the activities, the bank the
   loan, the market the cards; the square is the meeting point. */
.barri-sheet { width: min(980px, 100%); margin: 0 auto; height: 100%; display: flex; flex-direction: column; min-height: 0; }
.barri-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.barri-head-compact { justify-content: space-between; align-items: center; margin-bottom: 8px; flex: none; gap: 10px; }
.barri-head-compact .sheet-tresor { margin: 0; }
.barri-head-compact .account-top { flex: none; }
.barri-head h2 { margin: 2px 0 6px; font-family: var(--serif); font-weight: 680; }
.barri-head .muted { margin: 0; max-width: 64ch; }
.barri-no-league { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: rgba(180, 35, 44, 0.08); border: 1px solid rgba(180, 35, 44, 0.25); max-width: none; flex: none; }
.barri-stage {
  position: relative; flex: 1 1 auto; height: auto; min-height: 260px; overflow: hidden;
  border: 2px solid var(--ink); border-radius: 18px;
  background: linear-gradient(180deg, #cfe4f0 0%, #e8eef0 55%, #c9c0ae 56%, #c9c0ae 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.barri-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
/* Fins que el 3D ha pintat el primer fotograma no surten els controls: només
   l'animació d'espera, mai el rectangle buit amb botons. */
.barri-stage:not(.has3d) > :not(.barri-loader) { visibility: hidden; }
.barri-loader {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(180deg, #cfe4f0 0%, #e8eef0 60%, #d8cebd 100%);
  color: #3a2a1e; font-weight: 650; font-size: 0.95rem;
}
.barri-stage.has3d > .barri-loader { display: none; }
.barri-loader-ring {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid rgba(36, 25, 16, 0.16); border-top-color: #b4232c;
  animation: barri-spin 0.8s linear infinite;
}
@keyframes barri-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .barri-loader-ring { animation-duration: 2.2s; } }
.barri-sky { position: absolute; inset: 0; background: radial-gradient(60% 45% at 50% 8%, rgba(255, 247, 220, 0.9), transparent 70%); pointer-events: none; }
.barri-hint {
  position: absolute; left: 12px; top: 10px; margin: 0; z-index: 2;
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 250, 242, 0.86);
  border: 1.5px solid rgba(34, 23, 15, 0.35); font-size: 0.72rem; font-weight: 650; color: #3a2a1e;
  pointer-events: none;
}
.barri-names {
  position: absolute; right: 12px; top: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1.5px solid rgba(34, 23, 15, 0.35);
  background: rgba(255, 250, 242, 0.86);
  color: #3a2a1e; font-size: 0.72rem; font-weight: 650;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.barri-names svg { width: 15px; height: 15px; }
.barri-names.on { background: var(--gold-soft, #f6e2b0); border-color: var(--ink); }
#home-dock { display: none !important; }
.scene-buttons {
  position: absolute; right: 12px; top: 46px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.scene-buttons .barri-names { position: static; }
.scene-buttons .barri-talk { position: static; }
.scene-btn svg { width: 15px; height: 15px; }
.diada-left { position: absolute; left: 12px; right: auto; top: 46px; z-index: 5; }
.rondes-left { position: absolute; left: 12px; right: auto; top: 82px; z-index: 5; }
/* El xip de la diada («Inicia el castell», «Passar ronda», torn) va a l'esquerra. */
.diada-left-chip { left: 12px; right: auto; top: 118px; align-items: flex-start; }
/* Columna de l'esquerra: botons i xips apilats, també el de la parada. */
.scene-left {
  position: absolute; left: 12px; right: auto; top: 46px; z-index: 5;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  max-width: min(320px, 74%);
}
.scene-left .diada-left,
.scene-left .rondes-left,
.scene-left .diada-left-chip { position: static; left: auto; right: auto; top: auto; }
.scene-left .scene-buttons { align-items: flex-start; }
.scene-left > div:empty { display: none; }
.scene-left .barri-names { position: static; right: auto; top: auto; max-width: 100%; white-space: nowrap; }
#barri-stall-chip, #barri-pillar-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stall-chip.sale { background: #ffe7a8; border-color: #b07c12; color: #5a3a08; font-weight: 750; }
.stall-chip.sale:not([disabled]) { box-shadow: 0 2px 0 #b07c12; }
/* Compte enrere per iniciar el castell: àmbar i vermell a l'últim minut. */
.diada-chip .diada-wait {
  margin-left: 3px; padding: 1px 6px; border-radius: 999px;
  background: rgba(34, 23, 15, 0.12);
  font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: 0.02em;
}
.diada-chip .diada-wait.urgent { background: var(--red); color: #fff8ea; }
/* Compte enrere abans de les 13:00: quan comença la diada. */
.diada-float .diada-soon {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 10px;
  background: #fff1c9; border: 1.5px solid #b07c12; color: #5a3a08; font-weight: 750;
}
.diada-float .diada-soon b {
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
/* Parada de bus: llista de localitats on viatjar. */
.bus-float { display: grid; gap: 8px; }
.bus-towns { display: grid; gap: 6px; }
.bus-town {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  padding: 8px 10px; text-align: left; border: 1.5px solid var(--ink); border-radius: 10px;
  background: #fffaf2; cursor: pointer;
}
.bus-town b { grid-column: 1; }
.bus-town span { grid-column: 1; font-size: 0.82rem; color: #6b5842; }
.bus-town em { grid-column: 2; grid-row: 1 / span 2; font-style: normal; font-size: 0.74rem; font-weight: 700; color: #1f4a38; }
.bus-town.here { background: #f3ead6; opacity: 0.75; cursor: default; }
/* El display de .barri-names guanya l'atribut hidden: cal amagar-lo explícitament. */
.barri-names[hidden], .scene-btn[hidden] { display: none; }
/* Feina de l'hamburgueseria: targeta amb el client a qui toca portar la safata. */
.room-job {
  position: absolute; left: 12px; top: 46px; z-index: 5;
  width: min(300px, 66%);
  padding: 8px 10px 7px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.95);
  box-shadow: 0 6px 16px rgba(34, 23, 15, 0.18);
  color: #3a2a1e;
}
.room-job[hidden] { display: none; }
.room-job-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 0.72rem; }
.room-job-head b { font-size: 0.78rem; }
.room-job p { margin: 5px 0 7px; font-size: 0.8rem; line-height: 1.32; }
.room-job-quit { padding: 3px 9px; font-size: 0.72rem; }
/* Comptador dels 10 segons de la cafeteria: número gran i barra que es buida. */
.room-job-clock {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  z-index: 6; display: flex; align-items: baseline; gap: 2px;
  min-width: 92px; padding: 4px 12px 8px;
  border-radius: 14px; border: 2px solid var(--ink);
  background: rgba(255, 250, 242, 0.95);
  color: #3a2a1e; text-align: center;
  box-shadow: 0 6px 16px rgba(34, 23, 15, 0.2);
  font-variant-numeric: tabular-nums;
}
.room-job-clock[hidden] { display: none; }
.room-job-clock b { font-size: 1.7rem; line-height: 1; }
.room-job-clock span { font-size: 0.8rem; font-weight: 700; }
.room-job-clock i {
  position: absolute; left: 10px; right: 10px; bottom: 3px; height: 4px;
  border-radius: 999px; background: rgba(34, 23, 15, 0.15); overflow: hidden;
}
.room-job-clock i em { display: block; height: 100%; background: #2f7a55; transition: width 0.25s linear; }
.room-job-clock.warn { border-color: var(--red); color: #8a1f1f; }
.room-job-clock.warn i em { background: var(--red); }
/* Taller de pilars de la canalla: HUD del temps i de la inclinació. */
.pillar-hud {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  z-index: 6; width: min(300px, 74%);
  padding: 7px 10px 8px; border-radius: 14px;
  border: 2px solid var(--ink); background: rgba(255, 250, 242, 0.95);
  box-shadow: 0 6px 16px rgba(34, 23, 15, 0.2); color: #3a2a1e;
}
.pillar-hud[hidden] { display: none; }
.pillar-hud-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.pillar-hud small { display: block; margin-top: 5px; font-size: 0.68rem; color: #6b5842; }
.pillar-balance { position: relative; height: 8px; margin-top: 6px; border-radius: 999px; background: rgba(34, 23, 15, 0.14); }
.pillar-balance::before { content: ''; position: absolute; left: 50%; top: -3px; width: 2px; height: 14px; background: rgba(34, 23, 15, 0.45); transform: translateX(-50%); }
.pillar-balance i { position: absolute; top: -3px; width: 12px; height: 14px; margin-left: -6px; border-radius: 4px; background: #2f7a55; border: 1.5px solid #1f4a38; transition: left 0.1s linear; }
.pillar-balance.hot i { background: var(--red); border-color: #8a1f1f; }
.pillar-chip { background: var(--gold-soft, #f6e2b0) !important; }
.pillar-chip[disabled] { opacity: 0.72; cursor: default; }
.fps-badge {
  position: absolute; left: 12px; top: 10px; z-index: 6;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(34, 23, 15, 0.72); color: #fff8ea;
  font: 700 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em; pointer-events: none;
}
.diada-colla { padding: 10px 0; border-top: 1px solid rgba(34, 23, 15, 0.14); }
.diada-colla h3 { margin: 0; font-size: 1rem; }
.diada-colla p { margin: 2px 0; }
.diada-stats { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; font-size: 0.85rem; }
.furn-tag {
  position: absolute; z-index: 7; transform: translate(-50%, -50%);
  display: none; align-items: center; justify-content: center;
  padding: 6px 16px; border-radius: 999px;
  border: 1.5px solid #22170f; background: rgba(43, 32, 25, 0.94); color: #fff7e8;
  font-family: var(--serif); font-size: 0.92rem; font-weight: 700;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); cursor: pointer;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.furn-tag:active { transform: translate(-50%, -46%); }
.pocket-place { font-size: 0.74rem; }
.pocket-float {
  position: absolute; left: 10%; top: 10%; width: 80%; height: 80%; z-index: 6;
  display: flex; flex-direction: column;
  background: var(--paper, #f3e6cf); border: 2px solid var(--ink); border-radius: 16px;
  box-shadow: 0 12px 34px rgba(20, 13, 8, 0.42), 0 4px 0 rgba(34, 23, 15, 0.22);
  overflow: hidden;
}
.pocket-float-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-bottom: 1.5px solid var(--line, #d8c7a8);
  font-family: var(--serif); font-size: 1rem;
}
.pocket-float-head .ghost { min-height: 34px; padding: 0 10px; }
.pocket-float-body { flex: 1 1 auto; overflow: auto; padding: 8px 10px 14px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pocket-float-body .play-sheet-card { width: 100%; margin: 0; }
/* Activitat oberta damunt de l'escena 3D: el contingut s'adapta al flotant. */
.pocket-float-body .act-float-card { width: 100%; min-height: 0; margin: 0; }
.pocket-float-body .act-float-card .act-panel-head { padding-bottom: 8px; }
.pocket-float-body .act-float-card .act-panel-body { padding: 10px 0 4px; }
.pocket-float-body .act-float-card .assembly-close { min-height: 32px; }
.pocket-where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; font-size: 0.78rem; }
.pocket-where > span { font-weight: 700; }
.pocket-where button {
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem; font-weight: 650; cursor: pointer;
}
.pocket-where button.on { background: var(--gold-soft, #f6e2b0); border-color: var(--ink); font-weight: 800; }
.barri-talk {
  position: absolute; right: 12px; top: 46px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1.5px solid rgba(34, 23, 15, 0.35);
  background: rgba(255, 250, 242, 0.86);
  color: #3a2a1e; font-size: 0.72rem; font-weight: 650;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.barri-talk.off { display: none; }
.barri-talk span { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barri-talk svg { width: 15px; height: 15px; }
.pocket-give { margin-left: auto; flex: 0 0 auto; font-size: 0.74rem; }
.pocket-give.armed { border-color: #b23b2e; color: #b23b2e; }
.npc-kb-btn { padding: 0 9px; font-size: 1rem; line-height: 1; }
.fp-kb { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.kb-row { display: flex; gap: 5px; }
.kb-key {
  flex: 1 1 0; min-width: 0; height: 50px; border-radius: 9px;
  border: 1.5px solid rgba(34, 23, 15, 0.35); background: rgba(255, 250, 242, 0.95);
  color: #3a2a1e; font-size: 1.08rem; font-weight: 650; cursor: pointer;
  padding: 0 4px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kb-key:active { background: #f6e2b0; }
.kb-key.wide { flex: 1.4 1 0; }
.kb-key.space { flex: 3 1 0; }
.kb-key.arr { flex: 0.8 1 0; font-size: 1.05rem; }
#npc-form input { caret-color: #b23b2e; }
.kb-key.send { flex: 1.6 1 0; background: #3f6fa8; color: #fff; border-color: #2c4f7c; }
.kb-key.on { background: #f6e2b0; }
/* Teclat propi: resposta immediata i senyal de tecla premuda. */
.fp-kb { touch-action: none; gap: 7px; }
.kb-row { gap: 4px; }
.kb-key { height: 46px; padding: 0 2px; transition: background-color 60ms; }
.kb-key.down { background: #f6e2b0; transform: translateY(1px); box-shadow: inset 0 2px 0 rgba(34, 23, 15, 0.18); }
.kb-key.send.down { background: #2c4f7c; }
.kb-key.caps { background: #e9c46a; border-color: #8a6a1e; }
.kb-key.punct { flex: 0.8 1 0; }
.kb-key.mode { font-size: 0.95rem; }
.kb-pop-key { min-width: 48px; height: 50px; }
@media (max-width: 360px) { .kb-row { gap: 3px; } .kb-key { height: 44px; font-size: 1rem; } }
.kb-pop {
  position: fixed; z-index: 95; display: flex; gap: 6px; padding: 6px;
  background: rgba(255, 250, 242, 0.98); border: 1.5px solid rgba(34, 23, 15, 0.35);
  border-radius: 11px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  user-select: none; -webkit-user-select: none;
}
.kb-pop-key {
  min-width: 46px; height: 46px; border-radius: 9px;
  border: 1.5px solid rgba(34, 23, 15, 0.3); background: #fff;
  color: #3a2a1e; font-size: 1.3rem; font-weight: 650; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kb-pop-key:active { background: #f6e2b0; }
.kb-key[data-lp] { position: relative; }
.kb-key[data-lp]::after { content: ""; position: absolute; right: 5px; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: rgba(34, 23, 15, 0.28); }
#npc-float { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(460px, calc(100vw - 16px)); z-index: 70; }
.fp-float { background: rgba(255, 250, 242, 0.97); border: 1.5px solid rgba(34, 23, 15, 0.3); border-radius: 14px; padding: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); }
.fp-float-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fp-float-head b { font-size: 0.95rem; }
.fp-x { border: 0; background: none; font-size: 1.05rem; line-height: 1; padding: 2px 6px; cursor: pointer; color: #3a2a1e; }
.fp-form input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1.5px solid rgba(34, 23, 15, 0.3); font-size: 0.95rem; }
.fp-form { display: flex; gap: 8px; align-items: center; }
.fp-form .fp-field { flex: 1 1 auto; min-width: 0; }
.fp-form .fp-send { flex: 0 0 auto; }
.fp-hist { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.fp-hist::-webkit-scrollbar { display: none; }
.fp-log { display: flex; flex-direction: column; gap: 4px; max-height: 26vh; overflow-y: auto; margin: 0 0 8px; padding: 2px; overscroll-behavior: contain; }
.fp-line { max-width: 92%; padding: 4px 8px; border-radius: 9px; background: rgba(34, 23, 15, 0.07); font-size: 0.86rem; line-height: 1.3; color: #3a2a1e; }
.fp-line b { display: block; font-size: 0.68rem; font-weight: 600; color: #7a6a58; margin-bottom: 1px; }
.fp-line span { word-break: break-word; }
.fp-line.user { align-self: flex-end; background: rgba(178, 59, 46, 0.12); }
.fp-line.user b { color: #b23b2e; }
.fp-chip {
  flex: 0 0 auto; max-width: 220px; padding: 4px 9px; border-radius: 999px;
  border: 1.5px solid rgba(34, 23, 15, 0.28); background: rgba(255, 250, 242, 0.9);
  color: #3a2a1e; font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.fp-chip:active { background: #f6e2b0; }
.fp-field { position: relative; }
.kb-caret { position: absolute; width: 1.5px; background: #b23b2e; display: none; pointer-events: none; animation: kbCaret 1s steps(1) infinite; }
@keyframes kbCaret { 50% { opacity: 0; } }
.fp-wait { margin: 6px 0; color: #6b5a4a; }
.fp-answer-text { margin: 6px 0 10px; font-size: 0.95rem; line-height: 1.35; }
.fp-answer-acts { display: flex; gap: 8px; }
.fp-answer-acts button { flex: 1 1 0; }
.fp-offer { margin: 6px 0 10px; padding: 8px 10px; border: 1.5px dashed rgba(34, 23, 15, 0.35); border-radius: 10px; background: rgba(224, 176, 58, 0.12); }
.fp-offer p { margin: 0 0 6px; font-size: 0.86rem; line-height: 1.3; }
body.npc-talking #barri-controls, body.npc-talking #barri-zoom { display: none !important; }
.npc-chat { display: flex; flex-direction: column; gap: 10px; }
.npc-log {
  min-height: 190px; max-height: 48vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1.5px solid rgba(34, 23, 15, 0.25);
  border-radius: 14px; background: rgba(255, 250, 242, 0.72);
}
.npc-hello { margin: 0; font-size: 0.9rem; opacity: 0.85; }
.npc-msg {
  max-width: 88%; padding: 7px 10px; border-radius: 12px;
  background: #fff; border: 1.5px solid rgba(34, 23, 15, 0.16);
}
.npc-msg.user { align-self: flex-end; background: #f6e2b0; border-color: rgba(34, 23, 15, 0.25); }
.npc-msg b { display: block; font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; }
.npc-msg p { margin: 3px 0 0; white-space: normal; overflow-wrap: anywhere; }
.npc-wait p { opacity: 0.7; font-style: italic; }
.npc-form { display: flex; gap: 8px; }
.npc-form input {
  flex: 1 1 auto; min-width: 0; border: 1.5px solid var(--ink); border-radius: 10px;
  padding: 10px 12px; font: inherit; background: #fff; color: var(--ink);
}
.npc-form button { flex: none; }
.npc-left { margin: 0; font-size: 0.72rem; opacity: 0.75; }
.npc-sell { display: grid; gap: 6px; }
.npc-sell h3 { margin: 4px 0 0; }
.npc-sell-hint { margin: 0; }
.npc-sell-list { display: grid; gap: 6px; }
.npc-sell-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1.5px solid rgba(34, 23, 15, 0.2);
  border-radius: 12px; background: rgba(255, 250, 242, 0.8);
}
.npc-sell-icon { width: 34px; height: 34px; flex: none; }
.npc-sell-icon svg { width: 100%; height: 100%; }
.npc-sell-copy { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
.npc-sell-copy span { font-size: 0.76rem; opacity: 0.75; }
.npc-sell-btn { flex: none; }
.npc-sell-actions { display: flex; gap: 6px; flex: none; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.npc-trade {
  display: grid; gap: 8px; margin: 6px 0;
  padding: 10px 12px; border: 1.5px solid rgba(178, 59, 46, 0.45);
  border-radius: 12px; background: rgba(178, 59, 46, 0.08);
}
.npc-trade p { margin: 0; font-size: 0.88rem; line-height: 1.35; }
.npc-trade p b { display: block; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: #b23b2e; margin-bottom: 2px; }
.npc-trade-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.npc-trade-actions button { flex: 1 1 auto; }
.npc-give { display: grid; gap: 6px; }
.npc-give h3 { margin: 4px 0 0; }
.npc-give-money { display: flex; gap: 8px; align-items: center; }
.npc-give-money input {
  width: 88px; border: 1.5px solid var(--ink); border-radius: 10px;
  padding: 8px 10px; font: inherit; background: #fff; color: var(--ink);
}
@media (max-width: 520px) {
  .npc-log { max-height: 42vh; }
  .npc-msg { max-width: 94%; }
}
.barri-spots {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3;  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.barri-controls {
  position: absolute; right: 12px; bottom: 12px; z-index: 4;
  width: 132px; height: 132px;
  pointer-events: none;
  opacity: 0.78;
}
.barri-zoom {
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  width: 132px; height: 132px; border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 50% 45%, #fffaf2, #efe0c8);
  box-shadow: 0 4px 0 rgba(34, 23, 15, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  opacity: 0.78; pointer-events: auto; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.barri-zoom::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: rgba(34, 23, 15, 0.18);
}
.barri-zoom-knob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px;
  border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #fbe39a 0 30%, var(--gold) 31% 100%);
  border: 2px solid var(--ink); pointer-events: none;
  box-shadow: 0 3px 0 rgba(34, 23, 15, 0.25);
}
.barri-stick {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 50% 45%, #fffaf2, #efe0c8);
  box-shadow: 0 4px 0 rgba(34, 23, 15, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  touch-action: none; pointer-events: auto;
  user-select: none; -webkit-user-select: none;
}
.barri-stick::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: rgba(34, 23, 15, 0.18);
}
.barri-stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #fbe39a 0 30%, var(--gold) 31% 100%);
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}
@media (max-width: 600px) {
  .barri-controls { width: 112px; height: 112px; }
  .barri-zoom { width: 112px; height: 112px; }
  .barri-stick-knob { width: 42px; height: 42px; }
  .barri-zoom-knob { width: 42px; height: 42px; }
}
/* Escriptori (ratolí): només teclat, sense joystick ni pad de càmera. */
@media (hover: hover) and (pointer: fine) {
  .barri-controls,
  .barri-zoom { display: none !important; }
}
.barri-spot {
  flex: 1 1 180px; max-width: 240px; min-height: 54px; padding: 7px 10px;
  display: inline-flex; align-items: center; gap: 9px; text-align: left;
  border: 2px solid var(--ink); border-radius: 14px; color: #2a1a12;
  background: linear-gradient(180deg, #fffaf2, #efe0c8);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 4px 0 #8a5a2b,
    0 7px 12px rgba(36, 25, 16, 0.28);
  transform: perspective(240px) rotateX(7deg);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.barri-spot:hover { background: linear-gradient(180deg, #fffdf8, #f4e6cf); }
.barri-spot:active {
  transform: perspective(240px) rotateX(7deg) translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 #8a5a2b,
    0 3px 6px rgba(36, 25, 16, 0.3);
}
.barri-spot-ico { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(224, 176, 58, 0.22); }
.barri-spot-ico svg { width: 21px; height: 21px; display: block; color: #7a2418; }
.barri-spot-placa .barri-spot-ico svg { color: var(--green); }
.barri-spot-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.barri-spot-txt b { font-size: 0.92rem; line-height: 1.1; }
.barri-spot-txt small { font-size: 0.66rem; line-height: 1.15; color: var(--soft); }
.barri-people { display: flex; align-items: center; gap: 7px; margin: 9px 0 0; font-size: 0.78rem; color: var(--soft); }
.barri-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(46, 107, 74, 0.18); }
.barri-back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; }
.act-back { display: inline-flex; align-items: center; gap: 6px; }
.barri-back svg, .act-back svg { width: 17px; height: 17px; flex: none; }
/* El local: the cutaway of the building, with a room on each floor. */
.local-in { width: min(980px, 100%); margin: 0 auto; }
.local-panel-lead { margin: 0 0 10px; }
.assembly-panel { width: 100%; }
.assembly-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.assembly-close { min-height: 40px; padding: 6px 14px; }
.local-cut { display: block; width: 100%; max-width: 560px; margin: 0 auto; }
.local-stage {
  position: relative; height: clamp(300px, 52vh, 500px); max-width: 760px; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #dfe9ef, #efe3cc);
}
.local-stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; pointer-events: none; cursor: grab;
}
.local-stage.has3d canvas { pointer-events: auto; }
.local-stage.has3d canvas:active { cursor: grabbing; }
.local-stage .local-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; }
.local-stage .local-fallback .local-cut { width: 100%; height: 100%; max-width: none; margin: 0; }
.local-stage.has3d .local-fallback { display: none; }
.local-3d-hint {
  position: absolute; left: 12px; top: 10px; margin: 0; z-index: 2;
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 250, 242, 0.86);
  border: 1.5px solid rgba(34, 23, 15, 0.35); font-size: 0.72rem; font-weight: 650; color: #3a2a1e;
  pointer-events: none;
}
.local-cut .floor-hot { cursor: pointer; }
.local-act-strip-wrap {
  position: absolute; left: 12px; top: 10px; right: 112px; z-index: 3;
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; overflow-y: auto;
  pointer-events: none; -webkit-overflow-scrolling: touch;
}
.local-act-strip { display: flex; flex-wrap: wrap; gap: 6px; }
/* Local: el botó de super castellers és a dalt de la columna i els xips
   d'activitat queden a sota, sense encavalcar-s'hi. */
.local-act-strip-col {
  flex-direction: column;
  align-items: flex-start;
  max-height: none;
  overflow: visible;
}
.local-act-strip-col .local-act-strip { max-height: 110px; overflow-y: auto; }
.local-repte-row { display: flex; pointer-events: none; }
.local-repte-row .barri-names { position: static; pointer-events: auto; white-space: nowrap; }
.local-act-chip {
  pointer-events: auto; border: 1.5px solid rgba(34, 23, 15, 0.35);
  background: rgba(255, 250, 242, 0.92); color: #3a2a1e;
  border-radius: 999px; padding: 4px 10px; font-size: 0.72rem; font-weight: 650;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.local-act-chip.off { opacity: 0.6; cursor: pointer; }
.local-act-chip[disabled] { opacity: 0.55; cursor: default; }
.local-cut .floor-sel { fill: rgba(224, 176, 58, 0); stroke: transparent; stroke-width: 3; transition: fill 0.15s ease; }
.local-cut .floor-hot:hover .floor-sel { fill: rgba(224, 176, 58, 0.12); }
.local-cut .floor-hot.on .floor-sel { fill: rgba(224, 176, 58, 0.18); stroke: #b4232c; stroke-dasharray: 7 5; }
.local-floor-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 14px; }
.local-floor-tab {
  flex: 1 1 150px; max-width: 220px; text-align: left; padding: 6px 10px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffaf2;
  color: var(--ink); box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.06s ease, background 0.12s ease;
}
.local-floor-tab.on { background: var(--gold); }
.local-floor-tab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.local-floor-tab b { display: block; font-size: 0.86rem; line-height: 1.15; }
.local-floor-tab small { display: block; font-size: 0.66rem; line-height: 1.2; color: var(--soft); }
.local-floor-tab.on small { color: rgba(34, 23, 15, 0.72); }
.local-room { margin-top: 6px; }
.local-room-head h3 { margin: 0 0 2px; font-family: var(--serif); font-weight: 680; }
.local-room-head .muted { margin: 0 0 10px; }
.local-room-cards { display: grid; gap: 10px; }
.local-card {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px;
  background: #fffaf2; box-shadow: 0 3px 0 rgba(34, 23, 15, 0.16);
}
.local-card.ready, .local-card.now { background: linear-gradient(180deg, #fffdf6, #f7edd8); }
.local-card[data-act] { cursor: pointer; }
.local-card[data-act]:hover { background: #fff4dc; }
.local-card[data-act]:focus-visible { outline: 3px solid #b4232c; outline-offset: 2px; }
.local-card-ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: rgba(224, 176, 58, 0.2); color: #7a2418; }
.local-card-ico > svg { width: 32px; height: 32px; display: block; }
.local-card-ico .free-ico { width: 32px; height: 32px; display: grid; place-items: center; }
.local-card-ico .free-ico svg { width: 32px; height: 32px; display: block; }
.local-card-txt b { display: block; font-size: 0.95rem; line-height: 1.15; }
.local-card-txt p { margin: 2px 0 0; font-size: 0.76rem; line-height: 1.3; color: var(--soft); }
.local-card-note { margin: 4px 0 0; font-size: 0.72rem; font-weight: 650; color: var(--ink); }
.local-card-act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.local-card-act .act-chip { white-space: nowrap; }
.local-card-act button { padding: 6px 12px; }
@media (max-width: 560px) {
  .local-card { grid-template-columns: 38px minmax(0, 1fr); }
  .local-card-ico { width: 38px; height: 38px; }
  .local-card-act { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-end; }
  .local-floor-tab { flex: 1 1 44%; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .local-cut .floor-sel, .local-floor-tab { transition: none; } }
@media (max-width: 640px) {
  .barri-stage { height: auto; min-height: 220px; }
  .barri-spot { flex: 1 1 44%; min-height: 46px; padding: 5px 8px; }
  .barri-spot-txt small { display: none; }
  .barri-hint { font-size: 0.65rem; }
}
@media (prefers-reduced-motion: reduce) { .barri-spot { transition: none; } }
.act-kicker {
  margin: 0; font-size: 0.72rem; font-weight: 750; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--red, #b4232c);
}
.act-lead { font-size: 1.02rem; line-height: 1.45; margin: 0 0 10px; max-width: 72ch; }
.act-list { display: grid; gap: 14px; }
.act-card {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0;
  border: 2px solid var(--ink); border-radius: 18px; overflow: hidden;
  background: var(--card-solid, #fbf4e6); box-shadow: 0 4px 0 var(--ink);
}
.act-art {
  display: grid; place-items: center; padding: 10px 12px;
  border-right: 2px solid var(--ink);
  background: linear-gradient(160deg, #f8e5b8, #efc35a 72%);
}
.act-card-purse .act-art { background: linear-gradient(160deg, #e4eef5, #b9d0e2 72%); }
.act-card-extra .act-art { background: linear-gradient(160deg, #f7dcd7, #e6a096 72%); }
.act-card-loan .act-art { background: linear-gradient(160deg, #f1e8d7, #d8c29c 72%); }
.act-art-svg { width: 100%; height: auto; max-height: 118px; }
.act-card-body { padding: 14px 18px 16px; min-width: 0; }
.act-card-body h3 { margin: 2px 0 6px; font-family: var(--serif); font-size: 1.28rem; line-height: 1.15; }
.act-desc { margin: 0; color: var(--soft); font-size: 0.95rem; line-height: 1.4; max-width: 62ch; }
.act-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 11px 0 14px; }
.act-chip {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border: 1.5px solid rgba(34, 23, 15, 0.35); border-radius: 999px;
  background: #fffaf2; color: var(--ink); font-size: 0.78rem; font-weight: 650;
}
.act-chip-ready { background: #e7f1e8; border-color: #2e6b4a; color: #234f37; }
.act-chip-run { background: #fdf0cf; border-color: #a87512; color: #7c5609; }
.act-chip-done { background: #ece7df; border-color: #6f655b; color: #4d453d; }
.act-chip-good { background: #e7f1e8; border-color: #2e6b4a; color: #1f5a38; }
.act-chip-bad { background: #f8e3df; border-color: #a32a32; color: #8b1f27; }
.act-chip-warn { background: #fbe9d2; border-color: #a0612b; color: #7d4517; }
.act-chip-gold { background: #fbeec2; border-color: #a87512; color: #6f4d08; }
.act-open-btn { min-height: 46px; }
.act-progress { margin: 0 0 12px; font-weight: 650; }
.daily-box {
  display: grid; gap: 8px; padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: 14px;
  background: #fffaf2; box-shadow: 0 3px 0 rgba(36, 25, 16, 0.10);
}
.daily-box .daily-title { margin: 0; font-family: var(--serif); font-size: 1rem; }
.daily-box .act-lead { margin: 0; }
.daily-box .act-choices { margin-top: 2px; }
.daily-box .act-live { padding: 4px 0 0; }
.act-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; margin-top: 12px; }
.act-choice {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 86px; padding: 12px 14px; text-align: left;
  border: 2px solid var(--ink); border-radius: 16px;
  background: var(--card-solid, #fbf4e6); box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.act-choice:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.act-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.act-choice .free-ico {
  width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--ink);
  display: grid; place-items: center; background: var(--gold-soft, #f6e2b0); color: var(--ink);
}
.act-choice .free-ico svg { width: 38px; height: 38px; }
.act-choice-gralla .free-ico { background: #f3d9b4; }
.act-choice-bar .free-ico { background: #e8eef5; }
.act-choice-pati .free-ico { background: #f6d4cf; }
.act-choice-txt { display: grid; gap: 2px; min-width: 0; }
.act-choice-txt .act-pts {
  display: inline-flex; justify-self: start; margin-top: 2px; padding: 1px 8px;
  border: 1.5px solid #d8a62a; border-radius: 999px; background: #fff3c4;
  color: #6b4a00; font-size: 0.7rem; font-weight: 700;
}
.act-choice-txt b { font-family: var(--serif); font-size: 1.08rem; line-height: 1.15; }
.act-choice-txt span { color: var(--soft); font-size: 0.88rem; line-height: 1.3; }
.act-choice em { font-style: normal; font-weight: 750; color: var(--red, #b4232c); white-space: nowrap; }
.act-hint { margin: 10px 0 0; color: var(--soft); font-size: 0.9rem; }
.act-warn { margin: 10px 0 0; color: #8b1f27; font-weight: 600; }
.act-note { margin: 10px 0 0; font-weight: 650; }
.act-note.good { color: #1f5a38; }
.act-big-number { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.act-big-number b { font-family: var(--serif); font-size: 3rem; line-height: 1; color: var(--red, #b4232c); }
.act-big-number span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.act-start-btn { min-height: 52px; }

/* El panell d'accio: flotant, entre la barra de dalt i la barra de baix, sense tapar-les */
.act-panel {
  position: fixed; z-index: 10; overflow: auto;
  top: calc(var(--league-h, 0px) + 8px);
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(var(--dock-h, 0px) + 8px);
  left: max(8px, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 rgba(34, 23, 15, 0.22);
  padding: 14px 18px;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(224, 176, 58, 0.34), transparent 62%),
    var(--paper, #f3e6cf);
}
.act-panel.hidden { display: none; }
.act-panel-card { width: min(980px, 100%); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.act-panel.local-mode {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  top: calc(var(--league-h, 0px) + var(--top-h, 0px) + 16px);
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--dock-h, 0px) + 16px);
  left: max(16px, env(safe-area-inset-left));
}
.act-panel.local-mode .act-panel-head { display: none; }
.act-panel.local-mode .act-panel-card { width: 100%; max-width: none; height: 100%; min-height: 0; }
.act-panel.local-mode .act-panel-card.local-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.act-panel.local-mode .act-panel-card.local-card > .shop-in,
.act-panel.local-mode .act-panel-card.local-card > .room-in { flex: 1 1 auto; height: auto; min-height: 0; }
.act-panel.local-mode .act-panel-body { padding: 0; justify-content: stretch; }
.local-full { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.local-full .local-stage { flex: 1 1 auto; height: auto; min-height: 260px; max-width: none; margin: 0; border: 2px solid var(--ink); border-radius: 18px; }
.local-full .local-room { flex: 0 0 auto; margin-top: 10px; }
.act-panel-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 12px; border-bottom: 2px solid rgba(34, 23, 15, 0.16);
}
.act-back {
  flex: 0 0 auto; min-height: 44px; padding: 8px 15px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card-solid, #fbf4e6); color: var(--ink);
  font-weight: 650; box-shadow: 0 3px 0 var(--ink);
}
.act-back:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.act-panel-title { flex: 1 1 auto; min-width: 0; }
.act-panel-title h2 { margin: 2px 0 0; font-family: var(--serif); font-weight: 680; font-size: clamp(1.4rem, 3vw, 2rem); }
.act-panel .sheet-tresor { flex: 0 0 auto; margin: 0; }
.act-panel-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 20px 0 26px; }
.act-panel-intro, .act-result, .act-confirm { width: min(760px, 100%); margin: 0 auto; }
.act-panel-intro {
  padding: 22px 24px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: #fffaf2;
  box-shadow: 0 6px 0 var(--ink);
}
.act-intro { display: flex; align-items: center; gap: 20px; }
.act-intro-art {
  flex: 0 0 168px; padding: 8px 10px;
  border: 2px solid var(--ink); border-radius: 14px;
  background: linear-gradient(160deg, #f8e5b8, #efc35a 72%);
}
.act-intro-art.is-purse { background: linear-gradient(160deg, #e4eef5, #b9d0e2 72%); }
.act-intro-art.is-extra { background: linear-gradient(160deg, #f7dcd7, #e6a096 72%); }
.act-intro-art.is-loan { background: linear-gradient(160deg, #f1e8d7, #d8c29c 72%); }
.act-intro-art .act-art-svg { display: block; width: 100%; height: auto; }
.act-intro-txt { flex: 1 1 auto; min-width: 0; }
.act-intro-txt .act-big-number { margin-bottom: 6px; }
.act-intro-txt .act-lead { margin-bottom: 0; }
.act-panel .act-live { width: min(860px, 100%); margin: 0 auto; display: grid; gap: 12px; }
.act-panel .act-live .act-hint { text-align: center; }
.act-live-note { margin: 0; text-align: center; font-weight: 650; font-size: 1.05rem; }
.act-live-hint { text-align: center; margin: 0; color: var(--soft); font-size: 0.9rem; }
.act-panel .free-actions { justify-content: center; }
.act-panel .free-actions > button { flex: 1 1 190px; max-width: 320px; min-height: 54px; }
.act-result { text-align: center; display: grid; gap: 10px; justify-items: center; }
.act-result .free-tier { justify-content: center; width: auto; max-width: 100%; }
.act-result .coach { margin: 0; font-size: 1.08rem; }
.act-confirm {
  padding: 20px; border: 2px solid var(--ink); border-radius: 18px;
  background: #fffaf2; box-shadow: 0 6px 0 var(--ink);
}
.act-confirm h3 { margin: 6px 0 10px; font-family: var(--serif); font-size: 1.45rem; }
.act-confirm p { margin: 0 0 8px; }
.act-confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.act-confirm-actions button { flex: 1 1 200px; min-height: 50px; }
.act-danger { background: var(--red, #b4232c); color: #fff; border-color: var(--red-deep, #8d1a22); }
.act-danger:hover { background: var(--red-deep, #8d1a22); color: #fff; }

@media (max-width: 680px) {
  .act-sheet-head { flex-direction: column; gap: 10px; }
  .act-card { grid-template-columns: 1fr; }
  .act-art { border-right: 0; border-bottom: 2px solid var(--ink); padding: 6px 16px; }
  .act-art-svg { max-height: 92px; }
  .act-card-body { padding: 12px 14px 14px; }
  .act-panel-head { flex-wrap: wrap; gap: 8px 10px; }
  .act-panel-title { order: 3; flex-basis: 100%; }
  .act-panel .sheet-tresor { margin-left: auto; }
  .act-panel { padding: 10px 12px; }
  .act-panel-body { padding: 10px 0 12px; }
  .act-panel .crida-scene { height: 240px; }
  .act-panel .act-live .act-hint { display: none; }
  .act-panel .act-live { gap: 8px; }
  .act-panel .free-actions { gap: 8px; }
  .act-panel .free-actions > button:not(.free-big) { flex: 1 1 calc(50% - 4px); max-width: none; min-height: 50px; }
  .act-intro { flex-direction: column; align-items: stretch; gap: 12px; }
  .act-intro-art { flex: 0 0 auto; max-width: 190px; align-self: center; }
  .act-choices { grid-template-columns: 1fr; }
  .act-choice { grid-template-columns: 48px minmax(0, 1fr); }
  .act-choice em { display: none; }
  .act-choice .free-ico { width: 48px; height: 48px; }
  .act-choice .free-ico svg { width: 32px; height: 32px; }
}

/* ----- Card market between players ----- */
.act-card-market .act-art { background: linear-gradient(160deg, #efe6f7, #c9aede 72%); }
.market-panel { width: min(820px, 100%); }
.market-h { margin: 20px 0 8px; font-family: var(--serif); font-size: 1.12rem; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.market-card, .market-offer {
  display: grid; gap: 10px; padding: 12px 13px; max-width: 560px;
  border: 2px solid var(--ink); border-radius: 14px;
  background: var(--card-solid, #fbf4e6); box-shadow: 0 3px 0 var(--ink);
}
.market-offer.is-mine { border-color: #a87512; box-shadow: 0 3px 0 #a87512; }
.market-card-top { display: flex; align-items: flex-start; gap: 10px; }
.market-card-top .card-ico { flex: 0 0 auto; width: 34px; height: 34px; margin: 0; }
.market-card-txt { min-width: 0; }
.market-card-txt h4 { margin: 1px 0 3px; font-family: var(--serif); font-size: 1.06rem; line-height: 1.15; }
.market-card-d { margin: 0; color: var(--soft); font-size: 0.86rem; line-height: 1.32; }
.market-sell { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.market-price-field { display: grid; gap: 3px; font-size: 0.76rem; font-weight: 650; }
.market-price-field input {
  width: 76px; padding: 6px 8px; font: inherit; font-weight: 650;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffaf2; color: var(--ink);
}
.market-sell button { flex: 1 1 120px; max-width: 240px; margin-left: auto; min-height: 42px; padding: 0 18px; }
.market-offer-head { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; min-width: 0; }
.market-offer-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-offer-head .muted { margin-left: auto; font-size: 0.78rem; white-space: nowrap; }
.market-offer-buy { display: flex; align-items: center; gap: 10px; }
.market-price-tag { font-family: var(--serif); font-size: 1.04rem; white-space: nowrap; }
.market-offer-buy button { margin-left: auto; min-height: 42px; padding: 0 16px; }
.market-reason { margin: 0; color: #8b1f27; font-size: 0.82rem; font-weight: 600; }
.market-count { margin: 0; color: var(--soft); font-size: 0.8rem; font-weight: 650; }
.market-swap-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  align-items: end; gap: 10px; padding: 12px 13px; max-width: 820px;
  border: 2px dashed var(--ink); border-radius: 14px; background: #fffaf2;
}
.market-swap-form label { display: grid; gap: 4px; font-size: 0.78rem; font-weight: 650; }
.market-swap-form select {
  width: 100%; padding: 8px 9px; font: inherit; font-weight: 600;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffaf2; color: var(--ink);
}
.market-swap-form button { min-height: 42px; padding: 0 16px; }
.market-swap-want { margin: 0; font-size: 0.86rem; font-weight: 700; }
.market-give-pick { display: grid; gap: 4px; font-size: 0.78rem; font-weight: 650; }
.market-give-pick select {
  width: 100%; padding: 8px 9px; font: inherit; font-weight: 600;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffaf2; color: var(--ink);
}
.market-offer.is-swap { border-style: dashed; }
.market-offer.is-swap.is-mine { border-style: solid; }

/* ----- Furniture shop and the colla's furniture ----- */
.furniture-panel { width: min(880px, 100%); }
.furn-wallet {
  display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 10px;
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--gold); color: var(--ink); font-weight: 720;
}
.furn-wallet span { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }
.furn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr)); gap: 12px; }
.furn-card {
  display: grid; gap: 6px; padding: 12px; border: 2px solid var(--ink);
  border-radius: 14px; background: var(--card-solid, #fbf4e6); box-shadow: 0 3px 0 var(--ink);
  text-align: center;
}
.furn-card h3 { margin: 0; font-family: var(--serif); font-size: 1.02rem; }
.furn-card .primary { min-height: 40px; }
.furn-art { display: grid; place-items: center; min-height: 62px; }
.furn-art svg { width: 56px; height: 56px; }
.furn-art.small { min-height: 40px; }
.furn-art.small svg { width: 36px; height: 36px; }
.furn-cost { margin: 0; font-size: 0.82rem; font-weight: 700; color: #8a5a12; }
.furn-place-in { display: grid; gap: 3px; font-size: 0.74rem; text-align: left; color: var(--muted, #6b6258); }
.furn-place-in select { min-height: 36px; }
.furn-own-list { display: grid; gap: 8px; }
.furn-own {
  display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}
.furn-own-copy { display: grid; gap: 1px; min-width: 0; }
.furn-own-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.furn-own select { min-height: 36px; }
.furn-own button { min-height: 36px; padding: 0 10px; }
.account-back-row { margin-top: 14px; }
.account-back { width: 100%; }
.pocket-block { margin-top: 18px; }
.pocket-block + .pocket-block { margin-top: 18px; }
.bank-panel { width: min(620px, 100%); }
.reforms-panel { width: min(620px, 100%); }`r`n.music-panel { width: min(620px, 100%); }
.reform-item { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1.5px solid var(--line); }
.reform-item:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.roles-panel { width: min(640px, 100%); }
.roles-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.role-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55);
}
.role-row.mine { border-color: #a87512; box-shadow: 0 2px 0 #a87512; }
.role-row .casteller-thumb { width: 44px; height: 44px; flex: none; }
.role-copy { display: grid; gap: 1px; min-width: 0; flex: 1; }
.role-copy b { color: var(--ink); }
.role-copy small { color: var(--muted, #6b6258); font-size: 0.78rem; }
.role-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.role-actions button { min-height: 38px; padding: 0 12px; }
@media (max-width: 560px) {
  .role-row { flex-wrap: wrap; }
  .role-actions { width: 100%; justify-content: flex-start; }
}
.shop-in { position: relative; display: flex; flex-direction: column; gap: 0; width: 100%; height: 100%; min-height: 0; }
.room-in { position: relative; width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.room-in .room-stage { width: 100%; height: 100%; min-height: 260px; max-width: none; margin: 0; border-radius: 18px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.room-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shop-in .shop-stage { flex: 1 1 auto; width: 100%; height: auto; min-height: 260px; max-width: none; margin: 0; }
.shop-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#shop-buy-chip { display: flex; }
#shop-buy-chip:empty { display: none; }
#room-buy-chip { display: flex; }
#room-buy-chip:empty, #room-talk-chip:empty { display: none; }
#shop-seat-chip, #room-seat-chip, #local-seat-chip { display: flex; }
#shop-seat-chip:empty, #room-seat-chip:empty, #local-seat-chip:empty { display: none; }
#room-dress-chip { display: flex; }
#room-dress-chip:empty { display: none; }
.shop-buy-chip { position: static; }
.shop-buy-box {
  position: absolute; left: 10px; top: 10px; z-index: 5;
  width: min(250px, 58%); max-height: 46%; overflow: auto;
  padding: 8px 10px; border: 2px solid var(--ink); border-radius: 14px;
  background: rgba(251, 244, 230, 0.94); display: grid; gap: 6px;
  box-shadow: 0 3px 0 rgba(34, 23, 15, 0.2);
}
.local-furn-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: rgba(255, 250, 242, 0.92); border: 1.5px solid var(--ink);
}
.shop-buy-box { display: grid; gap: 8px; }
.shop-buy-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-buy-head .furn-wallet { margin: 0; }
.shop-buy-head button { margin-left: auto; }
.shop-item-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--card-solid, #fbf4e6);
  box-shadow: 0 3px 0 var(--ink); flex-wrap: wrap;
}
.shop-item-overlay {
  position: absolute; left: 50%; bottom: 158px; transform: translateX(-50%);
  z-index: 6; width: min(400px, calc(100% - 20px));
  max-height: calc(100% - 176px); overflow: auto;
  display: none;
}
.shop-item-overlay.show { display: block; }
.shop-item-overlay .shop-item-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
  gap: 8px 10px; position: relative; background: #fbf4e6;
  box-shadow: 0 4px 0 var(--ink), 0 12px 26px rgba(34, 23, 15, 0.24);
}
.shop-item-close { position: absolute; top: 6px; right: 6px; }
.shop-item-close button {
  width: 32px; height: 32px; min-height: 32px; padding: 0;
  border-radius: 999px; font-size: 1.1rem; line-height: 1;
}
.shop-item-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.shop-item-actions button { flex: 1 1 120px; }
.shop-item-card > button { flex: none; }
.shop-item-copy { display: grid; gap: 2px; flex: 1 1 180px; min-width: 0; }
.shop-item-copy h3 { margin: 0; font-family: var(--serif); }
.shop-item-card > button { flex: none; }
.shop-card .furn-own-list { margin-bottom: 4px; }
.furn-manage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.furn-manage-actions button { flex: 1 1 160px; }
.furn-own.is-pending { border-style: dashed; }
@media (max-width: 620px) {
  .furn-own { grid-template-columns: auto 1fr; grid-auto-flow: row; }
  .furn-own select, .furn-own button { grid-column: span 1; }
}
@media (min-width: 900px) {
  .barri-sheet { width: 100%; max-width: none; }
  .local-in { width: 100%; max-width: none; }
  .act-panel-card.local-card { width: 100%; max-width: none; }
  .local-stage { width: 100%; max-width: none; }
}

/* Cartes en joc: bonificacions i penalitzacions que la colla porta a sobre */
.card-fx {
  margin: 12px 0;
  padding: 10px 12px 12px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: var(--card-solid, #fbf4e6);
  box-shadow: 0 3px 0 rgba(34, 23, 15, 0.22);
}
.card-fx header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-fx h3 { margin: 0; font-family: var(--serif); font-size: 1.02rem; }
.fx-count {
  min-width: 26px; height: 26px; padding: 0 8px;
  display: grid; place-items: center;
  font-size: 0.82rem; font-weight: 750;
  border: 2px solid var(--ink); border-radius: 999px;
  background: #fffaf2;
}
.fx-total { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 3px; }
.card-fx .fx-none { margin: 6px 0 0; font-size: 0.86rem; }
.fx-group {
  margin: 10px 0 5px;
  font-size: 0.73rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.fx-group.good { color: var(--green, #1d6a42); }
.fx-group.bad { color: var(--red, #b4232c); }
.card-fx ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fx-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(34, 23, 15, 0.22);
}
.fx-row:first-child { border-top: 0; padding-top: 0; }
.fx-ico {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 10px;
  background: var(--gold-soft, #f6e3b8);
}
.fx-row.bad .fx-ico { background: #f6d9d2; }
.fx-ico svg { width: 24px; height: 24px; display: block; }
.fx-text { min-width: 0; display: grid; gap: 1px; }
.fx-text b { font-size: 0.9rem; line-height: 1.15; }
.fx-text em { font-style: normal; font-size: 0.73rem; color: var(--soft, #6b5b4b); }
.fx-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.fx-chip {
  padding: 2px 7px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-size: 0.71rem; font-weight: 700;
  white-space: nowrap;
}
.fx-chip.good { color: var(--green, #1d6a42); background: rgba(46, 120, 70, 0.1); }
.fx-chip.bad { color: var(--red, #b4232c); background: rgba(180, 35, 44, 0.08); }
.fx-chip.flat { color: var(--soft, #6b5b4b); }

/* A la diada, «Cartes en joc» és una pastilla plegada a la cantonada de baix a
   l'esquerra (al costat de «Salta la resta»): només el títol, el nombre i el total.
   Tocant-la s'obre la llista, translúcida i baixa, perquè el castell es vegi. */
.diada .card-fx.compact {
  position: absolute; left: 12px; bottom: 12px; top: auto; right: auto; z-index: 3;
  margin: 0; padding: 0;
  width: auto; max-width: min(340px, calc(100% - 150px));
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 3px 0 rgba(34, 23, 15, 0.3);
}
.diada .card-fx.compact > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  padding: 6px 10px; min-height: 36px;
}
.diada .card-fx.compact > summary::-webkit-details-marker { display: none; }
.diada .card-fx.compact > summary::after { content: '▴'; font-size: 0.7rem; margin-left: auto; opacity: 0.7; }
.diada .card-fx.compact[open] > summary::after { content: '▾'; }
.diada .card-fx.compact h3 { font-size: 0.86rem; margin: 0; }
.diada .card-fx.compact .fx-count { min-width: 20px; height: 20px; padding: 0 6px; font-size: 0.72rem; border-width: 1.5px; }
.diada .card-fx.compact .fx-total { margin: 0; gap: 3px; }
.diada .card-fx.compact[open] > summary .fx-total { display: none; }
.diada .card-fx.compact .fx-body {
  max-height: min(34vh, 230px); overflow: auto;
  padding: 0 10px 8px; border-top: 1px dashed rgba(34, 23, 15, 0.25);
}
.diada .card-fx.compact .fx-body .fx-total { margin: 6px 0 2px; }
.diada .card-fx.compact .fx-none { margin: 0; padding: 0 10px 8px; font-size: 0.74rem; }
.diada .card-fx.compact .fx-group { margin: 6px 0 3px; font-size: 0.64rem; }
.diada .card-fx.compact .fx-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px; padding-top: 4px; }
.diada .card-fx.compact .fx-ico { width: 24px; height: 24px; border-radius: 7px; }
.diada .card-fx.compact .fx-ico svg { width: 18px; height: 18px; }
.diada .card-fx.compact .fx-text b { font-size: 0.8rem; }
.diada .card-fx.compact .fx-text em { font-size: 0.66rem; }
.diada .card-fx.compact .fx-chip { padding: 1px 5px; font-size: 0.64rem; }
@media (max-width: 720px) {
  .diada .card-fx.compact { left: 10px; bottom: 10px; max-width: calc(100% - 168px); }
  .diada .card-fx.compact[open] { max-width: calc(100% - 20px); bottom: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  .card-fx, .fx-row, .fx-chip { transition: none; }
}

/* ----- El local de la colla: escena, editor i vot de diumenge ----- */
.local-box {
  margin: 14px 0 10px;
  padding: 10px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fffaf2;
}
.home-local { margin: 12px 0; }
.home-local .local-pay { font-size: 0.82rem; margin: 4px 0; }
.local-catalog li.off { opacity: 0.78; }
.local-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.local-head h3 { font-size: 1rem; margin: 0; }
.local-charm { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; font-weight: 640; color: var(--soft); white-space: nowrap; }
.local-charm-ico { width: 14px; height: 14px; flex: none; fill: #e0b03a; }
.local-scene {
  position: relative; margin: 8px 0 6px; aspect-ratio: 16 / 9;
  border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: #f2e2c8;
}
.local-scene .local-svg { display: block; width: 100%; height: 100%; }
.l3d-people { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.l3d-person { position: absolute; width: clamp(52px, 11%, 76px); height: clamp(80px, 24%, 132px); filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.35)); transform-origin: 50% 100%; animation: l3d-walk-a 10s ease-in-out infinite alternate; }
.l3d-person.walk-b { animation-name: l3d-walk-b; animation-timing-function: ease-in-out; }
.l3d-person.walk-c { animation-name: l3d-walk-c; animation-timing-function: linear; }
.l3d-person.resting { animation-play-state: paused; }
.l3d-person-fallback { position: absolute; inset: 0; }
.l3d-person-fallback svg { display: block; width: 100%; height: 100%; }
.l3d-person-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.l3d-person.has3d .l3d-person-fallback { display: none; }
@keyframes l3d-walk-a {
  0% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(var(--dx), calc(var(--dy) * -1)) rotate(var(--rot)); }
  100% { transform: translate(calc(var(--dx) * -0.5), 0) rotate(0); }
}
@keyframes l3d-walk-b {
  0% { transform: translate(0, 0) rotate(0); }
  35% { transform: translate(calc(var(--dx) * 0.7), calc(var(--dy) * -0.6)) rotate(calc(var(--rot) * -1)); }
  70% { transform: translate(calc(var(--dx) * -0.8), 0) rotate(0); }
  100% { transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * -0.4)) rotate(var(--rot)); }
}
@keyframes l3d-walk-c {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * -1)) rotate(var(--rot)); }
  60% { transform: translate(calc(var(--dx) * -0.9), 0) rotate(0); }
  100% { transform: translate(calc(var(--dx) * 0.2), calc(var(--dy) * -0.5)) rotate(calc(var(--rot) * -0.5)); }
}
@media (prefers-reduced-motion: reduce) { .l3d-person { animation: none; } }
.local-scene.editable { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.local-scene.editable .local-svg { touch-action: none; }
.local-scene.editable g.lu { cursor: grab; }
.local-scene.editable g.lu:active { cursor: grabbing; }
.local-bare { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.78rem; color: var(--soft); text-shadow: 0 1px 0 #fff; }
.decor-ico { display: block; width: 100%; height: 100%; }
.local-sets { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.local-sets .tag { font-size: 0.68rem; }
.local-sets .tag.done { background: var(--green); border-color: var(--green); color: #fff; }
.unsaved { color: var(--red-deep); }
/* Editor del local */
.local-editor { display: grid; gap: 8px; margin: 8px 0; }
.ed-panel { padding: 8px; border: 1.5px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.6); display: grid; gap: 6px; }
.ed-title { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.ed-title strong { font-size: 0.86rem; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ed-label { min-width: 58px; font-size: 0.72rem; font-weight: 640; color: var(--soft); }
.ed-hint { margin: 0; font-size: 0.78rem; }
.ed-panel button { padding: 5px 9px; font-size: 0.76rem; min-height: 32px; }
.ed-panel button.on { background: var(--ink); color: #fffaf2; }
.mv-pad, .seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.mv-pad .mv { width: 38px; min-height: 36px; font-size: 1rem; padding: 0; }
.sws { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-panel .sw { width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; border: 2px solid rgba(34, 23, 15, 0.35); }
.ed-panel .sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fffaf2, 0 0 0 4px var(--gold); }
.ed-stored { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ed-stored li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 0.8rem; }
.ed-stored .local-ico { width: 26px; height: 26px; }
.local-actions.sticky { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 0; background: #fffaf2; }
.shop-title { margin: 12px 0 4px; font-size: 0.92rem; }
.local-points b { color: var(--accent, #b4472b); }
.room-stat .local-points { font-weight: 640; margin: 2px 0 6px; }
.resum .local-gain { font-size: 0.82rem; font-weight: 640; margin: 4px 0 0; }
/* Botiga per col·leccions */
.set-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: thin; }
.set-tab { flex: 0 0 auto; padding: 5px 9px; font-size: 0.74rem; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; white-space: nowrap; }
.set-tab small { font-size: 0.66rem; color: var(--soft); }
.set-tab.on { background: var(--ink); color: #fffaf2; }
.set-tab.on small { color: #f2e2c8; }
.set-tab.done { border-color: var(--green); }
.set-tab.done small { color: var(--green); font-weight: 700; }
.set-tab.on.done small { color: #9fe0b8; }
.set-note { margin: 2px 0 0; font-size: 0.72rem; color: var(--soft); }
.set-note.done { color: var(--green); font-weight: 640; }
.unit-n { font-weight: 500; color: var(--soft); font-size: 0.7rem; }
.local-box, .local-shop, .local-editor, .ed-panel, .set-tabs { min-width: 0; max-width: 100%; box-sizing: border-box; }
.ed-title > * { min-width: 0; }
@media (min-width: 900px) {
  .home-local.editing .local-editor { grid-template-columns: 1fr 1fr; }
}
.local-count { margin: 0; font-size: 0.76rem; color: var(--soft); }
.local-hint { margin: 4px 0 0; font-size: 0.74rem; }
.local-actions { margin: 8px 0 0; }
.local-actions button { width: 100%; }
.local-catalog { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.local-catalog li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px; border: 1.5px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.55); }
.local-catalog li.owned { background: rgba(29, 106, 66, 0.08); }
.local-ico { width: 30px; height: 30px; color: var(--ink); }
.local-ico svg { width: 100%; height: 100%; }
.local-item { display: grid; gap: 1px; min-width: 0; }
.local-item strong { font-size: 0.82rem; }
.local-item small { font-size: 0.7rem; color: var(--soft); line-height: 1.25; }
.local-catalog button { padding: 5px 8px; font-size: 0.74rem; }
.local-catalog .tag.done { background: var(--green); border-color: var(--green); color: #fff; }

/* El vot de diumenge: 3, 2 i 1 punts a tres locals */
.local-vote { margin: 12px 0; padding: 12px; border: 2px solid var(--ink); border-radius: 14px; background: #fffaf2; }
.local-vote h3 { margin: 0 0 6px; font-size: 1.05rem; }
.local-vote-note { font-size: 0.8rem; font-weight: 640; margin: 6px 0; color: var(--red-deep); }
.local-vote-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.local-vote-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 6px 8px; align-items: center; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); }
.local-vote-card.voted { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224, 176, 58, 0.35); }
.local-vote-card .local-scene { grid-column: 1 / -1; margin: 0; border-width: 1.5px; }
.local-scene.mini .local-bare { font-size: 0.58rem; text-align: center; padding: 0 4px; }
.local-vote-info { grid-column: 1; display: grid; gap: 1px; min-width: 0; }
.local-vote-info strong { font-size: 0.84rem; }
.local-vote-info small { font-size: 0.7rem; color: var(--soft); }
.vote-pts { grid-column: 2; display: flex; gap: 4px; }
.vote-pt { width: 30px; height: 28px; padding: 0; border-radius: 8px; border: 1.5px solid var(--ink); background: #fff; font-weight: 700; font-size: 0.8rem; }
.vote-pt.on { background: var(--gold); color: var(--ink); box-shadow: inset 0 0 0 2px #fffaf2; }

/* El resultat del premi */
.local-result { margin: 12px 0; padding: 12px; border: 2px solid var(--ink); border-radius: 14px; background: #fffaf2; }
.local-result h3 { font-size: 1rem; margin: 0 0 6px; }
.local-winner { margin: 0 0 6px; }
.local-tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 0.82rem; }
.local-tally li { display: flex; justify-content: space-between; gap: 8px; }
.rank-best { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 0.68rem; font-weight: 700; vertical-align: 1px; }

@media (max-width: 720px) {
  .local-vote-list { grid-template-columns: 1fr; }
}
/* Limits de lligues: 3 alhora, 1 nova per setmana */
.room-limit { margin: 6px 0 8px; font-size: 0.8rem; font-weight: 640; color: var(--soft); }
.room-limit.full { color: var(--red-deep); }
.rooms-create { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); display: grid; gap: 6px; }
.rooms-create button { justify-self: start; }
.rooms-back { margin-bottom: 4px; }
/* Els meus castellers: the account roster */
.castellers-box { display: grid; gap: 6px; }
.casteller-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 0; }
.casteller-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 2px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; row-gap: 6px;
}
.casteller-row:last-child { border-bottom: 0; }
.casteller-thumb {
  flex: none;
  display: block;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--red);
  background: #efe8dc;
  box-shadow: 0 1px 0 rgba(36, 25, 16, 0.18);
}
.casteller-thumb svg { display: block; width: 100%; height: 100%; }
.casteller-thumb.tronc { border-color: var(--loaded); }
.casteller-thumb.canalla { border-color: #3b6fa8; }
.casteller-thumb.tecnica { border-color: var(--green); }
.casteller-thumb.graller { border-color: var(--gold); }
@media (max-width: 520px) {
  .casteller-thumb { width: 1.9rem; height: 1.9rem; }
}
.casteller-name { flex: 1 1 auto; font-weight: 640; overflow-wrap: anywhere; }
.casteller-role { flex: none; font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--soft); }
.casteller-del { flex: none; padding: 3px 9px; font-size: 0.78rem; }
.casteller-confirm { flex: none; font-size: 0.78rem; font-weight: 640; color: var(--red-deep); }
.casteller-row.confirming { flex-wrap: wrap; row-gap: 6px; }
.casteller-row.confirming .casteller-role { display: none; }
.casteller-del.on { border-color: var(--red-deep); background: var(--red-deep); color: #fffaf2; }
/* A member sees the colla but only the cap de colla makes the daily choices. */
#stage.member .actions,
#stage.member .catalog,
#stage.member #hurry,
#stage.member .sess-spend,
#stage.member .free-play { display: none; }
/* The graller's own song is played by the graller, so it stays visible. */
#stage.member .assaig-gralla .free-play { display: block; }
/* Every member votes on the local chores, so these buttons stay visible. */
#stage.member .actions.local-actions { display: grid; }
#stage.member .member-note { margin: 8px 0; }
.casteller-invite-box { margin: 8px 0; padding: 10px; border: 1.5px dashed var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.5); }
.casteller-invite-code { display: flex; gap: 6px; align-items: center; }
.casteller-invite-code input { flex: 1 1 auto; min-width: 0; font-family: var(--mono, monospace); font-size: 0.78rem; }
.casteller-invite-code button { flex: none; }
.casteller-invite-join { margin: 8px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; display: grid; gap: 6px; background: rgba(255, 255, 255, 0.55); }
.casteller-invite-join label { display: grid; gap: 3px; font-size: 0.8rem; font-weight: 640; }
.casteller-invite-join input { font-family: var(--mono, monospace); font-size: 0.78rem; }
.casteller-invite-join button { justify-self: start; }
.casteller-row.occupied .casteller-name { font-weight: 700; }
.casteller-row.own .casteller-name { text-decoration: underline; text-underline-offset: 2px; }
.casteller-points { font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border: 1px solid #e0b03a; border-radius: 999px; background: #fff3c4; white-space: nowrap; }
.casteller-notify.on { border-color: #e0b03a; background: #fff3c4; }
.casteller-notify-form { flex-basis: 100%; display: flex; align-items: center; gap: 6px; }
.casteller-notify-form input { flex: 1; min-width: 0; }
.casteller-3d-card { max-width: 460px; }
.casteller-3d-card .casteller-look-stage { height: clamp(300px, 52vh, 440px); }
#casteller-3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#casteller-3d-canvas:active { cursor: grabbing; }
.casteller-requests { margin: 8px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.65); }
.casteller-requests h3 { margin: 0 0 6px; font-size: 0.9rem; }
.casteller-requests ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.casteller-request { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; }
.casteller-request .casteller-name { font-weight: 700; }
.casteller-request .casteller-role { flex: 1 1 100px; }
.casteller-request button { padding: 3px 9px; font-size: 0.78rem; }
.colles-pending { margin: 8px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.65); display: grid; gap: 6px; }
.colles-pending p { margin: 0; font-weight: 640; }
.colles-pending button { justify-self: start; }
.home-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.home-tools .room-actions { margin: 0; }
.home-tools .handbook-row { margin: 0; }
.account-email {
  margin: 8px 0; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.55); display: grid; gap: 2px;
}
.account-email span { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.account-email b { font-weight: 640; overflow-wrap: anywhere; }
.account-email small { font-size: 0.72rem; }
.account-admin-row { margin: 8px 0; }
.account-admin {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; color: var(--ink); font-weight: 700; text-decoration: none;
}
.account-name { margin: 8px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); display: grid; gap: 6px; }
.account-name label { display: grid; gap: 3px; font-size: 0.8rem; font-weight: 640; }
.account-name button { justify-self: start; }
.account-points { margin: 0; font-weight: 700; }
.account-look { margin: 10px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.account-look-copy { display: grid; gap: 2px; flex: 1 1 140px; min-width: 0; }
.account-look .casteller-thumb { width: 56px; height: 56px; flex: none; }
.account-look button { flex: none; }
.account-colla { margin: 10px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); display: grid; gap: 3px; }
.account-music { margin: 10px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); display: grid; gap: 6px; }
.account-music-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-music-head span { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.account-music .look-range { display: flex; align-items: center; gap: 8px; }
.account-music input[type="range"] { flex: 1 1 auto; }
.account-music output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.account-music small { font-size: 0.72rem; }
.account-colla span { font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.account-colla b { font-weight: 700; }
.account-colla-meta { margin: 0; font-size: 0.82rem; color: var(--soft); font-weight: 600; }
.account-colla-confirm { margin: 8px 0; padding: 10px; border: 1.5px solid var(--red-deep); border-radius: 12px; background: rgba(180, 35, 44, 0.06); }
.account-colla-confirm p { margin: 0 0 8px; }
.account-colles { margin: 10px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); }
.account-colles h3 { margin: 0 0 4px; }
.local-vote-board { margin: 10px 0; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.55); display: grid; gap: 6px; }
.local-vote-board h3 { margin: 0; }
.local-vote-tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px; }
.local-vote-task { display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.local-vote-task.on { background: var(--ink); color: var(--paper); }
.local-vote-task.used { opacity: 0.5; }
.local-vote-task small { opacity: 0.7; }
.local-actions .act.act-row:hover:not(:disabled) { background: var(--card-solid); color: var(--ink); }
.local-actions .act.act-row.on, .local-actions .act.act-row.on:hover:not(:disabled) { background: #fff3c4; color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 2px #e0b03a; }
.local-vote-count { font-style: normal; font-size: 0.72rem; font-weight: 700; opacity: 0.65; }
.local-vote-people { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 3px; font-size: 0.82rem; }
.local-vote-people li { display: flex; gap: 6px; flex-wrap: wrap; }
.casteller-confirm { margin: 8px 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.7); display: grid; gap: 6px; }
.casteller-confirm p { margin: 0; font-weight: 640; }
.casteller-leave-row { margin-top: 10px; }
.casteller-leave-row button { justify-self: start; }
.colla-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.colla-row { display: grid; gap: 5px; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.55); }
.colla-copy { display: grid; gap: 2px; min-width: 0; }
.colla-copy strong { overflow-wrap: anywhere; }
.colla-copy .muted, .colla-free { font-size: 0.8rem; }
.colla-free { overflow-wrap: anywhere; }
.colla-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.colla-role { padding: 3px 9px; font-size: 0.78rem; }
.colla-full { color: var(--ink); opacity: 0.65; font-weight: 700; }
.colla-create { display: grid; gap: 6px; margin: 8px 0; }
.colla-create label { display: grid; gap: 3px; font-size: 0.8rem; font-weight: 640; }
.colla-create select { min-height: 42px; padding: 8px 10px; border: 1.5px solid var(--ink); border-radius: 10px; background: #fffdf7; font: inherit; }
.diada-names { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.diada-colla { display: inline-block; padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--line, #d8c7a8); background: rgba(255, 255, 255, 0.65); font-size: 0.78rem; font-weight: 650; }
.admin-role-player { margin-left: 6px; font-size: 0.82rem; font-weight: 700; color: #3f6fa8; }
.admin-reassign { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: 6px; }
.admin-role-pick { min-height: 30px; padding: 2px 6px; font: inherit; font-size: 0.78rem; border: 1.5px solid var(--ink); border-radius: 8px; background: #fffdf7; max-width: 118px; }
.casteller-add { margin-top: 10px; display: grid; gap: 8px; }
.casteller-look-btn { flex: none; padding: 3px 9px; font-size: 0.78rem; }
/* Editor 3D de l'aspecte (casteller3d.js) */
.casteller-look {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  background: rgba(36, 25, 16, 0.55);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.casteller-look-card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: #fffaf2;
  box-shadow: 8px 8px 0 rgba(36, 25, 16, 0.18);
}
.casteller-look-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.casteller-look-top h2 { margin: 0; font-family: var(--serif); font-size: clamp(1.2rem, 4vw, 1.6rem); line-height: 1.1; }
.casteller-look-stage {
  position: relative;
  height: clamp(240px, 42vh, 360px);
  flex: none;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: radial-gradient(80% 70% at 50% 18%, #fff8ea 0%, #f0dfc4 56%, #e3c9a4 100%);
}
.casteller-look-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(36, 25, 16, 0.11) 1px, transparent 1.2px);
  background-size: 8px 8px;
}
#casteller-look-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#casteller-look-canvas:active { cursor: grabbing; }
.casteller-look-hint {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 6px;
  margin: 0;
  pointer-events: none;
  font-size: 0.66rem;
  line-height: 1.2;
  color: var(--soft);
}
.casteller-look-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.casteller-look-tabs button {
  padding: 5px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 640;
}
.casteller-look-tabs button.on { border-color: var(--ink); background: var(--ink); color: #fffaf2; }
.casteller-look-body { display: grid; gap: 2px; }
.look-group { display: grid; gap: 5px; margin-bottom: 7px; }
.look-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.look-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.look-swatch {
  width: 31px;
  height: 31px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: none;
}
.look-swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; }
.look-swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold); }
.look-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.look-chips button {
  padding: 4px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.78rem;
}
.look-chips button.on { border-color: var(--ink); background: var(--gold); color: var(--ink); }
.look-range { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; }
.look-range input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--red); }
.look-range output { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; font-size: 0.85rem; }
.casteller-look-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.casteller-look-actions button { padding: 6px 14px; border-radius: 12px; font-weight: 640; }
.casteller-look-body .notice { margin: 4px 0; }
@media (max-width: 720px) {
  .casteller-look-card { padding: 12px; gap: 8px; border-radius: 18px; }
  .casteller-look-stage { height: clamp(220px, 40vh, 320px); }
  .casteller-look-actions { justify-content: stretch; }
  .casteller-look-actions button { flex: 1 1 auto; }
}
/* Vista 3D del castell (tower3d.js) */
.preview-wrap { position: relative; }
canvas.tower-3d { touch-action: pan-y; cursor: grab; }
canvas.tower-3d:active { cursor: grabbing; }
.mine-handbook { margin: 12px 0 4px; }

/* Apostes de la diada */
.apostes { margin: 14px 0; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.55); }
.apostes h3 { margin: 0 0 4px; }
.apostes h4 { margin: 12px 0 6px; font-size: 0.95rem; }
.apostes h4 small { font-weight: 500; color: var(--muted, #7a6a5a); }
.apostes .bet-head { margin: 6px 0; font-size: 0.85rem; }
.bet-colla ul, .bet-positions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bet-colla.own { opacity: 0.6; }
.bet-market { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.7); }
.bet-name { font-size: 0.9rem; }
.bet-outs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bet-out { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 10px; font-size: 0.75rem; line-height: 1.15; }
.bet-out b { font-size: 1rem; }
.bet-out.o0 { border-color: #2f7d4f; color: #2f7d4f; }
.bet-out.o1 { border-color: #b27a12; color: #8a5d0b; }
.bet-out.o2 { border-color: #b4472b; color: #b4472b; }
.bet-out.on { background: currentColor; }
.bet-out.on span, .bet-out.on b { color: #fff; }
.bet-out:disabled { opacity: 0.55; }
.bet-buy { display: grid; gap: 6px; }
.bet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bet-chip { min-width: 44px; padding: 4px 8px; border-radius: 999px; font-size: 0.8rem; }
.bet-chip.on { background: var(--ink, #222); color: #fff; }
.bet-buy small { font-size: 0.78rem; color: var(--muted, #7a6a5a); }
.bet-positions li { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; }
.bet-win { color: #2f7d4f; }
.bet-lost { color: #b4472b; }
.bet-empty { font-size: 0.82rem; padding: 4px 2px; }
/* Colla card: pick any colla of the league */
/* Colla selector: the chips wrap onto more rows, so every colla can be reached with
   a mouse on desktop too (a sideways row could not be scrolled without touch). */
.side-colles { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; margin-bottom: 6px; }
.side-colla { flex: 0 1 auto; max-width: 100%; min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
.side-colla > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.side-colla .side-escut, .side-colla .side-dot { flex: none; }
.side-colla.on { background: var(--ink, #222); color: #fff; }
.side-dot { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.side-escut svg { display: block; }
.bet-top { display: flex; align-items: center; gap: 10px; }
.bet-top .bet-name { flex: 0 0 auto; }
.bet-dom { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.bet-dom .dom { flex: 1 1 auto; margin: 0; }
.bet-dom small { flex: none; font-size: 0.75rem; font-weight: 640; min-width: 2ch; text-align: right; }

/* Floating panels (Apostes de la diada, Millor local): opened from buttons on the
   Sunday screen; they close only with ×. Same overlay and card as the handbook. */
.float-card { padding: 18px; }
.float-card .handbook-top { align-items: center; margin-bottom: 6px; }
.float-card h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
/* Close: a 40px tinted circle with a centred SVG ×, inside a 44px tap area. */
.float-x {
  flex: none; align-self: center; width: 44px; height: 44px; margin: 0 -4px 0 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink, #241910);
  line-height: 1; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.float-x-dot {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(36, 25, 16, 0.08); transition: background 0.15s ease, transform 0.1s ease;
}
.float-x svg { display: block; }
.float-x:hover .float-x-dot { background: rgba(36, 25, 16, 0.15); }
.float-x:active .float-x-dot { background: rgba(36, 25, 16, 0.22); transform: scale(0.94); }
.float-x:focus-visible { outline: none; }
.float-x:focus-visible .float-x-dot { outline: 3px solid var(--gold); outline-offset: 2px; }
.float-body .apostes { margin: 0; padding: 0; border: 0; background: none; }
.float-body .local-vote { margin: 0; }
.float-btns { display: grid; gap: 10px; margin: 14px 0; }
.float-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px 16px; border-radius: 16px; font-size: 1.05rem; font-weight: 680; text-align: left; box-shadow: 4px 4px 0 rgba(36, 25, 16, 0.16); }
.float-btn small { flex: none; font-size: 0.8rem; font-weight: 640; padding: 3px 9px; border-radius: 999px; background: var(--gold, #e0b03a); color: var(--ink, #241910); }
.float-btn small.done { background: rgba(47, 125, 79, 0.16); color: #2f7d4f; }
.ronda-empty-warn { margin: 8px 0; padding: 8px 10px; border: 1.5px solid #b4472b; border-radius: 12px; background: rgba(180, 71, 43, 0.08); color: #8f3420; font-size: 0.85rem; font-weight: 640; }
.resum .sat-out { opacity: 0.7; }

/* Millora card: an «i» that opens what the card does (floating panel), and the
   note under a castell in the diada summary. */
.boon-card { position: relative; }
.boon-i {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: 6px 0 0 auto; padding: 0; border: 0; background: transparent;
  -webkit-appearance: none; appearance: none;
  font: italic 700 1rem/1 Georgia, 'Times New Roman', serif; color: var(--ink, #241910); -webkit-tap-highlight-color: transparent;
}
.boon-i::before {
  content: ''; position: absolute; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--ink, #241910); background: #fffaf2; z-index: -1;
}
.boon-i { z-index: 1; isolation: isolate; }
.boon-i:active::before { background: rgba(36, 25, 16, 0.12); }
.boon-info { font-size: 1rem; line-height: 1.45; margin: 4px 0 0; }
.boon-note { display: block; font-size: 0.75rem; font-weight: 640; color: #8f3420; }
.boon-note.back { color: #2f7d4f; }

/* Apostes: a castell with a millora card reserved (a second chance if it falls). */
.bet-second {
  display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 2px; min-height: 32px; padding: 4px 10px;
  border: 1.5px solid #2f7d4f; border-radius: 999px; background: rgba(47, 125, 79, 0.1); color: #22603b;
  font-size: 0.8rem; font-weight: 680; -webkit-appearance: none; appearance: none;
}
.bet-second i {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid currentColor; font: italic 700 0.72rem/1 Georgia, serif;
}
.bet-second-info { margin: 4px 0 6px; padding: 8px 10px; border-radius: 10px; background: rgba(47, 125, 79, 0.08); font-size: 0.82rem; line-height: 1.4; }
.bet-market .bet-second { width: auto; max-width: 100%; align-self: flex-start; justify-self: start; }

/* Left panel: the colla's castells for the diada, once chosen (rivals: once public). */
.side-ronda { margin: 10px 0 4px; }
.side-ronda h4 { margin: 0 0 6px; font-size: 0.85rem; }
.side-ronda ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.side-ronda li { font-size: 0.82rem; }
.side-ronda li > * { vertical-align: middle; }
.side-ronda li { display: list-item; }
.side-ronda-name { display: inline-block; min-width: 5.5em; font-weight: 640; margin-right: 6px; }
.side-ronda .bet-dom { display: inline-flex; width: calc(100% - 7em); max-width: 140px; }

/* Pilar al pati: the end screen with the result (won or lost). */
.pati-result { margin: 12px 0; padding: 16px 18px; border: 2px solid var(--ink, #241910); border-radius: 16px; background: #fffaf2; text-align: center; box-shadow: 4px 4px 0 rgba(36, 25, 16, 0.16); }
.pati-result.win { border-color: #2f7d4f; background: rgba(47, 125, 79, 0.1); }
.pati-result.miss { border-color: #b4472b; background: rgba(180, 71, 43, 0.08); }
.pati-result-kicker { margin: 0 0 4px; font-size: 0.72rem; font-weight: 680; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.pati-result h3 { margin: 2px 0 8px; font-size: clamp(1.6rem, 5vw, 2.1rem); }
.pati-result.win h3 { color: #22603b; }
.pati-result.miss h3 { color: #8f3420; }
.pati-result-score { margin: 0 0 6px; font-size: 0.95rem; }
.pati-result-score b { font-size: 1.15rem; }
.pati-result-reward { margin: 6px 0 0; font-weight: 640; }
.pati-result .tier { margin: 6px auto; }

/* Lobby: a league the account left this week (it can join again next week). */
.room-left-note { margin: 4px 0 6px; padding: 6px 10px; border-left: 3px solid #b4472b; border-radius: 6px; background: rgba(180, 71, 43, 0.08); font-size: 0.86rem; }

/* ---- 3D activity art (actArt -> art3d in client.js): shared building blocks ---- */
.a3d { width: 180px; max-width: 100%; height: 108px; display: grid; place-items: center; perspective: 520px; perspective-origin: 50% 28%; }
.a3d-stage { position: relative; width: 120px; height: 92px; transform-style: preserve-3d; }
.a3d-stage * { transform-style: preserve-3d; }
.a3d-shadow { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 12px; border-radius: 50%; background: radial-gradient(closest-side, rgba(34, 23, 15, 0.3), rgba(34, 23, 15, 0)); transform-style: flat; }
.a3d-group { position: absolute; left: 0; right: 0; bottom: 0; height: 92px; }
.a3d-box { position: absolute; width: var(--w); height: var(--h); }
.a3d-f { position: absolute; box-sizing: border-box; border: 2px solid #22170f; background: var(--c); backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: flat; }
.a3d-thin .a3d-f, .a3d-thin.a3d-f { border-width: 1.5px; }
.a3d-front, .a3d-back { left: 0; top: 0; width: var(--w); height: var(--h); }
.a3d-front { transform: translateZ(calc(var(--d) / 2)); }
.a3d-back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); filter: brightness(0.82); }
.a3d-left, .a3d-right { top: 0; left: calc((var(--w) - var(--d)) / 2); width: var(--d); height: var(--h); filter: brightness(0.86); }
.a3d-left { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.a3d-right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.a3d-top, .a3d-bottom { left: 0; top: calc((var(--h) - var(--d)) / 2); width: var(--w); height: var(--d); }
.a3d-top { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); filter: brightness(1.06); }
.a3d-bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); filter: brightness(0.7); }
.a3d-front svg { display: block; width: 100%; height: 100%; }
/* Coin */
.a3d-coin { position: absolute; width: 26px; height: 26px; --metal: radial-gradient(circle at 34% 30%, #ffe9a3, #f2b632 46%, #c98e1c 100%); --edge: #b8861e; }
.a3d-coin.is-silver { --metal: radial-gradient(circle at 34% 30%, #ffffff, #cfd6dd 50%, #95a0aa 100%); --edge: #8a949d; }
.a3d-coin.is-copper { --metal: radial-gradient(circle at 34% 30%, #f3c39a, #b87333 52%, #8a5122 100%); --edge: #7e4a20; }
.a3d-coin-spin { position: absolute; inset: 0; animation: a3d-spin 3.2s linear infinite; }
.a3d-rim { position: absolute; inset: 0; border-radius: 50%; background: var(--edge); border: 2px solid #22170f; transform: translateZ(var(--z, 0)); }
.a3d-coin-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; border: 2px solid #22170f; background: var(--metal); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.a3d-coin-face svg { width: 70%; height: 70%; }
.a3d-coin-front { transform: translateZ(2.4px); }
.a3d-coin-back { transform: rotateY(180deg) translateZ(2.4px); }
/* Casteller and pilar */
.a3d-person { position: absolute; width: calc(16px * var(--k)); height: calc(25px * var(--k)); }
.a3d-person .a3d-body { left: 0; bottom: 0; }
.a3d-person .a3d-head { left: calc(3px * var(--k)); bottom: calc(15px * var(--k)); }
.a3d-faixa { position: absolute; left: 0; right: 0; bottom: 2px; height: 3px; background: #22170f; }
.a3d-pilar { position: absolute; width: 16px; height: 70px; }
.a3d-pilar .a3d-p1 { left: 0; bottom: 0; }
.a3d-pilar .a3d-p2 { left: 0; bottom: 25px; }
.a3d-pilar .a3d-p3 { left: 1.6px; bottom: 50px; }
/* Plate */
.a3d-plate { position: absolute; width: 60px; height: 60px; }
.a3d-disc { position: absolute; inset: 0; border-radius: 50%; background: var(--c); border: 2px solid #22170f; transform: rotateX(90deg) translateZ(var(--y)); }
.a3d-disc:last-child { background: radial-gradient(circle, #d58d4c 0 46%, var(--c) 48%); }
.a3d-sun { position: absolute; right: -14px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #f2b632; opacity: 0.9; transform-style: flat; }
/* Shared motions (transforms only) */
.a3d-sway { transform: rotateX(-12deg) rotateY(-24deg); animation: a3d-sway 7s ease-in-out infinite alternate; }
.a3d-float { animation: a3d-float 2.6s ease-in-out infinite; }
.a3d-turn { animation: a3d-spin 4.4s linear infinite; }
@keyframes a3d-sway { from { transform: rotateX(-12deg) rotateY(-30deg); } to { transform: rotateX(-12deg) rotateY(30deg); } }
@keyframes a3d-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes a3d-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
/* Banc */
.a3d-loan .lb-base { left: 16px; bottom: 12px; }
.a3d-loan .lb-body { left: 22px; bottom: 16px; }
.lb-ped { position: absolute; left: 20px; bottom: 55px; width: 80px; height: 16px; background: #22170f; clip-path: polygon(50% 0, 100% 100%, 0 100%); backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: flat; }
.lb-ped::after { content: ''; position: absolute; inset: 3px 6px 0; background: #b4232c; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lb-ped-f { transform: translateZ(14px); }
.lb-ped-b { transform: rotateY(180deg) translateZ(14px); }
.a3d-loan .lb-coin { position: absolute; left: 47px; top: -2px; width: 26px; height: 26px; transform: translateZ(10px); }
/* Dia lliure */
.a3d-free .fr-mug { left: 14px; bottom: 12px; }
.a3d-free .fr-handle { left: 34px; bottom: 19px; }
.a3d-free .fr-gralla { position: absolute; left: 44px; bottom: 14px; width: 9px; height: 40px; transform: rotateZ(-28deg); }
.a3d-free .fr-pipe { left: 2.5px; bottom: 6px; }
.a3d-free .fr-bell { left: 0; bottom: 0; }
.a3d-free .fr-pilar { left: 84px; bottom: 12px; }
.a3d-wobble { transform-origin: 50% 100%; animation: a3d-wobble 2.4s ease-in-out infinite; }
@keyframes a3d-wobble { 0%, 100% { rotate: z -3deg; } 50% { rotate: z 3deg; } }
/* Col·lecta */
.pu-tilt { transform: rotateX(-18deg) rotateY(-16deg); }
.pu-slide { position: absolute; left: 30px; bottom: 6px; width: 60px; height: 10px; animation: pu-slide 3.4s ease-in-out infinite alternate; }
.pu-plate { left: 0; bottom: -26px; }
@keyframes pu-slide { from { translate: -22px 0; } to { translate: 22px 0; } }
.a3d-fall { position: absolute; top: 0; width: 26px; height: 26px; animation: a3d-fall 2.4s ease-in infinite; }
.pu-f1 { left: 20px; animation-delay: 0s; }
.pu-f2 { left: 48px; animation-delay: -0.8s; }
.pu-f3 { left: 76px; animation-delay: -1.6s; }
@keyframes a3d-fall { 0% { translate: 0 -4px; opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { translate: 0 50px; opacity: 0; } }
/* Entrenament extra */
.a3d-extra .ex-mat { left: 30px; bottom: 10px; }
.a3d-extra .ex-pilar { left: 44px; bottom: 13px; }
.a3d-extra .ex-cap { left: 78px; bottom: 13px; }
.a3d-extra .ex-horn { left: 92px; bottom: 28px; }
.a3d-drill { animation: a3d-drill 1.8s ease-in-out infinite; }
@keyframes a3d-drill { 0%, 100% { translate: 0 0; } 40% { translate: 0 -6px; } 60% { translate: 0 -6px; } }
.a3d-call { transform-origin: 0 50%; animation: a3d-call 1.8s ease-in-out infinite; }
@keyframes a3d-call { 0%, 100% { rotate: z 0deg; } 50% { rotate: z -14deg; } }
/* Mercat */
.a3d-market .mk-counter { left: 25px; bottom: 12px; }
.a3d-market .mk-post-l { left: 25px; bottom: 36px; }
.a3d-market .mk-post-r { left: 92px; bottom: 36px; }
.a3d-market .mk-awning { left: 19px; bottom: 64px; }
.a3d-market .mk-c1 { position: absolute; left: 36px; bottom: 38px; width: 16px; height: 22px; }
.a3d-market .mk-c2 { position: absolute; left: 66px; bottom: 38px; width: 16px; height: 22px; animation-delay: -1.3s; }
.a3d-market .mk-c2 .a3d-turn { animation-delay: -2.2s; }
.mk-dot { position: absolute; left: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; }
.mk-line { position: absolute; left: 3px; right: 3px; top: 12px; height: 1.5px; background: #22170f; opacity: 0.5; }
.mk-stripe { position: absolute; left: 0; right: 0; top: 5px; height: 4px; background: #b4232c; opacity: 0.85; }
/* Sizes: same header box as the flat art */
.act-intro-art .a3d { width: 100%; }
@media (max-width: 680px) { .act-art .a3d { height: 96px; } }
/* Off-screen (IntersectionObserver) or reduced motion: no animation. */
.a3d.a3d-off * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .a3d * { animation: none !important; }
  .a3d .a3d-coin-spin { transform: rotateY(-28deg); }
  .a3d-fall { opacity: 1; }
  .pu-f1 { translate: 0 14px; } .pu-f2 { translate: 0 -2px; } .pu-f3 { translate: 0 24px; }
}

/* Mercat de cartes: the Cartes sheet shows it as an activity card with the 3D stall. */
.play-market .act-card { margin-top: 16px; }
.act-intro-art.is-market { background: linear-gradient(160deg, #efe6f7, #c9aede 72%); }
.market-panel .act-intro { margin-bottom: 10px; }

/* ---- El local in 3D (Decor.scene3dHtml): back wall, floor, side walls ---- */
.local-scene.l3d { --fit: 1; --ry: 0deg; background: linear-gradient(180deg, #3a2a1e, #5a4330 40%, #2f2218); }
.l3d-fit {
  position: absolute; left: 0; top: 0; width: 320px; height: 180px;
  transform: scale(var(--fit)); transform-origin: 0 0;
  perspective: 560px; perspective-origin: 50% -80%;
}
.l3d-room {
  position: absolute; left: 0; top: 0; width: 320px; height: 180px; transform-style: preserve-3d;
  transform-origin: 160px 122px -60px;
  transform: translateY(22px) translateZ(30px) rotateX(-4deg) rotateY(var(--ry));
  transition: transform 0.45s ease;
}
.l3d-room * { transform-style: preserve-3d; }
.l3d-back { position: absolute; left: 0; top: 0; width: 320px; height: 122px; transform: translateZ(-120px); }
.l3d-wallsvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.l3d-floor {
  position: absolute; left: 0; top: 122px; width: 320px; height: 120px;
  transform-origin: 50% 0; transform: translateZ(-120px) rotateX(90deg);
  background-color: var(--floor);
  box-shadow: inset 0 0 0 2px rgba(34, 23, 15, 0.35);
}
.l3d-floor.fl-fusta { background-image: repeating-linear-gradient(90deg, rgba(34, 23, 15, 0.22) 0 1px, transparent 1px 20px), repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 12px, rgba(34, 23, 15, 0.06) 12px 24px); }
.l3d-floor.fl-rajola { background-image: linear-gradient(90deg, rgba(34, 23, 15, 0.22) 1px, transparent 1px), linear-gradient(0deg, rgba(34, 23, 15, 0.22) 1px, transparent 1px); background-size: 20px 20px; }
.l3d-floor.fl-pedra { background-image: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.18) 0 6px, transparent 7px), radial-gradient(circle at 70% 70%, rgba(34, 23, 15, 0.16) 0 7px, transparent 8px); background-size: 26px 22px; }
.l3d-floor.fl-terratzo { background-image: radial-gradient(circle, rgba(194, 59, 46, 0.45) 0 1px, transparent 1.5px), radial-gradient(circle, rgba(42, 78, 138, 0.4) 0 1px, transparent 1.5px), radial-gradient(circle, rgba(34, 23, 15, 0.35) 0 0.8px, transparent 1.3px); background-size: 13px 11px, 17px 15px, 9px 7px; background-position: 0 0, 5px 3px, 2px 6px; }
.l3d-floor.fl-moqueta { background-image: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0 0.8px, transparent 1.2px); background-size: 6px 6px; }
.l3d-side { position: absolute; top: 0; width: 120px; height: 122px; background: var(--wall-d); box-shadow: inset 0 0 0 1.5px rgba(34, 23, 15, 0.3); }
.l3d-left { left: -120px; transform-origin: 100% 50%; transform: translateZ(-120px) rotateY(90deg); }
.l3d-right { left: 320px; transform-origin: 0 50%; transform: translateZ(-120px) rotateY(-90deg); }
.l3d-u { position: absolute; width: 0; height: 0; }
.l3d-spr { position: absolute; }
.l3d-spr svg { display: block; width: 100%; height: 100%; overflow: visible; }
.l3d-contact { position: absolute; left: 0; top: 0; height: 6px; transform: translate(-50%, -50%) translateZ(0.3px); border-radius: 50%; background: rgba(34, 23, 15, 0.28); }
.l3d-u.sel .l3d-spr { outline: 1.6px dashed #e0b03a; outline-offset: 2px; }
.local-scene.l3d.editable .l3d-u .l3d-spr { cursor: grab; }
.local-scene.l3d.editable .l3d-u:active .l3d-spr { cursor: grabbing; }
.l3d-turn { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; z-index: 2; }
.l3d-turn button {
  min-width: 38px; min-height: 38px; padding: 0; opacity: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 12px;
  background: linear-gradient(180deg, #fffaf2, #efe0c8);
  color: #2a1a12; font-size: 1.05rem; line-height: 1;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 4px 0 #8a5a2b,
    0 7px 12px rgba(36, 25, 16, 0.32);
  transform: translateY(0) perspective(240px) rotateX(9deg);
  transition: transform .06s ease, box-shadow .06s ease;
}
.l3d-turn button svg { width: 20px; height: 20px; display: block; }
.l3d-turn button:active {
  transform: translateY(4px) perspective(240px) rotateX(9deg);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 #8a5a2b,
    0 3px 6px rgba(36, 25, 16, 0.3);
}
.l3d-turn .l3d-3d { padding: 0 10px; }
.local-scene.l3d .local-bare { z-index: 1; color: #fffaf2; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.l3d-turn .l3d-3d { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
/* Real 3D view of the local (DecorView3D) */
.local-3d {
  position: fixed; inset: 0; z-index: 31; display: flex; align-items: center; justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(36, 25, 16, 0.58); overflow-y: auto; overscroll-behavior: contain;
}
.local-3d-card {
  width: min(760px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 2px solid var(--ink); border-radius: 22px; background: #fffaf2;
  box-shadow: 8px 8px 0 rgba(36, 25, 16, 0.18);
}
.local-3d-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.local-3d-top h2 { margin: 0; font-family: var(--serif); font-size: clamp(1.2rem, 4vw, 1.6rem); line-height: 1.1; }
.local-3d-stage {
  position: relative; height: clamp(260px, 52vh, 480px); overflow: hidden;
  border: 2px solid var(--ink); border-radius: 18px;
  background: radial-gradient(80% 70% at 50% 30%, #efe3cc 0%, #d8c7a8 60%, #bfa57f 100%);
}
.local-3d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.local-3d-stage canvas:active { cursor: grabbing; }
.local-3d-hint { margin: 0; font-size: 0.72rem; color: var(--soft); }
@media (prefers-reduced-motion: reduce) { .l3d-room { transition: none; } }
/* Hit testing: only the objects take the pointer (the room boxes would cover them). */
.l3d-fit, .l3d-room, .l3d-room * { pointer-events: none; }
.l3d-room .l3d-spr, .l3d-room .l3d-spr * { pointer-events: auto; }

/* Floating messages (showNotice): over the content, under the top bar, gone by themselves. */
.toasts {
  position: fixed; z-index: 60; left: 0; right: 0;
  top: max(calc(var(--toast-top, 0px) + 8px), calc(env(safe-area-inset-top, 0px) + 8px));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer; max-width: min(520px, 100%);
  padding: 10px 16px; border: 2px solid var(--ink); border-radius: 14px;
  background: #fffaf2; color: var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-weight: 600; font-size: 0.95rem; line-height: 1.35; white-space: pre-line; text-align: center;
  opacity: 0; transform: translateY(-10px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: #e3f1e4; border-color: #2f6b45; color: #1f4a2f; box-shadow: 0 4px 0 #2f6b45; }
.toast-ok::before { content: '✓ '; font-weight: 800; }
.toast-warn { background: #fbefd2; border-color: #a2741c; color: #5c4210; box-shadow: 0 4px 0 #a2741c; }
.toast-error { background: #f8e1de; border-color: var(--red-deep, #8d1a22); color: var(--red-deep, #8d1a22); box-shadow: 0 4px 0 var(--red-deep, #8d1a22); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; transform: none; } }

/* Avís de connexió en temps real perduda: pastilla fixa sobre la barra inferior. */
.net-badge {
  position: fixed; z-index: 58; left: 50%;
  bottom: calc(var(--dock-h, 64px) + 12px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  max-width: calc(100vw - 24px);
  padding: 7px 14px; border: 2px solid var(--red-deep, #8d1a22); border-radius: 999px;
  background: #f8e1de; color: var(--red-deep, #8d1a22);
  font-size: 0.85rem; font-weight: 700; line-height: 1.2; text-align: center;
  box-shadow: 0 4px 0 var(--red-deep, #8d1a22);
  pointer-events: none;
}
.net-badge[hidden] { display: none; }
.net-badge .net-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; animation: net-pulse 1.3s ease-in-out infinite;
}
@keyframes net-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .net-badge .net-dot { animation: none; } }

/* Diada: the pause before each castell («A continuació»). */
.hud.is-pause #hud-kicker { color: var(--gold, #e0b03a); letter-spacing: 0.12em; text-transform: uppercase; animation: hud-next 1.2s ease-in-out infinite alternate; }
.hud.is-pause #hud-title { animation: hud-next-in 0.5s ease-out both; }
@keyframes hud-next { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes hud-next-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hud.is-pause #hud-kicker, .hud.is-pause #hud-title { animation: none; } }

/* «Només colles humanes»: a small badge on the league row and in Temporada. */
.room-badges { margin: 4px 0 2px; }
.league-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border: 1.5px solid var(--ink); border-radius: 999px;
  font-family: var(--sans, inherit); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  background: #fffaf2; color: var(--ink); vertical-align: middle; white-space: nowrap;
}
.league-badge.humans::before { content: '👥'; font-size: 0.78rem; }
h2 .league-badge { margin-left: 6px; position: relative; top: -2px; }

/* El local card (Monday): the colla's own 3D local instead of the drawn house.
   Read-only, a slow sway; paused off-screen (watchArt3d) and still with reduced motion. */
.hall-local { width: 100%; max-width: 360px; margin: 0 auto; }
.hall-local .local-scene.hall-3d { margin: 0; aspect-ratio: 4 / 3; border-radius: 18px; box-shadow: var(--shadow); }
.hall-local .hall-3d .l3d-fit { top: 14%; }
.hall-local .hall-3d .l3d-room { animation: hall-sway 14s ease-in-out infinite alternate; }
.hall-local .hall-3d.a3d-off .l3d-room { animation-play-state: paused; }
.hall-local.worn .hall-3d { filter: saturate(0.8); }
.hall-local.poor .hall-3d { filter: saturate(0.6) brightness(0.92); }
@keyframes hall-sway {
  from { transform: translateY(22px) translateZ(30px) rotateX(-4deg) rotateY(-20deg); }
  to { transform: translateY(22px) translateZ(30px) rotateX(-4deg) rotateY(14deg); }
}
@media (prefers-reduced-motion: reduce) {
  .hall-local .hall-3d .l3d-room { animation: none; transform: translateY(22px) translateZ(30px) rotateX(-4deg) rotateY(-14deg); }
}
@media (min-width: 981px) { .hall-local { max-width: 240px; } }

/* La crida: the cap calls a pis, the bubble names it, that pis lights up and rises.
   One 4.8s toc, four calls (segon, aixecador, baix, terç), 1.2s each. */
.a3d-crida .a3d-stage { scale: 1.14; }
.a3d-crida .cr-sway { animation-duration: 9s; }
.a3d-crida .cr-mat { left: 22px; bottom: 10px; }
.a3d-crida .cr-pilar { position: absolute; left: 38px; bottom: 13px; width: 13px; height: 80px; }
.a3d-crida .cr-pis { position: absolute; left: 0; width: 13px; height: 20px; animation: cr-rise 4.8s ease-in-out infinite; }
.a3d-crida .cr-a { bottom: 0; }
.a3d-crida .cr-b { bottom: 20px; }
.a3d-crida .cr-c { bottom: 40px; }
.a3d-crida .cr-d { bottom: 60px; }
.a3d-crida .cr-who { left: 0; bottom: 0; }
.a3d-crida .cr-glow {
  position: absolute; left: -11px; bottom: -6px; width: 35px; height: 32px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 220, 100, 1), rgba(242, 182, 50, 0.7) 55%, rgba(242, 182, 50, 0));
  transform: translateZ(-7px); transform-style: flat; opacity: 0;
  animation: cr-on 4.8s ease-in-out infinite;
}
/* Call order: segon (0s), aixecador (1.2s), baix (2.4s), terç (3.6s). */
.a3d-crida .cr-ring {
  position: absolute; left: -5px; bottom: 3px; width: 23px; height: 23px; border-radius: 50%; box-sizing: border-box;
  border: 2.5px solid #f2b632; box-shadow: 0 0 5px rgba(242, 182, 50, 0.9);
  transform: translate3d(0, 0, 0) rotateX(78deg); transform-style: flat; opacity: 0;
  animation: cr-on 4.8s ease-in-out infinite;
}
.a3d-crida .cr-b, .a3d-crida .cr-b i, .cr-bubble .cr-b { animation-delay: 0s; }
.a3d-crida .cr-d, .a3d-crida .cr-d i, .cr-bubble .cr-d { animation-delay: 1.2s; }
.a3d-crida .cr-a, .a3d-crida .cr-a i, .cr-bubble .cr-a { animation-delay: 2.4s; }
.a3d-crida .cr-c, .a3d-crida .cr-c i, .cr-bubble .cr-c { animation-delay: 3.6s; }
.a3d-crida .cr-cap { left: 84px; bottom: 13px; }
.a3d-crida .cr-horn { left: 70px; bottom: 28px; transform-origin: 100% 50%; }
.cr-bubble {
  position: absolute; left: 60px; top: -8px; width: 70px; height: 22px;
  border: 2px solid #22170f; border-radius: 11px; background: #fffaf2;
  box-shadow: 0 2px 0 rgba(34, 23, 15, 0.25); transform-style: flat;
}
.cr-bubble::after {
  content: ''; position: absolute; left: 30px; bottom: -7px; width: 9px; height: 9px;
  background: #fffaf2; border-right: 2px solid #22170f; border-bottom: 2px solid #22170f; transform: rotate(45deg);
}
.cr-word {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 800 9.5px/1 var(--sans, system-ui, sans-serif); color: #b4232c; letter-spacing: 0.02em;
  opacity: 0; animation: cr-on 4.8s ease-in-out infinite; z-index: 1;
}
@keyframes cr-on { 0% { opacity: 0; } 4% { opacity: 1; } 21% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes cr-rise { 0%, 2% { translate: 0 0; } 7% { translate: 0 -3px; } 18% { translate: 0 -3px; } 24%, 100% { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  /* Still: the cap calls the terç, and the terç is lit. */
  .a3d-crida .cr-c .cr-glow, .a3d-crida .cr-c .cr-ring, .cr-bubble .cr-word.cr-c { opacity: 1; }
  .a3d-crida .cr-sway { transform: rotateX(-12deg) rotateY(-24deg); }
}
@media (max-width: 680px) { .a3d-crida .a3d-stage { scale: 0.9; translate: 0 8px; } }
.act-intro-art.is-crida { background: linear-gradient(160deg, #e4eef5, #b9d0e2 72%); }

/* ==========================================================================
   Cartes d'activitat, estil carta de col·lecció (Pokémon)
   Bloc afegit al final per sobreescriure el disseny anterior.
   ========================================================================== */
.play-row { align-items: stretch; }
.play-card {
  flex: 0 0 220px;
  width: 220px;
  max-width: 220px;
  min-height: 322px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 3px solid #d8a62a;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8dd, #efddb0);
  box-shadow: 0 5px 0 rgba(34, 23, 15, 0.28), inset 0 0 0 2px #f7d67a;
}
.play-card.bonus {
  border-color: #2f7a55;
  background: linear-gradient(180deg, #f4faef, #dcebd0);
  box-shadow: 0 5px 0 rgba(34, 23, 15, 0.28), inset 0 0 0 2px #a8cf9d;
}
.play-card.malus {
  border-color: #b4232c;
  background: linear-gradient(180deg, #fdf1ef, #f2d2cb);
  box-shadow: 0 5px 0 rgba(34, 23, 15, 0.28), inset 0 0 0 2px #e2a59c;
}
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pc-type {
  padding: 3px 8px;
  border-radius: 999px;
  background: #2f7a55;
  color: #fffaf2;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.play-card.malus .pc-type { background: #b4232c; }
.play-card.boon-card .pc-type { background: #2f7a55; }
.pc-hp { font-family: var(--serif); font-weight: 800; font-size: 1rem; }
.pc-art {
  height: 108px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(34, 23, 15, 0.45);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 28%, #fffdf4, #e9d7ae);
  overflow: hidden;
}
.pc-art .card-ico { width: 74px; height: 74px; margin: 0; }
.pc-body { flex: 1 1 auto; min-height: 0; }
.pc-body h3 { font-family: var(--serif); font-size: 1.05rem; line-height: 1.1; margin: 0 0 4px; }
.pc-body p { margin: 0 0 6px; font-size: 0.76rem; line-height: 1.35; }
.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px dashed rgba(34, 23, 15, 0.35);
  padding-top: 6px;
}
.pc-ready { font-size: 0.62rem; font-weight: 800; color: var(--green); text-transform: uppercase; }
.play-card .card-pair { position: static; }
.play-card > button { margin-top: 2px; }
.play-card .card-targets { margin-top: 2px; }

/* Administració: veïns */
.admin-npc-colla { max-width: 320px; }
.admin-npc-row { display: block; width: 100%; text-align: left; }
.admin-npc-row > span { display: block; margin-top: 3px; }
.admin-npc-meta { font-size: 0.76rem; color: var(--soft); }
.admin-npc-detail { display: grid; gap: 14px; margin-top: 10px; }
@media (min-width: 760px) {
  .admin-npc-detail { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
}
.admin-npc-look canvas { display: block; width: 100%; height: auto; max-height: 400px; background: #efe3cc; border: 1.5px solid var(--line); border-radius: 14px; }
.admin-field { display: block; margin: 10px 0; font-size: 0.82rem; font-weight: 600; }
.admin-field input, .admin-field textarea, .admin-field select {
  display: block; width: 100%; margin-top: 5px; padding: 9px; border-radius: 9px;
  border: 1.5px solid var(--line); background: #fffdf8; font: inherit; font-weight: 400;
}
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  background: rgba(224, 176, 58, 0.18); border: 1px solid var(--line); font-size: 0.78rem;
}
.admin-chip-x { border: 0; background: none; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0; }
.admin-add-item { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.admin-add-item select { flex: 1 1 auto; min-width: 0; padding: 8px; border-radius: 9px; border: 1.5px solid var(--line); background: #fffdf8; font: inherit; }


/* Panell d'assaig: barres d'estat compactes en dues columnes. */
.assaig-stats { grid-template-columns: 1fr 1fr; gap: 4px 16px; margin: 6px 0 10px; }
.assaig-stats li { grid-template-columns: 64px 1fr 28px; font-size: 0.8rem; }
@media (max-width: 560px) { .assaig-stats { grid-template-columns: 1fr; } }
.look-grid { display: grid; grid-template-columns: repeat(8, 22px); gap: 2px; margin: 4px 0 2px; }
.look-cell { width: 22px; height: 22px; padding: 0; border: 1px solid #6b4a2c; border-radius: 3px; background: #f4efe4; }
.look-cell.p1 { background: #b4232c; }
.look-cell.p2 { background: #3b5c8a; }
.look-cell.p3 { background: #e0b03a; }
.look-cell.p4 { background: #f4efe4; }
.look-cell.p5 { background: #2b2320; }

/* Mòbil: dins el joc la pàgina no es desplaça. Els fulls (activitats, mapa,
   compte) ja tenen el seu propi desplaçament; així arrossegar no fa sortir la
   barra del navegador ni mou la capçalera. */
html { overscroll-behavior: none; }
body.in-league,
body:has(#play-sheet:not(.hidden)),
body:has(.map-sheet:not(.hidden)),
body:has(.stats-sheet:not(.hidden)) {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* Panell d'anuncis del poble */
.board-box { display: grid; gap: 8px; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.board-list li { background: #fffaf2; border: 1.5px solid rgba(36, 25, 16, 0.35); border-radius: 10px; padding: 8px 10px; }
.board-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; }
.board-head b { font-family: var(--serif); }
.board-list p { margin: 4px 0 0; font-size: 0.86rem; line-height: 1.35; overflow-wrap: anywhere; }
.board-form { display: grid; gap: 6px; }
.board-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border-radius: 10px; border: 1.5px solid #241910; background: #fffaf2; resize: vertical; }

/* Assaig de gralla sobre l'escena del local */
.local-gralla-hud { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; pointer-events: none; }
.local-gralla-hud[hidden] { display: none; }
.local-gralla-hud .free-play { display: flex; flex-direction: column; height: 100%; gap: 6px; padding: 8px 8px 6px; border: 0; background: transparent; }
.local-gralla-hud #free-status { margin: 0; text-align: center; font-weight: 700; color: #fff8ea; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85); }
.local-gralla-hud #free-stage { flex: 1 1 auto; min-height: 0; display: flex; }
.local-gralla-hud .free-scene-gralla { flex: 1 1 auto; width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; }
.local-gralla-hud .gralla3d-wrap { height: 100%; max-width: none; border: 0; background: transparent; }
.local-gralla-hud .gralla-progress { max-width: none; margin: 0; }
.local-gralla-hud .free-actions.gralla-actions { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; padding: 0; pointer-events: auto; }
.local-gralla-hud .free-actions.gralla-actions > .gralla-lane { flex: 1 1 0; min-width: 0; min-height: 64px; padding: 0 4px; }

/* Pantalla d'inici: coberta a pantalla completa, retrat centrat a l'escriptori. */
body.splash-open { overflow: hidden; }
.splash {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1d66c2;
  overflow: hidden;
  transition: opacity 0.45s ease;
}
.splash[hidden] { display: none !important; }
.splash.is-out { opacity: 0; pointer-events: none; }
.splash-blur {
  position: absolute;
  inset: -12%;
  background-image: var(--splash-img);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(28px) saturate(1.08);
  transform: scale(1.12);
  pointer-events: none;
}
.splash-frame {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  height: 100%;
  width: 100%;
  max-width: 100%;
  container-type: size;
  container-name: splash;
  background-image: var(--splash-img);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 8% max(3.2vh, calc(env(safe-area-inset-bottom, 0px) + 14px));
  box-shadow: 0 0 48px rgba(20, 12, 6, 0.35);
}
@media (min-aspect-ratio: 720 / 1280) {
  /* Horitzontal: la coberta omple tota la pantalla amb la imatge ampla. */
  .splash-blur { display: none; }
  .splash-frame {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    background-image: var(--splash-img-wide, var(--splash-img));
  }
  .splash-frame::after {
    content: "";
    position: absolute;
    z-index: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 28%;
    background: linear-gradient(rgba(12, 8, 4, 0), rgba(12, 8, 4, 0.5));
    pointer-events: none;
  }
}
/* Pantalles més amples que 21:10 (mòbil horitzontal, ultrapanoràmiques): la
   coberta sencera, sense retallar el rètol, centrada sobre el fons difuminat. */
@media (min-aspect-ratio: 21 / 10) {
  .splash-blur { display: block; }
  .splash-frame {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
  }
}
.splash-start {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: fit-content;
  min-width: 8.6em;
  max-width: 90%;
  min-height: clamp(2.55em, 7.2vh, 4em);
  padding: 0.5em 1.35em 0.58em;
  border: 3px solid #f3d34a;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #8ee24a 0%, #4caf1c 52%, #2e8a12 100%);
  box-shadow:
    0 0 0 3px #c49a1e,
    0 6px 0 #1c5c0e,
    0 10px 18px rgba(20, 12, 6, 0.35),
    0 0 22px 6px rgba(255, 214, 60, 0.72);
  color: #fff8e4;
  font-family: Outfit, "Trebuchet MS", sans-serif;
  font-weight: 800;
  font-size: clamp(0.9rem, 4.6vh, 2.05rem);
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  overflow: visible;
  text-transform: uppercase;
  text-align: center;
  -webkit-text-stroke: 0.07em #3a1c08;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #2a1408, 0 4px 0 rgba(42, 20, 8, 0.35);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  animation: splash-bounce 1.7s ease-in-out infinite;
}
@supports (font-size: 1cqh) {
  .splash-start {
    font-size: clamp(0.9rem, min(4.6cqh, 7.6cqw), 2.05rem);
    min-height: clamp(2.55em, 7.2cqh, 4em);
  }
}
.splash-start:focus-visible {
  outline: 3px solid #fff8e4;
  outline-offset: 4px;
}
.splash-start.is-pressed,
.splash-start:active {
  animation: none;
  transform: translateY(5px) scale(0.97);
  box-shadow:
    0 0 0 3px #c49a1e,
    0 2px 0 #1c5c0e,
    0 4px 10px rgba(20, 12, 6, 0.3),
    0 0 16px 4px rgba(255, 214, 60, 0.55);
}
@keyframes splash-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.035); }
}
@media (prefers-reduced-motion: reduce) {
  .splash { transition: none; }
  .splash-start { animation: none; }
}
/* Pantalla de login: targeta de vidre sobre la imatge d'inici. */
body:has(#lobby:not(.hidden)):has(.poster.login-poster) {
  background:
    radial-gradient(900px 600px at 50% 0%, rgba(12, 8, 4, 0.06), rgba(12, 8, 4, 0.44)),
    linear-gradient(180deg, rgba(20, 10, 6, 0.10), rgba(20, 10, 6, 0.46)),
    url("/img/splash-wide.webp") center / cover no-repeat,
    #241910;
}

.poster.login-poster {
  width: min(430px, 100%);
  flex: 0 0 auto;
  align-self: center;
  padding: clamp(24px, 3.6vw, 34px) clamp(22px, 3.2vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 26px;
  background: rgba(255, 250, 242, 0.90);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 24px 60px rgba(20, 10, 4, 0.34),
    0 60px 120px rgba(20, 10, 4, 0.22);
}
.poster.login-poster .lang-stack { position: absolute; top: 16px; right: 16px; margin: 0; z-index: 2; }
#lobby > .poster.login-poster { flex: 0 0 auto; align-self: center; margin: auto 0; }
.poster.login-poster .langs {
  border: 1px solid rgba(36, 25, 16, 0.12);
  background: #efe1c9;
  padding: 3px;
  border-radius: 999px;
  overflow: hidden;
}
.poster.login-poster .langs button {
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
}
.poster.login-poster .langs button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(36, 25, 16, 0.16);
}
.login-brand { margin: 0 0 18px; font-size: 0.7rem; letter-spacing: 0.18em; }
.poster.login-poster .account {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 14px;
}
.poster.login-poster .account-title {
  font-size: clamp(1.8rem, 3vw, 2.05rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.poster.login-poster form { gap: 12px; }
.poster.login-poster .room-actions { width: 100%; }
.poster.login-poster .room-actions button { flex: 1 1 auto; }
.poster.login-poster .primary {
  height: 54px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #c92b36, #b4232c 55%, #981922);
  color: #fff8e8;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 20px rgba(124, 20, 32, 0.28);
}
.poster.login-poster .primary:hover {
  background: linear-gradient(180deg, #d2323d, #c02a34 55%, #a51c26);
  color: #fff8e8;
}
.poster.login-poster .primary:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 5px 12px rgba(124, 20, 32, 0.26);
}
.poster.login-poster .account-links { gap: 6px 20px; margin-top: 2px; }
.poster.login-poster .account-links button {
  color: var(--red-deep);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.poster.login-poster .account-links button:hover { text-decoration: underline; }
.poster.login-poster .account-note { font-size: 0.88rem; }
.poster.login-poster .muted { font-size: 0.85rem; }

/* Camps de formulari: etiqueta dins del camp, com a l'estil proposat. */
label.field { position: relative; display: block; font-size: 1rem; }
label.field input {
  width: 100%;
  height: 54px;
  padding: 23px 16px 7px;
  border: 1px solid #e2d3ba;
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
label.field input::placeholder { color: transparent; }
label.field > span {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: #8a7662;
  pointer-events: none;
  transition: all 0.16s ease;
}
label.field input:focus + span,
label.field input:not(:placeholder-shown) + span {
  top: 9px;
  transform: none;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}
label.field input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(180, 35, 44, 0.13);
}
label.field.field-pass input { padding-right: 92px; }
label.field .eye {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 600;
}
label.field .eye:hover { background: #f6ebd7; color: var(--ink); }

@media (min-width: 981px) {
  #lobby > .poster.login-poster {
    width: min(430px, 100%);
    max-width: 430px;
    align-self: center;
    padding: clamp(24px, 3.6vw, 34px) clamp(22px, 3.2vw, 30px);
  }
}
@media (max-width: 480px) {
  .poster.login-poster { padding: 24px 20px 26px; border-radius: 22px; }
}

/* Escena 3D a sang: sense la franja de la faixa ni marges, del panell de dalt
   fins a baix de tot, també al mòbil. */
body.barri-3d .faixa { display: none; }
body.barri-3d #stage { padding: 0; }
@media (max-width: 980px) {
  body.barri-3d,
  body.barri-3d #app { height: 100%; overflow: hidden; }
  body.barri-3d .layout { flex: 1 1 auto; min-height: 0; }
  body.barri-3d #stage { min-height: 0; }
  body.barri-3d .barri-sheet,
  body.barri-3d .barri-stage { min-height: 0; }
}

/* En vertical, el login fa servir la coberta vertical (la imatge ampla queda
   massa retallada en un mòbil). */
@media (max-aspect-ratio: 720 / 1280) {
  body:has(#lobby:not(.hidden)):has(.poster.login-poster) {
    background:
      radial-gradient(700px 520px at 50% 0%, rgba(12, 8, 4, 0.06), rgba(12, 8, 4, 0.44)),
      linear-gradient(180deg, rgba(20, 10, 6, 0.10), rgba(20, 10, 6, 0.46)),
      url("/img/splash.webp") center / cover no-repeat,
      #241910;
  }
}

/* Els camps ja marquen el focus amb l'anell vermell: sense doble contorn daurat. */
label.field input:focus-visible { outline: none; }

/* Pantalla d'entrada opaca: tapa el joc del darrere amb la coberta i amaga
   qualsevol panell que hi hagi sota (resum, registre, activitats). */
body.login-screen #lobby {
  background:
    linear-gradient(180deg, rgba(20, 10, 6, 0.10), rgba(20, 10, 6, 0.46)),
    url("/img/splash-wide.webp") center / cover no-repeat,
    #241910;
}
@media (max-aspect-ratio: 720 / 1280) {
  body.login-screen #lobby {
    background:
      linear-gradient(180deg, rgba(20, 10, 6, 0.10), rgba(20, 10, 6, 0.46)),
      url("/img/splash.webp") center / cover no-repeat,
      #241910;
  }
}
body.login-screen #top,
body.login-screen .faixa,
body.login-screen .layout,
body.login-screen #log,
body.login-screen .league-bar,
body.login-screen #home-dock,
body.login-screen #act-panel,
body.login-screen #float-panel,
body.login-screen #scene-float,
body.login-screen .play-sheet,
body.login-screen .map-sheet { visibility: hidden !important; }

/* Escena 3D: cap marge ni vora en tota la cadena del contenidor. */
body.barri-3d .layout,
body.barri-3d #stage,
body.barri-3d .barri-sheet,
body.barri-3d .barri-stage { padding: 0 !important; margin: 0 !important; }
body.barri-3d #stage,
body.barri-3d .barri-stage { border: 0 !important; }

/* L'escena 3D, clavada a la finestra: del panell de dalt fins a baix de tot,
   sense dependre de marges o padding de cap contenidor. */
body.barri-3d .barri-sheet {
  position: fixed !important;
  top: var(--league-h, 0px) !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 1;
}
body.barri-3d .barri-stage {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border-radius: 0 !important;
}

/* Sense barres de desplaçament mentre es juga a l'escena 3D. */
body.barri-3d { overflow: hidden !important; }
body.barri-3d #app { overflow: hidden !important; }

/* #stage fa de contenidor de consulta i això el converteix en l'ancoratge dels
   elements fixos; a l'escena 3D el desactivem perquè l'escena s'ancori a la
   finestra i no al panell. */
body.barri-3d #stage { container-type: normal !important; contain: none !important; }

/* ---- Aspecte modern dels panells (19/11/2026) ---- */
#act-panel {
  border: 1px solid rgba(36, 25, 16, 0.16);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(40, 25, 12, 0.18);
  padding: 16px 18px;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(224, 176, 58, 0.22), transparent 62%),
    #fbf3e4;
}
.act-panel-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.act-panel-title h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); }
.act-back,
.assembly-close {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  min-height: 40px;
  font-weight: 600;
}
.act-back:active,
.assembly-close:active { transform: none; box-shadow: none; }
.act-panel-intro,
.act-result,
.act-confirm {
  border: 1px solid #eadcc4;
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(60, 38, 18, 0.08);
  padding: 20px 22px;
}
.act-intro-art { border: 1px solid #eadcc4; border-radius: 14px; }

/* Targeta flotant dins de l'escena 3D. */
.float-card {
  width: min(560px, 100%);
  padding: 20px 20px 18px;
  border: 1px solid rgba(36, 25, 16, 0.14);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(20, 10, 4, 0.28);
  background: rgba(255, 250, 242, 0.98);
}
.float-card .handbook-top {
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.float-card .handbook-top h2 { font-size: 1.55rem; }
.float-card .act-panel-intro {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

/* Rols de la colla: files compactes amb etiquetes. */
.role-row {
  border: 1px solid #eadcc4;
  border-radius: 16px;
  background: #fff;
  padding: 10px 12px;
  gap: 12px;
}
.role-row.mine {
  border-color: rgba(224, 176, 58, 0.8);
  background: #fffdf4;
  box-shadow: none;
}
.role-copy b { font-size: 0.98rem; font-weight: 640; }
.role-copy small { font-size: 0.8rem; }
.role-row .casteller-points {
  justify-self: start;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff7e0;
  border: 1px solid rgba(224, 176, 58, 0.65);
  font-size: 0.72rem;
  font-weight: 700;
  color: #6a4a08;
}
.role-actions .primary {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #c92b36, #b4232c 60%, #981922);
  box-shadow: 0 6px 12px rgba(124, 20, 32, 0.22);
  font-weight: 700;
}
.role-actions .primary:active { transform: none; box-shadow: 0 3px 8px rgba(124, 20, 32, 0.2); }
.role-actions .ghost.act-danger {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.role-actions .act-chip { border-radius: 999px; padding: 4px 10px; }

/* Flotant de l'escena (rols, butxaca, xat...): mateix estil que els panells. */
.pocket-float {
  background: rgba(255, 250, 242, 0.98);
  border: 1px solid rgba(36, 25, 16, 0.14);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(20, 10, 4, 0.34);
}
.pocket-float-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 1.3rem;
  font-weight: 680;
}
.pocket-float-head .ghost {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  font-weight: 600;
}
.pocket-float-body { padding: 14px 16px; }

/* ---- Panells amb el mateix aspecte que el login: vidre sobre la coberta ---- */
#handbook,
#float-panel,
#account-gate,
#act-panel:not(.local-mode),
.play-sheet:not(.hidden),
.map-sheet:not(.hidden) {
  background:
    linear-gradient(180deg, rgba(20, 10, 6, 0.18), rgba(20, 10, 6, 0.52)),
    url("/img/splash-wide.webp") center / cover no-repeat,
    #241910 !important;
}
@media (max-aspect-ratio: 720 / 1280) {
  #handbook,
  #float-panel,
  #account-gate,
  #act-panel:not(.local-mode),
  .play-sheet:not(.hidden),
  .map-sheet:not(.hidden) {
    background:
      linear-gradient(180deg, rgba(20, 10, 6, 0.18), rgba(20, 10, 6, 0.52)),
      url("/img/splash.webp") center / cover no-repeat,
      #241910 !important;
  }
}

.poster,
.wait,
.handbook-card,
.float-card,
.act-panel-card,
.play-sheet-card,
.map-sheet-card,
.map-wrap,
.account-gate-card {
  background: rgba(255, 250, 242, 0.92) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.65) !important;
  border-radius: 24px !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 24px 60px rgba(20, 10, 4, 0.32) !important;
}
#act-panel:not(.local-mode) .act-panel-card {
  width: min(780px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 22px;
}
#act-panel:not(.local-mode) {
  border: 0 !important;
  box-shadow: none !important;
}
#act-panel:not(.local-mode) .act-panel-head {
  border-bottom: 1px solid rgba(36, 25, 16, 0.12);
}
#float-panel .float-card,
#handbook .handbook-card { width: min(620px, 100%); }

/* Flotant de l'escena: mida segons el contingut, centrat i sense caixes dobles. */
.pocket-float {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92%);
  height: auto;
  max-height: min(80%, 680px);
}
.pocket-float-head { font-size: 1.2rem; }
.pocket-float-head .ghost {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  line-height: 1;
}
.pocket-float-body { padding: 16px; }
.pocket-float-body .play-sheet-card,
.pocket-float-body .act-float-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Flotant de l'escena com el login: coberta de fons i targeta de vidre al mig. */
#scene-float.pocket-float {
  position: fixed;
  top: var(--league-h, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  transform: none;
  width: auto;
  height: auto;
  max-height: none;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(20, 10, 6, 0.18), rgba(20, 10, 6, 0.52)),
    url("/img/splash-wide.webp") center / cover no-repeat,
    #241910;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  z-index: 6;
}
@media (max-aspect-ratio: 720 / 1280) {
  #scene-float.pocket-float {
    background:
      linear-gradient(180deg, rgba(20, 10, 6, 0.18), rgba(20, 10, 6, 0.52)),
      url("/img/splash.webp") center / cover no-repeat,
      #241910;
  }
}
.pocket-card {
  width: min(560px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 24px 60px rgba(20, 10, 4, 0.32);
}
.pocket-card .pocket-float-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
  font-weight: 680;
}
.pocket-card .pocket-float-head .ghost {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  font-size: 0.8rem;
  font-weight: 600;
}
.pocket-card .pocket-float-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
}

/* Escenes interiors (local, botiga, sala): a sang, com el barri. */
#act-panel.local-mode {
  top: calc(var(--league-h, 0px) + var(--top-h, 0px)) !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
#act-panel.local-mode .act-panel-card,
#act-panel.local-mode .act-panel-card.local-card {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.local-full .local-stage,
.room-in .room-stage,
.shop-in .shop-stage {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.local-full .local-stage { min-height: 0 !important; }

/* El desenfocament del vidre creava un ancoratge per als elements fixos i el
   fons del flotant quedava dins del panell interior. A l'escena interior no hi
   ha vidre: el flotant s'ancora a la finestra i ocupa tot l'espai. */
#act-panel.local-mode .act-panel-card,
#act-panel.local-mode .act-panel-card.local-card {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Explicacio de la carta de millora, dins de la propia carta. */
.pc-body .boon-info { font-size: 0.9rem; color: var(--soft); line-height: 1.4; margin: 8px 0 0; }

/* Boto d informacio del panell d assaig. */
.assaig-plan-head { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.assaig-i {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  color: var(--soft); font: 700 1rem var(--sans, sans-serif);
}
.assaig-i:hover { background: #f6ebd7; color: var(--ink); }

/* Estadístiques de l'assaig compactes: dues columnes i barra fina sota el valor. */
.assaig-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin: 4px 0 12px;
}
.assaig-stats li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name val" "track track";
  align-items: center;
  gap: 3px 10px;
  font-size: 0.84rem;
  padding: 0 0 2px;
}
.assaig-stats .stat-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.assaig-stats li > span:last-child {
  grid-area: val;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.assaig-stats .track {
  grid-area: track;
  height: 4px;
  border-radius: 99px;
}
.assaig-stats .track i {
  border-radius: 99px;
}
@media (max-width: 560px) {
  .assaig-stats { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .assaig-stats li { font-size: 0.8rem; }
}

/* En horitzontal, les estadístiques s'encaren a l'esquerra i no s'estiren:
   cada columna té un màxim i el número queda a prop del nom. */
@media (orientation: landscape) {
  .assaig-stats {
    grid-template-columns: repeat(2, minmax(0, 260px));
    justify-content: start;
    column-gap: 32px;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: auto;
  }
}

/* En horitzontal, el panell d'assaig en dues columnes: estadístiques a
   l'esquerra i la llista de castells a la dreta. */
@media (orientation: landscape) {
  .assaig-panel .split > div {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    column-gap: 24px;
    align-items: start;
    align-content: start;
  }
  .assaig-panel .assaig-stats {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    justify-content: stretch;
    width: 100%;
    margin: 0 0 12px;
  }
  .assaig-panel .catalog,
  .assaig-panel .assaig-picks {
    grid-column: 2;
    grid-row: 1 / span 20;
    align-self: start;
    min-width: 0;
  }
}

/* La caixa del barri, a sang des del primer moment: sense marc, sense el cel
   pintat i sense la mida centrada, perquè no surti cap panell abans que el 3D
   pinti el primer fotograma. */
.barri-sheet {
  width: 100%;
  max-width: none;
  margin: 0;
}
.barri-stage {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #cfe4f0;
}
.barri-sky { display: none; }

/* Àlbum de fotos de la colla */
.photo-actions { margin: 0 0 12px; }
.photo-take {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  font-size: 0.95rem;
  cursor: pointer;
}
.photo-take svg { width: 20px; height: 20px; }
.photo-take:disabled { opacity: 0.6; }
.photo-note { margin: 10px 0; text-align: center; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.photo-thumb {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #efe4cf;
  cursor: pointer;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-noimg { font-size: 0.75rem; color: var(--soft); }
.photo-full { display: grid; gap: 10px; }
.photo-back { justify-self: start; }
.photo-big {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 14px;
  background: #241910;
}

/* Repte en directe: càmera i marc del castell */
.repte-lead { margin: 0 0 10px; font-size: 0.92rem; }
/* Capta super castellers: col·lecció de fins a 10 */
.super-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 4px 0 8px; }
.super-head b { font-size: 0.95rem; }
.super-head span { font-size: 0.78rem; color: var(--soft); }
.super-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; margin: 0 0 10px; }
.super-card {
  display: grid;
  gap: 2px;
  min-width: 0;
  position: relative;
  padding: 6px;
  border: 2px solid #22170f;
  border-radius: 12px;
  background: #fffaf2;
}
.super-card img, .super-card .super-empty {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 9px;
  background: #efe4cf;
}
.super-card img { display: block; object-fit: cover; }
.super-card .super-empty {
  display: grid;
  place-items: center;
  color: var(--soft);
  font-weight: 700;
  font-size: 1.1rem;
}
.super-card b { font-size: 0.68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.super-card > span:last-child {
  font-size: 0.66rem;
  line-height: 1.2;
  color: var(--soft);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.super-card.empty { border-style: dashed; border-color: rgba(34, 23, 15, 0.35); background: rgba(255, 255, 255, 0.5); }
.super-card.new { border-color: #f2b632; box-shadow: 0 0 0 3px rgba(242, 182, 50, 0.35); }
.super-card.used img { opacity: 0.45; }
.super-used-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(34, 23, 15, 0.82);
  color: #fffaf2;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.super-power { font-weight: 700; }
/* La casella buida tocada es converteix en l'àrea d'imatge en viu. */
.super-card.capturing {
  grid-column: 1 / -1;
  position: relative;
  padding: 6px;
}
.super-card.capturing #repte-stage { margin: 0; }
.super-card.capturing .repte-cam { aspect-ratio: 1; border-radius: 10px; }
.super-card.pending img { border-radius: 9px; }
.super-card[data-act] { cursor: zoom-in; }
.super-cancel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 9, 6, 0.6);
  color: #fffaf2;
  font-size: 0.74rem;
  font-weight: 700;
}
.repte-cam .repte-shot {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #241910;
}
.repte-cam .repte-shot.on { display: block; }
.super-view {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 8, 6, 0.84);
}
.super-view figure { margin: 0; display: grid; gap: 8px; max-width: min(92vw, 520px); }
.super-view img {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 4px solid #f2b632;
  background: #fffaf2;
}
.super-view figcaption { display: grid; gap: 2px; text-align: center; color: #fffaf2; font-size: 0.9rem; }
.super-view figcaption b { font-size: 1.05rem; }
.super-view .super-power { color: #f2b632; }
.super-view-x {
  position: fixed;
  top: 14px;
  right: 14px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: #fffaf2;
  color: #22170f;
  font-weight: 700;
}
.super-view-del {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: #b4232c;
  color: #fffaf2;
  font-weight: 700;
}
.super-view-acts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: min(92vw, 520px);
}
.super-view-use {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: #f2b632;
  color: #22170f;
  font-weight: 700;
}
.super-view-use:disabled { background: rgba(255, 250, 242, 0.35); color: rgba(34, 23, 15, 0.75); }
.super-view .super-uses { color: #f2b632; font-size: 0.82rem; font-weight: 600; }
.super-view .super-use-msg { color: #fffaf2; font-size: 0.86rem; font-weight: 600; }
.super-view-del.armed { background: #7d1118; }
.super-full { font-weight: 600; }
.repte-note { margin: 8px 0; font-size: 0.82rem; color: var(--soft); line-height: 1.4; }
.repte-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  max-height: 96px;
  overflow-y: auto;
}
.repte-chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.repte-chip.on { background: var(--ink); color: #fffaf2; border-color: var(--ink); }
.repte-stage { margin: 0 0 10px; }
.repte-cam {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #241910;
}
.repte-cam video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.repte-cam.live video { display: block; }
.repte-mark {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 9%;
  bottom: 9%;
  border: 1px dashed rgba(255, 250, 241, 0.55);
  border-radius: 12px;
  pointer-events: none;
}
.repte-mark i {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #fffaf2;
}
.repte-mark i.tl { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.repte-mark i.tr { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.repte-mark i.bl { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.repte-mark i.br { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.repte-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  font-size: 0.78rem;
  color: #fffaf2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.repte-cam:not(.live) { display: grid; place-items: center; }
.repte-cam:not(.live) .repte-hint { position: static; padding: 0 18px; }
.repte-actions { display: flex; align-items: center; gap: 10px; }
.repte-go { flex: 1 1 auto; }
.repte-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red, #b4232c); }
.repte-status { margin: 8px 0 0; min-height: 1.2em; font-size: 0.86rem; font-weight: 600; }
.repte-win {
  display: grid;
  gap: 2px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(24, 122, 66, 0.12);
  border: 1px solid rgba(24, 122, 66, 0.4);
}
.repte-win b { font-size: 1.15rem; }
.repte-win span { font-size: 0.86rem; }
.repte-comic-wrap { margin: 8px 0 2px; display: grid; gap: 6px; }
.repte-comic-title { margin: 0; font-size: 0.82rem; font-weight: 700; }
.repte-comic { display: block; width: 100%; border-radius: 14px; border: 3px solid #22170f; background: #fff; }
.repte-save { text-align: center; font-size: 0.82rem; font-weight: 700; color: var(--red, #b4232c); }
.repte-record { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.repte-record p { margin: 0; font-size: 0.84rem; }
.repte-log { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.repte-log li { font-size: 0.8rem; color: var(--soft); }
