/* ============================================================
   Marlin Tournament Manager — Mobile-first, big-tap CSS
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:          #c0392b;
  --red-light:    #fdedec;
  --red-dark:     #96281b;
  --blue:         #2980b9;
  --blue-light:   #eaf2f8;
  --blue-dark:    #1a5276;
  --bg:           #f5f6fa;
  --card:         #ffffff;
  --text:         #2c3e50;
  --text-dim:     #7f8c8d;
  --border:       #dcdde1;
  --green:        #27ae60;
  --green-dark:   #1e8449;
  --orange:       #e67e22;
  --radius:       12px;
  --tap-min:      48px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: 80px; /* space for sticky bars */
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Navigation ---------- */
nav {
  background: var(--card);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  flex-wrap: wrap;
  max-width: 960px;
  margin: 0 auto;
}
.nav-brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--text) !important;
  text-decoration: none !important;
  padding: 8px;
  flex-shrink: 0;
}
.nav-inner a {
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none !important;
  color: var(--text-dim);
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}
.nav-inner a:hover { background: var(--bg); text-decoration: none !important; }
.nav-inner a.active { background: var(--bg); color: var(--text); }

.nav-logout { margin-left: auto; }
.nav-login { color: var(--green) !important; font-weight: 700 !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none !important;
  transition: filter 0.15s;
  gap: 8px;
}
.btn:active { filter: brightness(0.85); }

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dark); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-sm {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 14px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

/* ---------- Event selector ---------- */
.event-select-wrap {
  padding: 12px;
  max-width: 960px;
  margin: 0 auto;
}
.event-select-wrap select {
  font-size: 16px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  min-height: var(--tap-min);
  min-width: 200px;
  background: var(--card);
  width: 100%;
  max-width: 400px;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }

/* ---------- Alliance blocks ---------- */
.alliance-block {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.alliance-block.red { background: var(--red-light); border: 2px solid var(--red); }
.alliance-block.blue { background: var(--blue-light); border: 2px solid var(--blue); }

.alliance-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alliance-block.red .alliance-title { color: var(--red-dark); }
.alliance-block.blue .alliance-title { color: var(--blue-dark); }

.team-numbers { font-size: 26px; font-weight: 800; }

/* ---------- Stepper ---------- */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
}
.stepper input[type="number"] {
  width: 56px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: none;
  padding: 8px 4px;
  min-height: var(--tap-min);
  -moz-appearance: textfield;
}
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}
.stepper button {
  min-width: 48px;
  min-height: var(--tap-min);
  width: 48px;
  height: var(--tap-min);
  border: none;
  background: var(--bg);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.stepper button:active { background: var(--border); }

/* ---------- Beacon toggle ---------- */
.beacon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  min-height: var(--tap-min);
  font-size: 16px;
  font-weight: 600;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.beacon-toggle.on {
  background: #d5f5e3;
  border-color: var(--green);
  color: var(--green-dark);
}
.beacon-indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s, border-color 0.15s;
}
.beacon-toggle.on .beacon-indicator {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ---------- Score display ---------- */
.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 15px;
}
.score-label { min-width: 100px; color: var(--text-dim); }
.score-value { font-weight: 700; font-size: 18px; }

/* ---------- Sticky bar ---------- */
.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 2px solid var(--border);
  padding: 12px 16px;
  z-index: 200;
  display: flex;
  justify-content: center;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.sticky-bar .btn { min-width: 240px; }

/* ---------- Score summary ---------- */
.score-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.score-summary .score-block {
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--card);
}
.score-summary .score-total {
  font-size: 28px;
  font-weight: 800;
}

