/* ==========================================================================
   JOC DE RATES · les pàgines de votar, del PIN i de l'administració
   Una sola columna estreta, com un tiquet de restaurant sobre l'asfalt, pensada per al mòbil.
   Surt del prototip (prototips/votar.html).
   ========================================================================== */
:root {
  color-scheme: dark;
  --asfalt: #12110f;
  --asfalt-2: #1c1a17;
  --linia: #34302a;
  --paper: #efe8da;
  --paper-2: #e4dccb;
  --tinta: #12110f;
  --tinta-2: #4f4a42;
  --groc: #f5d300;
  --vermell: #cf2e1b;
  --gris: #a39c90;
  --display: "Archivo", "Arial Narrow", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --marker: "Permanent Marker", "Comic Sans MS", cursive;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--asfalt); color: var(--paper);
  font-family: var(--display); font-variation-settings: "wdth" 100; font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--groc); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* franja de mode prova */
.prova { background: var(--vermell); color: var(--paper); border-bottom: 2px solid var(--tinta); }
.prova .gutter { max-width: 560px; margin: 0 auto; padding-block: 8px; display: flex; gap: 10px; align-items: center; }
.prova b { background: var(--groc); color: var(--tinta); padding: 2px 8px; font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; flex: none; }
.prova span { font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; }

.app { max-width: 560px; margin: 0 auto; padding-block: 18px 150px; display: flex; flex-direction: column; gap: 22px; }

/* capçalera */
.cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 10px; }
.segell { width: 40px; height: 40px; border-radius: 50%; background: var(--vermell); border: 2px solid var(--paper); display: grid; place-items: center;
  font-weight: 900; font-variation-settings: "wdth" 62; color: var(--groc); font-size: .95rem; }
.marca strong { font-weight: 900; font-variation-settings: "wdth" 62; font-size: 1.5rem; text-transform: uppercase; letter-spacing: .01em; }
.marca-txt { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.cap .mono { color: var(--gris); font-size: .68rem; letter-spacing: .06em; }
.cap-web { flex: none; font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--paper); text-decoration: none; border: 2px solid var(--paper); padding: 8px 10px; }
.cap-web:hover { background: var(--paper); color: var(--tinta); }
h1 { margin: 0; font-weight: 900; font-variation-settings: "wdth" 62; font-size: clamp(4rem, 22vw, 7.5rem); line-height: .8; text-transform: uppercase; }
h1 span { color: var(--groc); }

/* tiquet */
.tiquet { position: relative; background: var(--paper); color: var(--tinta); padding: 22px 20px 20px; font-family: var(--mono); font-size: .86rem; }
.tiquet::before, .tiquet::after {
  content: ""; position: absolute; left: 0; right: 0; height: 12px;
  background: radial-gradient(circle at 8px 6px, var(--asfalt) 5.5px, transparent 6px) repeat-x; background-size: 16px 12px;
}
.tiquet::before { top: -6px; }
.tiquet::after { bottom: -6px; }
.tiquet .t-cap { text-align: center; border-bottom: 1px dashed var(--tinta-2); padding-bottom: 10px; margin-bottom: 10px; }
.tiquet .t-cap b { display: block; font-family: var(--display); font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2.2rem; line-height: .95; text-transform: uppercase; letter-spacing: 0; }
.linia { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.linia .k { flex: none; }
.linia .pts { flex: 1; min-width: 12px; border-bottom: 2px dotted var(--tinta-2); transform: translateY(-4px); }
.linia .v { flex: 0 1 auto; min-width: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.linia.total { border-top: 1px dashed var(--tinta-2); margin-top: 8px; padding-top: 10px; font-size: 1rem; }
.linia.total .v { font-family: var(--display); font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2rem; line-height: 1; }
.tiquet .peu { text-align: center; color: var(--tinta-2); font-size: .72rem; margin-top: 12px; line-height: 1.5; }
.compte { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 8px; color: var(--vermell); font-weight: 600; }
.compte::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--vermell); animation: batec 1.2s infinite; }
@keyframes batec { 50% { opacity: .25; } }

