/* Arxiu obert — paper / tinta / vermell. Sense fonts ni recursos externs. */
:root {
  --paper: #EEE7D8;
  --ink: #17150F;
  --accent: #9B2A22;
  --grey: #7D776B;          /* només per a línies i vores (3,6:1 sobre paper: no apte per a text) */
  --grey-text: #4F4A40;     /* text secundari, AAA sobre paper */
  --line: #C9C0AB;
  --card: #F6F1E6;
  --escala: 1;
  --serif: Georgia, "Times New Roman", "Liberation Serif", serif;
  /* Georgia té xifres "antigues" (09 sembla o9): les xifres usen una serifa amb xifres alineades. */
  --num: "Times New Roman", Times, "Liberation Serif", "Noto Serif", serif;
}
html[data-mida="2"] { --escala: 1.2; }
html[data-mida="3"] { --escala: 1.45; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.25rem; line-height: 1.5;
}
#app { max-width: 40rem; margin: 0 auto; padding: 0 16px 48px; }
.noscript { padding: 24px 16px; font-size: 1.25rem; }

:where(button, a.boto, a.boto-petit) { font: inherit; color: inherit; }
.numero, .n, .visor, .tecla, .temps, .rodo.petit { font-family: var(--num); font-variant-numeric: lining-nums tabular-nums; }
.tecla.esborra { font-family: var(--serif); }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
.salta { position: absolute; left: -999px; }

/* Capçalera */
.cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; border-bottom: 2px solid var(--ink); margin-bottom: 20px; }
.cap .marca { font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; }
.cap .marca small { display: block; font-weight: 400; font-size: .85rem; color: var(--grey-text); letter-spacing: 0; }
.boto-petit { min-height: 48px; min-width: 48px; padding: 6px 14px; background: transparent; border: 2px solid var(--ink); border-radius: 10px; font-size: 1rem; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

h1 { font-size: calc(1.9rem * var(--escala)); line-height: 1.15; margin: 8px 0 12px; font-weight: 700; }
h1:focus { outline: none; }
h2 { font-size: 1.3rem; margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
h3 { font-size: 1.1rem; margin: 22px 0 8px; color: var(--grey-text); text-transform: uppercase; letter-spacing: .08em; }
p.ajuda { margin: 0 0 16px; color: var(--grey-text); }

/* Pantalla d'idioma */
.idiomes { display: grid; gap: 14px; margin-top: 8px; }
.idioma { min-height: 88px; font-size: 2rem; font-weight: 700; background: var(--card); border: 3px solid var(--ink); border-radius: 16px; padding: 12px; text-align: center; }
.idioma[aria-current="true"] { background: var(--ink); color: var(--paper); }
.idioma-nota { text-align: center; color: var(--grey-text); font-size: 1rem; margin: 0 0 6px; }

/* Teclat */
.visor { min-height: 84px; display: flex; align-items: center; justify-content: center; font-size: 3rem; letter-spacing: .35em; font-weight: 700; background: var(--card); border: 3px solid var(--ink); border-radius: 14px; margin: 0 0 14px; padding-left: .35em; font-variant-numeric: tabular-nums; }
.visor.buit { color: var(--grey-text); font-weight: 400; font-size: 1.1rem; letter-spacing: 0; padding-left: 0; }
.teclat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tecla { min-height: 68px; font-size: 2rem; font-weight: 700; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 0; }
.tecla:active { background: var(--line); }
.tecla.esborra { font-size: 1.1rem; }
.tecla.ok { background: var(--accent); color: var(--paper); border-color: var(--accent); font-size: 1.6rem; }
.tecla[disabled] { opacity: .45; cursor: default; }
.missatge { min-height: 1.5em; margin: 12px 0 0; font-weight: 700; color: var(--accent); }
.missatge:empty { margin: 0; min-height: 0; }

/* Llista de punts */
.llista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.llista a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.llista .n { font-weight: 700; min-width: 2.2ch; color: var(--accent); font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* Pista */
.planta { margin: 0; color: var(--grey-text); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; }
.numero { display: block; font-size: calc(3.4rem * var(--escala)); line-height: 1; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.reproductor { margin: 20px 0 24px; padding: 18px 14px; background: var(--card); border: 3px solid var(--ink); border-radius: 18px; }
.fila-botons { display: flex; align-items: center; justify-content: center; gap: 12px; }
.rodo { border-radius: 50%; border: 3px solid var(--ink); background: transparent; display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0; }
.rodo.petit { width: 68px; height: 68px; font-size: 1rem; font-weight: 700; line-height: 1.1; flex-direction: column; }
.rodo.gran { width: 104px; height: 104px; background: var(--accent); border-color: var(--accent); color: var(--paper); }
.rodo svg { width: 46px; height: 46px; fill: currentColor; }
.progres { margin-top: 18px; }
.progres input[type=range] { width: 100%; height: 48px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.progres input[type=range]::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; border: 2px solid var(--ink); background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--paper) var(--pct, 0%)); }
.progres input[type=range]::-moz-range-track { height: 10px; border-radius: 7px; border: 2px solid var(--ink); background: var(--paper); }
.progres input[type=range]::-moz-range-progress { height: 10px; border-radius: 7px; background: var(--accent); }
.progres input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--paper); }
.progres input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); border: 3px solid var(--paper); }
.temps { display: flex; justify-content: space-between; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.accions { display: grid; gap: 10px; margin-top: 18px; }
.boto { min-height: 60px; padding: 10px 18px; font-size: 1.2rem; font-weight: 700; border: 3px solid var(--ink); border-radius: 14px; background: var(--ink); color: var(--paper); text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.boto.secundari { background: transparent; color: var(--ink); }
.boto[disabled] { opacity: .45; cursor: default; }

.mida { display: flex; align-items: center; gap: 8px; margin: 28px 0 8px; }
.mida span { margin-right: auto; font-size: 1rem; color: var(--grey-text); }
.mida button { min-width: 56px; min-height: 52px; background: transparent; border: 2px solid var(--ink); border-radius: 10px; font-weight: 700; }
.mida button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.text { font-size: calc(1.25rem * var(--escala)); line-height: 1.6; }
.text p { margin: 0 0 1em; white-space: pre-line; }
.estat { margin: 10px 0 0; font-weight: 700; color: var(--accent); }
.estat:empty { display: none; }
.carrega { padding: 40px 0; text-align: center; color: var(--grey-text); }

@media (max-width: 340px) {
  #app { padding: 0 12px 40px; }
  .idioma { font-size: 1.7rem; }
  .visor { font-size: 2.4rem; }
  .fila-botons { gap: 8px; }
  .rodo.petit { width: 60px; height: 60px; }
  .rodo.gran { width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: no-preference) { .tecla, .boto, .idioma { transition: background-color .12s; } }
@media (forced-colors: active) { .rodo.gran, .tecla.ok { forced-color-adjust: auto; } }
