:root {
  --bg: #eceff4;
  --card: #ffffff;
  --text: #1b2029;
  --muted: #586172;
  --accent: #2f5fd0;
  --accent-dark: #244bb0;
  --accent-soft: #e5ecfb;
  --border: #d2d8e1;
  --img-bg: #e4e7ec;
  --pos-bg: #d7f0de;
  --pos-line: #9fd4ae;
  --pos-ink: #1d5631;
  --neg-bg: #fadcd8;
  --neg-line: #eba79f;
  --neg-ink: #84261f;
  --radius: 14px;
  --vh: 1vh;
  --g: 6px;
}
@supports (height: 1dvh) {
  :root { --vh: 1dvh; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 1px solid #b9c0cc;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f7f8fa;
  font: 600 0.9em/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  color: var(--text);
}

#app {
  min-height: calc(100 * var(--vh));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 12px 10px;
}

#progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: #d9dee7;
  z-index: 50;
}
#progress[hidden] { display: none; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

.loading { color: var(--muted); }

.page {
  width: 100%;
  max-width: 880px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(20, 30, 50, 0.07);
  padding: clamp(20px, 4vw, 48px);
  font-size: clamp(17px, 0.45vw + 14px, 21px);
  line-height: 1.55;
}
.page h1 { font-size: clamp(26px, 1.6vw + 18px, 40px); line-height: 1.18; margin: 0 0 0.6em; text-wrap: balance; }
.page h2 { font-size: clamp(22px, 1vw + 16px, 30px); line-height: 1.2; margin: 0 0 0.5em; text-wrap: balance; }
.page p { margin: 0 0 0.9em; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 1.3em; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.65em 2.2em;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 1.08em; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled { opacity: 0.6; cursor: default; }

.intro .agree {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 1.2em;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f5f7fa;
  cursor: pointer;
}
.intro .agree input { width: 22px; height: 22px; margin-top: 0.2em; flex: none; accent-color: var(--accent); }
.intro .help-hint { color: var(--muted); }
@media (pointer: coarse) { .kbd-only { display: none; } }

.form-page .q-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin-top: 0.4em; }
@media (max-width: 640px) { .form-page .q-grid { grid-template-columns: minmax(0, 1fr); } }
.form-page .q-wide { grid-column: 1 / -1; }
.form-page .q-item { margin: 0 0 1.3em; padding: 0; border: 0; min-width: 0; }
.form-page .q-grid .q-item { margin: 0; }
.form-page .q-prompt { display: block; font-weight: 600; margin: 0 0 0.4em; padding: 0; }
.form-page .q-optional { color: var(--muted); font-weight: 400; }
.form-page select,
.form-page input[type="text"],
.form-page textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--card);
}
.form-page select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23586172' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.form-page select:invalid { color: var(--muted); }
.form-page select option { color: var(--text); }
.form-page select:focus-visible,
.form-page input[type="text"]:focus-visible,
.form-page textarea:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.form-page .q-options { display: flex; flex-direction: column; gap: 6px; }
.form-page .q-option { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.form-page .q-option input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }

