:root {
  --ink: #030712;
  --body-text: #4b5563;
  --blue: #1f9fd7;
  --blue-dark: #0d7fb0;
  --blue-light: #f1f9fd;
  --paper: #fafafa;
  --surface: #ffffff;
  --line: #e5e7eb;
  --radius: 20px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--body-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2 {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--ink);
  font-weight: 400;
  text-transform: capitalize;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 64px 20px 44px;
  text-align: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
  font-weight: 600;
  color: var(--blue);
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
}
.hero .sub {
  margin: 14px 0 0;
  color: var(--body-text);
  font-size: 1.1rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.leaderboard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(3,7,18,.06), 0 1px 2px rgba(3,7,18,.04);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.campus-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--line);
}
.campus-card:last-child { border-bottom: none; }

.rank {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--body-text);
  text-align: center;
}
.campus-card.lead .rank { color: var(--blue); }

.campus-info { min-width: 0; }
.campus-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
  transition: width .5s ease;
}

.campus-total {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
  white-space: nowrap;
}
.campus-total .label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--body-text);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(3,7,18,.06), 0 1px 2px rgba(3,7,18,.04);
  padding: 28px 24px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

#entry-form, #tap-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--body-text);
}
.field-hint {
  font-size: .76rem;
  color: var(--body-text);
}
select, input {
  font: inherit;
  padding: 12px 14px;
  border-radius: .5rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
select:focus, input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

button#submit-btn, button#gate-btn {
  margin-top: 4px;
  padding: 13px 20px;
  border: none;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color .15s ease;
}
button#submit-btn:hover, button#gate-btn:hover { background: var(--blue-dark); }
button#submit-btn:active, button#gate-btn:active { transform: translateY(1px); }
button#submit-btn:disabled, button#gate-btn:disabled { opacity: .6; cursor: default; }

.hint {
  margin: 0;
  font-size: .8rem;
  color: var(--body-text);
}
.status {
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  min-height: 1.2em;
}
.status.ok { color: #0d8a4e; }
.status.err { color: #c23434; }

.table-wrap { overflow-x: auto; }
.table-wrap.scroll-tall { max-height: 420px; overflow-y: auto; }
.table-wrap.scroll-tall thead th { position: sticky; top: 0; background: var(--surface); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th {
  color: var(--body-text);
  font-weight: 600;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tbody tr:last-child td { border-bottom: none; }
td.total-cell { font-weight: 700; color: var(--ink); }

.undo-btn {
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: #c23434;
  background: none;
  border: 1px solid #f0c9c9;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.undo-btn:hover { background: #fdf1f1; }
.undo-btn:disabled { opacity: .5; cursor: default; }

footer {
  text-align: center;
  color: var(--body-text);
  font-size: .82rem;
  padding: 0 20px 40px;
}
footer a { color: var(--blue); text-decoration: none; font-weight: 600; }
footer a:hover { text-decoration: underline; }
