:root {
  font-family: "MS PGothic", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 16px;
  color: #302b2d;
  background: #f4c8bd;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: #5d68ad; text-decoration: none; }
a:visited { color: #527ea3; }
a:hover { color: #a5545e; text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 14px 24px;
  text-align: center;
}
h1 {
  margin: 9px 0 12px;
  color: #d43d39;
  font-family: "Times New Roman", "MS Mincho", serif;
  font-size: clamp(3rem, 8vw, 4.7rem);
  font-weight: normal;
  line-height: 1.1;
}
hr {
  width: 80%;
  height: 1px;
  margin: 13px auto;
  border: 0;
  background: #a88480;
}
nav { font-size: .95rem; }
.intro-table {
  margin: 14px auto;
  border-spacing: 0;
  text-align: left;
}
.intro-table td { padding: 0 8px; }
.intro-table p { margin: 4px 0; line-height: 1.45; }

.tally { margin: 16px 0 5px; line-height: 1.7; }
#updated-at { margin-right: 4px; }
.tally strong { font-size: 1.2rem; }
.tally button { margin-left: 12px; }
.status { min-height: 1.3em; margin: 4px 0 7px; color: #5b4748; font-size: .88rem; }
.status.error, .form-message.error { color: #a8292c; }
.form-message.success { color: #346344; }

.table-wrap { overflow-x: auto; }
.ranking-table {
  width: min(100%, 960px);
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: fixed;
}
.ranking-table thead { background: #fffdfb; }
.ranking-table th { padding: 6px 5px; text-align: center; font-weight: bold; }
.ranking-table th:nth-child(1) { width: 80px; }
.ranking-table th:nth-child(2) { width: 108px; }
.ranking-table th:nth-child(4) { width: 98px; }
.ranking-table th:nth-child(5) { width: 180px; }
.ranking-table td { padding: 8px 5px; text-align: center; overflow-wrap: anywhere; }
.ranking-table tbody tr:nth-child(odd) { background: #f4c8bd; }
.ranking-table tbody tr:nth-child(even) { background: #eeb5b6; }
.rank-cell, .votes-cell { font-weight: bold; }
.candidate-name { font-weight: normal; }
.vote-controls { display: flex; justify-content: center; gap: 4px; }
button {
  padding: 3px 9px;
  color: #242424;
  background: #ececec;
  border: 2px outset #f7f7f7;
  border-radius: 0;
}
button:active { border-style: inset; }
button:disabled { opacity: .55; cursor: wait; }
.vote-button { min-width: 36px; font-weight: bold; }
.graph-cell { text-align: left !important; white-space: nowrap; }
.graph-bar {
  display: inline-block;
  height: 7px;
  margin-right: 5px;
  background: #7283b5;
  vertical-align: middle;
}
.graph-cell small { color: #5d5052; font-size: .75rem; }
.empty-state { margin: 20px 0; }

.add-section { margin-top: 27px; }
.add-section h2 { margin: 18px 0 9px; font-size: 1.25rem; }
.add-section p { margin: 8px 0; }
.add-section form {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px auto 6px;
}
.add-section input {
  width: min(100%, 300px);
  padding: 4px 6px;
  color: #302b2d;
  background: #fff;
  border: 2px inset #cfcfcf;
}
.add-section input:focus { outline: 2px solid #687cb0; outline-offset: 1px; }
.form-message { min-height: 1.3em; }
footer { margin-top: 30px; font-size: .86rem; }
footer hr { width: 90%; }
footer p { margin: 12px 0; }

@media (max-width: 680px) {
  .page { padding: 8px 7px 20px; }
  .intro-table { font-size: .9rem; }
  .ranking-table { min-width: 500px; font-size: .88rem; }
  .ranking-table th:nth-child(1) { width: 60px; }
  .ranking-table th:nth-child(2) { width: 90px; }
  .ranking-table th:nth-child(4) { width: 76px; }
  .ranking-table th:nth-child(5) { width: 120px; }
  .graph-bar { max-width: 65px; }
}
@media (max-width: 530px) {
  .ranking-table { min-width: 0; }
  .ranking-table .graph-head, .ranking-table .graph-cell { display: none; }
  .ranking-table th:nth-child(1) { width: 55px; }
  .ranking-table th:nth-child(2) { width: 85px; }
  .ranking-table th:nth-child(4) { width: 70px; }
  .ranking-table td { padding: 7px 3px; }
  .vote-button { min-width: 32px; padding: 2px 6px; }
  .tally button { display: block; margin: 8px auto 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
