* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #fafafa;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
header.top {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.8rem 1rem; border-bottom: 1px solid #ddd;
  max-width: 920px; margin: 0 auto; width: 100%;
}
.brand { font-size: 1rem; font-weight: 600; }
.meta { font-size: 0.8rem; color: #666; }
.meta a { color: #666; }
footer { text-align: center; color: #999; font-size: 0.75rem; padding: 1rem; }

h1 { font-size: 1.25rem; font-weight: 600; margin: 1rem 0; }
h2 { font-size: 1rem; font-weight: 600; margin: 2rem 0 0.6rem; border-bottom: 1px solid #ddd; padding-bottom: 0.3rem; }
p { line-height: 1.5; }
.hint { color: #666; font-size: 0.9rem; }

button, .btn {
  font: inherit; font-size: 0.9rem;
  background: #1a1a1a; color: #fafafa; border: none;
  padding: 0.55rem 1.4rem; cursor: pointer; border-radius: 3px;
}
button:disabled { background: #b5b5b5; cursor: default; }
button.small { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
input[type="text"], input[type="password"], input[type="number"] {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid #c5c5c5; background: #fff; width: 100%; border-radius: 3px;
}
label { display: block; margin: 0.7rem 0 0.2rem; font-size: 0.85rem; color: #444; }
.error { color: #8c2f22; font-size: 0.9rem; min-height: 1.2rem; margin-top: 0.6rem; }

.card { background: #fff; border: 1px solid #ddd; padding: 1.2rem 1.4rem; border-radius: 4px; }
.cols { display: flex; gap: 2rem; flex-wrap: wrap; }
.cols > div { flex: 1; min-width: 240px; }

/* survey */
.progress { font-size: 0.8rem; color: #666; }
.itemrow { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 1rem; }
.item { width: 120px; text-align: center; font-size: 0.7rem; color: #666; }
.item img { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid #ddd; display: block; }
.cands { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.9rem; margin: 0.6rem 0 1.2rem; }
.cand { background: #fff; border: 1px solid #ddd; padding: 0.7rem; text-align: center; border-radius: 4px; }
.cand img { width: 100%; max-width: 160px; height: 150px; object-fit: contain; }
.cand .cat { font-size: 0.7rem; color: #666; min-height: 1em; margin: 0.2rem 0 0.5rem; }
.cand input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px; background: #ddd; outline: none; margin: 0.4rem 0 0.2rem;
}
.cand input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; background: #444;
  border: 2px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,0.5); cursor: pointer;
}
.cand input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #444;
  border: 2px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,0.5); cursor: pointer;
}
.cand .val { font-size: 0.85rem; font-weight: 600; color: #999; min-height: 1.2em; }
.scale { display: flex; justify-content: space-between; font-size: 0.65rem; color: #999; }

/* tables (admin) */
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { border: 1px solid #ddd; padding: 0.35rem 0.55rem; text-align: left; }
th { background: #f0f0f0; font-weight: 600; }
td.num, th.num { text-align: right; }
.settings-grid { display: grid; grid-template-columns: auto repeat(3, 90px); gap: 0.4rem 0.8rem; align-items: center; max-width: 480px; font-size: 0.85rem; }
.settings-grid input { width: 80px; }
.tag { font-size: 0.7rem; padding: 0.1rem 0.4rem; border: 1px solid #c5c5c5; border-radius: 3px; }
.tag.easy { background: #e3eedd; }
.tag.borderline { background: #f5efd7; }
.tag.wrong { background: #f3e0dc; }
.ok { color: #3d6b35; } .bad { color: #8c2f22; }

/* admin question preview */
.qcand { width: 150px; text-align: left; font-size: 0.72rem; color: #444;
         border: 1px solid #ddd; border-radius: 4px; padding: 0.5rem; background: #fff; }
.qcand img { width: 100%; height: 120px; object-fit: contain; display: block; }
.qcand .badges { min-height: 1.3em; margin: 0.25rem 0; }
.badge { display: inline-block; font-size: 0.65rem; padding: 0.05rem 0.35rem; border-radius: 3px; margin-right: 0.2rem; }
.badge.gt { background: #3d6b35; color: #fff; }
.badge.model { background: #fff; color: #1a1a1a; border: 1.5px solid #1a1a1a; }
.bar { height: 8px; background: #eee; border-radius: 2px; overflow: hidden; margin: 0.15rem 0; }
.bar > div { height: 100%; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f6f6f6; }
#pool { user-select: none; }
tr.hidden-user td { color: #999; background: #f7f7f7; }

/* admin question modal */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 20, 20, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 1rem;
}
.modal {
  background: #fff; border-radius: 6px; width: 100%; max-width: 900px;
  max-height: 92vh; overflow-y: auto; padding: 1rem 1.4rem 1.4rem;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  border-bottom: 1px solid #ddd; padding-bottom: 0.5rem; margin-bottom: 0.6rem;
  position: sticky; top: 0; background: #fff;
}
.modal-head .nav { display: flex; gap: 0.4rem; align-items: center; white-space: nowrap; }
button.ghost { background: #fff; color: #1a1a1a; border: 1px solid #c5c5c5; }
button.ghost:disabled { color: #bbb; background: #fff; border-color: #e2e2e2; }
button.danger { background: #8c2f22; }
.invite-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; max-width: 640px; }
.invite-row input { max-width: 200px; }
code.link { background: #f0f0f0; padding: 0.2rem 0.45rem; border-radius: 3px; font-size: 0.8rem; word-break: break-all; }
