/*
 * «تست هوش هیجانی (EQ)» — quiz + report + the server-drawn charts (engine/eq/charts_svg.py).
 * Everything is scoped under .eq-scope / .eq-* so it can never touch another test. Colours: write hex literals here, then run
 * `python ../scripts/tokenize_colors.py` before the push (and ship MaghzetoEngine/service/payments/theme_palette.json with it).
 * The chart classes (lv-low/mid/high, c-total/intrapersonal/interpersonal/stress/adaptability/mood, ring, ring-mid, axis, tick, sep, band, area,
 * dot, bar, t-ink/t-name/t-mute) are the ones charts_svg.py documents; light and dark are defined here, nothing is drawn with inline colour.
 */
.eq-scope {
  --eq-low: var(--lc-d98b1f, #d98b1f);
  --eq-mid: var(--lc-5b7cc4, #5b7cc4);
  --eq-high: var(--lc-1f9276, #1f9276);
  --eq-ring: var(--lc-d9dde8, #d9dde8);
  --eq-mute: var(--lc-6b7385, #6b7385);
  --eq-ink: var(--lc-1d2433, #1d2433);
  --eq-surface: var(--lc-f6f7fb, #f6f7fb);
  --eq-line: var(--lc-e4e7ef, #e4e7ef);
  --eq-c-total: var(--lc-1d2433, #1d2433);
  --eq-c-intrapersonal: var(--lc-4a5fc1, #4a5fc1);
  --eq-c-interpersonal: var(--lc-b8478f, #b8478f);
  --eq-c-stress: var(--lc-2a8f8f, #2a8f8f);
  --eq-c-adaptability: var(--lc-c27a1c, #c27a1c);
  --eq-c-mood: var(--lc-7a6bb0, #7a6bb0);
}
html[data-theme="dark"] .eq-scope {
  --eq-low: var(--lc-f0b050, #f0b050);
  --eq-mid: var(--lc-8fa8e0, #8fa8e0);
  --eq-high: var(--lc-4fc7a6, #4fc7a6);
  --eq-ring: var(--lc-394057, #394057);
  --eq-mute: var(--lc-a3abbf, #a3abbf);
  --eq-ink: var(--lc-eef0f6, #eef0f6);
  --eq-surface: var(--lc-1b2030, #1b2030);
  --eq-line: var(--lc-2b3247, #2b3247);
  --eq-c-total: var(--lc-eef0f6, #eef0f6);
  --eq-c-intrapersonal: var(--lc-8ea0f0, #8ea0f0);
  --eq-c-interpersonal: var(--lc-e285c0, #e285c0);
  --eq-c-stress: var(--lc-5fd0d0, #5fd0d0);
  --eq-c-adaptability: var(--lc-f0b050, #f0b050);
  --eq-c-mood: var(--lc-b3a6e6, #b3a6e6);
}

/* ---------------------------------------------------------------- quiz */
.eq-scope .eq-instr { color: var(--eq-mute); line-height: 1.9; margin: 8px 0 14px; }
.eq-scope .eq-item { background: var(--eq-surface); border: 1px solid var(--eq-line); border-radius: 14px; padding: 14px 14px 12px; margin: 0 0 12px; transition: border-color .2s; }
.eq-scope .eq-item.is-done { border-color: var(--eq-high); }
.eq-scope .eq-item--check { border-style: dashed; }
.eq-scope .eq-item__t { margin: 0 0 10px; line-height: 1.9; color: var(--eq-ink); }
.eq-scope .eq-item__n { display: inline-block; min-width: 26px; margin-inline-end: 8px; color: var(--eq-mute); font-weight: 700; }
.eq-scope .eq-cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.eq-scope .eq-cell { min-height: 52px; padding: 4px 2px; border-radius: 12px; border: 1.5px solid var(--eq-line); background: transparent; color: var(--eq-ink); font: inherit; cursor: pointer; transition: transform .12s, background .15s, border-color .15s; }
.eq-scope .eq-cell__l { display: block; font-size: 11.5px; line-height: 1.5; font-weight: 600; }
.eq-scope .eq-cell:hover { border-color: var(--eq-mid); }
.eq-scope .eq-cell:focus-visible { outline: 3px solid var(--eq-mid); outline-offset: 2px; }
.eq-scope .eq-cell.is-selected { background: var(--eq-mid); border-color: var(--eq-mid); color: var(--lt-ffffff, #fff); transform: scale(1.03); }
.eq-scope .eq-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.eq-scope .eq-warn { color: var(--lt-c0392b, #c0392b); font-size: 14px; margin: 8px 0; }
html[data-theme="dark"] .eq-scope .eq-warn { color: var(--lt-ff8f84, #ff8f84); }
.eq-scope .eq-ready, .eq-scope .eq-resume { background: var(--eq-surface); border: 1px solid var(--eq-line); border-radius: 14px; padding: 12px 14px; margin: 14px 0; line-height: 1.9; }
.eq-scope .eq-ready p { margin: 4px 0 0; color: var(--eq-mute); }

/* ---------------------------------------------------------------- result */
.eq-scope .eq-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }   /* minmax(0,…): a long paragraph must never widen the track past its frame */
.eq-scope .eq-lead { line-height: 2; color: var(--eq-ink); }
.eq-scope .eq-banner { border: 1px solid var(--eq-low); background: rgba(217, 139, 31, .1); border-radius: 12px; padding: 10px 14px; line-height: 1.9; }
.eq-scope .eq-banner--soft { border-color: var(--eq-line); background: var(--eq-surface); }
.eq-scope .eq-card { background: var(--eq-surface); border: 1px solid var(--eq-line); border-radius: 16px; padding: 16px 18px; }
.eq-scope .eq-card h3, .eq-scope .eq-card h4 { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.eq-scope .eq-card p { margin: 0 0 8px; line-height: 2; }
.eq-scope .eq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.eq-scope .eq-comp { border-inline-start: 5px solid var(--eq-line); }
.eq-scope .eq-comp.c-intrapersonal { border-inline-start-color: var(--eq-c-intrapersonal); }
.eq-scope .eq-comp.c-interpersonal { border-inline-start-color: var(--eq-c-interpersonal); }
.eq-scope .eq-comp.c-stress { border-inline-start-color: var(--eq-c-stress); }
.eq-scope .eq-comp.c-adaptability { border-inline-start-color: var(--eq-c-adaptability); }
.eq-scope .eq-card--mood { border-style: dashed; border-color: var(--eq-c-mood); }
.eq-scope .eq-care { background: rgba(122, 107, 176, .12); border-radius: 10px; padding: 8px 12px; }
.eq-scope .eq-area + .eq-area { border-top: 1px dashed var(--eq-line); padding-top: 12px; margin-top: 12px; }
.eq-scope .eq-about, .eq-scope .eq-note { color: var(--eq-mute); font-size: 14px; }
.eq-scope .eq-practice { background: rgba(31, 146, 118, .1); border-radius: 10px; padding: 8px 12px; }
.eq-scope .eq-lvl { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; color: var(--lt-ffffff, #fff); }
.eq-scope .eq-lvl.lv-low { background: var(--eq-low); }
.eq-scope .eq-lvl.lv-mid { background: var(--eq-mid); }
.eq-scope .eq-lvl.lv-high { background: var(--eq-high); }
.eq-scope .eq-d { background: var(--eq-surface); border: 1px solid var(--eq-line); border-radius: 12px; margin: 8px 0; }
.eq-scope .eq-d > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; }
.eq-scope .eq-d__b { padding: 0 14px 12px; }
.eq-scope .eq-d.lv-low > summary { border-inline-start: 4px solid var(--eq-low); }
.eq-scope .eq-d.lv-mid > summary { border-inline-start: 4px solid var(--eq-mid); }
.eq-scope .eq-d.lv-high > summary { border-inline-start: 4px solid var(--eq-high); }
.eq-scope .eq-actions { text-align: center; }

/* ---------------------------------------------------------------- charts (server SVG) */
.eq-scope .eq-fig { margin: 0; background: var(--eq-surface); border: 1px solid var(--eq-line); border-radius: 16px; padding: 12px 12px 8px; }
.eq-scope .eq-figcap { font-weight: 700; margin-bottom: 6px; }
.eq-scope .eq-alt { font-size: 13px; color: var(--eq-mute); margin-top: 6px; }
.eq-scope svg.ch { width: 100%; height: auto; display: block; }
.eq-scope .t-ink, .eq-scope .t-name { fill: var(--eq-ink); }
.eq-scope .t-mute { fill: var(--eq-mute); }
.eq-scope svg .ring { fill: none; stroke: var(--eq-ring); }
.eq-scope svg .ring-mid { stroke: var(--eq-mute); stroke-dasharray: 3 3; }
.eq-scope svg .axis, .eq-scope svg .tick { stroke: var(--eq-ring); }
.eq-scope svg .sep { stroke: var(--eq-mute); stroke-dasharray: 5 4; }
.eq-scope svg .area { fill: rgba(91, 124, 196, .14); stroke: var(--eq-mid); stroke-width: 2; }
.eq-scope svg .dot { stroke: var(--eq-surface); stroke-width: 2; }
.eq-scope svg .dot.c-intrapersonal { fill: var(--eq-c-intrapersonal); }
.eq-scope svg .dot.c-interpersonal { fill: var(--eq-c-interpersonal); }
.eq-scope svg .dot.c-stress { fill: var(--eq-c-stress); }
.eq-scope svg .dot.c-adaptability { fill: var(--eq-c-adaptability); }
.eq-scope svg .bar.lv-low { fill: var(--eq-low); }
.eq-scope svg .bar.lv-mid { fill: var(--eq-mid); }
.eq-scope svg .bar.lv-high { fill: var(--eq-high); }
.eq-scope svg .bar.c-mood { stroke: var(--eq-c-mood); stroke-width: 2; stroke-dasharray: 5 3; }
.eq-scope svg .bar.c-total { stroke: var(--eq-ink); stroke-width: 1.5; }
.eq-scope svg .band.lv-low { fill: rgba(217, 139, 31, .1); }
.eq-scope svg .band.lv-mid { fill: rgba(91, 124, 196, .1); }
.eq-scope svg .band.lv-high { fill: rgba(31, 146, 118, .1); }

@media (max-width: 480px) {
  .eq-scope .eq-cells { gap: 4px; }
  .eq-scope .eq-cell { min-height: 56px; }
  .eq-scope .eq-cell__l { font-size: 10.5px; }
  .eq-scope .eq-card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .eq-scope .eq-cell, .eq-scope .eq-item { transition: none; }
  .eq-scope .eq-cell.is-selected { transform: none; }
}
@media print {
  .eq-scope .eq-nav, .eq-scope .eq-actions { display: none; }
  .eq-scope .eq-d { break-inside: avoid; }
}

/* ---------------------------------------------------------------- inside the shared result layer (result.css folds, sys-cards) */
.eq-scope .sys-card .eq-fig { background: transparent; border: 0; padding: 0; }
.eq-scope .sys-card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.eq-scope .eq-grid { margin: 14px 0; }
.eq-scope .eq-comp h4 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.eq-scope .eq-mini { list-style: none; margin: 6px 0 8px; padding: 0; }
.eq-scope .eq-mini li { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--eq-line); font-size: 14px; }
.eq-scope .eq-mini li:last-child { border-bottom: 0; }
.eq-scope .eq-mini b { text-align: left; color: var(--eq-ink); }
.eq-scope .eq-subh { font-size: 15px; margin: 18px 0 6px; color: var(--eq-mute); }
.eq-scope .eq-drawers .eq-d { background: var(--eq-surface); }
.eq-scope .eq-lead { margin-bottom: 4px; }
.eq-scope.eq-banner--soft, .eq-scope .eq-banner--soft { border: 1px solid var(--eq-line); background: var(--eq-surface); border-radius: 12px; padding: 10px 14px; line-height: 1.9; margin: 10px 0; }
@media print { .eq-scope .eq-d { break-inside: avoid; } .eq-scope details.eq-d { display: block; } }

.eq-scope, .eq-scope .res-story, .eq-scope .eq-card, .eq-scope .sys-card { min-width: 0; }
.eq-scope .res-story p, .eq-scope .eq-card p, .eq-scope .sys-card p { overflow-wrap: anywhere; }

/* charts keep a readable size on wide screens (the SVG scales with its box; unbounded it fills a 1200px frame) */
.eq-scope svg.ch { max-width: 760px; margin-inline: auto; }
.eq-scope .eq-fig--radar svg.ch, .eq-scope .eq-fig svg.ch[data-chart="radar"] { max-width: 620px; }