/* passos */
.pas { display: flex; flex-direction: column; gap: 16px; }
.pas h2 { margin: 0; font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2.4rem; line-height: .95; text-transform: uppercase; text-wrap: balance; }
.pas .sub { margin: 0; color: var(--gris); }
.enrere { align-self: flex-start; background: none; border: 2px solid var(--linia); color: var(--paper); padding: 10px 14px; cursor: pointer; font-family: var(--mono); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.enrere:hover { border-color: var(--paper); }

/* qui ets */
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 480px) { .rates { grid-template-columns: repeat(4, 1fr); } }
.rata {
  position: relative; overflow: hidden; text-align: left; cursor: pointer; min-height: 84px;
  background: var(--asfalt-2); border: 2px solid var(--linia); padding: 10px; display: flex; flex-direction: column; justify-content: flex-end;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.rata:hover { border-color: var(--paper); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--groc); }
.rata .num { position: absolute; right: 4px; top: -8px; font-weight: 900; font-variation-settings: "wdth" 62; font-size: 3.6rem; line-height: 1; color: transparent; -webkit-text-stroke: 1.5px var(--linia); }
.rata .nom { position: relative; font-weight: 900; font-variation-settings: "wdth" 66; font-size: 1.3rem; text-transform: uppercase; line-height: 1; }

