:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e3e5e9;
  --accent: #2f6df6;
  --good: #17864a;
  --warn: #9a5b00;
  --bad: #b3261e;
  --code-bg: #f0f1f4;

  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 3rem 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.card {
  max-width: 34rem;
  margin: 0 auto;
  padding: 2rem 2.25rem 2.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 a { color: inherit; text-decoration: none; }

h2 { margin: 0 0 0.35rem; font-size: 1.15rem; font-weight: 600; }
h3 { margin: 1.75rem 0 0.6rem; font-size: 0.95rem; font-weight: 600; }

p { margin: 0 0 0.9rem; }
.lede { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- form ---- */

label {
  display: block;
  margin: 1.1rem 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input[type="text"]:focus, input[type="file"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="file"] { width: 100%; font: inherit; color: var(--muted); }

button, .button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.08); }

.note {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.note p:last-child { margin-bottom: 0; }

/* ---- score ---- */

.score { text-align: center; padding: 0.5rem 0 0.25rem; }
.score-number { line-height: 1; }
.big { font-size: 4rem; font-weight: 700; letter-spacing: -0.03em; }
.of { font-size: 1.6rem; font-weight: 600; color: var(--muted); }
.score-caption { margin: 0.6rem 0 1rem; color: var(--muted); }

.bar {
  height: 8px;
  background: var(--code-bg);
  border-radius: 99px;
  overflow: hidden;
}
.fill { height: 100%; background: var(--accent); border-radius: 99px; }
.score.perfect .fill { background: var(--good); }
.score.perfect .big { color: var(--good); }

.verdict { margin-top: 1.5rem; }
.verdict.good { color: var(--good); font-weight: 600; }

section { border-top: 1px solid var(--line); }

ul.groups, ul.errors { margin: 0 0 0.6rem; padding-left: 1.1rem; }
ul.groups li, ul.errors li { margin-bottom: 0.3rem; }
ul.errors code { display: block; margin-top: 0.25rem; color: var(--bad); }

.actions { margin-top: 2rem; }

/* ---- waiting ---- */

.waiting { text-align: center; padding: 1.5rem 0 0.5rem; }
.waiting p { margin-bottom: 0; }

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 1.25rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}

/* ---- problem ---- */

.problem {
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border-left: 3px solid var(--warn);
  border-radius: 0 8px 8px 0;
}
.problem p { margin: 0; }

/* ---- per-part breakdown (canvas) ---- */

ul.parts { margin: 0 0 0.6rem; padding: 0; list-style: none; }
ul.parts li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
ul.parts li:last-child { border-bottom: 0; }
.part-name { color: var(--ink); }
.part-name .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.part-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--warn);
}
.part-score.ok { color: var(--good); }
.part-score.zero { color: var(--bad); }
