/* Barlow, SIL Open Font License (fonts/OFL.txt). Bundled so the app looks right offline. */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Barlow-Regular.woff") format("woff"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/Barlow-Medium.woff") format("woff"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Barlow-SemiBold.woff") format("woff"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Barlow-Bold.woff") format("woff"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/BarlowCondensed-Medium.woff") format("woff"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/BarlowCondensed-SemiBold.woff") format("woff"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/BarlowCondensed-Bold.woff") format("woff"); }
/* Stecca app
   felt = the cloth (structure), chalk = cue-chalk blue (selection & action),
   red = the red ball (losses), ivory = the cue ball (grade). */
:root {
  --felt: #1d5c45; --felt-deep: #123d2e; --felt-hi: #2b7259; --rail: #4a3020;
  --chalk: #2f74c0; --chalk-deep: #225a99; --chalk-soft: #e4eef9;
  --red: #c23b2e; --red-soft: #fbe9e6; --gold: #c9a46a;
  --ivory: #fbf8ee;
  --ink: #16201b; --muted: #5b6a63; --faint: #8a9892;
  --line: #d8e0dc; --line-soft: #e9eeeb;
  --bg: #eef2f0; --surface: #ffffff; --surface-2: #f6f9f7;
  --ok: #1f7a4f; --ok-soft: #e1f2e8; --warn: #8a5a00; --warn-soft: #fff3d6;
  --h0: #f6e3df; --h1: #f3d6c8; --h2: #efe7c9; --h3: #d9ecd9; --h4: #b6dcc3; --h5: #86c4a0;
  --shadow: 0 1px 2px rgba(18, 61, 46, .06), 0 4px 16px rgba(18, 61, 46, .06);
  --r-s: 8px; --r-m: 12px; --r-l: 18px;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --felt: #1f5f48; --felt-deep: #0d2a20; --felt-hi: #2d7a5f; --rail: #3a2618;
    --chalk: #5b9be0; --chalk-deep: #82b4ea; --chalk-soft: #1b2c40;
    --red: #e36a5c; --red-soft: #3a1f1c; --ivory: #f3efe2;
    --ink: #e8efeb; --muted: #9fb0a8; --faint: #6f817a;
    --line: #2a3632; --line-soft: #222d2a;
    --bg: #0f1614; --surface: #17201d; --surface-2: #1c2723;
    --ok: #5fc48f; --ok-soft: #173327; --warn: #f0c060; --warn-soft: #3a2f14;
    --h0: #4a2420; --h1: #4a3424; --h2: #3f3d26; --h3: #284331; --h4: #2a5a3f; --h5: #2f7a53;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --felt: #1f5f48; --felt-deep: #0d2a20; --felt-hi: #2d7a5f; --rail: #3a2618;
  --chalk: #5b9be0; --chalk-deep: #82b4ea; --chalk-soft: #1b2c40;
  --red: #e36a5c; --red-soft: #3a1f1c; --ivory: #f3efe2;
  --ink: #e8efeb; --muted: #9fb0a8; --faint: #6f817a;
  --line: #2a3632; --line-soft: #222d2a;
  --bg: #0f1614; --surface: #17201d; --surface-2: #1c2723;
  --ok: #5fc48f; --ok-soft: #173327; --warn: #f0c060; --warn-soft: #3a2f14;
  --h0: #4a2420; --h1: #4a3424; --h2: #3f3d26; --h3: #284331; --h4: #2a5a3f; --h5: #2f7a53;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--chalk-deep); }
:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--red); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { min-height: 100vh; }
.side { display: none; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--felt-deep); color: #fff;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font: 700 1.45rem var(--display); letter-spacing: .02em; color: #fff; text-decoration: none; }
.topbar .brand svg { width: 26px; height: 26px; }
.topbar .title { flex: 1; font: 600 1.25rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { padding: 18px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); max-width: 1240px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; color: var(--muted); font-size: .72rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--chalk-deep); }
.tab.rec .dotwrap { width: 46px; height: 46px; margin-top: -18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chalk); color: #fff; box-shadow: 0 4px 12px rgba(47,116,192,.4); border: 3px solid var(--surface); }
.tab.rec.on .dotwrap { background: var(--chalk-deep); }
.tab.rec .live { position: absolute; }

