:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --ink: #1d1b24;
  --muted: #6b6775;
  --line: #e4e0d8;
  --accent: #5b3fd1;
  --accent-ink: #ffffff;
  --yes: #1f8a4c;
  --no: #c2372f;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
header.top h1 { font-size: 18px; margin: 0; }
header.top .who { color: var(--muted); font-size: 13px; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
input[type=text], input[type=password], textarea, select {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; min-width: 0;
}
textarea { width: 100%; min-height: 150px; resize: vertical; direction: ltr; text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
textarea.note { min-height: 56px; direction: rtl; text-align: right; font-family: inherit; font-size: 13px; }
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 4px 8px; }

/* projects list */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.project-tile { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.project-tile .cover { aspect-ratio: 3/4; background: #ece8f7 center/cover no-repeat; }
.project-tile .meta { padding: 10px 12px; }

/* references */
.refs-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ref-group h3 { font-size: 14px; margin: 0 0 4px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: #eee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { border-color: var(--accent); }
.thumb .x { position: absolute; top: 2px; left: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.thumb .pick { position: absolute; bottom: 2px; right: 2px; accent-color: var(--accent); width: 18px; height: 18px; }
.drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--accent); }

/* rounds */
.round-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #efeafc; color: var(--accent); }
details.prompt summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.prompt pre { white-space: pre-wrap; direction: ltr; text-align: left; font-size: 12px; background: #faf9f6; padding: 10px; border-radius: 8px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 12px; }
.result { border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.result.yes { border-color: var(--yes); }
.result.no { border-color: var(--no); }
.result .pic { aspect-ratio: 3/4; background: #eee; display: grid; place-items: center; color: var(--muted); }
.result .pic img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.result .body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.verdict { display: flex; gap: 8px; }
.verdict button { flex: 1; justify-content: center; font-size: 18px; font-weight: 700; }
.verdict button.v.on { background: var(--yes); color: #fff; border-color: var(--yes); }
.verdict button.x.on { background: var(--no); color: #fff; border-color: var(--no); }
.scores { display: flex; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.scores span { display: inline-flex; gap: 2px; align-items: center; }
.scores button { padding: 1px 7px; font-size: 12px; }
.scores button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.saved { font-size: 12px; color: var(--yes); min-height: 16px; }
.spinner { width: 28px; height: 28px; border: 3px solid #ddd; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--no); font-size: 13px; padding: 10px; direction: ltr; text-align: left; word-break: break-word; }

/* login */
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 10px; }
.login button { width: 100%; justify-content: center; }

@media (max-width: 600px) {
  main { padding: 14px 12px 60px; }
  .results { grid-template-columns: 1fr; }
}