/* pin */
.qui-sou { display: flex; align-items: center; gap: 12px; background: var(--asfalt-2); border: 2px solid var(--linia); padding: 12px; }
.qui-sou .dors { width: 44px; height: 44px; border-radius: 50%; background: var(--groc); color: var(--tinta); display: grid; place-items: center; font-weight: 900; font-variation-settings: "wdth" 62; font-size: 1.3rem; flex: none; }
.qui-sou b { font-weight: 900; font-variation-settings: "wdth" 66; font-size: 1.6rem; text-transform: uppercase; line-height: 1; display: block; }
.punts { display: flex; gap: 12px; justify-content: center; padding: 6px 0; }
.punts i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--paper); }
.punts i.ple { background: var(--groc); border-color: var(--groc); }
.punts.error i { border-color: var(--vermell); animation: sacseja .3s; }
@keyframes sacseja { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.teclat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.teclat button {
  height: 64px; background: var(--asfalt-2); border: 2px solid var(--linia); cursor: pointer;
  font-weight: 900; font-variation-settings: "wdth" 70; font-size: 1.8rem;
}
.teclat button:active { background: var(--groc); color: var(--tinta); border-color: var(--groc); }
.teclat .petit { font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.recorda { display: flex; gap: 10px; align-items: center; color: var(--gris); font-size: .95rem; cursor: pointer; }
.recorda input { width: 20px; height: 20px; accent-color: var(--groc); }
.avis-pin { font-family: var(--mono); font-size: .72rem; color: var(--groc); text-align: center; margin: 0; }

/* votació */
.hola { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hola b { font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2rem; text-transform: uppercase; line-height: 1; }
.criteri { background: var(--asfalt-2); border: 2px solid var(--linia); padding: 14px 14px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: end; }
.criteri label { font-weight: 900; font-variation-settings: "wdth" 66; font-size: 1.4rem; text-transform: uppercase; line-height: 1; }
.criteri .ajuda { grid-column: 1; color: var(--gris); font-size: .88rem; line-height: 1.3; }
.criteri .valor { grid-row: 1 / span 2; grid-column: 2; font-weight: 900; font-variation-settings: "wdth" 62; font-size: 3.2rem; line-height: .85; color: var(--groc); min-width: 2.6ch; text-align: right; font-variant-numeric: tabular-nums; }
.criteri.buit .valor { color: var(--linia); }
.fila-slider { grid-column: 1 / -1; display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin-top: 12px; }
.fila-slider button { height: 44px; background: none; border: 2px solid var(--linia); cursor: pointer; font-weight: 800; font-size: 1.3rem; }
.fila-slider button:hover { border-color: var(--paper); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; background: linear-gradient(to right, var(--groc) var(--p, 0%), var(--linia) var(--p, 0%)); border-radius: 0 5px 5px 0; }
input[type="range"]::-moz-range-track { height: 10px; background: var(--linia); }
input[type="range"]::-moz-range-progress { height: 10px; background: var(--groc); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: var(--groc); border: 3px solid var(--tinta); box-shadow: 0 0 0 2px var(--groc); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--groc); border: 3px solid var(--tinta); }
.criteri.buit input[type="range"]::-webkit-slider-thumb { background: var(--gris); box-shadow: 0 0 0 2px var(--gris); }
.criteri.buit input[type="range"]::-moz-range-thumb { background: var(--gris); }
.escala { grid-column: 1 / -1; display: flex; justify-content: space-between; padding: 0 54px; color: var(--gris); }
.bloc { display: flex; flex-direction: column; gap: 10px; }
.bloc h3 { margin: 0; font-weight: 900; font-variation-settings: "wdth" 66; font-size: 1.4rem; text-transform: uppercase; line-height: 1; }
.bloc p { margin: 0; color: var(--gris); font-size: .92rem; }
.xips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 480px) { .xips { grid-template-columns: repeat(4, 1fr); } }
.xip { background: var(--asfalt-2); border: 2px solid var(--linia); padding: 10px 6px; cursor: pointer; font-weight: 800; font-variation-settings: "wdth" 80; text-transform: uppercase; font-size: .95rem; }
.xip[aria-pressed="true"] { background: var(--groc); color: var(--tinta); border-color: var(--groc); }
.camp { background: var(--asfalt-2); border: 2px solid var(--linia); padding: 12px; width: 100%; font-size: 1rem; }
.camp:focus { border-color: var(--groc); outline: none; }
textarea.camp { min-height: 96px; resize: vertical; }
.comptador { align-self: flex-end; color: var(--gris); }

/* premi ribeira */
.ribeira { background: var(--asfalt-2); border: 2px solid var(--vermell); padding: 14px; }
.ribeira h3 label { display: flex; align-items: center; gap: 10px; }
.llauna { width: 34px; height: 20px; border-radius: 5px; background: var(--groc); border: 2px solid var(--vermell); position: relative; flex: none; }
.llauna::after { content: ""; position: absolute; left: 4px; right: 4px; top: 5px; height: 4px; background: var(--vermell); border-radius: 2px; }
.fila-preu { display: grid; grid-template-columns: 52px 1fr 52px; gap: 10px; align-items: center; }
.fila-preu button { height: 56px; background: none; border: 2px solid var(--linia); cursor: pointer; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.fila-preu button:hover { border-color: var(--paper); }
.preu-camp { position: relative; }
.preu-camp input { text-align: center; font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2.2rem; padding: 6px 34px 6px 12px; height: 56px; font-variant-numeric: tabular-nums; }
.preu-camp span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-weight: 900; font-size: 1.4rem; color: var(--gris); pointer-events: none; }

/* barra d'enviar */
.barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--asfalt); border-top: 2px solid var(--paper);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.barra .gutter { max-width: 560px; margin: 0 auto; padding-block: 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.barra .nota span { display: block; color: var(--gris); }
.barra .nota b { font-weight: 900; font-variation-settings: "wdth" 62; font-size: 2.4rem; line-height: .9; color: var(--groc); }
.boto {
  background: var(--groc); color: var(--tinta); border: 2px solid var(--tinta); box-shadow: 4px 4px 0 var(--vermell);
  padding: 14px 18px; cursor: pointer; font-weight: 900; font-variation-settings: "wdth" 70; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .02em;
}
.boto:disabled { background: var(--linia); color: var(--gris); box-shadow: none; cursor: not-allowed; }
.boto.sec { background: none; color: var(--paper); border-color: var(--paper); box-shadow: none; }
.boto:not(:disabled):active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--vermell); }
.falten { color: var(--gris); }

