* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: #f4f1ea;
  color: #1a1a1a;
  line-height: 1.5;
  position: relative;
}

.container { max-width: 900px; margin: 0 auto; padding: 1rem; }

.site-header {
  background: #2c3e50;
  color: #fff;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.site-header h1 { margin: 0; font-size: 1.4rem; }
.header-sub { margin: 0.25rem 0 0; opacity: 0.85; font-size: 0.9rem; }

.header-inner { display: flex; align-items: center; gap: 0.9rem; }
.site-logo {
  height: 44px;
  width: auto;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.header-text { min-width: 0; }

.card {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.center-card { max-width: 420px; margin: 2rem auto; text-align: center; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary { background: #2c3e50; color: #fff; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-group { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

.form label { display: block; text-align: left; margin-bottom: 0.75rem; }
.form input {
  display: block;
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border: 1px solid #aaa;
  border-radius: 4px;
}

.messages { list-style: none; padding: 0; }
.message { padding: 0.75rem; margin-bottom: 0.5rem; border-radius: 4px; }
.message.error { background: #fde8e8; border: 1px solid #c0392b; }
.message.warning { background: #fef3cd; border: 1px solid #b8860b; }
.message.info { background: #e8f0fe; border: 1px solid #3b5998; }

.muted { color: #666; font-size: 0.9rem; }

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  align-items: stretch;
  scroll-margin-top: 0.5rem;
}

.candidate-card { cursor: pointer; height: 100%; }
.candidate-card input { display: none; }

.candidate-body {
  border: 2px solid #b9b9b9;
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.candidate-card input:checked + .candidate-body {
  border-color: #2c3e50;
  background: #eef2f6;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}

.symbol-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
}
.symbol-placeholder {
  width: 80px; height: 80px; margin: 0 auto 0.75rem;
  background: #e5e5e5; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: bold;
}

.candidate-body strong {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  color: #1a1a1a;
  font-size: 1.05rem;
}

.symbol-label {
  display: block;
  color: #444;
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.success { border-left: 4px solid #27ae60; }
.warning { border-left: 4px solid #b8860b; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .results-grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem; text-align: left; border-bottom: 1px solid #ddd; }
.count { font-weight: bold; text-align: right; }

.btn-lg { font-size: 1.15rem; padding: 0.85rem 1.5rem; }
.btn-sm { font-size: 0.85rem; padding: 0.4rem 0.8rem; }

.vote-submit-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 0.75rem 0;
  margin-top: 1rem;
  text-align: center;
  z-index: 10;
  scroll-margin-bottom: 1rem;
}

.vote-page {
  padding-bottom: 1rem;
}

.btn-vote {
  display: block;
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  background: #1e8e3e;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-vote:hover { background: #1aa043; }

.btn-vote:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.btn-vote .vote-icon { margin-right: 0.4rem; }

.booth-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.booth-bar h2 { margin: 0; }

.instruction {
  background: #eef2f6;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Fit voting page to one screen (no page scroll) */
body.vote-fit { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.vote-fit .site-header { margin-bottom: 0; flex: 0 0 auto; padding: 0.6rem 0; }
body.vote-fit .site-header h1 { font-size: 1.2rem; }
body.vote-fit main.container {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1.5rem;
}
body.vote-fit .site-header .container { max-width: none; }
body.vote-fit .vote-page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 1rem 1.25rem;
}
body.vote-fit .vote-page form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
body.vote-fit .booth-bar { margin-bottom: 0.4rem; }
body.vote-fit .instruction { margin-bottom: 0.5rem; padding: 0.5rem 0.75rem; }
body.vote-fit .candidate-grid {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0;
}
body.vote-fit .candidate-card { height: auto; }
body.vote-fit .candidate-body {
  height: auto;
  padding: 0.75rem;
  justify-content: center;
}
body.vote-fit .symbol-img,
body.vote-fit .symbol-placeholder { width: 72px; height: 72px; margin-bottom: 0.5rem; }
body.vote-fit .candidate-body strong { min-height: 2.4em; font-size: 1.05rem; }
body.vote-fit .symbol-label { font-size: 0.8rem; margin-top: 0.25rem; }
body.vote-fit .vote-submit-bar { margin-top: 1.5rem; flex: 0 0 auto; }
body.vote-fit .btn-vote { padding: 0.7rem 1rem; font-size: 1.1rem; }

