@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../fonts/archivo-black.woff2") format("woff2");
}
/* Risografia (com Numerològic): tinta negra + tintes que canvien amb la dificultat.
   La dificultat es llegeix del DOM amb :has(), sense tocar el JS. */
:root {
  --ink: #1b1b1b; --paper: #f3efe7; --paper-2: #e6e0d4; --muted: #4d4a44;
  --ok: #00764e; --bad: #c4252f; --warn: #a14a00; --gold: #8a5a00;
  --display: "Archivo Black", system-ui, sans-serif;
}
.pl { --hex-center: #ff6c2f; --center-ink: var(--ink); --shadow: #ffe800; }
.pl:has(.difficulty .facil, .tab.facil[aria-pressed="true"]) { --hex-center: #5ec8e5; }
.pl:has(.difficulty .dificil, .tab.dificil[aria-pressed="true"]) { --hex-center: #ff48b0; --shadow: #ff6c2f; }

* { box-sizing: border-box; }
body {
  margin: 0; background: #e2ddd1; font-family: system-ui, sans-serif; color: var(--ink);
  display: flex; justify-content: center; padding: 16px;
}
.pl {
  width: 100%; max-width: 400px; background: var(--paper); border: 2px solid var(--ink);
  border-radius: 16px; padding: 16px 16px 20px;
}
.topbar { text-align: center; }
.logo {
  margin: 4px 0 8px; font-family: var(--display); font-weight: 400; font-size: 36px; letter-spacing: -1px;
  line-height: 1.1; color: var(--ink); text-shadow: 2px 2px 0 var(--hex-center);
}

.goal { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.difficulty { text-align: center; margin-top: 6px; }
.difficulty span {
  display: inline-block; padding: 2px 10px; border: 2px solid var(--ink); border-radius: 4px;
  font-size: 12px; font-weight: 800; background: var(--hex-center); color: var(--center-ink);
}
.difficulty .special { background: var(--paper); color: var(--ink); }

.goal b { display: block; font-family: var(--display); font-weight: 400; font-size: 46px; color: var(--ink); line-height: 1.1; text-shadow: 2px 2px 0 var(--hex-center); }
.route { text-align: center; font-size: 15px; color: var(--muted); min-height: 22px; margin-top: 6px; }
.result { text-align: center; min-height: 24px; font-size: 20px; font-weight: 700; color: var(--muted); }
.result.hit { color: var(--ok); }

.hive { display: flex; flex-direction: column; align-items: center; margin: 6px 0 14px; }
/* l'ombra va a la fila: el clip-path de cada cel·la retallaria la seua */
.hrow { display: flex; gap: 5px; filter: drop-shadow(2px 2px 0 var(--shadow)); }
.hrow + .hrow { margin-top: -12px; }
.hex {
  position: relative; width: 60px; height: 69px; background: var(--ink); color: var(--paper); font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; padding: 0;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.hex.center { background: var(--hex-center); color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 24px; cursor: default; }
.hex.on { background: #2f4a86; color: #fff; }
.hex.on.here { background: var(--shadow); color: var(--ink); }
.hex.off { background: var(--paper-2); color: var(--muted); cursor: default; }
.hex small { position: absolute; bottom: 9px; font-size: 10px; font-weight: 600; opacity: .85; }
.hex:not(.off):not(.center):hover { filter: brightness(1.15); }
.hex:not(.off):not(.center):active { filter: brightness(.85); }
/* el clip-path amaga l'outline: el focus canvia la cel·la de color */
.hex:focus-visible { background: #fff; color: var(--ink); }
.dup { color: var(--warn); }
.flash.dup { color: var(--warn); }

.flash { text-align: center; min-height: 22px; font-size: 14px; font-weight: 700; margin: 4px 0; }
.flash.found { color: var(--ok); }
.flash.tutti { color: var(--gold); }
.flash.error { color: var(--bad); }

.keys { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin: 6px 0 12px; }
.key, .pill, .tab {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.key { padding: 10px 0; border-radius: 8px; font-size: 18px; font-weight: 700; }
.pill { padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 700; }
.key:hover, .pill:hover, .tab:hover { background: #fff; }
.key:active, .pill:active, .tab:active { transform: translate(2px, 2px); box-shadow: none; }
.pill:disabled { opacity: .5; cursor: default; }
.actions { display: flex; align-items: center; justify-content: center; gap: 14px; }
.send { background: var(--shadow); }
.send:hover { background: var(--shadow); filter: brightness(1.05); }

.foot { text-align: center; margin-top: 16px; }
.found { background: none; border: none; color: var(--ink); font-size: 14px; cursor: pointer; }
.status, .links { color: var(--muted); font-size: 13px; }
.status { margin-top: 8px; }
.links { margin-top: 6px; }
.num { color: var(--ink); font-weight: 600; }
.rankbtn { background: none; border: none; color: var(--ink); font-weight: 600; cursor: pointer; font-size: 13px; }
.rankbtn:hover { text-decoration: underline; text-decoration-color: var(--hex-center); text-decoration-thickness: 2px; }
.goalst.done { color: var(--ok); font-weight: 700; }
.star { color: var(--gold); }
.star.done { font-weight: 700; }
.streak:empty { display: none; }
.streak::before { content: " · "; color: var(--muted); }

.panel { position: fixed; inset: 0; background: rgba(27,27,27,.5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel-card {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
  padding: 18px 20px; max-width: 360px; width: 100%; max-height: 70vh; overflow: auto;
}
.panel-card h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; }
.panel-card ul { margin: 0; padding-left: 18px; }
.panel-card li { margin: 4px 0; }
.panel-card .mini { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--ink); vertical-align: -3px; }
.hint-btn { margin-left: 6px; padding: 3px 10px; font-size: 12px; }
.hidden { display: none; }

/* Jocs de la família: fila d'icones al peu */
.games { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-top: 14px; padding-top: 10px; border-top: 2px solid var(--ink); }
.game { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; border-radius: 8px; color: var(--muted); font-size: 10px; font-weight: 600; text-decoration: none; }
.game:hover { background: #fff; }
.game:active { background: var(--paper-2); }
.game.here { color: var(--ink); background: var(--paper-2); }
.game img { display: block; }

button:focus-visible, .game:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.share.ready:focus-visible, [aria-pressed="true"]:focus-visible { outline-color: var(--hex-center); }
@media (prefers-reduced-motion: reduce) {
  .key:active, .pill:active, .tab:active { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .hex:not(.off):not(.center):active { transform: scale(.94); }
}
