@font-face {
  font-family: 'Roboto';
  src: url('/a/Roboto.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bowler';
  src: url('/a/Bowler.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eaeef7;
  --bg-2: #f3f6fc;
  --panel: #ffffff;
  --panel-2: #f4f7fd;
  --line: #d9e0f0;
  --text: #111834;
  --muted: #5b6588;
  --blue: #1f3bb3;
  --blue-deep: #16298a;
  --orange: #e8461e;
  --orange-dim: #b8360f;
  --green: #1f9d57;
  --green-dim: #167a42;
  --red: #d8382c;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(31, 59, 179, .08), 0 1px 3px rgba(17, 24, 52, .06);
  --mono: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bowler', 'Roboto', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(760px 460px at 88% -8%, rgba(31, 59, 179, .10) 0%, transparent 60%),
    radial-gradient(680px 460px at 4% 108%, rgba(232, 70, 30, .08) 0%, transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5em; letter-spacing: .2px; font-family: var(--display); font-weight: 700; }
h1 { font-size: 1.8rem; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.container-wide { max-width: none; }
.center-screen { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grid { display: grid; gap: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.pad-lg { padding: 28px; }

/* ---- Brand / wordmark ---- */
.brand {
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand .leto { color: var(--blue); }
.brand .ctf { color: var(--orange); }
.brand .dim { color: var(--muted); }
.brand img { height: 1.6em; width: auto; }

/* ---- Mascots ---- */
.mascot { width: auto; max-width: 100%; display: block; margin: 0 auto; }
.mascot.sm { height: 120px; }
.mascot.md { height: 180px; }
.mascot.lg { height: 240px; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: .95rem;
  font-family: var(--sans);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 59, 179, .12); }
textarea { min-height: 90px; resize: vertical; }
::placeholder { color: #9aa3c0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 16px; font-size: .95rem; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, transform .08s ease, box-shadow .15s, filter .15s;
}
.btn:hover { border-color: var(--blue); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--blue); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--blue-deep); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31,59,179,.28); }
.btn.primary:active { transform: scale(.96); }
.btn.amber, .btn.orange { background: var(--orange); color: #fff; border-color: transparent; }
.btn.amber:hover, .btn.orange:hover { background: var(--orange-dim); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(232,70,30,.28); }
.btn.danger { background: #fff; color: var(--red); border-color: #f0c5c0; }
.btn.danger:hover { background: #fdecea; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.lg { padding: 16px 22px; font-size: 1.1rem; }
.btn.block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted);
}
.badge.green { color: var(--green); border-color: #b7e2c7; background: #e9f8ef; }
.badge.amber, .badge.orange { color: var(--orange); border-color: #f6c9bd; background: #fdece7; }
.badge.blue  { color: var(--blue); border-color: #c2ccf0; background: #eaeffb; }
.badge.red   { color: var(--red); border-color: #f0c5c0; background: #fdecea; }
.badge.gray  { color: var(--muted); background: #f1f3f9; }

.code-pill {
  font-family: var(--mono); font-weight: 700; letter-spacing: 2px;
  background: #eaeffb; border: 1px dashed var(--blue); color: var(--blue);
  padding: 6px 12px; border-radius: 8px; display: inline-block;
}

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: #f6f8fd; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 10px 16px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 700; }
.tab.active { color: var(--blue); border-color: var(--blue); }

.map { height: 320px; width: 100%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.map.tall { height: 55vh; }

.timer { font-family: var(--mono); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.timer.big { font-size: clamp(3rem, 12vw, 8rem); line-height: 1; }
.timer.warn { color: var(--orange); }
.timer.crit { color: var(--red); }

.notice { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.err { border-color: #f0c5c0; background: #fdecea; color: #a52a20; }
.notice.ok { border-color: #b7e2c7; background: #e9f8ef; color: var(--green-dim); }

.big-msg { text-align: center; }
.big-msg .em { font-family: var(--display); font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 700; }

.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.list-actions { display: flex; gap: 6px; }

.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.float { animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.leaflet-container { background: #eaeef7; }

/* ---------- Motion ---------- */
@keyframes hq-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes hq-pop { 0% { opacity: 0; transform: scale(.94); } 60% { transform: scale(1.02); } 100% { opacity: 1; transform: scale(1); } }
@keyframes hq-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hq-pulse-scale { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes hq-shake { 10%, 90% { transform: translateX(-1px); } 30%, 70% { transform: translateX(3px); } 50% { transform: translateX(-4px); } }
@keyframes hq-spin { to { transform: rotate(360deg); } }

.container { animation: hq-fade .3s ease both; }
.card { animation: hq-rise .38s cubic-bezier(.22,.61,.36,1) both; }
.center-screen > .card,
.center-screen > form.card { animation: hq-pop .45s cubic-bezier(.22,.61,.36,1) both; }
.badge { animation: hq-fade .3s ease both; }
.big-msg .em { animation: hq-pop .5s cubic-bezier(.22,.61,.36,1) both; }
.notice.ok { animation: hq-pop .4s cubic-bezier(.22,.61,.36,1) both; }
.notice.err { animation: hq-shake .4s ease both; }
.timer.crit { display: inline-block; animation: hq-pulse-scale 1s ease-in-out infinite; }

/* interactive niceties */
input, textarea, select { transition: border-color .15s, box-shadow .15s; }
.tab { transition: color .15s, border-color .15s; }
.code-pill { transition: background .15s; }
tr td { transition: background .12s; }
.card > .card { animation-duration: .3s; } /* nested list items: lighter */
a { transition: color .15s; }

/* confetti */
.confetti-root { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.confetti-root i {
  position: absolute; top: -16px; width: 9px; height: 15px;
  background: var(--c); opacity: .95; border-radius: 2px;
  animation-name: hq-confetti; animation-timing-function: cubic-bezier(.25,.6,.4,1); animation-fill-mode: both;
}
@keyframes hq-confetti {
  0% { transform: translateY(0) translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateY(108vh) translateX(calc(var(--x) * 160px)) rotate(var(--r)); opacity: .9; }
}

/* team screen transitions */
@keyframes hq-slide-in { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
.hq-screen { animation: hq-slide-in .34s cubic-bezier(.22,.61,.36,1) both; }

/* animated map marker */
.hq-pin { position: relative; width: var(--s); height: var(--s); }
.hq-pin-dot {
  position: absolute; inset: 0; border-radius: 50%; background: var(--c);
  border: 2px solid #fff; box-shadow: 0 0 8px var(--c), 0 1px 4px rgba(0,0,0,.4);
}
.hq-pin-pulse::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%; background: var(--c); opacity: .55;
  animation: hq-marker-pulse 1.6s ease-out infinite;
}
@keyframes hq-marker-pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3.2); opacity: 0; } }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .container { padding: 14px; }
  .card { padding: 16px; border-radius: 12px; }
  .card.pad-lg { padding: 18px; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }
  /* inputs must be >=16px so iOS doesn't zoom on focus */
  input, textarea, select { font-size: 16px; padding: 12px; }
  .btn { padding: 12px 14px; }
  .btn.lg { padding: 15px 18px; font-size: 1.05rem; }
  /* stack any two-column layouts */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .map { height: 240px; }
  .map.tall { height: 40vh; }
  .brand { font-size: 1.05rem !important; }
  .brand img { height: 1.3em; }
  /* headers wrap instead of overflowing */
  .spread { flex-wrap: wrap; row-gap: 8px; }
  .spread > .row { flex-wrap: wrap; }
  .mascot.lg { height: 190px; }
  .mascot.md { height: 150px; }
  .big-msg .em { font-size: clamp(1.4rem, 7vw, 2rem); }
  .timer.big { font-size: clamp(2.6rem, 16vw, 5rem); }
  /* wide tables scroll instead of squashing */
  table { font-size: .86rem; }
  th, td { padding: 8px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .float, .pulse { animation: none !important; }
}
