* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f9;
  color: #1c2733;
}

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: #16324f; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
#topbar h1 { font-size: 17px; margin: 0; flex: 1 1 320px; font-weight: 600; }
#progress-box { display: flex; align-items: center; gap: 12px; }
#progress-label { font-variant-numeric: tabular-nums; font-size: 14px; }
#progress-track {
  width: 160px; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.25); overflow: hidden;
}
#progress-fill { height: 100%; width: 0; background: #7fd47f; transition: width .2s; }
#submit-btn {
  padding: 8px 18px; border: 0; border-radius: 6px;
  background: #2e9e44; color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
#submit-btn:disabled { background: #8aa0b4; cursor: not-allowed; }
#submit-btn:not(:disabled):hover { background: #37b850; }

/* ---------- intro ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }
#intro {
  background: #fff; border-radius: 10px; padding: 18px 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 22px;
  font-size: 15px; line-height: 1.5;
}
#intro .blue { color: #4477cc; font-weight: 600; }
#intro .orange { color: #cc6611; font-weight: 600; }
#legend { padding-left: 20px; }
#legend li { margin: 4px 0; }
.note { color: #5a6b7d; font-size: 14px; }
#voter-form { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 12px; }
#voter-form label { display: flex; flex-direction: column; font-size: 13px; color: #44566a; gap: 4px; flex: 1 1 240px; }
#voter-form input {
  padding: 8px 10px; font-size: 15px; border: 1px solid #c3ccd6; border-radius: 6px;
}
#voter-form input:invalid { border-color: #d78787; }

/* ---------- cards ---------- */
#cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
}
@media (max-width: 640px) {
  #cards { grid-template-columns: 1fr; }
}
.card {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex; flex-direction: column;
}
.card.voted { outline: 3px solid #bfe3c4; }
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 14px 6px; font-size: 14px;
}
.card-head .gid { font-weight: 700; color: #16324f; }
.card-head .ginfo { color: #5a6b7d; font-size: 13px; }
.card img.plot { width: 100%; height: auto; display: block; background: #fff; }

.vote-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; padding: 10px 14px 14px;
}
.vote-bar button {
  padding: 9px 4px; font-size: 14px; font-weight: 600;
  border: 1.5px solid #c3ccd6; border-radius: 7px;
  background: #f7f9fb; color: #33445a; cursor: pointer;
  transition: all .12s;
}
.vote-bar button:hover { border-color: #16324f; background: #eef3f8; }
.vote-bar button.sel {
  background: #16324f; color: #fff; border-color: #16324f;
}

/* ---------- summary overlay ---------- */
#summary-overlay[hidden] { display: none; }
#summary-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,20,35,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#summary-panel {
  background: #fff; border-radius: 12px; padding: 26px 30px;
  max-width: 640px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
}
#summary-panel h2 { margin-top: 0; color: #16324f; }
#summary-content .dm {
  font-size: 30px; font-weight: 700; color: #2e9e44; margin: 6px 0;
}
#summary-content table { border-collapse: collapse; margin-top: 14px; font-size: 13px; }
#summary-content td, #summary-content th { padding: 3px 10px; border-bottom: 1px solid #e3e8ee; }
#summary-content .ok { color: #2e9e44; }
#summary-content .ko { color: #c0392b; }
#close-summary {
  margin-top: 18px; padding: 9px 22px; border: 0; border-radius: 7px;
  background: #16324f; color: #fff; font-size: 14px; cursor: pointer;
}
