/* Typing test — additions on top of race.css, which styles the dark .race-app stage
   (typing line, telemetry, boards, buttons). Loaded only on /typing-test. */

/* ---------- stage ---------- */
.test-app .panel{ border:1px solid var(--r-line); border-radius:6px; }
/* "Click here to start typing" only while the text waits for keys (test.js › setPhase):
   before Start and after the result, clicking the text does nothing. */
.test-app:not([data-phase="ready"]):not([data-phase="running"]) .typearea::after{ content:none; }
.test-app[data-phase="done"] .textinner{ opacity:.55; }
/* A long test: show four whole lines. The window takes the text's font size so that
   1.75em here is exactly one line of .textinner (race.css sizes it with clamp()). */
.test-app .textwin{ font-size:clamp(15px,2.1vw,19px); height:calc(4 * 1.75em); }

.test-app .hudbtn{
  display:inline-flex; align-items:center; gap:8px;
  margin:4px 6px 4px 0; padding:4px 10px;
  background:transparent; color:var(--r-muted);
  border:1px solid var(--r-line); border-radius:4px;
  font:500 11px/1 var(--f-mono); letter-spacing:.06em; text-transform:uppercase;
  cursor:pointer;
}
.test-app .hudbtn:hover{ color:var(--r-text); background:var(--r-surface-2); }
.test-app .hudbtn[hidden]{ display:none; }

/* ---------- length picker ---------- */
.test-app .durations{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.test-app .dur{
  display:inline-flex; align-items:baseline; gap:6px;
  min-width:128px; padding:10px 16px;
  background:var(--r-surface-2); color:var(--r-text);
  border:1px solid var(--r-line); border-radius:4px;
  font:500 var(--r-step)/1 var(--f-mono); letter-spacing:.04em;
  cursor:pointer;
}
.test-app .dur b{ font:700 28px/1 var(--f-display); }
.test-app .dur:hover{ border-color:var(--r-muted); }
.test-app .dur[aria-checked="true"]{
  background:#2A2716; color:var(--r-amber);
  border-color:var(--r-amber); box-shadow:inset 0 0 0 1px var(--r-amber);
}
.test-app .dur:focus-visible{ outline:2px solid var(--r-best); outline-offset:1px; }
.test-app .bestline{ margin:0 0 16px; font-size:var(--r-step); color:var(--r-muted); }

/* ---------- result ---------- */
.test-app #rwpm{ font-size:clamp(44px,8vw,72px); color:var(--r-amber); }
.test-app #rwpm .u{ font-size:.42em; color:var(--r-text); }
.test-app .boardnote[hidden]{ display:none; }

/* ---------- certificate (light shell) ---------- */
.cert{ padding-top:36px; }
.cert[hidden]{ display:none !important; }
.cert-grid{ display:grid; gap:20px; grid-template-columns:minmax(0,1fr); align-items:start; }
@media (min-width:900px){ .cert-grid{ grid-template-columns:minmax(0,1fr) 280px; } }
.cert-frame{ padding:10px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); }
.cert-frame canvas{ display:block; width:100%; height:auto; }
.cert-side{ display:flex; flex-direction:column; gap:8px; }
.cert-label{ font:600 15px/1.3 var(--f-ui); }
.cert-input{
  width:100%; padding:11px 12px;
  font:400 16px/1.2 var(--f-ui); color:var(--ink);
  background:var(--card); border:1px solid var(--line-strong); border-radius:8px;
}
.cert-input:focus{ outline:2px solid var(--bus); outline-offset:1px; border-color:var(--bus-edge); }
.cert-note{ margin:0; font-size:13px; line-height:1.45; color:var(--muted); }
.cert-actions{ display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; }
/* .btn.btn-quiet, not .btn-quiet: style.css loads after this file and would win a tie. */
.btn.btn-quiet{ background:var(--card); box-shadow:0 4px 0 var(--line-strong); border:1px solid var(--line-strong); }
.btn.btn-quiet:hover{ background:var(--paper); }
.btn.btn-quiet:active{ box-shadow:0 1px 0 var(--line-strong); }

.test-prose{ padding-top:48px; }

/* ---------- printing the certificate only (test.js › printCert) ---------- */
.cert-print{ display:none; }
@media print{
  html.printing-cert body > *:not(.cert-print){ display:none !important; }
  html.printing-cert .cert-print{ display:block; }
  .cert-print img{ display:block; width:100%; height:auto; }
  @page{ size:landscape; margin:10mm; }
}
