/* Chart Crimes: all selectors prefixed with .g-charts */
.g-charts .ch-wrap {
  max-width: 560px; margin: 0 auto; padding: 4px 0 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.g-charts .ch-stage { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Crime board (corkboard) ---------- */
.g-charts .ch-board {
  position: relative; border-radius: var(--radius); padding: 8px 10px 10px;
  border: 1.5px solid var(--card-border);
  background-color: var(--warn-soft);
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.4px), radial-gradient(var(--grid) 1px, transparent 1.2px);
  background-size: 9px 9px, 13px 13px; background-position: 0 0, 4px 6px;
  box-shadow: inset 0 0 0 3px var(--surface);
}
.g-charts .ch-board-title {
  display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--warn); margin: 0 0 6px 2px;
}
.g-charts .ch-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.g-charts .ch-slot {
  position: relative; min-height: 64px; border-radius: 8px; border: 1.5px dashed var(--line);
  display: grid; place-items: center; color: var(--ink-3); font-family: var(--font-mono); font-size: 12px;
}
.g-charts .ch-slot.is-filled { border-color: transparent; }
.g-charts .ch-note {
  position: relative; width: 100%; height: 100%; min-height: 64px; padding: 10px 2px 4px; border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--card); box-shadow: var(--shadow); transform: rotate(var(--tilt, -3deg));
  animation: ch-pin-in .45s cubic-bezier(.2,.8,.2,1.25);
}
@keyframes ch-pin-in {
  0% { opacity: 0; transform: translateY(-26px) rotate(-14deg) scale(1.2); }
  70% { opacity: 1; transform: translateY(2px) rotate(var(--tilt, -3deg)) scale(.98); }
  100% { transform: rotate(var(--tilt, -3deg)); }
}
.g-charts .ch-pin {
  position: absolute; top: -4px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--shadow);
}
.g-charts .ch-note.is-right .ch-pin { background: var(--ok); }
.g-charts .ch-note-emoji { font-size: 20px; line-height: 1.1; }
.g-charts .ch-note-name {
  font-size: 11px; font-weight: 700; line-height: 1.15; text-align: center; color: var(--ink-2);
  overflow-wrap: anywhere; max-width: 100%;
}
.g-charts .ch-note-mark { font-size: 12px; font-weight: 800; line-height: 1; }
.g-charts .ch-note.is-right .ch-note-mark { color: var(--ok); }
.g-charts .ch-note.is-wrong .ch-note-mark { color: var(--bad); }
.g-charts .ch-board.is-done { box-shadow: inset 0 0 0 3px var(--surface), 0 0 0 2px var(--gold); }

