:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray-100: #f6f6f6;
  --gray-200: #ebebeb;
  --gray-300: #d6d6d6;
  --gray-500: #8f8f8f;
  --gray-700: #444444;
  --red: #c8102e;
  --border: #111111;
  --radius: 8px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--gray-100);
  color: var(--black);
  line-height: 1.5;
}

header.site-header {
  background: var(--white);
  color: var(--black);
  border-bottom: 1px solid var(--gray-300);
}

header.site-header .header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 20px 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--black);
  text-align: center;
}

.school-logo {
  display: inline-block;
  height: 96px;
  width: 96px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-eyebrow {
  margin: 0;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--gray-700);
  letter-spacing: 0.04em;
}

.brand-title {
  margin: 2px 0 0;
  font-family: "Special Elite", "Consolas", "Courier New", monospace;
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--black);
}

.header-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.header-actions .btn {
  padding: 13px 28px;
  font-size: 1rem;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.period-section { margin-bottom: 28px; }

.period-section h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
  color: var(--black);
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-section h2 .count {
  font-weight: 500;
  color: var(--gray-500);
  font-size: 0.8rem;
  font-family: inherit;
}

table.roster {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table.roster th, table.roster td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-300);
  font-size: 0.92rem;
}

table.roster th {
  background: var(--gray-100);
  color: var(--black);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1.5px solid var(--black);
}

table.roster tbody tr:nth-child(even) { background: var(--gray-100); }
table.roster tr:last-child td { border-bottom: none; }

.num-earned { color: var(--gray-700); }
.num-used { color: var(--gray-700); }
.num-available {
  display: inline-block;
  background: var(--white);
  color: var(--black);
  font-weight: 700;
  padding: 2px 12px;
  border: 1.5px solid var(--black);
  border-radius: 4px;
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  color: var(--gray-500);
  padding: 40px 20px;
}

.btn {
  display: inline-block;
  border: 1.5px solid var(--black);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--white);
  color: var(--black);
  transition: background 0.15s, color 0.15s;
}

.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--gray-700); border-color: var(--gray-700); }

.btn-earn:hover { background: var(--black); color: var(--white); }
.btn-use:hover { background: var(--black); color: var(--white); }

.btn-ghost { border-color: var(--gray-300); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }

.btn-danger { border-color: var(--black); color: var(--black); }
.btn-danger:hover { background: var(--black); color: var(--white); }

.btn-sm { padding: 6px 10px; font-size: 0.76rem; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

form.stack { display: flex; flex-direction: column; gap: 14px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--black);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--black);
}

.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }

.hint { font-size: 0.8rem; color: var(--gray-500); margin-top: -6px; }

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1.5px solid var(--black);
  background: var(--white);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert::before {
  font-weight: 700;
  flex-shrink: 0;
}
.alert-error { background: var(--gray-100); }
.alert-error::before { content: "\2715"; }
.alert-success { background: var(--gray-100); }
.alert-success::before { content: "\2713"; }
.alert-warning { background: var(--gray-200); border-style: dashed; }
.alert-warning::before { content: "!"; }
.alert-info { background: var(--white); }
.alert-info::before { content: "i"; font-style: italic; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--white);
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: 100%;
}