.syncpill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 600; background: rgba(255,255,255,.1); color: #d6e8df; border: 0; cursor: pointer; white-space: nowrap; }
.syncpill i { width: 8px; height: 8px; border-radius: 50%; background: #8fd0ad; }
.syncpill.offline i { background: #e6c15a; }
.syncpill.error i { background: #ff8b7e; }
.syncpill.syncing i { background: #8fbbe9; animation: pulse 1s infinite; }
.syncpill.demo i { background: var(--gold); }
@keyframes pulse { 50% { opacity: .3; } }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); background: linear-gradient(90deg, var(--felt-deep) 242px, var(--rail) 242px 248px, transparent 248px); }
  .side {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
    background: var(--felt-deep); color: #fff; padding: 20px 14px;
    border-right: 6px solid var(--rail);
  }
  .side .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
    font: 700 1.7rem var(--display); letter-spacing: .02em; padding: 4px 10px 20px; }
  .side .brand svg { width: 32px; height: 32px; }
  .side a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
    color: #cfe2d9; text-decoration: none; font-weight: 600; }
  .side a.nav svg { width: 22px; height: 22px; opacity: .85; }
  .side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
  .side a.nav.on { background: var(--felt); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
  .side a.nav kbd { margin-left: auto; font: 600 .7rem var(--body); color: #8fb5a3; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; padding: 0 5px; }
  .side a.nav .livedot { margin-left: auto; }
  .side .foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.1); color: #a9cbbb; font-size: .82rem; }
  .side .who b { display: block; color: #fff; font-size: .95rem; }
  .topbar, .tabbar { display: none; }
  .main { padding: 28px 32px 48px; }
}
.livedot { width: 9px; height: 9px; border-radius: 50%; background: #ff6b5b; box-shadow: 0 0 0 3px rgba(255,107,91,.25); display: inline-block; }

/* ---------- page bits ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r-m); margin-bottom: 16px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
.banner.info { background: var(--chalk-soft); color: var(--chalk-deep); }
.banner.demo { background: var(--felt); color: #fff; }
.banner.demo b { color: var(--gold); }
@media (max-width: 700px) { .card-head { flex-wrap: wrap; } .card-head h2, .card-head h3 { white-space: nowrap; } .demo-long { display: none; } .banner.demo { padding: 8px 12px; } .livehead .who h1 { font-size: 1.5rem; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 9px 16px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--chalk); border-color: var(--chalk); color: #fff; }
.btn.primary:hover { background: var(--chalk-deep); border-color: var(--chalk-deep); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: .88rem; }
.btn.big { min-height: 54px; font-size: 1.1rem; padding: 12px 26px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 20px; height: 20px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field > small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--chalk-soft); border-color: var(--chalk); }
textarea { min-height: 76px; resize: vertical; }
.row2 { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .hint { margin: 0; }
.hint { color: var(--muted); font-size: .84rem; }
.grid { display: grid; gap: 16px; }
.dash { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash > .wide { grid-column: span 2; } }
@media (min-width: 1560px) { .dash { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash > .wide { grid-column: span 2; } }
.g2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 16px; }

.panel-tools { display: none; gap: 2px; }
.editing .panel-tools { display: flex; }
.editing .card.dpanel { outline: 2px dashed var(--chalk); outline-offset: 3px; }
.hidden-panels { display: none; margin-top: 16px; }
.editing .hidden-panels { display: block; }
.chiplist { display: flex; flex-wrap: wrap; gap: 8px; }
.addchip { border: 1px dashed var(--chalk); color: var(--chalk-deep); background: var(--chalk-soft); padding: 7px 12px; border-radius: 99px; font-weight: 600; cursor: pointer; }

/* figures */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface-2); border-radius: var(--r-m); padding: 12px 14px; }
.kpi b { display: block; font: 600 2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .84rem; }
.kpi small { display: block; font-size: .78rem; margin-top: 3px; }

/* score ring + ball */
.scorebox { display: flex; align-items: center; gap: 20px; }
.ring { position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line-soft); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--chalk); stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .9s ease; }
.ring-fg.grade-A { stroke: var(--ok); } .ring-fg.grade-B { stroke: #3f9a6b; } .ring-fg.grade-C { stroke: var(--chalk); }
.ring-fg.grade-D { stroke: #d39a2e; } .ring-fg.grade-F { stroke: var(--red); }
.ring .ball { position: absolute; inset: 22%; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, var(--ivory) 40%, #e3dbc2 100%);
  box-shadow: 0 5px 0 rgba(0,0,0,.15); color: #123d2e; font: 700 calc(var(--size) * .3)/1 var(--display); }
.ring .ball.empty { color: #b3ab92; }
.scorebox .big { font: 600 3.2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.scorebox .big small { font-size: 1.3rem; color: var(--muted); }
.prov { display: inline-block; margin-top: 8px; font-size: .74rem; color: var(--muted); border: 1px dashed var(--line); padding: 1px 9px; border-radius: 99px; }
.delta { font-weight: 600; font-size: .9rem; }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--body); }
.chart .gl { stroke: var(--line-soft); fill: none; }
.chart .zero { stroke: var(--faint); stroke-dasharray: 3 3; }
.chart .ref { stroke: var(--gold); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.chart .ln { fill: none; stroke: var(--chalk); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.felt { stroke: var(--felt-hi); }
.chart .ln.gold { stroke: var(--gold); }
.chart .ln.ink { stroke: var(--ink); stroke-width: 2; }
.chart .ln.dashed { stroke-dasharray: 6 5; stroke-width: 2; }
.chart .area { fill: var(--chalk); opacity: .12; }
.chart .area.pos { fill: var(--ok); opacity: .22; }
.chart .area.neg { fill: var(--red); opacity: .22; }
.chart .dot { fill: var(--surface); stroke: var(--chalk); stroke-width: 2.2; }
.chart .dot.gold { stroke: var(--gold); }
.chart .dot.felt { stroke: var(--felt-hi); }
@media (prefers-reduced-motion: no-preference) {
  .chart .ln.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s ease-out forwards; }
  .chart .ln.draw.dashed { animation: none; stroke-dasharray: 6 5; stroke-dashoffset: 0; }
  .radar .grow { animation: grow .8s cubic-bezier(.2,.8,.2,1) both; }
  .hb-f { animation: fillw .8s ease-out both; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scale(.2); opacity: 0; } }
@keyframes fillw { from { width: 0; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.legend .sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--chalk); vertical-align: middle; margin-right: 6px; }
.legend .sw.gold { background: var(--gold); } .legend .sw.felt { background: var(--felt-hi); }
.legend .sw.dashed { background: repeating-linear-gradient(90deg, var(--faint) 0 5px, transparent 5px 9px); }
.radar .rp { fill: var(--chalk); fill-opacity: .22; stroke: var(--chalk); stroke-width: 2.4; }
.radar .rdot { fill: var(--chalk); }
.radar .rl { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.radar .rv { fill: var(--muted); font-weight: 500; }
.bubbles .q-train { fill: var(--red); opacity: .05; }
.bubbles .qt { fill: var(--faint); font-size: 11.5px; font-weight: 600; }
.bubbles .bub circle { stroke-width: 2; fill-opacity: .55; }
.bubbles .bub.good circle { fill: var(--ok); stroke: var(--ok); }
.bubbles .bub.mid circle { fill: var(--gold); stroke: #a8833f; }
.bubbles .bub.bad circle { fill: var(--red); stroke: var(--red); }
.bubbles .bub text { fill: var(--ink); font-size: 11.5px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }

.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 32%) minmax(40px, 1fr) auto; gap: 10px; align-items: center; font-size: .92rem; }
.hb-l small { display: block; color: var(--muted); font-size: .76rem; }
.hb-t { position: relative; height: 12px; background: var(--line-soft); border-radius: 99px; }
.hb-f { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--felt-hi); border-radius: 99px; }
.hbar.chalk .hb-f { background: var(--chalk); }
.hbar.bad .hb-f { background: var(--red); }
.hbar.gold .hb-f { background: var(--gold); }
.hb-m { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .55; }
.hb-v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 52px; white-space: nowrap; }

.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: .88rem; }
.heat th { font-weight: 600; color: var(--muted); font-size: .8rem; text-align: center; padding: 2px 4px; }
.heat th[scope=row] { text-align: left; color: var(--ink); white-space: nowrap; }
.heat td { text-align: center; padding: 9px 4px; border-radius: 7px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 54px; }
.heat td small { font-weight: 500; opacity: .7; }
.heat td.none { color: var(--faint); background: var(--surface-2); }
.heat .h0 { background: var(--h0); } .heat .h1 { background: var(--h1); } .heat .h2 { background: var(--h2); }
.heat .h3 { background: var(--h3); } .heat .h4 { background: var(--h4); } .heat .h5 { background: var(--h5); }
.heat td.few { opacity: .45; }

.donut { position: relative; width: 120px; height: 120px; flex: none; }
.donut svg { width: 100%; height: 100%; }
.dn-bg { fill: none; stroke: var(--line-soft); stroke-width: 16; }
.dn { fill: none; stroke-width: 16; stroke: var(--felt-hi); }
.dn.bad { stroke: var(--red); } .dn.chalk { stroke: var(--chalk); }
.dn-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dn-c b { font: 600 1.6rem/1 var(--display); }
.dn-c span { font-size: .72rem; color: var(--muted); }
.spark { width: 80px; height: 24px; }
.spark path { fill: none; stroke: var(--chalk); stroke-width: 2; }

/* improvement cards */
.prio { display: grid; gap: 12px; }
.prio-item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding: 14px; border-radius: var(--r-m); background: var(--surface-2); border: 1px solid var(--line-soft); }
.prio-item .gain { text-align: center; align-self: start; background: var(--surface); border-radius: 10px; padding: 8px 4px; border: 1px solid var(--line-soft); }
.prio-item .gain b { display: block; font: 700 1.9rem/1 var(--display); color: var(--ok); }
.prio-item .gain span { font-size: .7rem; color: var(--muted); line-height: 1.2; display: block; margin-top: 3px; }
.prio-item h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.prio-item p { margin: 0 0 4px; font-size: .92rem; }
.prio-item .tip { color: var(--muted); }
.rank { font: 700 .8rem var(--display); background: var(--felt); color: #fff; border-radius: 6px; padding: 1px 7px; }
.conf { font: 600 .72rem var(--body); padding: 1px 8px; border-radius: 99px; background: var(--line-soft); color: var(--muted); }
.conf.alta { background: var(--ok-soft); color: var(--ok); }
.conf.bassa { background: var(--warn-soft); color: var(--warn); }
.strengths { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.strength { padding: 12px 14px; border-radius: var(--r-m); background: var(--ok-soft); }
.strength b { display: block; }
.strength span { font-size: .88rem; color: var(--muted); }
.hero-gain { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 18px; border-radius: var(--r-l); margin-bottom: 16px;
  background: var(--felt); color: #fff; border: 1px solid var(--felt-deep);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.1), transparent 60%); }
.hero-gain .n { font: 700 3.4rem/1 var(--display); color: #fff; }
.hero-gain p { margin: 0; color: #d3e6dc; max-width: 56ch; }
.hero-gain h2 { color: #fff; }

/* lists */
.mlist { display: grid; gap: 10px; }
.mitem { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; color: inherit; }
.mitem:hover { border-color: var(--faint); }
.mitem .mb { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 700 1.3rem var(--display);
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, var(--ivory) 40%, #e3dbc2); color: #123d2e; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.mitem .mb.none { color: #b3ab92; }
.mitem .t { font-weight: 600; display: block; }
.mitem .s { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitem .r { text-align: right; font: 600 1.25rem var(--display); }
.mitem .r small { display: block; font: 500 .75rem var(--body); color: var(--muted); }
.month { font: 600 .9rem var(--body); color: var(--muted); margin: 18px 2px 8px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.tag.gain { background: var(--ok-soft); color: var(--ok); }
.tag.loss { background: var(--red-soft); color: var(--red); }
.tag.live { background: var(--red); color: #fff; }
.tag.n { background: var(--line-soft); color: var(--muted); }

.empty { text-align: center; padding: 34px 18px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 44ch; margin: 0 auto 14px; }

/* ---------- recording: the table ---------- */
.felt {
  background: var(--felt); color: #fff; border: 9px solid var(--rail); border-radius: var(--r-l);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.08), transparent 60%);
  padding: 18px; box-shadow: var(--shadow);
}
.felt-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.felt-top h2 { color: #fff; }
.shotno { color: #cfe2d9; display: flex; align-items: baseline; gap: 6px; }
.shotno b { font: 700 2.8rem/1 var(--display); color: #fff; font-variant-numeric: tabular-nums; }
.fg { border: 0; margin: 0; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.12); }
.fg:first-of-type { border-top: 0; }
.fg legend { float: left; width: 100%; padding: 0; margin-bottom: 9px; font-weight: 600; color: #e8f1ec; }
.fg legend small { font-weight: 400; color: #a9cbbb; margin-left: 6px; }
.fg legend + * { clear: both; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span { display: block; min-height: 44px; padding: 10px 15px; line-height: 22px; border-radius: 99px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(0,0,0,.14); color: #f1f7f4; font-weight: 500; user-select: none; }
.chip:hover span { border-color: rgba(255,255,255,.5); }
.chip input:checked + span { background: var(--chalk); border-color: #a7cbf0; color: #fff; box-shadow: 0 0 0 2px rgba(143,187,233,.35); }
.chip.loss input:checked + span { background: var(--red); border-color: #f1a69c; }
.chip input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }
.pts { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pts > label { color: #e8f1ec; font-weight: 500; margin-right: 2px; }
.stepper { display: inline-flex; border: 1px solid rgba(255,255,255,.3); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; border: 0; background: rgba(0,0,0,.2); color: #fff; font-size: 1.3rem; cursor: pointer; }
.stepper input { width: 70px; border: 0; border-radius: 0; text-align: center; font: 700 1.4rem var(--display); padding: 6px; background: #fff; color: #16201b; }
.quick { display: flex; gap: 5px; flex-wrap: wrap; }
.quick button { min-width: 40px; min-height: 38px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font: 600 1rem var(--display); cursor: pointer; }
.quick button:hover { background: rgba(255,255,255,.18); }
.felt input[type=text] { background: rgba(255,255,255,.96); color: #16201b; border-color: transparent; }
.felt .extra { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.felt-save { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-top: 14px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,.12); }
.felt-save .hint { color: #a9cbbb; }
.rec-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .rec-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
.livehead { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.livehead .who { flex: 1; min-width: 180px; }
.livehead .who h1 { font-size: 1.8rem; }
.livescore { display: flex; gap: 8px; }
.livescore div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; text-align: center; }
.livescore b { display: block; font: 600 1.5rem/1.1 var(--display); }
.livescore span { font-size: .72rem; color: var(--muted); }

.shots { list-style: none; margin: 0; padding: 0; }
.shots li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.shots li:last-child { border-bottom: 0; }
.shots .n { font: 600 1.25rem var(--display); color: var(--muted); text-align: center; }
.shots .w { font-weight: 600; }
.shots .m { display: block; color: var(--muted); font-size: .83rem; }
.shots .ops { display: flex; gap: 2px; }
.insert-here { display: block; width: 100%; border: 1px dashed var(--chalk); background: var(--chalk-soft); color: var(--chalk-deep); border-radius: 8px; padding: 6px; font-weight: 600; font-size: .85rem; cursor: pointer; margin: 4px 0; }

/* sheets & dialogs */
.sheet-back { position: fixed; inset: 0; background: rgba(8, 20, 15, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 760px) { .sheet-back { align-items: center; } }
.sheet { width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
@media (min-width: 760px) { .sheet { border-radius: var(--r-l); } }
.sheet.felt-sheet { background: var(--felt); color: #fff; border: 8px solid var(--rail); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet .actions { margin-top: 14px; justify-content: flex-end; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .22s ease-out; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; left: calc(50% + 124px); } }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.error { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* settings */
.set-list { display: grid; gap: 16px; max-width: 860px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: .94rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--line); border-radius: 99px; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--chalk); }
.switch input:checked::after { transform: translateX(20px); }

/* activation */
.activate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .activate { grid-template-columns: 1fr 1fr; } }
.act-side { background: var(--felt); color: #fff; padding: 40px 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.1), transparent 55%); border-bottom: 8px solid var(--rail); }
@media (min-width: 900px) { .act-side { border-bottom: 0; border-right: 12px solid var(--rail); padding: 56px; } }
.act-side .brand { display: flex; align-items: center; gap: 10px; font: 700 2rem var(--display); }
.act-side .brand svg { width: 36px; height: 36px; }
.act-side h1 { font-size: clamp(2.4rem, 5vw, 4rem); max-width: 11ch; margin: 18px 0 12px; }
.act-side p { color: #d3e6dc; max-width: 40ch; font-size: 1.05rem; }
.balls { display: flex; gap: 12px; }
.balls i { width: 36px; height: 36px; border-radius: 50%; display: block; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.balls i:nth-child(1) { background: radial-gradient(circle at 34% 30%, #fff 0 14%, #fbf8ee 40%, #e3dbc2); }
.balls i:nth-child(2) { background: radial-gradient(circle at 34% 30%, #fff 0 10%, #e6e04a 40%, #b9a51f); }
.balls i:nth-child(3) { background: radial-gradient(circle at 34% 30%, #ffd8d2 0 10%, #c23b2e 45%, #8d2219); }
.act-main { display: grid; place-items: center; padding: 32px 18px; }
.act-card { width: 100%; max-width: 420px; }
.act-card h2 { font-size: 2rem; margin-bottom: 6px; }
.act-card > p { color: var(--muted); margin-bottom: 20px; }
input.lic { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.err { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.twrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
details.method { margin-top: 18px; }
details.method summary { cursor: pointer; font-weight: 600; color: var(--chalk-deep); }
details.method ul { color: var(--muted); font-size: .9rem; padding-left: 20px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select { width: auto; min-width: 150px; padding: 8px 10px; }

/* ======================= explanations ("Perché questo numero") ======================= */
a.xlink { color: inherit; text-decoration: none; display: block; cursor: pointer; }
a.xlink:hover .why, a.xlink:focus-visible .why { text-decoration: underline; }
.scorebox.xlink { display: flex; border-radius: var(--r-m); }
.why { display: block; margin-top: 8px; font-size: .84rem; font-weight: 600; color: var(--chalk-deep); }
.why.light { color: #bfe0cf; }
.kpi.xlink { transition: background .15s, box-shadow .15s; }
.kpi.xlink:hover { background: var(--chalk-soft); }
.kpi .why { margin-top: 4px; font-size: .74rem; }
.golink { cursor: pointer; }
a.hbar { color: inherit; text-decoration: none; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
a.hbar:hover { background: var(--surface-2); }
.chev { color: var(--faint); margin-left: 6px; font-weight: 700; }
.prio-item.xlink:hover, .strength.xlink:hover { border-color: var(--chalk); box-shadow: 0 0 0 1px var(--chalk); }
.strength.xlink { border: 1px solid transparent; }
.prio-item .why { margin-top: 6px; }
a.hero-gain { color: #fff; }
a.hero-gain:hover { filter: brightness(1.05); }
.table tr.golink:hover td, .heat tr.golink:hover th { background: var(--surface-2); }
.heat th a { color: inherit; text-decoration: none; }
.card-head h2 a { color: inherit; text-decoration: none; }
.card-head h2 a:hover { text-decoration: underline; }

.chart .hit { fill: transparent; }
.radar .rlink:hover .hit { fill: var(--chalk-soft); }
.chart .pt.golink:hover .dot, .chart .pt:focus .dot { r: 7; stroke-width: 3; }
.chart .bub.golink:hover circle { fill-opacity: .85; stroke-width: 3; }
.radar .rlink:hover .rl { fill: var(--chalk-deep); text-decoration: underline; }

.tip { position: fixed; left: 0; top: 0; z-index: 80; max-width: 260px; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: .84rem; font-weight: 600; line-height: 1.35;
  opacity: 0; transition: opacity .12s; box-shadow: var(--shadow); }
.tip.on { opacity: 1; }

.explain > * + * { margin-top: 16px; }
.card.half { margin: 0; }
.xbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.xbar .hint { flex: 1; min-width: 140px; }

.xhero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 22px 24px;
  border-radius: var(--r-l); background: var(--felt); color: #fff; border: 1px solid var(--felt-deep);
  background-image: radial-gradient(ellipse at 15% 0%, rgba(255,255,255,.12), transparent 55%); }
.xhero.bad { background-color: #7d2a22; border-color: #5e1d17; }
.xhero.good { background-color: var(--felt); }
.xhero-n { font: 700 clamp(3.4rem, 9vw, 5.6rem)/0.9 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.xhero-n small { display: block; font: 500 1rem/1.2 var(--body); color: #cfe2d9; margin-top: 6px; letter-spacing: 0; }
.xhero-k { font: 600 .8rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.xhero h1 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 4px 0 8px; text-wrap: balance; }
.xhero p { margin: 0; color: #dcebe3; max-width: 62ch; }
.xhero p b { color: #fff; }
.xhero .pos { color: #8fe3b4; } .xhero .neg { color: #ffb4a8; }
.xhero-side .ring .ball { color: #123d2e; }
.xhero-side .dn-bg { stroke: rgba(255,255,255,.15); }
.xhero-side .dn { stroke: #8fe3b4; } .xhero-side .dn.bad { stroke: #ff9c8f; }
.xhero-side .dn-c b { color: #fff; } .xhero-side .dn-c span { color: #cfe2d9; }
@media (max-width: 760px) { .xhero { grid-template-columns: 1fr; gap: 10px; padding: 18px; } .xhero-side { display: none; } }

.recipe { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.recipe li { border-bottom: 1px dashed var(--line); }
.recipe li > a, .recipe li { color: inherit; text-decoration: none; }
.recipe li > a, .recipe li:not(.link) { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 2px; }
.recipe li.link { display: block; }
.recipe li.link > a:hover { background: var(--surface-2); }
.recipe .op { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 1rem var(--display);
  background: var(--chalk-soft); color: var(--chalk-deep); }
.recipe .op:empty { background: transparent; }
.recipe .rl { font-weight: 600; }
.recipe .rl small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 1px; }
.recipe .rv { font: 600 1.35rem var(--display); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.recipe li:not(.link) .rv { grid-column: 3 / span 2; }
.recipe li.total { border-bottom: 0; border-top: 3px double var(--ink); margin-top: 2px; }
.recipe li.total .op { background: var(--felt); color: #fff; }
.recipe li.total .rv { font-size: 1.8rem; color: var(--felt-hi); }

.whatif { background: linear-gradient(180deg, var(--chalk-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--chalk) 30%, var(--line)); }
.wi-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 54px; gap: 14px; align-items: center; padding: 8px 0; }
.wi-l { font-weight: 600; }
.wi-v { font: 700 1.3rem var(--display); text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 99px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--chalk) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, #fbf8ee 40%, #e3dbc2); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, #fbf8ee 40%, #e3dbc2); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
input[type=range]:focus-visible { outline: 3px solid var(--chalk); outline-offset: 4px; }
.wi-out { margin-top: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.wi-out p { margin: 0; flex: 1; min-width: 200px; }
.wi-big { display: flex; align-items: center; gap: 10px; }
.wi-big span:first-child { font: 700 2.8rem/1 var(--display); font-variant-numeric: tabular-nums; }
.wi-big small { color: var(--muted); font-size: .85rem; max-width: 7em; line-height: 1.2; }
.wi-big .mb { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font: 700 1.5rem var(--display);
  background: radial-gradient(circle at 34% 30%, #fff 0 14%, var(--ivory) 40%, #e3dbc2); color: #123d2e; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
@media (max-width: 560px) { .wi-row { grid-template-columns: 1fr 54px; } .wi-row input { grid-column: 1 / -1; grid-row: 2; } }

.ladder { position: relative; display: flex; margin-top: 6px; padding-top: 18px; }
.rung { background: var(--surface-2); border: 1px solid var(--line); border-left-width: 0; padding: 8px 2px; text-align: center; min-width: 0; overflow: hidden; }
.rung:first-child { border-left-width: 1px; border-radius: 6px 0 0 6px; } .rung:last-child { border-radius: 0 6px 6px 0; }
.rung b { display: block; font: 700 1.3rem var(--display); }
.rung span { font-size: .72rem; color: var(--muted); }
.rung.on { background: var(--felt); border-color: var(--felt); color: #fff; }
.rung.on span { color: #cfe2d9; }
.ladder-mark { position: absolute; top: 0; width: 0; height: 0; transform: translateX(-7px);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 12px solid var(--ink); }

.flow { display: grid; gap: 10px; }
.flow-r { display: grid; grid-template-columns: minmax(110px, 40%) minmax(0, 1fr) 54px; gap: 10px; align-items: center; }
.flow-r i { display: block; height: 18px; width: var(--w); border-radius: 4px; background: var(--ok); opacity: .85; }
.flow-r.neg i { background: var(--red); }
.flow-r b { font: 600 1.15rem var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.flow-r.pos b { color: var(--ok); } .flow-r.neg b { color: var(--red); }

.cirange { margin-top: 4px; }
.ci-track { position: relative; height: 26px; border-radius: 99px; background: var(--line-soft); }
.ci-band { position: absolute; top: 4px; bottom: 4px; border-radius: 99px; background: color-mix(in srgb, var(--chalk) 35%, transparent); }
.ci-avg { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--gold); border-radius: 2px; }
.ci-dot { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--chalk); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.ci-lab { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: 6px; }
.strip { position: relative; height: 40px; border-radius: 10px; background: linear-gradient(90deg, var(--h0), var(--h2) 50%, var(--h5)); margin-top: 6px; }
.sdot { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); opacity: .7; }
.sdot.me { width: 26px; height: 26px; margin: -13px 0 0 -13px; background: var(--chalk); border: 3px solid var(--surface); opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 2; }
.sdot:hover { opacity: 1; transform: scale(1.2); }
.strip-t { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--ink); }

.leavechart { position: relative; display: flex; align-items: flex-end; gap: 10px; height: 250px; padding-top: 10px; }
.lc-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; text-align: center; }
.lc-col b { font: 600 1.15rem var(--display); }
.lc-col i { display: block; width: 100%; max-width: 64px; height: calc(var(--h) * .72); min-height: 4px; border-radius: 8px 8px 3px 3px; background: var(--felt-hi); }
.lc-col i.bad { background: var(--red); }
.lc-col span { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lc-col small { color: var(--muted); font-size: .72rem; }
.lc-avg { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--gold); pointer-events: none; }
.lc-avg span { position: absolute; left: 0; top: -20px; font-size: .74rem; color: var(--muted); background: var(--surface); padding: 0 4px; }

.insight { padding: 14px 16px; border-radius: var(--r-m); background: var(--surface-2); border-left: 4px solid var(--chalk); }
.insight b { display: block; margin-bottom: 2px; }
.insight p { margin: 0; color: var(--muted); }

.beforeafter { display: flex; align-items: center; gap: 16px; justify-content: center; padding: 10px 0; }
.beforeafter div { text-align: center; padding: 14px 18px; border-radius: var(--r-m); background: var(--surface-2); min-width: 110px; }
.beforeafter div.after { background: var(--ok-soft); }
.beforeafter span { display: block; font-size: .8rem; color: var(--muted); }
.beforeafter b { font: 700 2.4rem/1.1 var(--display); }
.beforeafter .after b { color: var(--ok); }
.beforeafter i { font: 700 2rem var(--display); color: var(--faint); font-style: normal; }

.xkpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
@media (min-width: 900px) { .xkpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.xkpi { padding: 14px 16px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.xkpi:hover { border-color: var(--chalk); }
.xkpi span { display: block; font-size: .82rem; color: var(--muted); }
.xkpi b { display: block; font: 600 2.1rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.xkpi b small { font-size: 1rem; margin-left: 6px; color: var(--muted); }
.xkpi em { font-style: normal; font-size: .8rem; font-weight: 600; color: var(--chalk-deep); }

/* ======================= results, live score, pressure ======================= */
.res { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 6px;
  font: 700 .82rem var(--body); letter-spacing: .02em; text-decoration: none; vertical-align: middle; white-space: nowrap; }
.res.win { background: var(--ok); color: #fff; }
.res.loss { background: var(--red); color: #fff; }
.res.draw { background: var(--line); color: var(--ink); }
h1 .res { font-size: .95rem; height: 28px; vertical-align: 6px; }
.formrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.formrow .res { width: 30px; height: 30px; padding: 0; font-size: .9rem; }
.formrow.big .res { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 50%; }
.resbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wl { background: var(--surface-2); border-radius: var(--r-m); padding: 10px 12px; }
.wl b { display: block; font: 600 2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.wl span { font-size: .82rem; color: var(--muted); }
.keyfactor { margin: 0 0 12px; }

.split { display: grid; gap: 8px; margin-top: 12px; }
.split-r { display: grid; grid-template-columns: minmax(0, 1fr) 90px; grid-template-areas: "l l" "bar v" "s s"; gap: 2px 10px; align-items: center; }
.split-r span { grid-area: l; font-size: .86rem; font-weight: 600; }
.split-r i { grid-area: bar; display: block; height: 14px; border-radius: 99px; width: var(--w); min-width: 4px; background: var(--ok); }
.split-r.bad i { background: var(--faint); }
.split-r b { grid-area: v; text-align: right; font: 700 1.4rem/1 var(--display); }
.split-r small { grid-area: s; color: var(--muted); font-size: .76rem; }

.factors { display: grid; gap: 8px; }
.factor { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) auto; grid-template-areas: "l s v" "x x x"; gap: 4px 14px; align-items: center;
  padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--line-soft); background: var(--surface-2); }
.factor:hover { border-color: var(--chalk); }
.factor.top { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.factor .fl { grid-area: l; font-weight: 700; }
.factor .fs { grid-area: s; display: grid; gap: 4px; }
.factor .fs i { display: block; height: 9px; width: var(--w); min-width: 3px; border-radius: 99px; }
.factor .fs i.g { background: var(--ok); }
.factor .fs i.b { background: var(--faint); opacity: .7; }
.factor .fv { grid-area: v; white-space: nowrap; color: var(--muted); font-size: .9rem; }
.factor .fv b { font: 700 1.3rem var(--display); color: var(--ok); }
.factor small { grid-area: x; color: var(--muted); font-size: .8rem; }
@media (max-width: 560px) { .factor { grid-template-columns: 1fr auto; grid-template-areas: "l v" "s s" "x x"; } }

.wincurve .goodside { fill: var(--ok); opacity: .07; }
.wincurve .wdot { stroke: var(--surface); stroke-width: 2; }
.wincurve .wdot.w { fill: var(--ok); }
.wincurve .wdot.l { fill: var(--red); }
.wincurve .pt:hover .wdot { r: 8; }

.livescore2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px 16px; box-shadow: var(--shadow); }
.livehead .livescore2 { flex: 1 1 340px; }
.ls span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls b { display: block; font: 700 2.6rem/1 var(--display); font-variant-numeric: tabular-nums; }
.ls.me b { color: var(--felt-hi); }
.ls.opp { text-align: right; }
.lsbar { display: block; height: 6px; border-radius: 99px; background: var(--line-soft); margin-top: 6px; overflow: hidden; }
.ls.opp .lsbar { transform: scaleX(-1); }
.lsbar i { display: block; height: 100%; width: var(--w); border-radius: 99px; background: var(--felt-hi); transition: width .5s ease; }
.lsbar i.opp { background: var(--red); }
.ls-mid { text-align: center; display: grid; gap: 4px; justify-items: center; }
.ls-mid small { font-size: .74rem; color: var(--muted); }
.lschip { border: 0; cursor: default; display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.lschip.good { background: var(--ok-soft); color: var(--ok); }
.lschip.bad { background: var(--red-soft); color: var(--red); }
button.lschip { cursor: pointer; }
.lschip.hot { background: var(--gold); color: #2a1d08; animation: pulse 1.6s infinite; }
@media (prefers-reduced-motion: reduce) { .lschip.hot { animation: none; } }

.resopts { display: flex; gap: 8px; flex-wrap: wrap; }
.resopt { position: relative; }
.resopt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.resopt span { display: block; padding: 12px 22px; border-radius: 99px; border: 2px solid var(--line); font-weight: 700; }
.resopt.win input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.resopt.loss input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.resopt.draw input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.resopt input:focus-visible + span { outline: 3px solid var(--chalk); outline-offset: 2px; }
.scorepair { display: flex; align-items: center; gap: 8px; }
.scorepair b { color: var(--muted); }

.pcards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pcard { padding: 14px; border-radius: var(--r-m); background: var(--surface-2); border: 1px solid var(--line-soft); }
.pcard span { display: block; font-weight: 600; font-size: .88rem; }
.pcard b { display: block; font: 700 2.4rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.pcard small { color: var(--muted); font-size: .78rem; }
.pcard.bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.pcard.bad b { color: var(--red); }
.pcard.good { background: var(--ok-soft); }
.pcard.good b { color: var(--ok); }
.clutchline { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface-2); }
.clutchline.neg { background: var(--red-soft); }
.clutchline.pos { background: var(--ok-soft); }
a.factor.xlink { display: grid; }
a.resbox.xlink { display: grid; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }

/* ======================= games & modes ======================= */
.chooser { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; background: var(--felt);
  background-image: radial-gradient(ellipse at 30% 0%, rgba(255,255,255,.1), transparent 55%); color: #fff; }
.chooser-in { width: 100%; max-width: 760px; text-align: center; }
.chooser .brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.8rem var(--display); letter-spacing: .02em; }
.chooser .brand svg { width: 34px; height: 34px; }
.chooser h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); color: #fff; margin: 22px 0 8px; }
.chooser p { color: #d3e6dc; margin: 0 auto 26px; max-width: 46ch; }
.gcards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.gcard { display: grid; justify-items: center; gap: 6px; padding: 22px 18px; border-radius: var(--r-l); cursor: pointer;
  background: rgba(0,0,0,.18); border: 2px solid rgba(255,255,255,.18); color: #fff; font: inherit; transition: transform .15s, border-color .15s, background .15s; }
.gcard:hover, .gcard:focus-visible { border-color: var(--gold); background: rgba(0,0,0,.28); transform: translateY(-2px); }
.gcard svg { width: 120px; height: 120px; margin-bottom: 6px; }
.gcard b { font: 700 2rem/1.1 var(--display); }
.gcard span { color: #d3e6dc; }
.gcard small { color: #a9cbbb; }
.gc-cloth { fill: #2b7259; stroke: #4a3020; stroke-width: .35; }
.gc-pin { fill: #fbf8ee; }
.gc-red { fill: #c23b2e; }

.side-game { padding: 0 6px 16px; }
.seg.dark { background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.12); width: 100%; }
.seg.dark button { color: #a9cbbb; flex: 1; }
.seg.dark button.on { background: var(--felt); color: #fff; box-shadow: none; }
.side-mode span { display: block; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: #8fb5a3; margin-bottom: 6px; }
.seg.big { width: 100%; }
.seg.big button { flex: 1; padding: 14px; font-size: 1.05rem; }
.mswitch button.locked { color: var(--faint); }
.mswitch button svg, .seg button svg { width: 14px; height: 14px; vertical-align: -2px; }
.page-head .seg { align-self: center; }
.gamepill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 0; cursor: pointer;
  background: var(--gold); color: #2a1d08; font: 700 .8rem var(--body); white-space: nowrap; }
.gamepill svg { width: 15px; height: 15px; }
.gamefix { padding: 11px 12px; border-radius: var(--r-s); background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.gamefix small { color: var(--muted); font-weight: 400; }
.field > div.gamefix { margin-top: 0; }
div.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }

.calcbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--gold); background: rgba(201,164,106,.18); color: #fff; font: 600 .9rem var(--body); }
.calcbtn svg { width: 16px; height: 16px; }
.calcbtn:hover { background: rgba(201,164,106,.32); }
.pcalc .pc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.pcalc .pc-row.col { display: block; }
.pcalc .pc-row.col > span { display: block; margin-bottom: 8px; }
.pcalc .pc-row span { font-weight: 600; }
.pcalc .pc-row small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.pcalc .stepper { border-color: var(--line); }
.pcalc .stepper button { background: var(--surface-2); color: var(--ink); }
.pcalc .stepper output { display: grid; place-items: center; width: 54px; font: 700 1.5rem var(--display); }
.pc-tog, .pc-chip { border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 99px; font-weight: 600; cursor: pointer; color: var(--ink); }
.pc-tog.on { background: var(--red); border-color: var(--red); color: #fff; }
.pc-chip.on { background: var(--chalk); border-color: var(--chalk); color: #fff; }
.pc-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 0; }
.pc-total b { font: 700 2.6rem var(--display); color: var(--felt-hi); }

.lockcard { text-align: left; border: 2px dashed color-mix(in srgb, var(--chalk) 40%, var(--line)); background: linear-gradient(180deg, var(--chalk-soft), var(--surface) 75%); }
.lockcard h2:empty, .lockcard h2:only-child { display: none; }
.lock-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--chalk); color: #fff; margin-bottom: 10px; }
.lock-ico svg { width: 24px; height: 24px; }
.lockcard h2 { margin-bottom: 8px; }
.ticks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.ticks li { padding-left: 26px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.setrow:last-child { border-bottom: 0; }
.setrow p { margin: 2px 0 0; }
@media (max-width: 640px) { .page-head .mswitch { order: 3; } .topbar .title { font-size: 1.1rem; } .syncpill span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; } }

/* simple mode: numbers are shown, the step-by-step explanations are an advanced feature */
.mode-simple a.xlink { pointer-events: none; cursor: default; }
.mode-simple .why, .mode-simple .hb-v .chev { display: none; }
.mode-simple .kpi.xlink:hover { background: var(--surface-2); }
.mode-simple a.hbar.golink { pointer-events: none; }

/* ======================= pin pad: tap the pins that fell ======================= */
.pinpad { display: grid; grid-template-columns: minmax(170px, 250px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 10px; }
@media (max-width: 560px) { .pinpad { grid-template-columns: 1fr; } .pp-draw { max-width: 230px; margin: 0 auto; width: 100%; } }
.ppsvg { width: 100%; height: auto; display: block; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pp-cloth { fill: #17533e; stroke: var(--rail); stroke-width: .12; }
.pp-line { stroke: rgba(255,255,255,.08); stroke-width: .03; }
.pp { cursor: pointer; outline: none; }
.pp .hit { fill: transparent; }
.pp .shadow { fill: rgba(0,0,0,.35); }
.pp .head { fill: #fbf8ee; stroke: #d9d0b5; stroke-width: .04; transition: fill .12s, transform .15s; }
.pp.red .head { fill: #c23b2e; stroke: #8d2219; }
.pp .shine { fill: rgba(255,255,255,.75); }
.pp .cross { stroke: #fff; stroke-width: .07; stroke-linecap: round; opacity: 0; }
.pp:hover .head { stroke: var(--gold); stroke-width: .08; }
.pp:focus-visible .hit { fill: rgba(201,164,106,.35); }
.pp.down .head { fill: rgba(255,255,255,.12); stroke: rgba(255,255,255,.35); stroke-dasharray: .08 .06; }
.pp.red.down .head { fill: rgba(194,59,46,.35); stroke: #f1a69c; }
.pp.down .shine, .pp.down .shadow { opacity: 0; }
.pp.down .cross { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .pp.down .cross { animation: knock .18s ease-out; } }
@keyframes knock { from { opacity: 0; transform: scale(.4); transform-origin: center; transform-box: fill-box; } }
.pp-side { display: grid; gap: 10px; align-content: start; }
.pp-k { font-weight: 600; font-size: .9rem; color: #e8f1ec; }
.pp-balls { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-ball { border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.15); color: #f1f7f4; border-radius: 99px; padding: 8px 12px; font: 500 .88rem var(--body); cursor: pointer; min-height: 40px; }
.pp-ball b { color: var(--gold); }
.pp-ball.on { background: var(--chalk); border-color: #a7cbf0; color: #fff; }
.pp-ball.on b { color: #fff; }
.pp-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.2); }
.pp-total span { font-size: .85rem; color: #cfe2d9; }
.pp-total b { font: 700 2.2rem/1 var(--display); color: #fff; font-variant-numeric: tabular-nums; }
.pp-clear { justify-self: start; background: none; border: 0; color: #a9cbbb; text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.ptshint { color: #a9cbbb; font-size: .82rem; }
.linkish { background: none; border: 0; padding: 4px 0; color: #cfe2d9; text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }
/* the same pad on a light sheet */
.pcalc .pp-k { color: var(--ink); }
.pcalc .pp-ball { color: var(--ink); border-color: var(--line); background: var(--surface); }
.pcalc .pp-ball b { color: #9a7432; }
.pcalc .pp-total { background: var(--surface-2); }
.pcalc .pp-total span { color: var(--muted); }
.pcalc .pp-total b { color: var(--felt-hi); }
.pcalc .pp-clear { color: var(--muted); }
