/* BarDrill: "graded practice sheet" design.
   Cool paper, chart-paper grid, navy ink, red pen for rule breaks. */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; 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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Rubik";
  src: url("/assets/fonts/rubik-hebrew-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Caveat";
  src: url("/assets/fonts/caveat-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-display: swap;
}

:root {
  --paper: #f4f6f9;
  --sheet: #ffffff;
  --grid: #e4eaf2;
  --rule: #d3dbe6;
  --ink: #16233a;
  --ink-2: #4b5a70;
  --ink-3: #7b889b;
  --up: #0f7a62;
  --down: #c4344a;
  --pen: #d0213a;
  --blue: #2346b8;
  --warn: #9a6a00;
  --font: "Archivo", "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Rubik", "Comic Sans MS", cursive;
  --wrap: 1180px;
  --gut: clamp(18px, 4vw, 32px);
  --r: 6px;
}
html[lang="he"] { --font: "Rubik", "Archivo", system-ui, sans-serif; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.12; font-weight: 750; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 4.1vw, 3.5rem); font-weight: 820; font-stretch: 118%; letter-spacing: -.025em; line-height: 1.02; }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); font-stretch: 112%; letter-spacing: -.015em; }
h3 { font-size: 1.12rem; font-stretch: 106%; }
html[lang="he"] h1, html[lang="he"] h2, html[lang="he"] h3 { letter-spacing: 0; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { width: auto; height: auto; clip-path: none; inset-inline-start: 1rem; top: 1rem; background: var(--sheet); padding: .5rem 1rem; z-index: 50; }
.hint { color: var(--ink-2); font-size: .9rem; }
.pos { color: var(--up); }
.neg { color: var(--down); }
.pen { font-family: var(--hand); color: var(--pen); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.15rem;
  border-radius: 4px; border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink);
  font: 650 .97rem/1.2 var(--font); font-stretch: 104%;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, color .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ink, .btn-primary { background: var(--ink); color: #fff; }
.btn-ink:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: #0b1526; border-color: #0b1526; }
.btn-line { background: var(--sheet); }
.btn-paper { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-paper:hover:not(:disabled) { background: #fff; color: var(--ink); border-color: #fff; }
.btn-ghost { border-color: var(--rule); }
.btn-danger { color: var(--down); border-color: #e3a9b2; background: var(--sheet); }
.btn-danger:hover:not(:disabled) { background: var(--down); border-color: var(--down); color: #fff; }
.btn-small { min-height: 38px; padding: .4rem .8rem; font-size: .88rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* Forms */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; min-width: 0; }
.field label, .rules-grid label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
input, select {
  width: 100%; min-height: 44px; padding: .5rem .65rem;
  background: var(--sheet); color: var(--ink);
  border: 1.5px solid var(--rule); border-radius: 4px;
  font: 500 1rem var(--font);
}
input:hover, select:hover { border-color: #b7c3d3; }
input:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(35, 70, 184, .18); }
input:disabled, select:disabled { background: var(--paper); color: var(--ink-3); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row2.align-end { align-items: end; }
.row2.align-end .btn { margin-bottom: .8rem; }
.inline { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink-2); font-size: .9rem; font-weight: 600; }
.inline select { width: auto; }
.tag { display: inline-block; padding: .05rem .5rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink-2); font-size: .75rem; font-weight: 650; vertical-align: middle; }
.tag-warn { color: var(--warn); border-color: #e7cf8c; background: #fffbea; }
.form-error { color: var(--down); font-size: .9rem; margin: .6rem 0 0; }
.alert { margin: 0 0 1rem; padding: .8rem 1rem; border: 1.5px solid #e3a9b2; border-radius: var(--r); background: #fff5f6; color: #8a1c2c; }
.alert a { margin-inline-start: .4rem; }

/* Header */
.site-head { background: var(--sheet); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20; }
.site-head-in { max-width: var(--wrap); margin: 0 auto; padding: .7rem var(--gut); display: flex; align-items: center; gap: 1.6rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
.brand img { display: block; }
.wordmark { font-family: "Archivo", sans-serif; font-weight: 820; font-stretch: 115%; font-size: 1.25rem; letter-spacing: -.02em; color: var(--ink); }
.wordmark span { color: var(--up); }
.site-nav { display: flex; gap: 1.4rem; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.head-tools { margin-inline-start: auto; display: flex; align-items: center; gap: .8rem; }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; min-height: 38px; display: flex; align-items: center; padding: 0 .65rem; border: 1.5px solid var(--rule); border-radius: 4px; font-weight: 700; font-size: .85rem; color: var(--ink-2); }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; width: 6px; height: 6px; margin-inline-start: .45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.lang[open] summary { border-color: var(--ink); color: var(--ink); }
.lang ul { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); margin: 0; padding: .35rem; list-style: none; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 8px 24px rgba(22, 35, 58, .12); min-width: 150px; }
.lang li a { display: block; padding: .45rem .7rem; border-radius: 4px; color: var(--ink); text-decoration: none; font-weight: 550; }
.lang li a:hover { background: var(--paper); }
.lang li a[aria-current] { font-weight: 800; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); background: var(--sheet); margin-top: 0; }
.site-foot-in { max-width: var(--wrap); margin: 0 auto; padding: 2.5rem var(--gut) 2rem; display: grid; grid-template-columns: 1fr 1.1fr 2fr; gap: 2rem; }
.foot-brand p { color: var(--ink-2); margin-top: .4rem; font-size: .95rem; }
.foot-nav { display: flex; flex-direction: column; gap: .35rem; }
.foot-nav a { color: var(--ink); text-decoration: none; font-weight: 550; font-size: .95rem; }
.foot-nav a:hover { text-decoration: underline; }
.foot-legal { color: var(--ink-2); font-size: .84rem; line-height: 1.55; }
.foot-legal a { color: var(--ink-2); }
.sep { margin: 0 .35rem; color: var(--ink-3); }

/* Home: hero */
main { display: block; }
.page-home main > section { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gut); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: center; padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3.5rem); }
.hero-kicker { color: var(--up); font-weight: 700; font-stretch: 108%; margin-bottom: .8rem; }
.hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }

.sheet { margin: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; box-shadow: 0 1px 0 var(--rule), 0 18px 40px -24px rgba(22, 35, 58, .35); }
.sheet-plot {
  position: relative; aspect-ratio: 640 / 340;
  background-color: #fff;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px; background-position: -1px -1px;
  border: 1px solid var(--grid);
}
.sheet-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sheet figcaption { margin-top: .6rem; font-size: .8rem; color: var(--ink-3); }
.cdl line { stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.cdl.up line { stroke: var(--up); } .cdl.up rect { fill: var(--up); }
.cdl.dn line { stroke: var(--down); } .cdl.dn rect { fill: var(--down); }
.entry { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pen-ring { fill: none; stroke: var(--pen); stroke-width: 2.6; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; transform-box: fill-box; transform-origin: center; transform: rotate(-8deg); }
.pen-note { position: absolute; top: 2%; inset-inline-start: calc(var(--x) - 34%); margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.45rem); line-height: 1.05; transform: rotate(-3deg); white-space: nowrap; }
.pen-pts { font-size: 1.25em; }
.pen-score { position: absolute; inset-inline-end: 3%; bottom: 7%; width: 5.4em; height: 5.4em; display: grid; place-content: center; text-align: center; border: 2.5px solid var(--pen); border-radius: 50%; transform: rotate(-10deg); font-size: clamp(.8rem, 1.6vw, 1rem); line-height: .9; background: rgba(255, 255, 255, .7); }
.pen-score span { font-size: 2.4em; }
.pen-score small { font-size: 1.05em; }

@media (prefers-reduced-motion: no-preference) {
  .cdl { opacity: 0; animation: cdl-in .22s ease-out forwards; animation-delay: calc(var(--i) * 45ms + .25s); }
  .entry { opacity: 0; animation: fade .3s forwards 2.45s; }
  .pen-ring { stroke-dashoffset: 1; animation: draw .55s ease-out forwards 2.75s; }
  .pen-note { opacity: 0; animation: fade .35s forwards 3.2s; }
  .pen-score { opacity: 0; animation: stamp .3s ease-out forwards 3.6s; }
}
@keyframes cdl-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes stamp { from { opacity: 0; transform: rotate(-10deg) scale(1.25); } to { opacity: 1; transform: rotate(-10deg) scale(1); } }

/* Home: pick strip */
.pick { padding-block: 0 clamp(1rem, 2vw, 1.5rem); }
.pick-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem; border-top: 2px solid var(--ink); padding-top: 1.2rem; }
.pick-head h2 { margin: 0; }
.pick-head p { margin: 0; color: var(--ink-2); max-width: 60ch; }
.pick-form { display: grid; grid-template-columns: 1.5fr 1fr .8fr auto; gap: 1rem; align-items: end; margin-top: 1.2rem; padding: 1.1rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.pick-form .field { margin: 0; }
.pick .hint { margin-top: .6rem; }

/* Home: steps (a real sequence, so numbered) */
.steps { padding-block: clamp(2.5rem, 5vw, 4rem); }
.step-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.step-list li { border-top: 1px solid var(--rule); padding-top: 1rem; }
.step-n { display: block; font-size: 3.2rem; font-weight: 300; font-stretch: 125%; line-height: 1; color: var(--ink-3); margin-bottom: .8rem; }
.step-list p { color: var(--ink-2); margin: 0; }

/* Home: marking key */
.key { padding-block: clamp(2.5rem, 5vw, 4rem); }
.key-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.key-head a { font-weight: 650; white-space: nowrap; }
.key-table { width: 100%; border-collapse: collapse; margin-top: 1rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.key-table td, .key-table th { padding: .85rem 1.1rem; border-bottom: 1px solid var(--grid); text-align: start; vertical-align: baseline; }
.key-table tr:last-child td, .key-table tr:last-child th { border-bottom: 0; }
.key-table th { font-weight: 700; width: 32%; }
.key-table td:last-child { color: var(--ink-2); }
.key-pts { width: 6.5rem; font-size: 1.55rem; line-height: 1; white-space: nowrap; }

/* Home: fit */
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); padding-block: clamp(2rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem); }
.fit > div { border-inline-start: 3px solid var(--ink); padding-inline-start: 1.3rem; }
.fit p { color: var(--ink-2); margin: 0; max-width: 60ch; }

/* Home: history */
.history { padding-block: 0 clamp(2.5rem, 5vw, 4rem); }
.history-avg { color: var(--ink-2); }
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: .6rem .8rem; border-bottom: 1px solid var(--grid); text-align: start; white-space: nowrap; }
.tbl th { color: var(--ink-2); font-weight: 650; font-size: .82rem; background: var(--paper); }
.tbl tr:last-child td { border-bottom: 0; }
.history > .hint, #history-body > .hint { padding: 1rem 1.1rem; background: var(--sheet); border: 1px dashed var(--rule); border-radius: var(--r); }

/* Home: CTA band */
.page-home main > section.cta { max-width: none; background: var(--ink); color: #fff; padding-block: clamp(2.5rem, 5vw, 3.5rem); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 2rem; text-align: center; }
.cta h2 { margin: 0; color: #fff; }

/* Content pages */
.doc { max-width: var(--wrap); margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) var(--gut) clamp(2.5rem, 5vw, 4rem); }
.doc-head { max-width: 760px; padding-bottom: 1.6rem; border-bottom: 2px solid var(--ink); margin-bottom: 2rem; }
.doc-head h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); }
.doc-desc { color: var(--ink-2); font-size: 1.12rem; margin: 0; }
.doc-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.doc-grid:not(:has(.doc-toc)) { grid-template-columns: minmax(0, 1fr); }
.doc-toc { position: sticky; top: 84px; font-size: .9rem; }
.toc-title { font-weight: 700; color: var(--ink-2); margin-bottom: .5rem; }
.doc-toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--rule); }
.doc-toc a { display: block; padding: .3rem .9rem; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.doc-toc a:hover { color: var(--ink); background: var(--sheet); }
.prose { max-width: 68ch; font-size: 1.04rem; line-height: 1.72; }
.prose h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin: 2.2em 0 .6em; scroll-margin-top: 90px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.6em 0 .5em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--ink-3); }
.prose-faq h2 { font-size: 1.2rem; font-stretch: 104%; padding-top: 1.4rem; border-top: 1px solid var(--rule); margin-top: 1.4rem; }
.prose-faq h2:first-child { border-top: 0; padding-top: 0; }
.doc-cta { margin-top: 3rem; padding: 1.4rem 1.6rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; background: var(--sheet); border: 1px solid var(--rule); border-inline-start: 4px solid var(--ink); border-radius: var(--r); }
.doc-cta p { margin: 0; font-weight: 700; font-size: 1.15rem; font-stretch: 108%; }