.modal h3 { margin-top: 0; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.pin-gate {
  max-width: 360px;
  margin: 60px auto;
  text-align: center;
}

.pin-gate .card { text-align: left; }

footer.site-footer {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.8rem;
  padding: 20px;
}

.loading { color: var(--gray-500); padding: 20px; text-align: center; }

.hero {
  text-align: center;
  padding: 20px 20px 8px;
}

.hero h2 {
  font-size: 1.6rem;
  margin: 0 0 6px;
}

.hero p {
  color: var(--gray-700);
  margin: 0 0 18px;
}

@media (max-width: 560px) {
  table.roster { font-size: 0.85rem; }
  table.roster th, table.roster td { padding: 8px 6px; }
}

/* --- Exit Tickets additions --- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1.5px solid var(--black);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-open { background: var(--black); color: var(--white); }
.badge-closed { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }

.course-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.course-tab {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 18px;
  border: 1.5px solid var(--gray-300);
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  cursor: pointer;
}
.course-tab:hover { border-color: var(--black); }
.course-tab.active { background: var(--black); color: var(--white); border-color: var(--black); }

.ticket-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-300);
}
.ticket-list-item:last-child { border-bottom: none; }

.ticket-meta { display: flex; flex-direction: column; gap: 4px; }
.ticket-meta .title { font-weight: 700; font-size: 1rem; }
.ticket-meta .sub { font-size: 0.8rem; color: var(--gray-700); }

.question-card {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--gray-100);
}
.question-card .q-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.question-card .q-number {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-700);
}
.question-card > p { white-space: pre-wrap; }

.q-result {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.grading-row {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.quiz-course-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  table-layout: fixed;
}
.quiz-course-table th {
  text-align: left;
  padding: 6px 14px 10px;
  border-bottom: 2px solid var(--black);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--black);
}
.quiz-course-table th .count {
  font-weight: 500;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: normal;
}
.quiz-course-table td {
  vertical-align: top;
  padding: 10px 14px;
  border-right: 1px solid var(--gray-200);
}
.quiz-course-table td:last-child { border-right: none; }

.quiz-link-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
}
.quiz-link-item:last-child { border-bottom: none; }

.quiz-link {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--black);
  text-decoration: none;
  cursor: pointer;
}
.quiz-link:hover { text-decoration: underline; }

.stats-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.stat-chip {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 8px 14px;
  flex: 1;
  min-width: 160px;
}
.stat-chip-wide { flex: 2; min-width: 260px; }
.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  font-weight: 700;
  margin-bottom: 3px;
}
.stat-value { font-size: 0.92rem; font-weight: 600; }

.leaderboard {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-200);
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--gray-100); }
.leaderboard-rank {
  width: 22px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-500);
}
.leaderboard-arrow { color: var(--gray-500); font-size: 0.75rem; flex-shrink: 0; }
.leaderboard-name { flex: 1; font-weight: 600; }
.grading-row textarea, .grading-row .response-text {
  white-space: pre-wrap;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 6px 0 10px;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.choice-row input[type="text"] { flex: 1; }
.choice-row input[type="radio"] { width: auto; flex-shrink: 0; }

.option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  white-space: pre-wrap;
  font-family: inherit;
}
.option-label:has(> input) { align-items: flex-start; }
.option-label:hover { border-color: var(--black); }
.option-label input { width: auto; flex-shrink: 0; }
.option-label.is-correct { border-color: var(--black); background: var(--gray-200); }
.option-label.is-incorrect { border-color: var(--gray-500); }

.score-pill {
  display: inline-block;
  padding: 3px 12px;
  border: 1.5px solid var(--black);
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--white);
}

.q-result.is-correct { border-color: var(--black); }
.q-result .q-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.match-row .match-left {
  flex: 1;
  min-width: 160px;
  font-weight: 600;
}
.match-row select {
  flex: 1;
  min-width: 160px;
  padding: 9px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--white);
}

.short-answer-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
}
.short-answer-input:focus {
  outline: none;
  border-color: var(--black);
}

.order-list { list-style: none; margin: 0; padding: 0; }
.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--white);
}
.order-item .order-num {
  font-weight: 700;
  color: var(--gray-700);
  min-width: 22px;
}
.order-item .order-text { flex: 1; }
.order-item .order-controls { display: flex; gap: 4px; }
.order-item .order-controls button {
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.quiz-timer {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: inline-block;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  margin: 4px 0 16px;
}
.quiz-timer.timer-low {
  background: var(--red);
  animation: timer-pulse 1s ease-in-out infinite;
}
@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .quiz-timer.timer-low { animation: none; }
}

