/* ------------------------------------------------------------------
   Hex — foglio di stile
   Tutte le classi sono prefissate con hex- e tutti i token stanno su
   .hex-app, così il widget non tocca gli stili del sito ospite.
------------------------------------------------------------------ */

@font-face{
  font-family:"Jost";
  src:url("fonts/jost-latin-var.woff2") format("woff2-variations"),
      url("fonts/jost-latin-var.woff2") format("woff2");
  font-weight:300 600;
  font-style:normal;
  font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,
                U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,
                U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Newsreader";
  src:url("fonts/newsreader-latin-var.woff2") format("woff2-variations"),
      url("fonts/newsreader-latin-var.woff2") format("woff2");
  font-weight:300 500;
  font-style:normal;
  font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,
                U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,
                U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

.hex-app{
  --hex-paper:#eceae3;
  --hex-card:#f7f6f2;
  --hex-ink:#14181b;
  --hex-muted:#5f6a6e;
  --hex-rule:#cdcbc2;
  --hex-fill:#dcdad1;
  --hex-fill-hi:#cdcabd;
  --hex-line:#8d9095;
  --hex-red:#c93a31;
  --hex-blue:#2f5ad0;
  --hex-shadow:0 1px 2px rgba(20,24,27,.10), 0 8px 24px rgba(20,24,27,.06);
  --hex-ghost:var(--hex-red);

  font-family:"Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight:400;
  font-size:16px;
  line-height:1.45;
  color:var(--hex-ink);
  -webkit-font-smoothing:antialiased;
}
@media (prefers-color-scheme: dark){
  .hex-app:not([data-theme="light"]){
    --hex-paper:#12171a;
    --hex-card:#1a2126;
    --hex-ink:#e9ece9;
    --hex-muted:#93a0a3;
    --hex-rule:#2a3439;
    --hex-fill:#2f393f;
    --hex-fill-hi:#3d4a51;
    --hex-line:#5a686f;
    --hex-red:#e05146;
    --hex-blue:#5b83ee;
    --hex-shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  }
}
.hex-app[data-theme="dark"]{
  --hex-paper:#12171a;
  --hex-card:#1a2126;
  --hex-ink:#e9ece9;
  --hex-muted:#93a0a3;
  --hex-rule:#2a3439;
  --hex-fill:#2f393f;
  --hex-fill-hi:#3d4a51;
  --hex-line:#5a686f;
  --hex-red:#e05146;
  --hex-blue:#5b83ee;
  --hex-shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
}

.hex-app *,
.hex-app *::before,
.hex-app *::after{box-sizing:border-box}

/* ---------- impianto ---------- */
.hex-layout{display:grid;grid-template-columns:minmax(0,1fr) 258px;gap:26px;align-items:start}
@media (max-width:860px){.hex-layout{grid-template-columns:minmax(0,1fr)}}

/* ---------- stato ---------- */
.hex-status{display:flex;align-items:center;gap:11px;min-height:34px;margin-bottom:10px}
.hex-dot{width:13px;height:13px;border-radius:50%;flex:none;background:var(--hex-muted)}
.hex-dot.is-red{background:var(--hex-red)}
.hex-dot.is-blue{background:var(--hex-blue)}
.hex-line{font-size:17px}
.hex-sub{color:var(--hex-muted);font-size:13.5px}
.hex-bar{height:2px;background:var(--hex-rule);border-radius:2px;overflow:hidden;margin-bottom:12px}
.hex-bar > i{display:block;height:100%;width:0;background:var(--hex-ink);opacity:.55;
  transition:width .12s linear}

/* ---------- scacchiera ---------- */
.hex-boardbox{background:var(--hex-card);border:1px solid var(--hex-rule);border-radius:3px;
  padding:14px 12px 10px;box-shadow:var(--hex-shadow)}
.hex-board{display:block;width:100%;height:auto;touch-action:manipulation}
.hex-board:focus{outline:none}
.hex-board:focus-visible{outline:2px solid var(--hex-blue);outline-offset:3px}
.hex-poly{fill:var(--hex-fill);stroke:var(--hex-line);stroke-width:.9;stroke-linejoin:round}
.hex-board.is-playable .hex-cell:not(.is-filled) .hex-poly{cursor:pointer}
.hex-board.is-playable .hex-cell:not(.is-filled):hover .hex-poly{fill:var(--hex-fill-hi)}
.hex-ghost{opacity:0;pointer-events:none;fill:var(--hex-ghost)}
.hex-board.is-playable .hex-cell:not(.is-filled):hover .hex-ghost{opacity:.34}
.hex-stone{pointer-events:none;transform:scale(0);transform-box:fill-box;transform-origin:center;
  transition:transform .19s cubic-bezier(.34,1.4,.64,1)}
.hex-cell.is-filled .hex-stone{transform:scale(1)}
.hex-stone.is-red{fill:var(--hex-red)}
.hex-stone.is-blue{fill:var(--hex-blue)}
.hex-gloss{pointer-events:none;fill:#fff;opacity:0}
.hex-cell.is-filled .hex-gloss{opacity:.17}
.hex-mark{fill:none;stroke:var(--hex-card);stroke-width:1.6;opacity:0;pointer-events:none}
.hex-cell.is-last .hex-mark{opacity:.85}
.hex-edge{stroke-linecap:round;stroke-linejoin:round;fill:none}
.hex-edge.is-red{stroke:var(--hex-red)}
.hex-edge.is-blue{stroke:var(--hex-blue)}
.hex-coord{fill:var(--hex-muted);font-size:8px;font-family:"Jost",sans-serif;
  text-anchor:middle;dominant-baseline:central;user-select:none}
.hex-winline{fill:none;stroke:var(--hex-card);stroke-width:3.4;
  stroke-linecap:round;stroke-linejoin:round;opacity:.92}
.hex-cell.is-cursor .hex-poly{stroke:var(--hex-ink);stroke-width:1.9}
.hex-cell.is-hint .hex-poly{fill:var(--hex-fill-hi);animation:hex-pulse 1s ease-in-out 3}
@keyframes hex-pulse{50%{fill:var(--hex-fill)}}

/* ---------- pannello ---------- */
.hex-panel{background:var(--hex-card);border:1px solid var(--hex-rule);border-radius:3px;
  padding:16px 16px 18px;box-shadow:var(--hex-shadow)}
.hex-field{margin-bottom:15px}
.hex-field > span.hex-label{display:block;font-size:13px;color:var(--hex-muted);margin-bottom:6px}
.hex-seg{display:flex;border:1px solid var(--hex-rule);border-radius:2px;overflow:hidden}
.hex-seg button{flex:1;appearance:none;background:transparent;border:0;
  border-right:1px solid var(--hex-rule);padding:7px 4px;font:inherit;font-size:14px;
  color:var(--hex-muted);cursor:pointer}
.hex-seg button:last-child{border-right:0}
.hex-seg button[aria-pressed="true"]{background:var(--hex-ink);color:var(--hex-card)}
.hex-seg button:hover:not([aria-pressed="true"]){color:var(--hex-ink)}
.hex-seg.hex-side button[aria-pressed="true"][data-v="1"]{background:var(--hex-red);color:#fff}
.hex-seg.hex-side button[aria-pressed="true"][data-v="2"]{background:var(--hex-blue);color:#fff}
.hex-grid2{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.hex-grid2 button{border:1px solid var(--hex-rule);border-radius:2px;background:transparent;
  padding:7px 4px;font:inherit;font-size:14px;color:var(--hex-muted);cursor:pointer}
.hex-grid2 button[aria-pressed="true"]{background:var(--hex-ink);color:var(--hex-card);
  border-color:var(--hex-ink)}
.hex-grid2 button:hover:not([aria-pressed="true"]){color:var(--hex-ink)}
.hex-check{display:flex;align-items:flex-start;gap:9px;font-size:14px;cursor:pointer}
.hex-check input{margin:3px 0 0;accent-color:var(--hex-ink);width:15px;height:15px}
.hex-note{display:block;color:var(--hex-muted);font-size:12.5px;line-height:1.35;margin-top:2px}
.hex-sep{border:0;border-top:1px solid var(--hex-rule);margin:16px 0}
.hex-actions{display:flex;flex-direction:column;gap:7px}
.hex-btn{appearance:none;border:1px solid var(--hex-rule);background:transparent;
  color:var(--hex-ink);border-radius:2px;padding:9px 12px;font:inherit;font-size:14.5px;
  cursor:pointer;text-align:left;width:100%}
.hex-btn:hover:not(:disabled){border-color:var(--hex-ink)}
.hex-btn:disabled{opacity:.38;cursor:default}
.hex-btn.is-primary{background:var(--hex-ink);color:var(--hex-card);border-color:var(--hex-ink)}
.hex-btn.is-primary:hover{opacity:.88}
.hex-btn.is-swap{border-color:var(--hex-blue);color:var(--hex-blue);font-weight:500}
.hex-eval{font-size:12.5px;color:var(--hex-muted);margin:12px 0 0;
  font-variant-numeric:tabular-nums;min-height:17px}
.hex-record{color:var(--hex-muted);font-size:13.5px;font-variant-numeric:tabular-nums;margin:0}
.hex-app :focus-visible{outline:2px solid var(--hex-blue);outline-offset:2px}

@media (prefers-reduced-motion: reduce){
  .hex-stone{transition:none}
  .hex-cell.is-hint .hex-poly{animation:none}
  .hex-bar > i{transition:none}
}

/* ------------------------------------------------------------------
   Stili della pagina dimostrativa: servono solo a hex.html.
   Se incorpori il widget in una tua pagina puoi cancellare da qui.
------------------------------------------------------------------ */
.hex-page{background:var(--hex-paper);margin:0;padding:0}
.hex-wrap{max-width:1180px;margin:0 auto;padding:18px 20px 64px}
.hex-topbar{display:flex;align-items:baseline;gap:16px;flex-wrap:wrap;
  padding-bottom:12px;border-bottom:1px solid var(--hex-rule);margin-bottom:22px}
.hex-mark{display:flex;align-items:center;gap:10px}
.hex-mark svg{display:block}
.hex-mark h1{font-size:30px;font-weight:300;letter-spacing:.22em;margin:0 0 0 2px;line-height:1}
.hex-origin{color:var(--hex-muted);font-size:13.5px;margin:0}
.hex-topbar .hex-record{margin-left:auto}
.hex-rules{margin-top:34px;border-top:1px solid var(--hex-rule);padding-top:22px;
  display:grid;grid-template-columns:repeat(auto-fit,minmax(255px,1fr));gap:26px 38px}
.hex-rules h2{font-size:15px;font-weight:500;margin:0 0 7px}
.hex-rules p{font-family:"Newsreader",Georgia,"Times New Roman",serif;font-weight:300;
  font-size:16.5px;line-height:1.62;color:var(--hex-muted);margin:0 0 10px;max-width:62ch}
.hex-rules p b{font-weight:400;color:var(--hex-ink)}