/* Trainer */
.page-replay { font-size: 16px; }
.trainer { max-width: 1600px; margin: 0 auto; padding: 1rem var(--gut) 2rem; }
.session-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.session-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.session-label { font-size: 1.15rem; font-stretch: 108%; margin: 0; }
.session-meta { display: flex; align-items: center; gap: .55rem; }
.clock { font-size: 1.35rem; font-weight: 750; font-stretch: 110%; }
.tz { color: var(--ink-3); font-size: .82rem; font-weight: 650; }
.progress { width: 130px; height: 4px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--ink); transition: width .2s; }
.trainer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1rem; align-items: start; }
.chart { height: min(68vh, 680px); min-height: 360px; background: #fff; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .75rem; }
.btn-end { margin-inline-start: auto; }
.keys { margin: .55rem 0 0; }
.seg { display: inline-flex; border: 1.5px solid var(--rule); border-radius: 4px; overflow: hidden; background: var(--sheet); }
.seg button { min-height: 40px; padding: 0 .8rem; border: 0; background: transparent; color: var(--ink-2); font: 650 .88rem var(--font); cursor: pointer; }
.seg button + button { border-inline-start: 1px solid var(--rule); }
.seg button.on { background: var(--ink); color: #fff; }
.seg-side { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--rule); border-radius: 4px; overflow: hidden; margin-bottom: .9rem; }
.seg-side label { position: relative; }
.seg-side input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg-side span { display: block; padding: .6rem; text-align: center; font-weight: 750; color: var(--ink-2); cursor: pointer; background: var(--sheet); }
.seg-side label + label span { border-inline-start: 1px solid var(--rule); }
.seg-side input:checked + span { background: var(--up); color: #fff; }
.seg-side label:last-child input:checked + span { background: var(--down); }
.seg-side input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }
.panel { display: grid; gap: .8rem; }
.box, .card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem; }
.box-h { font-size: .95rem; font-stretch: 106%; margin-bottom: .8rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.stats .k, .stat-grid .k, .score-box .k { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.stats .v { font-size: 1.05rem; font-weight: 750; font-stretch: 106%; }
.preview { font-size: .86rem; color: var(--ink-2); min-height: 1.3em; margin: 0 0 .7rem; }
.preview.neg { color: var(--down); }
.orders { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; gap: .35rem; font-size: .86rem; }
.orders li { display: flex; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; background: var(--paper); border-radius: 4px; }
.rules summary { cursor: pointer; font-weight: 700; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .9rem; }
.rules-grid label { display: flex; flex-direction: column; gap: .3rem; }
.log { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; font-size: .86rem; display: grid; gap: .3rem; }
.log time, .mistakes time { color: var(--ink-3); font-weight: 650; margin-inline-end: .3rem; }

.results { margin-top: 1.5rem; background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--ink); border-radius: var(--r); padding: clamp(1.2rem, 3vw, 2rem); }
.results:focus { outline: none; }
.reveal { font-size: 1.08rem; }
.score-top { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.2rem 0; }
.score-box { padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); }
.big { display: block; font-size: 2.6rem; font-weight: 800; font-stretch: 112%; line-height: 1.1; margin: .2rem 0; }
.big.pen { font-size: 3.6rem; font-weight: 600; line-height: 1; }
.big.pen.good { color: var(--up); }
.big.pen.mid { color: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.4rem; }
.stat-grid > div { padding: .7rem .8rem; border: 1px solid var(--grid); border-radius: 4px; }
.stat-grid .v { font-weight: 750; }
.results h3 { margin-top: .6rem; }
.mistakes { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: .5rem; }
.mistakes li { display: flex; gap: 1rem; align-items: baseline; padding: .7rem .9rem; border: 1px solid var(--grid); border-radius: 4px; }
.mistakes .pts { font-size: 1.6rem; line-height: 1; min-width: 2.6ch; }
.mistakes .clean { color: var(--up); font-weight: 600; }
.results-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