.form-page .q-scale { display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: 6px; max-width: 520px; }
.form-page .q-step { position: relative; cursor: pointer; }
.form-page .q-step input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.form-page .q-step > span {
  display: block;
  padding: 0.4em 0;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.form-page .q-step:hover > span { border-color: var(--accent); }
.form-page .q-step input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.form-page .q-step input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.form-page .q-scale-ends { display: flex; justify-content: space-between; max-width: 520px; margin-top: 4px; color: var(--muted); font-size: 0.85em; }
.form-page .more-box { margin-top: 1.6em; padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; background: #f5f7fa; }
.form-page .more-box p { margin: 0; }
.form-page.is-incomplete .page-actions .btn { opacity: 0.55; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.save-error { margin-bottom: 1.5em; padding-bottom: 1em; border-bottom: 1px solid var(--border); }
.save-ok { color: #1a7f37; font-weight: 600; }
.save-pending { color: var(--muted); font-weight: 600; }
.btn-small { font-size: 0.85em; padding: 0.35em 1.2em; }

.extra-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
body.layout-col .extra-bar { grid-column: 1 / -1; }
.save-error h2 { color: #b3261e; }

.fatal pre { white-space: pre-wrap; font-size: 13px; }

.trial {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(20, 30, 50, 0.07);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  max-width: 100%;
}
.trial:not(.is-shown) img { visibility: hidden; }
.trial:not(.is-ready) .query-btn { pointer-events: none; }
.trial-loading { display: none; }
.trial.is-loading .trial-loading {
  display: block;
  position: absolute;
  inset: auto 0 45% 0;
  text-align: center;
  color: var(--muted);
}

.concept-name {
  text-align: center;
  font-size: clamp(18px, 0.7vw + 13px, 27px);
  line-height: 1.3;
  background: var(--pos-bg);
  border: 1px solid var(--pos-line);
  border-radius: 10px;
  padding: 5px 18px;
  max-width: 100%;
}
.concept-label { color: var(--pos-ink); }
.concept-name-value { font-weight: 700; }
.concept-name-empty { visibility: hidden; }

.ref-block { border-radius: 10px; }
.ref-high { background: var(--pos-bg); box-shadow: inset 0 0 0 1px var(--pos-line); }
.ref-low { background: var(--neg-bg); box-shadow: inset 0 0 0 1px var(--neg-line); }
.ref-label { font-weight: 400; }
.ref-label b { font-weight: 700; }
.ref-high .ref-label { color: var(--pos-ink); }
.ref-low .ref-label { color: var(--neg-ink); }
.ref-img {
  width: var(--s);
  height: var(--s);
  object-fit: cover;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--img-bg);
}

.trial-prompt { font-weight: 700; text-align: center; font-size: clamp(17px, 0.5vw + 13px, 24px); line-height: 1.3; }
.trial-prompt mark {
  background: var(--pos-bg);
  box-shadow: inset 0 0 0 1px var(--pos-line);
  color: inherit;
  padding: 0 0.3em;
  border-radius: 6px;
  white-space: nowrap;
}

.query-btn {
  all: unset;
  display: block;
  position: relative;
  box-sizing: border-box;
  border: 3px solid transparent;
  border-radius: 12px;
  padding: 3px;
  line-height: 0;
  cursor: pointer;
  background: var(--card);
  box-shadow: 0 2px 4px rgba(20, 30, 50, 0.18), 0 8px 18px rgba(20, 30, 50, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .query-btn:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(20, 30, 50, 0.22), 0 14px 28px rgba(20, 30, 50, 0.2);
  }
}
.query-btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(20, 30, 50, 0.25); }
.query-btn:focus-visible { border-color: var(--accent); }
.query-btn.is-picked {
  border-color: var(--accent);
  transform: scale(0.985);
  box-shadow: 0 0 0 5px var(--accent-soft), 0 2px 6px rgba(20, 30, 50, 0.2);
}
.query-btn.is-chosen { border-color: var(--accent); }
.query-btn.is-chosen::after {
  content: attr(data-label);
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: 700 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-reduced-motion: reduce) {
  .query-btn, .query-btn:hover, .query-btn.is-picked { transition: none; transform: none; }
}
.query-img {
  width: var(--q);
  height: var(--q);
  object-fit: cover;
  display: block;
  border-radius: 7px;
  background: var(--img-bg);
}

.key-hint { color: var(--muted); font-size: 15px; line-height: 1.4; text-align: center; }
@media (pointer: coarse) { .key-hint { display: none; } }

body.layout-row {
  --lab: clamp(92px, 9vw, 168px);
  --fixed: 236px;
  --avail: calc(97 * var(--vh) - var(--fixed) - var(--fit, 0px));
  --s: max(34px, min(calc((90vw - var(--lab) - 86px - 8 * var(--g)) / 9), calc(var(--avail) * 0.25)));
  --q: max(110px, min(calc(var(--avail) - 2 * var(--s) - 10px), 36vw, calc(45vw - 64px), 600px));
}
body.layout-row .trial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 14px;
}
body.layout-row .refs { display: flex; flex-direction: column; gap: 8px; }
body.layout-row .ref-block {
  display: grid;
  grid-template-columns: var(--lab) auto;
  align-items: center;
  column-gap: 14px;
  padding: 6px 10px;
}
body.layout-row .ref-label { text-align: right; font-size: clamp(14px, 0.35vw + 11px, 17px); line-height: 1.3; }
body.layout-row .ref-grid { display: grid; grid-template-columns: repeat(9, var(--s)); gap: var(--g); }
body.layout-row .lab-short,
body.layout-row .hint-col { display: none; }
body.layout-row .choice { display: flex; flex-direction: column; align-items: center; gap: 8px; }
body.layout-row .query-pair { display: flex; gap: clamp(28px, 5vw, 96px); }

body.layout-col {
  --fixed: 190px;
  --s: max(30px, min(calc((100 * var(--vh) - var(--fixed) - var(--fit, 0px)) / 9), calc((100vw - 70px) / 6.5)));
  --q: max(100px, min(calc(4.5 * var(--s) - 24px), calc(100vw - 2 * var(--s) - 92px), 560px));
}
body.layout-col #app { padding: 12px 8px 8px; }
body.layout-col.on-round #app { padding-top: 48px; justify-content: flex-start; }
body.layout-col .key-hint { display: none; }
body.layout-col .tuto-open { font-size: 14px; padding: 7px 12px; }
body.layout-col .round-num { font-size: 13px; padding: 7px 11px; }
body.layout-col .trial {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 10px 8px;
  align-items: start;
  justify-content: center;
  padding: 10px 8px;
}
body.layout-col .concept-name { grid-column: 1 / -1; justify-self: center; }
body.layout-col .debug-badge { grid-column: 1 / -1; }
body.layout-col .refs { display: contents; }
body.layout-col .ref-high { grid-column: 1; order: 1; }
body.layout-col .choice { grid-column: 2; order: 2; }
body.layout-col .ref-low { grid-column: 3; order: 3; }
body.layout-col .ref-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 4px; }
body.layout-col .ref-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  height: 50px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
body.layout-col .ref-label .info-btn { width: 18px; height: 18px; margin-left: 0; font-size: 11px; }
body.layout-col .concept-name { font-size: 16px; padding: 4px 12px; }
body.layout-col .ref-grid { display: grid; grid-template-columns: var(--s); gap: 4px; justify-content: center; }
body.layout-col .ref-block { align-items: center; }
body.layout-col .choice { align-self: center; }
body.layout-col .lab-long,
body.layout-col .hint-row { display: none; }
body.layout-col .choice { display: flex; flex-direction: column; align-items: center; gap: 10px; }
body.layout-col .trial-prompt { max-width: calc(var(--q) + 12px); }
body.layout-col .query-pair { display: flex; flex-direction: column; gap: 12px; }

#rotate { display: none; }
@media (orientation: landscape) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  body.on-round #rotate {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 900;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    text-align: center;
    font-size: 20px;
  }
}