/* ---------- Case file ---------- */
.g-charts .ch-case {
  position: relative; padding: 12px; display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  animation: ch-case-in .4s cubic-bezier(.2,.8,.2,1.15);
}
@keyframes ch-case-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.g-charts .ch-case-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.g-charts .ch-headline {
  margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.15;
  text-transform: uppercase; letter-spacing: -.01em; overflow-wrap: anywhere;
  padding-bottom: 6px; border-bottom: 3px double var(--line);
}
.g-charts .ch-title { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.g-charts .ch-chart { width: 100%; }
.g-charts .ch-svg { display: block; width: 100%; height: auto; overflow: visible; }
.g-charts .ch-source { margin: 0; font-size: 12px; color: var(--ink-3); font-style: italic; }

/* SVG marks: colours come from the theme tokens */
.g-charts .ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.g-charts .ch-axis { stroke: var(--ink-3); stroke-width: 1.5; }
.g-charts .ch-tick { fill: var(--ink-2); font-family: var(--font-mono); font-size: 12px; }
.g-charts .ch-tick--b { fill: var(--blue); }
.g-charts .ch-unit { fill: var(--ink-3); font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.g-charts .ch-unit--b { fill: var(--blue); }
.g-charts .ch-bar { fill: var(--accent); }
.g-charts .ch-line { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.g-charts .ch-line--a { stroke: var(--accent); }
.g-charts .ch-line--b { stroke: var(--blue); }
.g-charts .ch-dot--a { fill: var(--accent); stroke: var(--card); stroke-width: 1.5; }
.g-charts .ch-dot--b { fill: var(--blue); stroke: var(--card); stroke-width: 1.5; }
.g-charts .ch-pt { fill: var(--accent); fill-opacity: .75; stroke: var(--card); stroke-width: 1.5; }
.g-charts .ch-pt--hot { fill: var(--blue); fill-opacity: 1; }
.g-charts .ch-slice { stroke: var(--card); stroke-width: 2; }
.g-charts .ch-slice--0 { fill: var(--accent); }
.g-charts .ch-slice--1 { fill: var(--blue); }
.g-charts .ch-slice--2 { fill: var(--gold); }
.g-charts .ch-slice--3 { fill: var(--ok); }
.g-charts .ch-pie-label { fill: var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.g-charts .ch-picto-val { fill: var(--ink); font-family: var(--font-mono); font-size: 14px; font-weight: 700; }

/* legend */
.g-charts .ch-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.g-charts .ch-legend:empty { display: none; }
.g-charts .ch-key { display: inline-flex; align-items: center; gap: 6px; }
.g-charts .ch-key b { font-family: var(--font-mono); color: var(--ink); }
.g-charts .ch-key--hot { color: var(--blue); font-weight: 700; animation: ch-fade-in .4s ease; }
@keyframes ch-fade-in { from { opacity: 0; } to { opacity: 1; } }
.g-charts .ch-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.g-charts .ch-sw--a, .g-charts .ch-sw--0, .g-charts .ch-sw--pt { background: var(--accent); }
.g-charts .ch-sw--b, .g-charts .ch-sw--1, .g-charts .ch-sw--hot { background: var(--blue); }
.g-charts .ch-sw--2 { background: var(--gold); }
.g-charts .ch-sw--3 { background: var(--ok); }
.g-charts .ch-sw--pt, .g-charts .ch-sw--hot { border-radius: 50%; }

/* "fixing" tag + CASE CLOSED stamp */
.g-charts .ch-evidence {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700;
  animation: ch-fade-in .25s ease;
}
.g-charts .ch-stamp {
  position: absolute; bottom: 10px; right: 8px; pointer-events: none; white-space: nowrap;
  padding: 4px 12px; border: 4px double var(--accent); border-radius: 8px; color: var(--accent);
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--card); box-shadow: var(--shadow); font-family: var(--font-mono); font-weight: 800; font-size: 20px; letter-spacing: .1em;
  transform: rotate(-9deg); opacity: .92;
  animation: ch-stamp .42s cubic-bezier(.2,.8,.2,1.2) both;
}
.g-charts .ch-stamp--ok { border-color: var(--ok); color: var(--ok); background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--card); }
@keyframes ch-stamp {
  0% { opacity: 0; transform: rotate(-20deg) scale(2.4); }
  60% { opacity: 1; transform: rotate(-7deg) scale(.92); }
  100% { opacity: .95; transform: rotate(-9deg) scale(1); }
}

/* ---------- Questions ---------- */
.g-charts .ch-ask { display: flex; flex-direction: column; gap: 10px; }
.g-charts .ch-q { margin: 0; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.g-charts .ch-verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-charts .ch-vbtn {
  min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer;
  font-weight: 800; font-size: 15.5px; display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 0 8px;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .15s ease, background-color .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.g-charts .ch-vbtn:active { transform: scale(.96); }
.g-charts .ch-vbtn--fair:hover { border-color: var(--ok); }
.g-charts .ch-vbtn--crime:hover { border-color: var(--accent); }
.g-charts .ch-vbtn:disabled { cursor: default; opacity: .45; transform: none; }
.g-charts .ch-vbtn.is-picked { opacity: 1; }
.g-charts .ch-vbtn--fair.is-picked { border-color: var(--ok); background: var(--ok-soft); }
.g-charts .ch-vbtn--crime.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.g-charts kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--ink-3); font-weight: 600;
}

.g-charts .ch-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; animation: ch-case-in .3s ease; }
.g-charts .ch-opt {
  position: relative; min-height: 76px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .12s ease, border-color .15s ease, background-color .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.g-charts .ch-opt:hover { border-color: var(--accent); }
.g-charts .ch-opt:active { transform: scale(.95); }
.g-charts .ch-opt:disabled { cursor: default; opacity: .45; transform: none; }
.g-charts .ch-opt.is-answer { opacity: 1; border-color: var(--ok); background: var(--ok-soft); }
.g-charts .ch-opt.is-wrong { opacity: 1; border-color: var(--bad); background: var(--bad-soft); }
.g-charts .ch-opt-emoji { font-size: 26px; line-height: 1.1; }
.g-charts .ch-opt-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.g-charts .ch-opt-key { position: absolute; top: 4px; left: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* ---------- Verdict ---------- */
.g-charts .ch-verdict { display: flex; flex-direction: column; gap: 6px; animation: ch-case-in .35s ease; }
.g-charts .ch-verdict--ok { border-color: var(--ok); }
.g-charts .ch-verdict--bad { border-color: var(--bad); }
.g-charts .ch-vtitle { margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 1.25; }
.g-charts .ch-answer { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.g-charts .ch-answer-name { font-weight: 800; font-size: 16px; }
.g-charts .ch-yousaid { margin: 0; font-size: 13.5px; }
.g-charts .ch-lesson { margin: 0; font-size: 15px; line-height: 1.5; }
.g-charts .ch-points { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }

/* ---------- End ---------- */
.g-charts .ch-end { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 20px 16px; }
.g-charts .ch-end-emoji { font-size: 48px; line-height: 1.1; }
.g-charts .ch-end-score { margin: 0; font-size: 30px; }
.g-charts .ch-end-line { margin: 0; font-size: 15.5px; color: var(--ink-2); }
.g-charts .ch-end-missed { margin: 4px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.g-charts .ch-end-missed .label { width: 100%; }

@media (min-width: 520px) {
  .g-charts .ch-headline { font-size: 26px; }
  .g-charts .ch-case { padding: 16px; }
}