/* Admin */
.admin { max-width: 920px; margin: 0 auto; padding: 2rem var(--gut); display: grid; gap: 1.25rem; }
.admin .card h2 { font-size: 1.25rem; }
.notice { padding: .75rem 1rem; border-radius: var(--r); border: 1px solid var(--rule); background: var(--sheet); }
.notice.ok { border-color: #9fd3c4; background: #effaf6; color: #0b5a48; }
.notice.bad { border-color: #e3a9b2; background: #fff5f6; color: #8a1c2c; }
code { font-size: .88em; background: var(--paper); padding: .05em .3em; border-radius: 3px; }

/* Responsive */
@media (max-width: 1040px) {
  .trainer-grid { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 56vh; min-height: 300px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .sheet { max-width: 720px; }
  .pick-form { grid-template-columns: 1fr 1fr; }
  .pick-form .btn { grid-column: 1 / -1; }
  .doc-grid { grid-template-columns: 1fr; }
  .doc-toc { position: static; }
  .site-foot-in { grid-template-columns: 1fr 1fr; }
  .foot-legal { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .site-head-in { flex-wrap: wrap; row-gap: .4rem; }
  .site-nav { order: 3; width: 100%; gap: 1.1rem; overflow-x: auto; padding-bottom: .15rem; }
  .site-nav a { font-size: .88rem; white-space: nowrap; }
  .head-cta { display: none; }
  .step-list, .fit, .score-top { grid-template-columns: 1fr; }
  .key-table th { width: auto; }
  .key-table, .key-table tbody, .key-table tr, .key-table td, .key-table th { display: block; }
  .key-table tr { display: grid; grid-template-columns: 5.5rem 1fr; padding: .8rem 1rem; border-bottom: 1px solid var(--grid); }
  .key-table td, .key-table th { padding: 0; border: 0; }
  .key-table td:last-child { grid-column: 2; }
  .key-pts { grid-row: span 2; width: auto; }
  .pick-form { grid-template-columns: 1fr; }
  .site-foot-in { grid-template-columns: 1fr; }
  .btn-end { margin-inline-start: 0; }
  .progress { width: 70px; }
  .pen-note { inset-inline-start: 4%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Admin: automatic loading */
textarea { width: 100%; padding: .55rem .65rem; border: 1.5px solid var(--rule); border-radius: 4px; font: 500 .95rem var(--font); color: var(--ink); background: var(--sheet); resize: vertical; }
textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(35, 70, 184, .18); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 650; margin-bottom: .9rem; }
.check input { width: 20px; min-height: 20px; height: 20px; }
.auto-run { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0 .8rem; }
.cron-help { margin-top: 1rem; }
.cron-help summary { cursor: pointer; font-weight: 650; }
.cron-help code { word-break: break-all; }

/* Chart: legend, tools, indicators menu, full screen */
.chart-wrap { position: relative; }
.legend { position: absolute; top: 8px; left: 10px; right: 70px; z-index: 3; pointer-events: none; font-size: .78rem; line-height: 1.5; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0 .2rem; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.legend b { font-weight: 700; color: var(--ink); }
.legend .lg-up b { color: var(--up); }
.legend .lg-dn b { color: var(--down); }
.legend .lg-gap { width: .8rem; }
.draw-hint { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 3; margin: 0; padding: .35rem .8rem; background: var(--ink); color: #fff; border-radius: 4px; font-size: .85rem; pointer-events: none; }
.chart-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; align-items: center; }
.btn.on { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.ind-menu { position: relative; }
.ind-menu summary { list-style: none; }
.ind-menu summary::-webkit-details-marker { display: none; }
.ind-menu summary::after { content: ""; width: 6px; height: 6px; margin-inline-start: .45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.ind-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; min-width: 240px; padding: .5rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 10px 28px rgba(22, 35, 58, .16); display: grid; gap: .1rem; }
[dir="rtl"] .ind-list { left: auto; right: 0; }
.ind-list label { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 4px; cursor: pointer; font-size: .92rem; font-weight: 550; }
.ind-list label:hover { background: var(--paper); }
.ind-list input { width: 18px; height: 18px; min-height: 18px; margin: 0; }
.swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--c); flex: none; }
.chart-col:fullscreen { background: var(--paper); padding: 1rem; overflow: auto; }
.chart-col:fullscreen .chart { height: calc(100vh - 150px); }