.info-btn, .info-btn-sample {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  font: italic 700 13px/1 Georgia, "Times New Roman", serif;
  vertical-align: middle;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.info-btn-sample { cursor: default; margin: 0 2px; }
.info-btn:hover, .info-btn:focus-visible { background: var(--accent); color: #fff; outline: none; }
@media (pointer: coarse) {
  .info-btn { position: relative; }
  .info-btn::before { content: ""; position: absolute; inset: -9px; }
}
.info-link {
  all: unset;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.info-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#info-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 20, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#info-modal[hidden] { display: none; }
#info-modal .info-box {
  background: var(--card);
  color: var(--text);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  padding: 20px 24px 18px;
  font-size: clamp(16px, 0.3vw + 14px, 19px);
  text-align: left;
}
#info-modal h3 { margin: 0 0 8px; font-size: 1.15em; }
#info-modal p { margin: 0 0 0.7em; }
#info-modal ul { padding-left: 20px; margin: 6px 0; }
#info-modal li { margin: 5px 0; }
#info-close { margin-top: 10px; padding: 0.45em 1.6em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 800;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: #1f2a3d;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: opacity 0.5s ease;
}
.toast.is-out { opacity: 0; }

@media (max-height: 600px) {
  body.layout-row { --fixed: 202px; }
  body.layout-row .trial { gap: 6px; padding: 8px 16px 10px; }
  .concept-name { padding: 2px 14px; }
}

body.in-extra.layout-row { --fixed: 280px; }
body.in-extra.layout-col { --fixed: 236px; }
body.debug.layout-row { --fixed: 324px; }
body.debug.layout-col { --fixed: 282px; }
body.debug.in-extra.layout-row { --fixed: 368px; }
body.debug.in-extra.layout-col { --fixed: 328px; }
.debug-badge {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  width: 100%;
  max-width: 1100px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 2px solid #8a8a8a;
  background: #f2f2f2;
  color: #222;
  font: 13px/1.35 system-ui, sans-serif;
  text-align: left;
  user-select: text;
}
.debug-badge .dbg-source { font-weight: 700; font-size: 15px; }
.debug-badge .dbg-meta { font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; color: #444; }
.debug-badge.dbg-a { border-color: #777; background: #eeeeee; }
.debug-badge.dbg-b { border-color: #1f6fd1; background: #e3efff; }
.debug-badge.dbg-c { border-color: #b8860b; background: #fff3d6; }
.debug-badge.dbg-d { border-color: #7b3fb5; background: #f1e6fb; }
.dbg-verdict { font-weight: 700; font-size: 15px; padding: 2px 0; }
.dbg-names { font-size: 15px; }
.dbg-verdict.dbg-ok { color: #11733a; }
.dbg-verdict.dbg-ko { color: #b3261e; }
.dbg-catch { font-weight: 700; color: #8a1c1c; background: #ffe8e8; border-radius: 4px; padding: 2px 6px; }
.dbg-nav { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 auto 8px; }
.dbg-arrow { font-size: 18px; width: 44px; height: 34px; border: 1px solid #888; border-radius: 6px; background: #f4f4f4; cursor: pointer; }
.dbg-arrow:disabled { opacity: 0.35; cursor: default; }
.dbg-count { font: 14px/1 ui-monospace, Menlo, Consolas, monospace; min-width: 110px; text-align: center; }
.dbg-version { font: 11px/1 ui-monospace, Menlo, Consolas, monospace; color: #777; }
.dbg-end { font-size: 13px; padding: 4px 10px; border: 1px solid #888; border-radius: 6px; background: #fff; cursor: pointer; }

.tuto { max-width: 820px; }
.tuto-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 0.8em; }
.tuto-dots { display: inline-flex; gap: 8px; }
.tuto-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.tuto-dot.is-on { background: var(--accent); }
.tuto-body { text-align: center; }
.tuto-body p { margin: 0 0 0.6em; }

.tuto-figure { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 0.6em 0 0.4em; }
.tuto-svg { width: min(330px, 70vw); height: auto; }
.tuto-svg .edges line { stroke: #c4cbd6; stroke-width: 1; }
.tuto-svg circle { fill: #fff; stroke: #8792a5; stroke-width: 2; }
.tuto-svg circle.hot { fill: var(--pos-bg); stroke: var(--pos-ink); stroke-width: 3; }
.tuto-svg .arrow { fill: none; stroke: var(--pos-ink); stroke-width: 2.5; stroke-dasharray: 5 4; }
.tuto-concept { background: var(--pos-bg); box-shadow: inset 0 0 0 1px var(--pos-line); border-radius: 12px; padding: 10px; }
.tuto-mini { display: grid; grid-template-columns: repeat(2, 64px); gap: 6px; }
.tuto-mini-img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.tuto-caption { color: var(--pos-ink); font-size: 0.8em; font-weight: 700; margin-top: 6px; }

.tuto-ref { border-radius: 10px; padding: 8px; margin: 0 auto 6px; width: fit-content; max-width: 100%; }
.tuto-high { background: var(--pos-bg); box-shadow: inset 0 0 0 1px var(--pos-line); }
.tuto-low { background: var(--neg-bg); box-shadow: inset 0 0 0 1px var(--neg-line); }
.tuto-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 72px)); gap: 5px; }
.tuto-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; display: block; }
.tuto-lab { font-size: 0.9em; margin: 0.4em 0 0.3em !important; }
.tuto-lab-high { color: var(--pos-ink); }
.tuto-lab-low { color: var(--neg-ink); }
.tuto-goal { margin-top: 0.8em !important; }
.tuto-pair { display: flex; justify-content: center; gap: 14px; }
.tuto-cand { width: min(120px, 30vw); aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 3px solid var(--accent); display: block; }
@media (max-width: 640px) {
  .tuto-grid { grid-template-columns: repeat(5, minmax(0, 52px)); }
  .tuto-grid .tuto-img:nth-child(n + 6) { display: none; }
}

.tuto-shot { position: relative; margin: 0.6em auto 0.8em; max-width: 680px; }
.tuto-shot img { width: 100%; display: block; border-radius: 10px; border: 1px solid var(--border); }
.tuto-zoom {
  display: inline-block;
  position: relative;
  margin-bottom: 14px;
  font-size: clamp(18px, 1.2vw + 12px, 26px);
  background: var(--pos-bg);
  border: 3px solid #e8a200;
  border-radius: 12px;
  padding: 6px 18px;
  box-shadow: 0 6px 22px rgba(20, 30, 50, 0.25);
}
.tuto-zoom::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: #e8a200;
  border-bottom: 0;
}
.tuto-score {
  display: inline-block;
  margin-top: 1.1em;
  padding: 8px 16px;
  border-radius: 10px;
  background: #fff6db;
  border: 1px solid #f0d27a;
  font-weight: 700;
}

.score { text-align: center; margin: 0 0 1.2em; }
.score-label { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8em; }
.score-value { font-size: clamp(44px, 4vw + 28px, 72px); line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.score-text { font-weight: 700; }

.fireworks { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.fireworks canvas { display: block; }

@media (max-width: 640px) { .tuto-svg .arrow { display: none; } }

.tuto-open {
  position: fixed;
  top: 8px;
  right: 10px;
  z-index: 20;
  font: 600 16px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  opacity: 0.85;
}
.tuto-open::before { content: "?"; display: inline-block; margin-right: 6px; font-weight: 800; }
.tuto-open:hover { opacity: 1; border-color: var(--accent); }
.tuto-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tuto-ref .tuto-lab { margin: 0 0 6px !important; }
body.on-intro {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cg stroke='%239db2ec' stroke-width='1.6' opacity='.45'%3E%3Cline x1='46' y1='98' x2='227' y2='255'/%3E%3Cline x1='46' y1='98' x2='247' y2='588'/%3E%3Cline x1='46' y1='98' x2='248' y2='900'/%3E%3Cline x1='39' y1='208' x2='248' y2='91'/%3E%3Cline x1='39' y1='208' x2='241' y2='390'/%3E%3Cline x1='39' y1='208' x2='248' y2='900'/%3E%3Cline x1='56' y1='330' x2='248' y2='91'/%3E%3Cline x1='56' y1='330' x2='248' y2='900'/%3E%3Cline x1='56' y1='330' x2='227' y2='255'/%3E%3Cline x1='47' y1='519' x2='249' y2='723'/%3E%3Cline x1='47' y1='519' x2='248' y2='91'/%3E%3Cline x1='47' y1='519' x2='241' y2='390'/%3E%3Cline x1='63' y1='619' x2='249' y2='723'/%3E%3Cline x1='63' y1='619' x2='248' y2='91'/%3E%3Cline x1='63' y1='619' x2='248' y2='900'/%3E%3Cline x1='38' y1='791' x2='227' y2='255'/%3E%3Cline x1='38' y1='791' x2='249' y2='723'/%3E%3Cline x1='38' y1='791' x2='247' y2='588'/%3E%3Cline x1='63' y1='953' x2='227' y2='255'/%3E%3Cline x1='63' y1='953' x2='241' y2='390'/%3E%3Cline x1='63' y1='953' x2='249' y2='723'/%3E%3Cline x1='248' y1='91' x2='428' y2='763'/%3E%3Cline x1='248' y1='91' x2='432' y2='398'/%3E%3Cline x1='248' y1='91' x2='444' y2='559'/%3E%3Cline x1='227' y1='255' x2='436' y2='60'/%3E%3Cline x1='227' y1='255' x2='451' y2='921'/%3E%3Cline x1='227' y1='255' x2='444' y2='559'/%3E%3Cline x1='241' y1='390' x2='444' y2='559'/%3E%3Cline x1='241' y1='390' x2='451' y2='921'/%3E%3Cline x1='241' y1='390' x2='428' y2='763'/%3E%3Cline x1='247' y1='588' x2='432' y2='398'/%3E%3Cline x1='247' y1='588' x2='436' y2='60'/%3E%3Cline x1='247' y1='588' x2='430' y2='254'/%3E%3Cline x1='249' y1='723' x2='436' y2='60'/%3E%3Cline x1='249' y1='723' x2='432' y2='398'/%3E%3Cline x1='249' y1='723' x2='428' y2='763'/%3E%3Cline x1='248' y1='900' x2='444' y2='559'/%3E%3Cline x1='248' y1='900' x2='430' y2='254'/%3E%3Cline x1='248' y1='900' x2='436' y2='60'/%3E%3Cline x1='436' y1='60' x2='604' y2='232'/%3E%3Cline x1='436' y1='60' x2='611' y2='647'/%3E%3Cline x1='436' y1='60' x2='639' y2='369'/%3E%3Cline x1='430' y1='254' x2='604' y2='232'/%3E%3Cline x1='430' y1='254' x2='628' y2='787'/%3E%3Cline x1='430' y1='254' x2='611' y2='647'/%3E%3Cline x1='432' y1='398' x2='626' y2='59'/%3E%3Cline x1='432' y1='398' x2='611' y2='647'/%3E%3Cline x1='432' y1='398' x2='639' y2='369'/%3E%3Cline x1='444' y1='559' x2='628' y2='787'/%3E%3Cline x1='444' y1='559' x2='626' y2='59'/%3E%3Cline x1='444' y1='559' x2='639' y2='369'/%3E%3Cline x1='428' y1='763' x2='611' y2='647'/%3E%3Cline x1='428' y1='763' x2='639' y2='369'/%3E%3Cline x1='428' y1='763' x2='604' y2='232'/%3E%3Cline x1='451' y1='921' x2='639' y2='369'/%3E%3Cline x1='451' y1='921' x2='604' y2='232'/%3E%3Cline x1='451' y1='921' x2='611' y2='647'/%3E%3Cline x1='626' y1='59' x2='810' y2='707'/%3E%3Cline x1='626' y1='59' x2='812' y2='929'/%3E%3Cline x1='626' y1='59' x2='815' y2='215'/%3E%3Cline x1='604' y1='232' x2='780' y2='441'/%3E%3Cline x1='604' y1='232' x2='778' y2='803'/%3E%3Cline x1='604' y1='232' x2='815' y2='215'/%3E%3Cline x1='639' y1='369' x2='778' y2='803'/%3E%3Cline x1='639' y1='369' x2='810' y2='707'/%3E%3Cline x1='639' y1='369' x2='815' y2='215'/%3E%3Cline x1='596' y1='485' x2='780' y2='441'/%3E%3Cline x1='596' y1='485' x2='788' y2='580'/%3E%3Cline x1='596' y1='485' x2='812' y2='929'/%3E%3Cline x1='611' y1='647' x2='810' y2='707'/%3E%3Cline x1='611' y1='647' x2='812' y2='929'/%3E%3Cline x1='611' y1='647' x2='800' y2='58'/%3E%3Cline x1='628' y1='787' x2='800' y2='58'/%3E%3Cline x1='628' y1='787' x2='778' y2='803'/%3E%3Cline x1='628' y1='787' x2='778' y2='287'/%3E%3Cline x1='598' y1='951' x2='812' y2='929'/%3E%3Cline x1='598' y1='951' x2='778' y2='287'/%3E%3Cline x1='598' y1='951' x2='815' y2='215'/%3E%3Cline x1='800' y1='58' x2='966' y2='796'/%3E%3Cline x1='800' y1='58' x2='998' y2='636'/%3E%3Cline x1='800' y1='58' x2='966' y2='376'/%3E%3Cline x1='815' y1='215' x2='963' y2='487'/%3E%3Cline x1='815' y1='215' x2='966' y2='796'/%3E%3Cline x1='815' y1='215' x2='966' y2='376'/%3E%3Cline x1='778' y1='287' x2='966' y2='376'/%3E%3Cline x1='778' y1='287' x2='983' y2='80'/%3E%3Cline x1='778' y1='287' x2='968' y2='244'/%3E%3Cline x1='780' y1='441' x2='983' y2='80'/%3E%3Cline x1='780' y1='441' x2='968' y2='244'/%3E%3Cline x1='780' y1='441' x2='963' y2='487'/%3E%3Cline x1='788' y1='580' x2='968' y2='244'/%3E%3Cline x1='788' y1='580' x2='966' y2='376'/%3E%3Cline x1='788' y1='580' x2='972' y2='900'/%3E%3Cline x1='810' y1='707' x2='963' y2='487'/%3E%3Cline x1='810' y1='707' x2='998' y2='636'/%3E%3Cline x1='810' y1='707' x2='966' y2='796'/%3E%3Cline x1='778' y1='803' x2='972' y2='900'/%3E%3Cline x1='778' y1='803' x2='983' y2='80'/%3E%3Cline x1='778' y1='803' x2='963' y2='487'/%3E%3Cline x1='812' y1='929' x2='966' y2='796'/%3E%3Cline x1='812' y1='929' x2='966' y2='376'/%3E%3Cline x1='812' y1='929' x2='983' y2='80'/%3E%3Cline x1='983' y1='80' x2='1194' y2='187'/%3E%3Cline x1='983' y1='80' x2='1164' y2='432'/%3E%3Cline x1='983' y1='80' x2='1149' y2='666'/%3E%3Cline x1='968' y1='244' x2='1164' y2='432'/%3E%3Cline x1='968' y1='244' x2='1178' y2='941'/%3E%3Cline x1='968' y1='244' x2='1194' y2='187'/%3E%3Cline x1='966' y1='376' x2='1153' y2='808'/%3E%3Cline x1='966' y1='376' x2='1178' y2='941'/%3E%3Cline x1='966' y1='376' x2='1149' y2='666'/%3E%3Cline x1='963' y1='487' x2='1149' y2='666'/%3E%3Cline x1='963' y1='487' x2='1180' y2='88'/%3E%3Cline x1='963' y1='487' x2='1178' y2='941'/%3E%3Cline x1='998' y1='636' x2='1153' y2='808'/%3E%3Cline x1='998' y1='636' x2='1164' y2='432'/%3E%3Cline x1='998' y1='636' x2='1178' y2='941'/%3E%3Cline x1='966' y1='796' x2='1194' y2='187'/%3E%3Cline x1='966' y1='796' x2='1149' y2='666'/%3E%3Cline x1='966' y1='796' x2='1178' y2='941'/%3E%3Cline x1='972' y1='900' x2='1179' y2='292'/%3E%3Cline x1='972' y1='900' x2='1194' y2='187'/%3E%3Cline x1='972' y1='900' x2='1180' y2='88'/%3E%3Cline x1='1180' y1='88' x2='1358' y2='305'/%3E%3Cline x1='1180' y1='88' x2='1365' y2='670'/%3E%3Cline x1='1180' y1='88' x2='1378' y2='486'/%3E%3Cline x1='1194' y1='187' x2='1358' y2='305'/%3E%3Cline x1='1194' y1='187' x2='1365' y2='670'/%3E%3Cline x1='1194' y1='187' x2='1378' y2='486'/%3E%3Cline x1='1179' y1='292' x2='1378' y2='486'/%3E%3Cline x1='1179' y1='292' x2='1358' y2='305'/%3E%3Cline x1='1179' y1='292' x2='1356' y2='895'/%3E%3Cline x1='1164' y1='432' x2='1356' y2='895'/%3E%3Cline x1='1164' y1='432' x2='1358' y2='305'/%3E%3Cline x1='1164' y1='432' x2='1348' y2='99'/%3E%3Cline x1='1157' y1='549' x2='1348' y2='99'/%3E%3Cline x1='1157' y1='549' x2='1356' y2='895'/%3E%3Cline x1='1157' y1='549' x2='1378' y2='486'/%3E%3Cline x1='1149' y1='666' x2='1358' y2='305'/%3E%3Cline x1='1149' y1='666' x2='1365' y2='670'/%3E%3Cline x1='1149' y1='666' x2='1348' y2='99'/%3E%3Cline x1='1153' y1='808' x2='1358' y2='305'/%3E%3Cline x1='1153' y1='808' x2='1348' y2='99'/%3E%3Cline x1='1153' y1='808' x2='1356' y2='895'/%3E%3Cline x1='1178' y1='941' x2='1358' y2='305'/%3E%3Cline x1='1178' y1='941' x2='1378' y2='486'/%3E%3Cline x1='1178' y1='941' x2='1365' y2='670'/%3E%3Cline x1='1348' y1='99' x2='1535' y2='322'/%3E%3Cline x1='1348' y1='99' x2='1539' y2='527'/%3E%3Cline x1='1348' y1='99' x2='1525' y2='904'/%3E%3Cline x1='1358' y1='305' x2='1525' y2='904'/%3E%3Cline x1='1358' y1='305' x2='1535' y2='711'/%3E%3Cline x1='1358' y1='305' x2='1535' y2='97'/%3E%3Cline x1='1378' y1='486' x2='1535' y2='97'/%3E%3Cline x1='1378' y1='486' x2='1539' y2='527'/%3E%3Cline x1='1378' y1='486' x2='1535' y2='322'/%3E%3Cline x1='1365' y1='670' x2='1525' y2='904'/%3E%3Cline x1='1365' y1='670' x2='1535' y2='711'/%3E%3Cline x1='1365' y1='670' x2='1539' y2='527'/%3E%3Cline x1='1356' y1='895' x2='1535' y2='322'/%3E%3Cline x1='1356' y1='895' x2='1525' y2='904'/%3E%3Cline x1='1356' y1='895' x2='1539' y2='527'/%3E%3C/g%3E%3Ccircle cx='46' cy='98' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='39' cy='208' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='56' cy='330' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='47' cy='519' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='63' cy='619' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='38' cy='791' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='63' cy='953' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='248' cy='91' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='227' cy='255' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='241' cy='390' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='247' cy='588' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='249' cy='723' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='248' cy='900' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='436' cy='60' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='430' cy='254' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='432' cy='398' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='444' cy='559' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='428' cy='763' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='451' cy='921' r='17' fill='%237fcf98' opacity='.55'/%3E%3Ccircle cx='451' cy='921' r='9' fill='%233fae68'/%3E%3Ccircle cx='626' cy='59' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='604' cy='232' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='639' cy='369' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='596' cy='485' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='611' cy='647' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='628' cy='787' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='598' cy='951' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='800' cy='58' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='815' cy='215' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='778' cy='287' r='17' fill='%237fcf98' opacity='.55'/%3E%3Ccircle cx='778' cy='287' r='9' fill='%233fae68'/%3E%3Ccircle cx='780' cy='441' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='788' cy='580' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='810' cy='707' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='778' cy='803' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='812' cy='929' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='983' cy='80' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='968' cy='244' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='966' cy='376' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='963' cy='487' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='998' cy='636' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='966' cy='796' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='972' cy='900' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1180' cy='88' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1194' cy='187' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1179' cy='292' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1164' cy='432' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1157' cy='549' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1149' cy='666' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1153' cy='808' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1178' cy='941' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1348' cy='99' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1358' cy='305' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1378' cy='486' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1365' cy='670' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1356' cy='895' r='17' fill='%237fcf98' opacity='.55'/%3E%3Ccircle cx='1356' cy='895' r='9' fill='%233fae68'/%3E%3Ccircle cx='1535' cy='97' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1535' cy='322' r='17' fill='%237fcf98' opacity='.55'/%3E%3Ccircle cx='1535' cy='322' r='9' fill='%233fae68'/%3E%3Ccircle cx='1539' cy='527' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1535' cy='711' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3Ccircle cx='1525' cy='904' r='8' fill='%23ffffff' stroke='%238ea6e8' stroke-width='2.5'/%3E%3C/svg%3E") center / cover no-repeat,
    radial-gradient(38vmax 38vmax at 12% 18%, rgba(47, 95, 208, 0.24), transparent 70%),
    radial-gradient(34vmax 34vmax at 88% 22%, rgba(63, 174, 104, 0.22), transparent 70%),
    radial-gradient(40vmax 40vmax at 80% 90%, rgba(235, 120, 160, 0.20), transparent 70%),
    radial-gradient(30vmax 30vmax at 10% 92%, rgba(250, 190, 80, 0.22), transparent 70%),
    #f3f5fb;
  background-attachment: fixed;
}
body.on-intro .page { box-shadow: 0 10px 40px rgba(30, 50, 110, 0.14); }
.round-num {
  position: fixed;
  top: 8px;
  left: 10px;
  z-index: 20;
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
}
.code-note { text-align: center; font-size: 14px; color: var(--muted); margin: 4px 0 16px; }
.score-info { display: inline-block; margin-top: 0.5em; font-size: 0.85em; }