/* fet */
.fet { position: relative; }
.estampa { position: absolute; right: 14px; top: 46px; font-family: var(--marker); color: var(--vermell); border: 3px solid var(--vermell); padding: 2px 10px; transform: rotate(-12deg); font-size: 1.3rem; opacity: .9; }
.botons { display: flex; flex-wrap: wrap; gap: 10px; }
.botons .boto { flex: 1 1 200px; text-align: center; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- afegit per a la versió de debò ---------- */
a { color: inherit; }
.carrega { color: var(--gris); font-family: var(--mono); font-size: .8rem; }
.missatge { background: var(--asfalt-2); border: 2px solid var(--linia); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.missatge p { margin: 0; }
.missatge.error { border-color: var(--vermell); }
.missatge.be { border-color: var(--groc); }
.enllacos { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.enllacos a, .enllacos button { color: var(--paper); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.rata:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.rata .estat { position: relative; font-family: var(--mono); font-size: .6rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); margin-top: 4px; }
.sessio { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 2px solid var(--linia); padding-top: 14px; }

/* administració */
.targeta { background: var(--asfalt-2); border: 2px solid var(--linia); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.targeta.oberta { border-color: var(--groc); }
.targeta h3 { margin: 0; font-weight: 900; font-variation-settings: "wdth" 66; font-size: 1.5rem; text-transform: uppercase; line-height: 1; overflow-wrap: anywhere; }
.targeta .mono { color: var(--gris); }
.xip-estat { display: inline-block; font-family: var(--mono); font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; background: var(--linia); color: var(--paper); }
.xip-estat.oberta { background: var(--groc); color: var(--tinta); }
.xip-estat.resultats { background: var(--paper); color: var(--tinta); }
.camp-fila { display: flex; flex-direction: column; gap: 6px; }
.camp-fila p { margin: 0; overflow-wrap: anywhere; }
.camp-fila > span { font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); }
.en-linia { display: flex; gap: 8px; align-items: stretch; }
.en-linia > :first-child { flex: 1; min-width: 0; }
.boto.petit { padding: 10px 12px; font-size: .9rem; box-shadow: 3px 3px 0 var(--vermell); }
.boto.sec.petit { box-shadow: none; }
.boto.perill { background: none; color: var(--vermell); border-color: var(--vermell); box-shadow: none; }
select.camp { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--paper) 50%), linear-gradient(135deg, var(--paper) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
input[type="date"].camp { min-height: 48px; }
.hl-admin { border-left: 4px solid var(--linia); padding: 6px 0 6px 10px; display: flex; flex-direction: column; gap: 8px; }
.hl-admin.pendent { border-color: var(--groc); }
.hl-admin.aprovat { border-color: #5fa35f; }
.hl-admin.rebutjat, .hl-admin.filtrat { border-color: var(--vermell); }
.hl-admin p { margin: 0; overflow-wrap: anywhere; }
.files-rates { display: flex; flex-direction: column; gap: 6px; }
.fila-rata { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; background: var(--asfalt-2); border: 2px solid var(--linia); padding: 10px; }
.fila-rata b { font-weight: 900; font-variation-settings: "wdth" 66; text-transform: uppercase; font-size: 1.1rem; }
.fila-rata .mono { grid-column: 1 / -1; color: var(--gris); }
.fila-rata .botons { grid-column: 1 / -1; }
textarea.resultats { min-height: 220px; font-family: var(--mono); font-size: .75rem; }
details.targeta > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 6px; }
details.targeta > summary::-webkit-details-marker { display: none; }
details.targeta > summary::after { content: "Obre ▾"; font-family: var(--mono); font-size: .7rem; color: var(--gris); letter-spacing: .08em; text-transform: uppercase; }
details.targeta[open] > summary::after { content: "Tanca ▴"; }
