:root {
  --brand: #0b5fa5;
  --brand-dark: #073e6e;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --border: #dbe1e8;
  --text: #1f2937;
  --text-muted: #6b7280;
  --danger: #b3261e;
  --success: #1e7e34;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--brand); }

.topbar {
  background: var(--brand-dark);
  color: white;
  /* ~25% taller than the original 70px (14px padding + the old 42px logo
     chip) so the centered Walkaround 360 logo has room to breathe. */
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  row-gap: 8px;
}
.topbar a { color: white; text-decoration: none; font-weight: 600; }
.topbar-brand { grid-column: 1; justify-self: start; display: flex; align-items: center; gap: 14px; }
.brand-logo { display: block; height: 38px; width: auto; background: #ffffff; padding: 4px 10px; border-radius: 8px; }
.topbar-center-logo { grid-column: 2; justify-self: center; display: flex; align-items: center; }
.topbar-center-logo img { display: block; height: 48px; width: auto; }
.topbar nav { grid-column: 3; justify-self: end; display: flex; gap: 18px; align-items: center; }
.topbar form { margin: 0; }

/* Below tablet width, a 3-column grid with a wide center logo gets cramped
   (this bar shows on the judge scoring screen too, which is used on phones) —
   stack the three groups instead, each centered, and shrink the center logo
   a little so it doesn't dominate a narrow screen. */
@media (max-width: 700px) {
  .topbar { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .topbar-brand, .topbar-center-logo, .topbar nav { grid-column: 1; justify-self: center; }
  .topbar-center-logo img { height: 38px; }
  .topbar nav { flex-wrap: wrap; justify-content: center; }
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

h1, h2, h3 { margin-top: 0; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: white; color: var(--brand); border-color: var(--brand); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }

.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash.success { background: #e6f4ea; color: var(--success); }
.flash.error { background: #fbe9e7; color: var(--danger); }
.flash.warning { background: #fff3cd; color: #856404; }
.contestant-changed-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.contestant-changed-banner button { flex-shrink: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.muted { color: var(--text-muted); font-style: italic; }

.form-group { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
input[type=text], input[type=number], input[type=date], input[type=password], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.setup { background: #fff3cd; color: #856404; }
.badge.active { background: #d4edda; color: #155724; }
.badge.completed { background: #e2e3e5; color: #383d41; }

.judge-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.judge-card img { max-width: 180px; }
.judge-card .pin { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.1em; margin: 8px 0; }

.category-block { margin-bottom: 28px; }
.category-block h3 { border-bottom: 2px solid var(--brand); padding-bottom: 6px; }
.scoring-item { margin-bottom: 18px; padding: 8px; border-radius: 8px; border: 1px solid transparent; }
.scoring-item .item-label { margin-bottom: 8px; }
.scoring-item.missing { border-color: var(--danger); background: #fbe9e7; }
.scoring-item.missing .missing-note { color: var(--danger); font-weight: 600; font-size: 0.85rem; }
.score-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.score-scale label {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-weight: 600; margin: 0;
}
.score-scale input { display: none; }
.score-scale input:checked + span { background: var(--brand); color: white; }
.score-scale label span { display:flex; align-items:center; justify-content:center; width:100%; height:100%; border-radius:6px; }

/* On a phone-width screen, 11 fixed-width buttons (0-10) don't divide evenly
   into the available width, so the flex-wrap default breaks them 8-then-3 (or
   7-then-4) at an arbitrary point. Force an even 6-per-row split instead —
   each button's basis is exactly 1/6 of the row, so a 7th always wraps, and
   `justify-content: center` centers the shorter 5-item second row rather than
   leaving it jammed against the left edge. Buttons also grow to a full
   44px-tall tap target, the recommended minimum for touch. */
@media (max-width: 480px) {
  .score-scale { justify-content: center; gap: 8px; }
  .score-scale label { flex: 0 0 calc((100% - 5 * 8px) / 6); width: auto; height: 44px; }
}

.contestant-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.danger-zone { border-color: var(--danger); }
.danger-zone h2 { color: var(--danger); }

/* --- Public scoreboard / digital signage --- */
body.scoreboard {
  background: #05192f;
  color: white;
  min-height: 100vh;
}
.scoreboard-wrap { padding: 40px; }
.scoreboard-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 24px;
  row-gap: 12px;
  margin-bottom: 20px;
}
.scoreboard-header-left { grid-column: 1; justify-self: start; text-align: left; }
.scoreboard-center-logo { grid-column: 2; justify-self: center; display: block; height: 72px; width: auto; }
.scoreboard-logo { grid-column: 3; justify-self: end; display: block; height: 64px; width: auto; background: #ffffff; padding: 10px 18px; border-radius: 12px; }
.scoreboard-wrap h1 { font-size: 2.6rem; margin-bottom: 4px; }
.scoreboard-wrap .subtitle { color: #9fb3c8; font-size: 1.2rem; }

/* On a narrow signage display or a phone preview, the 3-column layout gets
   cramped — stack the three pieces instead, each centered, mirroring the
   nav bar's own narrow-width fallback. */
@media (max-width: 700px) {
  .scoreboard-header { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .scoreboard-header-left, .scoreboard-center-logo, .scoreboard-logo { grid-column: 1; justify-self: center; }
  .scoreboard-header-left { text-align: center; }
  .scoreboard-center-logo { height: 48px; }
}
.scoreboard-table { width: 100%; border-collapse: collapse; font-size: 1.6rem; }
.scoreboard-table th, .scoreboard-table td { padding: 16px 20px; border-bottom: 1px solid #1c3a58; }
.scoreboard-table th { color: #9fb3c8; font-size: 1rem; text-transform: uppercase; }
.scoreboard-table tr:nth-child(odd) td { background: rgba(255,255,255,0.03); }
.scoreboard-table td.average { font-weight: 800; color: #6fd0ff; }
.scoreboard-table td.rank-1 { color: #ffd54a; font-weight: 800; }

/* --- Footer --- */
.site-footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 24px 28px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}
body.scoreboard .site-footer { max-width: none; color: #6c85a0; }