/* ---------- Status badge ---------- */
.badge {
  display: inline-block;
  min-width: 72px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-queued { background: #f0e68c; color: #7d6608; }
.badge-scoring { background: #fdebd0; color: #a04000; }
.badge-final { background: #d5f5e3; color: var(--green-dark); }
.badge-qual { background: #e8daef; color: #6c3483; }
.badge-elim { background: #fadbd8; color: #943126; }

/* ---------- Form inputs ---------- */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-dim);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  min-height: var(--tap-min);
}

/* ---------- Login ---------- */
.login-wrap {
  max-width: 360px;
  margin: 60px auto;
  padding: 0 16px;
}
.login-wrap .card { text-align: center; }
.login-wrap input { text-align: center; }
.login-error {
  color: var(--red);
  font-weight: 600;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--red-light);
  border-radius: var(--radius);
}

/* ---------- Admin sections ---------- */
.admin-section {
  margin-bottom: 24px;
}
.admin-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Misc ---------- */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ---------- Polling flash ---------- */
.poll-flash {
  animation: flash-bg 1s ease;
}
@keyframes flash-bg {
  0%   { background: #d5f5e3; }
  100% { background: var(--card); }
}

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
  body { padding: 0 16px 80px; }
  .nav-inner { gap: 2px; }
  th, td { padding: 12px 16px; }
}

@media (min-width: 900px) {
  .nav-inner { justify-content: center; }
}

/* ---------- Elimination bracket diagram ---------- */
.bracket-toggle {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 8px;
}
.bracket-toggle-btn { opacity: 0.55; }
.bracket-toggle-btn.active { opacity: 1; font-weight: 700; }

/* Toggle: bracket diagram by default, list table when .show-list is set. */
.bracket-list { display: none; }
.bracket-view.show-list .bracket { display: none; }
.bracket-view.show-list .bracket-list { display: block; }
.bracket-list-win { font-weight: 700; color: var(--green-dark); }

.bracket {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 0;
  gap: 0;
  align-items: stretch;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1 0 200px;
  padding-right: 32px; /* room for connector lines */
}
.bracket-round-last { padding-right: 0; }
.bracket-round-title {
  text-align: center;
  font-weight: 700;
  color: var(--text-dim);
  margin: 0 0 8px;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.bracket-match {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
}
.bracket-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-weight: 600;
  white-space: nowrap;
}
.bracket-team + .bracket-team { border-top: 1px solid var(--border); }
.bracket-win { background: var(--green); color: #fff; }
.bracket-lose { color: var(--text-dim); font-weight: 400; }
.bracket-seed {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 700;
  min-width: 1.6em;
}
.bracket-win .bracket-seed { color: rgba(255,255,255,0.85); }
.bracket-name { overflow: hidden; text-overflow: ellipsis; }
.bracket-state {
  position: absolute;
  top: -8px;
  right: 6px;
  font-size: 0.65rem;
}

/* Connector lines: horizontal stub out the right of every match,
   plus a vertical line pairing matches (odd goes down, even goes up). */
.bracket-round:not(.bracket-round-last) .bracket-match::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 16px;
  height: 2px;
  background: var(--border);
}
.bracket-round:not(.bracket-round-last) .bracket-match::before {
  content: "";
  position: absolute;
  left: calc(100% + 16px);
  width: 2px;
  height: calc(50% + 10px); /* span half the box + half the 20px margin gap */
  background: var(--border);
}
.bracket-round:not(.bracket-round-last) .bracket-match:nth-of-type(odd)::before  { top: 50%; }
.bracket-round:not(.bracket-round-last) .bracket-match:nth-of-type(even)::before { bottom: 50%; }

/* Mobile: lock column width so the diagram keeps its scale and scrolls
   horizontally instead of squishing. */
@media (max-width: 599px) {
  .bracket-round { flex: 0 0 150px; padding-right: 24px; font-size: 0.85rem; }
  .bracket-round:not(.bracket-round-last) .bracket-match::after { width: 12px; }
  .bracket-round:not(.bracket-round-last) .bracket-match::before { left: calc(100% + 12px); }
}

/* ============================================================
   Marlin Robotics brand system
   Based on the supplied 2026 brand guide.
   ============================================================ */

:root {
  --wave:         #003152;
  --wave-deep:    #00243d;
  --sun:          #ffa500;
  --sun-dark:     #d77d00;
  --sea:          #70cccd;
  --sand:         #e8e5dc;
  --sand-light:   #f5f3ed;
  --brand-blue:   #1e98da;
  --brand-red:    #ea4832;
  --ink:          #003152;
  --paper:        #fbfaf6;

  --red:          #ea4832;
  --red-light:    #fff0ed;
  --red-dark:     #a92a1b;
  --blue:         #1e98da;
  --blue-light:   #ecf8ff;
  --blue-dark:    #075e91;
  --bg:           var(--sand-light);
  --card:         var(--paper);
  --text:         var(--ink);
  --text-dim:     #526b7b;
  --border:       #c8c6bd;
  --green:        #178b86;
  --green-dark:   #0d6966;
  --orange:       var(--sun);
  --radius:       3px;
  --shadow:       0 10px 28px rgba(0, 49, 82, 0.08);
}

html {
  min-height: 100%;
  background: var(--sand);
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Noto Sans", Aptos, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0, 49, 82, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(rgba(0, 49, 82, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--sand-light);
}

body::before {
  content: "";
  position: fixed;
  right: -90px;
  bottom: -70px;
  width: min(540px, 55vw);
  height: min(350px, 42vw);
  z-index: -1;
  background: url("/brand/fish-mech.svg") right bottom / contain no-repeat;
  opacity: 0.035;
  pointer-events: none;
}

body > :not(nav):not(script):not(.sticky-bar) {
  width: calc(100% - 32px);
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

h1, h2 {
  font-family: "Noto Serif", Georgia, "Times New Roman", serif;
  color: var(--wave);
  line-height: 1.12;
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

h3 {
  color: var(--wave);
  font-size: 20px;
  letter-spacing: 0.01em;
}

a {
  color: #075e91;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--wave);
}

/* ---------- Branded navigation ---------- */
nav {
  background: var(--wave);
  border: 0;
  border-bottom: 5px solid var(--sun);
  box-shadow: 0 7px 22px rgba(0, 36, 61, 0.2);
}

.nav-inner {
  max-width: 1160px;
  min-height: 76px;
  padding: 7px 16px;
  gap: 2px;
}

.nav-brand {
  align-self: stretch;
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  padding: 2px 14px 2px 0 !important;
  color: #fff !important;
}

.nav-brand img {
  display: block;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
}

.nav-brand span {
  display: grid;
  line-height: 1;
}

.nav-brand strong {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 20px;
  letter-spacing: 0.08em;
}

.nav-brand small {
  margin-top: 5px;
  color: var(--sea);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-inner > a:not(.nav-brand) {
  min-height: 42px;
  padding: 8px 13px;
  color: #fff;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 14px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.nav-inner > a:not(.nav-brand):hover {
  color: var(--wave);
  background: var(--sea);
  border-color: var(--sea);
}

.nav-login {
  color: var(--sun) !important;
}

.nav-logout {
  margin-left: 8px;
}

.nav-logout .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.nav-logout .btn:hover {
  color: var(--wave);
  background: #fff;
  border-color: #fff;
}

/* ---------- Page headings and event control ---------- */
.event-select-wrap {
  position: relative;
  max-width: 1120px;
  padding: 24px 0 12px;
}

.event-select-wrap::before {
  content: "EVENT";
  display: block;
  margin-bottom: 5px;
  color: var(--wave);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.event-select-wrap select {
  width: min(100%, 460px);
  max-width: none;
  color: var(--wave);
  background:
    linear-gradient(135deg, transparent 0 88%, rgba(112, 204, 205, 0.28) 88%),
    var(--paper);
  border: 1px solid var(--wave);
  border-left: 6px solid var(--sun);
  border-radius: 0;
  font-weight: 700;
  box-shadow: 4px 4px 0 rgba(0, 49, 82, 0.08);
}

.event-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 1120px;
  margin: 8px 0 18px;
  border-bottom: 2px solid var(--border);
}
.event-tabs a {
  padding: 8px 16px;
  color: var(--wave);
  font-weight: 700;
  border: 1px solid transparent;
}
.event-tabs a:hover { background: var(--sea); text-decoration: none; }
.event-tabs a.active {
  color: var(--wave);
  background: var(--paper);
  border: 1px solid var(--border);
  border-bottom-color: var(--sun);
  border-bottom-width: 3px;
}
.event-tabs-back { margin-right: auto; color: var(--text-dim) !important; font-weight: 400; }

/* Match Schedule header: title left, search aligned right inside the bar */
.schedule-header { display: flex; align-items: center; gap: 16px; }
.schedule-header > span { font-weight: 700; }
.schedule-header::after { display: none; } /* drop decorative diamond so the search box doesn't overlap it */
.schedule-header .team-search {
  margin: 0 0 0 auto;
  width: min(320px, 50%);
}

body > .mb-16,
body > .mb-12 {
  position: relative;
  margin-top: 18px;
  margin-bottom: 22px;
  padding: 18px 20px 18px 24px;
  color: var(--wave);
  background: rgba(251, 250, 246, 0.78);
  border-left: 6px solid var(--sea);
  border-bottom: 1px solid var(--border);
}

body > .mb-16::after,
body > .mb-12::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%) rotate(45deg);
  background: url("/brand/chip-diamond.svg") center / contain no-repeat;
  opacity: 0.35;
}

/* ---------- Surfaces ---------- */
.card,
.table-wrap,
.alliance-block {
  box-shadow: var(--shadow);
}

.card {
  position: relative;
  padding: 20px;
  background: rgba(251, 250, 246, 0.96);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 74px;
  height: 4px;
  background: var(--sun);
}

.admin-section {
  margin-bottom: 30px;
}

.admin-section h3 {
  margin-bottom: 13px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--sea);
  text-transform: none;
}

.admin-section.card h3 {
  border-bottom-color: rgba(0, 49, 82, 0.16);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow: auto;
  background: rgba(251, 250, 246, 0.96);
  border: 1px solid var(--border);
  border-top: 4px solid var(--wave);
}

table {
  font-size: 14px;
}

th {
  padding: 13px 15px;
  color: #fff;
  background: var(--wave);
  border: 0;
  font-size: 11px;
  letter-spacing: 0.11em;
}

td {
  padding: 13px 15px;
  border-bottom-color: #dedbd2;
}

tbody tr:nth-child(even) {
  background: rgba(112, 204, 205, 0.07);
}

tbody tr:hover {
  background: rgba(112, 204, 205, 0.16);
}

.row-link { cursor: pointer; }

/* tappable back link */
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 4px;
  font-weight: 700;
}

.card table th {
  color: var(--text-dim);
  background: transparent;
  border-bottom: 2px solid var(--wave);
}

/* ---------- Controls ---------- */
.btn {
  min-height: 46px;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(0, 49, 82, 0.12);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(0, 49, 82, 0.13);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0, 49, 82, 0.13);
}

.btn-primary {
  color: var(--wave);
  background: var(--sun);
  border-color: var(--sun);
}

.btn-primary:hover {
  color: #fff;
  background: var(--sun-dark);
  border-color: var(--sun-dark);
}

.btn-outline {
  color: var(--wave);
  background: transparent;
  border-color: var(--wave);
}

.btn-outline:hover {
  color: #fff;
  background: var(--wave);
}

.btn-danger {
  background: var(--brand-red);
  border-color: var(--brand-red);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 11px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  min-height: 48px;
  padding: 10px 12px;
  color: var(--wave);
  background: #fff;
  border: 1px solid #9daab2;
  border-radius: 2px;
  font: inherit;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(30, 152, 218, 0.38);
  outline-offset: 2px;
}

.form-group label {
  color: var(--wave);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

/* ---------- Badges ---------- */
.badge {
  border-radius: 2px;
  padding: 5px 9px;
  letter-spacing: 0.07em;
}

.badge-queued {
  color: var(--wave);
  background: #ffd98a;
}

.badge-scoring {
  color: var(--wave);
  background: var(--sea);
}

.badge-final {
  color: #fff;
  background: var(--green-dark);
}

.badge-qual {
  color: #fff;
  background: var(--brand-blue);
}

.badge-elim {
  color: #fff;
  background: var(--brand-red);
}

.badge-bye {
  color: var(--text-dim);
  background: var(--border);
}

/* ---------- Referee scoring ---------- */
body > form {
  max-width: 1120px;
}

.alliance-block {
  position: relative;
  padding: 22px;
  border-radius: 2px;
  background: var(--paper);
}

.alliance-block.red {
  background: linear-gradient(145deg, #fff7f4, #fff);
  border: 1px solid #eab0a7;
  border-top: 7px solid var(--brand-red);
}

.alliance-block.blue {
  background: linear-gradient(145deg, #f1faff, #fff);
  border: 1px solid #9bd2ee;
  border-top: 7px solid var(--brand-blue);
}

.alliance-title {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 24px;
}

.stepper {
  border: 1px solid #9daab2;
  border-radius: 2px;
  background: #fff;
}

.stepper button {
  color: var(--wave);
  background: var(--sand);
}

.stepper input[type="number"] {
  color: var(--wave);
}

.beacon-toggle {
  color: var(--wave);
  border-radius: 2px;
}

.beacon-toggle.on {
  color: var(--wave);
  background: #c8efeb;
  border-color: var(--green);
}

.score-summary {
  border-top: 2px solid rgba(0, 49, 82, 0.15);
}

.score-summary .score-block {
  border: 1px solid rgba(0, 49, 82, 0.12);
  border-radius: 2px;
}

.score-summary .score-total {
  color: var(--wave);
  font-family: "Noto Serif", Georgia, serif;
  font-size: 36px;
}

.sticky-bar {
  background: rgba(232, 229, 220, 0.96);
  border-top: 4px solid var(--wave);
  box-shadow: 0 -8px 24px rgba(0, 49, 82, 0.15);
  backdrop-filter: blur(8px);
}

/* ---------- Login ---------- */
.login-wrap {
  max-width: 430px;
  margin-top: 42px;
}

.login-wrap .card {
  padding: 28px 34px 34px;
  text-align: left;
  border-top: 5px solid var(--sun);
}

.login-wrap .card::before {
  display: none;
}

.login-logo {
  display: block;
  width: 190px;
  max-height: 165px;
  margin: -8px auto 12px;
}

.login-wrap h2 {
  text-align: center;
}

.login-wrap input {
  text-align: left;
}

.login-error {
  color: #8f2317;
  background: #ffe6e1;
  border-left: 5px solid var(--brand-red);
  border-radius: 0;
}

/* ---------- Responsive ---------- */
@media (min-width: 780px) {
  body {
    padding: 0 24px 96px;
  }

  nav {
    margin-left: -24px;
    margin-right: -24px;
  }

  body > form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  body > form .sticky-bar {
    grid-column: 1 / -1;
  }
}

@media (max-width: 779px) {
  .nav-inner {
    align-items: center;
    min-height: 68px;
    padding: 5px 10px 9px;
  }

  .nav-brand {
    width: 100%;
    min-height: 54px !important;
  }

  .nav-brand img {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .nav-inner > a:not(.nav-brand) {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .nav-logout {
    margin-left: 0;
  }

  .nav-logout .btn {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 10px;
  }

  .event-select-wrap {
    padding-top: 18px;
  }

  body > .mb-16,
  body > .mb-12 {
    padding-right: 48px;
  }

  .card {
    padding: 16px;
  }

  body > form .sticky-bar { grid-column: 1 / -1; }

  .alliance-block { padding: 10px; }
  .alliance-title { font-size: 17px; }
  .form-group { margin-bottom: 8px; }
  .form-group label { font-size: 12px; }

  /* Steppers fill the narrow column instead of overflowing it. */
  .stepper { display: flex; width: 100%; }
  .stepper button { min-width: 40px; width: 40px; flex: 0 0 40px; font-size: 20px; }
  .stepper input[type="number"] { width: auto; flex: 1 1 0; min-width: 0; }

  .beacon-toggle { width: 100%; justify-content: center; padding: 10px 6px; gap: 6px; }

  th,
  td {
    padding: 11px 12px;
  }

  .sticky-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sticky-bar .btn {
    min-width: min(240px, 100%);
  }
}

/* Panels fit side by side down to 600px (min-content ~264px each); below that, stack. */
@media (min-width: 600px) and (max-width: 779px) {
  body > form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

@media (max-width: 599px) {
  body > form {
    display: block;
  }
  .stepper button { min-width: 44px; width: 44px; flex: 0 0 44px; }
}

/* Ref match list: taller tap rows */
.ref-table td {
  padding-top: 15px;
  padding-bottom: 15px;
}

/* Field scheduling board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { flex: 1 0 180px; min-width: 180px; background: var(--card, #f4f4f4); border-radius: 8px; padding: 8px; }
.board-col.col-over { outline: 2px dashed var(--primary, #2a6); }
.board-col-unassigned { background: #eee; }
.board-col-head { font-weight: 700; margin-bottom: 8px; }
.match-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; cursor: grab; font-size: 13px; }
.match-card.dragging { opacity: 0.4; }
.match-card .mc-red { color: #c0392b; font-weight: 600; }
.match-card .mc-blue { color: #2471a3; font-weight: 600; }
.match-card.match-dupe { outline: 2px solid #c00; }

/* Mobile schedule table: drop the Ord column (least useful column for spectators)
   so State stays on-screen without horizontal scroll. Column order shipped:
   1 Ord, 2 Time, 3 Field, 4 Red, 5 Blue, 6 State (1-indexed, matches nth-child). */
@media (max-width: 599px) {
  #scheduleTable th:nth-child(1),
  #scheduleTable td:nth-child(1) {
    display: none;
  }
}
