/* rate.html: upload, progress, result. Builds on style.css tokens. */
:root {
  --pass: #22a04b;
  --fail: #d64545;
  --warn: #e3a92b;
  --pend: #c9c5bb;
}
main.rp { max-width: 860px; }
.rp-title { font-size: 34px; letter-spacing: -0.6px; line-height: 1.3; margin: 40px 0 6px; }
.rp-lead { margin: 0 0 24px; color: var(--soft); }
.rp-meta { margin: 0 0 28px; color: var(--soft); font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rp .rate { margin: 8px 0 28px; }

/* ---------- progress ---------- */
.steps, .steps ol { list-style: none; margin: 0; padding: 0; }
.step {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 22px; gap: 14px; align-items: start;
  padding: 10px 0;
}
.step-ic { width: 32px; height: 32px; color: var(--pend); transition: color .4s; }
.step-ic svg { width: 32px; height: 32px; display: block; overflow: visible; }
.step-ic svg * { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: square; stroke-linejoin: miter; }
.step-label { font-size: 16px; line-height: 1.4; color: var(--soft); transition: color .4s; padding-top: 5px; }
.step-detail { font-size: 13px; color: var(--soft); line-height: 1.45; min-height: 0; }
.step-mark { width: 22px; height: 22px; margin-top: 5px; }
.step-mark svg { width: 22px; height: 22px; display: block; }

.step.running .step-ic, .step.done .step-ic, .step.error .step-ic { color: var(--ink); }
.step.running .step-label, .step.done .step-label, .step.error .step-label { color: var(--ink); }
.step.running .step-label { font-weight: 600; }

/* lead agent with its seven check agents as children */
.agents { margin: 0 0 4px 15px; padding: 2px 0 2px 0; border-left: 1px solid var(--line); }
.agents .step { position: relative; padding-left: 28px; grid-template-columns: 26px minmax(0, 1fr) 22px; padding-top: 7px; padding-bottom: 7px; }
.agents .step::before { content: ""; position: absolute; left: 0; top: 20px; width: 18px; border-top: 1px solid var(--line); }
.agents .step-ic, .agents .step-ic svg { width: 26px; height: 26px; }
.agents .step-label { font-size: 15px; padding-top: 2px; }
.agents .step-mark { margin-top: 2px; }
.agents-count { margin: 4px 0 6px 28px; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
.agents-count b { color: var(--ink); font-weight: 600; }

/* marks */
.mk-tick path { fill: none; stroke: var(--pass); stroke-width: 2.4; stroke-linecap: square; stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .45s ease-out forwards; }
.mk-cross path { fill: none; stroke: var(--fail); stroke-width: 2.2; stroke-linecap: square; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* running animations: calm, one per kind */
.a-scan { opacity: 0; transition: opacity .3s; }
.step.running .a-scan { opacity: 1; animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(0); } to { transform: translateY(12px); } }
.step.running .a-orbit { animation: orbit 6s linear infinite; transform-origin: 12px 12px; }
.a-orbit { opacity: 0; transition: opacity .4s; stroke-width: 1.1 !important; stroke-linecap: butt !important; }
.step.running .a-orbit { opacity: 1; }
@keyframes orbit { to { transform: rotate(360deg); } }
.step.running .a-trace { stroke-dasharray: .72 .28; animation: trace 2.6s linear infinite; }
@keyframes trace { to { stroke-dashoffset: -1; } }
.step.running .a-lift { animation: lift 1.4s ease-in-out infinite; }
@keyframes lift { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-2px); } }
.step.running .a-needle { animation: needle 1.6s ease-in-out infinite alternate; transform-origin: 12px 18px; }
@keyframes needle { from { transform: rotate(-70deg); } to { transform: rotate(10deg); } }
.paused .step.running * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .step.running * { animation: none !important; } }

