:root{
  --bg:#050716; --panel:rgba(10,14,42,.72); --fg:#E7E8FB; --muted:rgba(231,232,251,.72);
  --blue:#4FA3FF; --blue2:#7C5CFF; --shadow:0 10px 30px rgba(0,0,0,.45); --radius:18px;
  --mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  --sans:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
}
*{box-sizing:border-box} html,body{height:100%}
body{
  margin:0; font-family:var(--sans); color:var(--fg);
  background:
    radial-gradient(1200px 600px at 20% 15%, rgba(79,163,255,.22), transparent 60%),
    radial-gradient(900px 500px at 65% 20%, rgba(124,92,255,.22), transparent 55%),
    radial-gradient(900px 700px at 50% 85%, rgba(79,163,255,.12), transparent 60%),
    var(--bg);
}
a{color:var(--blue);text-decoration:none} a:hover{text-decoration:underline}
.container{max-width:1180px;margin:0 auto;padding:28px 18px 60px}
.header{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin:8px 0 22px}
.brand h1{margin:0;font-size:26px} .brand p{margin:8px 0 0;color:var(--muted);max-width:820px;line-height:1.55}
.badges{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end}
.badge{padding:8px 12px;border:1px solid rgba(231,232,251,.14);border-radius:999px;background:rgba(0,0,0,.22);font-size:12px}
.grid{display:grid;grid-template-columns:1.15fr .85fr;gap:18px}
.card{background:var(--panel);border:1px solid rgba(231,232,251,.14);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.card-h{padding:16px 16px 12px;border-bottom:1px solid rgba(231,232,251,.10);
  background:linear-gradient(180deg, rgba(79,163,255,.10), rgba(0,0,0,0))}
.card-h h2{margin:0;font-size:16px} .card-h p{margin:8px 0 0;color:var(--muted);line-height:1.55;font-size:13px}
.card-b{padding:16px}
.row{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start}
.canvas{width:320px;height:320px;max-width:100%;border-radius:16px;border:1px solid rgba(231,232,251,.16);background:#000;touch-action:none}
.controls{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.btn{border:none;padding:10px 12px;border-radius:999px;background:linear-gradient(90deg, rgba(79,163,255,.95), rgba(124,92,255,.95));
  color:#fff;font-weight:650;cursor:pointer}
.btn.secondary{background:rgba(0,0,0,.28);border:1px solid rgba(231,232,251,.16)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:320px}
.kpi{background:rgba(0,0,0,.22);border:1px solid rgba(231,232,251,.12);border-radius:14px;padding:12px}
.kpi .label{color:var(--muted);font-size:12px} .kpi .value{font-size:22px;font-weight:750;margin-top:6px}
.small{font-size:12px;color:var(--muted);line-height:1.55}
.code{font-family:var(--mono);font-size:12px;padding:10px 12px;background:rgba(0,0,0,.28);border:1px solid rgba(231,232,251,.12);border-radius:14px;overflow:auto}

/* ===== Chart sizing fix (prevents runaway growth) =====
   Chart.js is responsive by default. If the canvas height participates in layout
   and is also being set by JS, you can get a feedback loop where the canvas grows.
   We give the chart a fixed-height container and absolutely position the canvas
   inside it so the chart can never expand the page height.
*/
.chartWrap{
  position: relative;
  width: 100%;
  height: 220px;
}

.chartWrap canvas{
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* (Deprecated) old chart sizing — keep commented out to avoid conflict */
/* .chart{width:100%;height:320px} */

.probs{margin-top:10px;display:grid;gap:10px}
.bar{display:flex;align-items:center;gap:10px}
.bar .d{width:18px;text-align:right;font-weight:700}
.bar .track{flex:1;height:10px;border-radius:999px;background:rgba(231,232,251,.10);overflow:hidden;border:1px solid rgba(231,232,251,.10)}
.bar .fill{height:100%;width:0%;background:linear-gradient(90deg, rgba(79,163,255,.95), rgba(124,92,255,.95))}
.bar .p{width:60px;text-align:right;color:var(--muted);font-family:var(--mono);font-size:12px}
.footer{margin-top:18px;color:rgba(231,232,251,.62);font-size:12px}
@media (max-width:980px){.grid{grid-template-columns:1fr}.badges{justify-content:flex-start}}


/* --- v5 updates: split charts, intro, diagrams, highlight predicted digit --- */
.chartStack{display:grid;grid-template-columns:1fr;gap:14px;margin-top:10px}
.chartBlock{display:flex;flex-direction:column;gap:8px}
.chartTitle{color:var(--muted);font-size:12px}

/* Make the “Predicted digit” stand out */
.kpiMain{grid-column:1 / -1;padding:16px}
.valueBig{font-size:56px !important;line-height:1.05}

/* Top description */
.intro{margin:18px 0}
.intro h2{margin:0 0 10px}
.intro p{max-width:900px}

/* Diagrams section */
.diagrams{margin-top:18px}
.diagramGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:12px}
.diagram{margin:0}
.diagram img{width:100%;height:auto;border-radius:12px;background:#fff;display:block}
.diagram figcaption{color:var(--muted);font-size:12px;margin-top:8px;line-height:1.35}

@media (max-width: 900px){
  .diagramGrid{grid-template-columns:1fr}
}
