:root {
  --ink: #1a1f26;
  --muted: #55606b;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #dde1e6;
  --accent: #1f6feb;
  --green: #1a7f43;
  --amber: #a06600;
  --gray: #5b6570;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.instructions {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 20px;
  text-align: center;
}

.instructions h1 {
  font-size: 1.7rem;
  margin: 0 0 10px;
}

.instructions p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  margin: 8px auto;
  max-width: 640px;
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 0;
  margin: 18px 0;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.badge-1 { background: var(--green); }
.badge-2 { background: var(--amber); }
.badge-3 { background: var(--gray); }

.hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.progress {
  font-weight: 600;
  color: var(--ink);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-block;
  padding: 8px 18px;
  margin-top: 8px;
}

.grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease;
}

.card.is-graded {
  box-shadow: 0 0 0 2px var(--accent);
}

.card-photo {
  aspect-ratio: 4 / 3;
  background: #e8eaed;
  overflow: hidden;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.grade-btn {
  appearance: none;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 0;
  cursor: pointer;
}

.grade-btn + .grade-btn {
  border-left: 1px solid var(--border);
}

.grade-btn:hover {
  background: #eef1f4;
}

.grade-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.grade-btn.selected.grade-1 { background: var(--green); color: #fff; }
.grade-btn.selected.grade-2 { background: var(--amber); color: #fff; }
.grade-btn.selected.grade-3 { background: var(--gray); color: #fff; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px;
}

.error-banner {
  max-width: 640px;
  margin: 12px auto 0;
  background: #fdecea;
  border: 1px solid #f3b5ae;
  color: #7a2018;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
}