.notice { margin: 0 0 24px; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); }
.notice p { margin: 0; }
.notice .btn { margin-top: 12px; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 16px; color: #fff; background: var(--ink); border: 1px solid var(--ink);
}
.btn:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- result ---------- */
.score-head { display: flex; align-items: center; gap: 40px; padding: 36px 0 30px; border-bottom: 2px solid var(--ink); }
.gauge-wrap { flex: 0 0 280px; text-align: center; }
.gauge { width: 100%; height: auto; display: block; overflow: visible; }
.g-zone { stroke-dasharray: 1; stroke-dashoffset: 1; animation: gdraw .5s ease-out forwards; }
@keyframes gdraw { to { stroke-dashoffset: 0; } }
.g-lab { font: 600 12px ui-sans-serif, -apple-system, "Segoe UI", Inter, sans-serif; fill: var(--soft); }
.gauge-num { font-size: 44px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.gauge-num span { color: var(--soft); font-weight: 600; }
.score-text { min-width: 0; }
.score-line { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.3; margin: 0 0 6px; }
.verdict { font-size: 19px; margin: 0 0 14px; line-height: 1.45; }
.verdict.ready { color: #176b34; }
.verdict.close { color: #8a5a07; }
.verdict.work { color: #b42323; }
.score-text .rp-meta { margin: 0; }

.rsec > h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 44px 0 0; padding: 0 0 10px; font-size: 28px; letter-spacing: -0.5px; line-height: 1.2;
  border-bottom: 2px solid var(--ink);
}
.rsec > h2 small { font-size: 15px; font-weight: 600; color: var(--soft); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rsec h3 { font-size: 20px; color: var(--accent); margin: 26px 0 2px; letter-spacing: -0.2px; }
.rsec.optional > h2 { border-bottom-width: 1px; font-size: 24px; }

.crit {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 16px; align-items: start;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.crit.fail { background: #fbefec; border-left: 3px solid var(--fail); padding-left: 14px; padding-right: 14px; margin: 6px 0; border-bottom-color: transparent; }
.optional .crit.fail { background: none; border-left: 0; padding-left: 0; padding-right: 0; margin: 0; border-bottom-color: var(--line); }
.crit-mk { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.crit-mk svg { width: 20px; height: 20px; }
.crit-mk svg path { fill: none; stroke-width: 3; stroke-linecap: square; }
.crit-mk.pass { background: var(--pass); }
.crit-mk.fail { background: var(--fail); }
.crit-mk.pass path, .crit-mk.fail path { stroke: #fff; }
.crit-mk.na, .crit-mk.unknown { border: 1.5px solid var(--pend); }
.crit-mk.na path, .crit-mk.unknown path { stroke: var(--soft); stroke-width: 2; }
.crit-rule { margin: 0; font-size: 18px; line-height: 1.45; letter-spacing: -0.1px; }
.crit.na .crit-rule, .crit.unknown .crit-rule { color: #5e6268; }
.crit-num { font-weight: 700; }
.crit-note { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: #3d4045; }
.crit-at { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crit-state { color: var(--soft); }
.crit-snap { display: block; width: 64px; aspect-ratio: 9/16; padding: 0; border: 1px solid var(--line); background: #e9e5da; cursor: zoom-in; overflow: hidden; }
.crit-snap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crit-snap:hover { border-color: var(--accent); }
.rp-again { margin-top: 40px; font-size: 15px; }
.rp-own { margin: 24px 0 0; font-size: 14px; }
.rp ~ .foot { max-width: 860px; }

/* share link + JSON */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0 0; }
.btn.line { color: var(--ink); background: transparent; }
.btn.line:hover { color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.share-msg { font-size: 14px; color: var(--soft); }

/* optional rules: never counted, never a red cross */
.opt-box { margin: 44px 0 0; border: 2px solid; }
.opt-box + .opt-box { margin-top: 24px; }
.opt-box > h2 { margin: 0; padding: 10px 16px; font-size: 19px; line-height: 1.35; letter-spacing: -0.2px; border-bottom: 2px solid; }
.opt-box.good { border-color: #8fd3a5; }
.opt-box.good > h2 { color: #176b34; background: #e3f5e8; border-bottom-color: #8fd3a5; }
.opt-box.alt { border-color: #a7c3ea; }
.opt-box.alt > h2 { color: #1f4f8a; background: #e5eefa; border-bottom-color: #a7c3ea; }
.opt-box .crit { padding: 16px; }
.opt-box .crit:last-child { border-bottom: 0; }
.crit-mk.used { background: var(--pass); }
.crit-mk.used path { stroke: #fff; }
.crit-mk.unused { border: 1.5px solid var(--pend); }
.crit-mk.unused path { stroke: var(--soft); stroke-width: 2; }
.opt-state { display: block; font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 2px; color: var(--soft); letter-spacing: 0; }
.crit.used .opt-state { color: #176b34; }
.crit.unused .crit-rule, .crit.unused .crit-note { color: #5e6268; }
.empty-score { font-size: 18px; margin: 0; }

/* snapshot lightbox */
.snap-lb { position: fixed; inset: 0; z-index: 50; background: rgba(20, 20, 20, .86); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.snap-lb img { max-width: 100%; max-height: 88vh; display: block; background: #000; }

@media (max-width: 820px) {
  .score-head { gap: 28px; }
  .gauge-wrap { flex-basis: 240px; }
}
@media (max-width: 600px) {
  .rp-title { font-size: 28px; margin-top: 28px; }
  .score-head { flex-direction: column; align-items: stretch; gap: 18px; padding-top: 24px; text-align: center; }
  .gauge-wrap { flex: none; width: 100%; max-width: 280px; margin: 0 auto; }
  .score-line { font-size: 22px; }
  .verdict { font-size: 17px; }
  .rsec > h2 { font-size: 24px; }
  .crit { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; }
  .crit-rule { font-size: 16px; }
  .crit-note { font-size: 14px; }
  .crit-snap { width: 52px; }
  .crit.fail { padding-left: 10px; padding-right: 10px; }
  .opt-box > h2 { font-size: 17px; padding: 10px 12px; }
  .opt-box .crit { padding: 14px 12px; }
}
