:root {
  --orange: #ff4c00;
  --orange-dark: #d93f00;
  --blue: #003399;
  --red: #e10600;
  --yellow: #ffcc00;
  --paper: #ffffff;
  --ink: #111319;
  --muted: #98a0af;
  --panel: rgba(12, 15, 22, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --font-body: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Arial", "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --font-display-mobile: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  color-scheme: dark;
  font-family: var(--font-body);
  font-weight: 400;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  margin: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-height: 100%;
  margin: 0;
  background: #05070b;
  color: #fff;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
button, input, select { font: inherit; }
button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
input, select { min-width: 0; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

#app { min-height: 100vh; min-height: 100dvh; }
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, calc(var(--safe-bottom) + 12px));
  width: max-content;
  max-width: calc(100vw - 28px - var(--safe-left) - var(--safe-right));
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  z-index: 600;
  background: #fff;
  color: #111;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 15px 45px rgba(0,0,0,.45);
  transition: .25s ease;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.error { background: #ffdedc; color: #850900; }

.racing-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--weight-heavy);
  font-synthesis: weight style;
  text-rendering: optimizeLegibility;
  letter-spacing: -.025em;
  text-transform: uppercase;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: .25em;
  font-weight: var(--weight-semibold);
  font-size: .72rem;
}

/* Home */
.home-page {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding:
    max(22px, calc(var(--safe-top) + 12px))
    max(clamp(18px, 4vw, 50px), calc(var(--safe-right) + 12px))
    max(18px, calc(var(--safe-bottom) + 12px))
    max(clamp(18px, 4vw, 50px), calc(var(--safe-left) + 12px));
  isolation: isolate;
}
.home-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background: url('/home-bg.jpg') center/cover no-repeat;
  filter: saturate(1.1);
}
.home-page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at center, transparent 20%, rgba(0,0,0,.55) 70%),
    linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.12) 45%, #000 100%);
}
.home-header {
  width: min(1100px, 100%);
  margin-inline: auto;
  text-align: center;
  animation: drop-in .65s ease both;
}
.home-header h1 {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 5.8rem);
  line-height: .95;
  text-wrap: balance;
  text-shadow: 0 10px 30px #000;
}
.home-header h1 span { color: var(--orange); }
.home-header p {
  max-width: 90%;
  margin: 12px auto 0;
  color: #c8d8ff;
  line-height: 1.4;
}
.racer-grid {
  width: min(1180px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  gap: clamp(8px, 3vw, 40px);
}
.racer-card {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: transparent;
  color: #fff;
  border-radius: 28px;
  transition: transform .25s ease, background .25s ease;
}
.racer-image-wrap {
  width: min(38vw, 370px);
  min-width: 115px;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
}
.racer-image-wrap::before {
  content: "";
  position: absolute;
  inset: 14%;
  background: var(--glow);
  filter: blur(50px);
  opacity: .24;
  border-radius: 50%;
  transition: opacity .25s;
}
.racer-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 20px rgba(0,0,0,.75));
  position: relative;
}
/* The Ryan artwork has a wider canvas than Evangeline's, so it looked smaller
   when both were fitted into equal square frames. This small scale correction
   equalises their visual height without changing the source images. */
.ryan-card .racer-image-wrap img {
  transform: scale(1.08);
  transform-origin: center center;
}
.racer-card h2 {
  width: 100%;
  max-width: 100%;
  margin: -4px 0 7px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: clamp(1.75rem, 5.8vw, 5.4rem);
  line-height: .9;
  text-align: center;
  overflow: visible;
  transition: color .25s;
}
.racer-name-text {
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}
.racer-card small {
  color: var(--glow);
  font-weight: var(--weight-semibold);
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
}
.vs {
  width: clamp(44px, 7vw, 76px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #000;
  font: italic var(--weight-heavy) clamp(1rem,2.5vw,2rem)/1 var(--font-display);
  box-shadow: 0 10px 30px #000;
  transform: rotate(-5deg);
}
.home-footer {
  max-width: 100%;
  text-align: center;
  color: rgba(255,255,255,.42);
  font-size: .62rem;
  line-height: 1.5;
  letter-spacing: .28em;
  text-transform: uppercase;
}

/* RSVP */
.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  background: var(--page-bg, #08101d);
}
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  background: var(--banner) center/cover no-repeat;
  opacity: .5;
}
.page-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, rgba(0,0,0,.88), rgba(0,0,0,.1) 42%, #000 100%);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: calc(60px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  background: rgba(0,0,0,.84);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(700px, 100%);
  min-width: 0;
  min-height: 60px;
  margin: auto;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  display: flex;
}
.nav-home {
  flex: 0 0 60px;
  min-width: 52px;
  background: transparent;
  color: #fff;
  border-right: 1px solid var(--line);
  font-size: 1.25rem;
}
.profile-tab {
  flex: 1 1 0;
  min-width: 0;
  color: #89909b;
  background: transparent;
  font: italic var(--weight-heavy) 1rem/1 var(--font-display);
  letter-spacing: .04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-tab.active.ryan { color: #fff; background: var(--orange); }
.profile-tab.active.evangeline { color: #fff; background: var(--red); }
.content {
  width: min(650px, 100%);
  margin: 0 auto;
  padding:
    clamp(24px, 4vw, 38px)
    max(16px, calc(var(--safe-right) + 12px))
    max(60px, calc(var(--safe-bottom) + 42px))
    max(16px, calc(var(--safe-left) + 12px));
}
.rsvp-card {
  width: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  border-radius: clamp(28px, 7vw, 48px);
  border: 4px solid var(--profile-dark);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  animation: card-in .45s ease both;
}
.banner {
  min-height: 140px;
  height: clamp(140px, 28vw, 205px);
  position: relative;
  background: var(--banner) center/cover no-repeat;
}
.banner::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent,#fff);
}
.form-body { padding: 0 clamp(22px, 6vw, 42px) clamp(26px, 6vw, 42px); }
.profile-badge {
  width: max-content;
  max-width: 96%;
  margin: -34px auto 32px;
  position: relative;
  z-index: 1;
  background: var(--profile);
  color: #fff;
  padding: 13px 24px;
  border-radius: 18px;
  box-shadow: 0 9px 0 rgba(0,0,0,.25);
  transform: rotate(-2deg);
  text-align: center;
}
.profile-badge h1 {
  margin: 0;
  font-size: clamp(1.65rem, 6vw, 2.4rem);
  line-height: 1;
  overflow-wrap: anywhere;
}
.form-grid { display: grid; gap: 16px; }
.field {
  width: 100%;
  min-height: 54px;
  color: #111;
  background: #f5f6f8;
  border: 0;
  border-bottom: 4px solid var(--profile);
  border-radius: 13px 13px 3px 3px;
  padding: 15px 17px;
  outline: 0;
  font-size: 1rem;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: .01em;
  text-transform: none;
  transition: .2s;
}
.field::placeholder {
  color: #707784;
  opacity: 1;
  font-weight: var(--weight-medium);
  letter-spacing: .045em;
  text-transform: uppercase;
}
.field:focus {
  background: #fff8e7;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.choice-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 13px;
}
.choice {
  min-width: 0;
  min-height: 58px;
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 17px;
  background: #eff1f4;
  color: #687080;
  padding: 14px 10px;
  text-align: center;
  font: italic var(--weight-bold) 1rem/1.15 var(--font-display);
  transition: .2s;
  cursor: pointer;
  touch-action: manipulation;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected.yes { background: var(--profile); color: #fff; border-color: #111; }
.choice.selected.no { background: #22252b; color: #fff; border-color: #000; }
.choice:has(input:focus-visible) { outline: 3px solid var(--yellow); outline-offset: 3px; }
.primary-btn {
  width: 100%;
  min-height: 58px;
  color: #fff;
  background: var(--profile);
  padding: 15px 18px;
  border-radius: 17px;
  font: italic var(--weight-heavy) clamp(1.25rem,5vw,1.85rem)/1 var(--font-display);
  text-transform: uppercase;
  box-shadow: 0 8px 0 rgba(0,0,0,.23);
  transition: .18s;
}
.primary-btn:active { transform: translateY(3px); box-shadow: 0 5px 0 rgba(0,0,0,.23); }
.primary-btn:disabled { opacity: .6; cursor: wait; }
.admin-link {
  display: block;
  min-height: 44px;
  margin: 42px auto 0;
  padding: 10px 14px;
  color: rgba(255,255,255,.46);
  background: none;
  font-weight: var(--weight-semibold);
  font-size: .68rem;
  line-height: 1.3;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.success-card {
  width: 100%;
  text-align: center;
  background: rgba(12,14,18,.96);
  border: 4px solid var(--yellow);
  border-radius: clamp(28px, 7vw, 46px);
  padding: clamp(32px,8vw,64px) clamp(22px,6vw,42px);
  box-shadow: 0 30px 90px rgba(0,0,0,.65);
  animation: success-pop .45s cubic-bezier(.2,1.35,.4,1) both;
}
.success-icon {
  width: clamp(84px, 24vw, 104px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--profile);
  border: 4px solid #fff;
  font-size: clamp(2.5rem, 12vw, 3.25rem);
  box-shadow: 0 15px 30px rgba(0,0,0,.35);
}
.success-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2.2rem,8vw,4rem);
  line-height: .95;
  text-wrap: balance;
}
.success-card p {
  max-width: 32rem;
  margin: 0 auto 34px;
  color: var(--yellow);
  text-transform: uppercase;
  font-weight: var(--weight-semibold);
  line-height: 1.5;
  letter-spacing: .15em;
  font-size: .78rem;
}

/* Login */
.center-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(22px, calc(var(--safe-top) + 16px))
    max(22px, calc(var(--safe-right) + 16px))
    max(22px, calc(var(--safe-bottom) + 16px))
    max(22px, calc(var(--safe-left) + 16px));
  background: radial-gradient(circle at top, var(--profile-fade), transparent 35%), #05070b;
}
.login-card {
  width: min(430px, 100%);
  border: 3px solid var(--line);
  background: rgba(17,19,25,.97);
  padding: clamp(26px,7vw,42px);
  border-radius: clamp(24px, 7vw, 32px);
  box-shadow: 0 30px 90px #000;
}
.login-card h1 {
  margin: 0 0 30px;
  text-align: center;
  font-size: clamp(1.75rem, 8vw, 2.2rem);
  line-height: 1;
}
.login-card .field {
  color: #fff;
  background: rgba(0,0,0,.42);
  border-color: rgba(255,255,255,.16);
  text-transform: none;
}
.login-card .field::placeholder { color: #aeb4bf; }
.error-box {
  color: #ffb3af;
  background: rgba(225,6,0,.14);
  border: 1px solid rgba(225,6,0,.55);
  padding: 11px;
  border-radius: 10px;
  text-align: center;
  font-size: .76rem;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  text-transform: uppercase;
}
.text-btn {
  width: 100%;
  min-height: 44px;
  color: rgba(255,255,255,.58);
  background: transparent;
  margin-top: 14px;
  font-size: .72rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
}

/* Admin */
.admin-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at top right, var(--profile-fade), transparent 28%), #06080d;
  padding:
    max(24px, calc(var(--safe-top) + 16px))
    max(16px, calc(var(--safe-right) + 12px))
    max(70px, calc(var(--safe-bottom) + 52px))
    max(16px, calc(var(--safe-left) + 12px));
}
.admin-wrap { width: min(980px,100%); margin: auto; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}
.admin-header h1 {
  min-width: 0;
  margin: 0;
  font-size: clamp(1.7rem,5vw,2.5rem);
  line-height: 1;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.small-btn {
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.1);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  font-size: .68rem;
  line-height: 1.2;
  letter-spacing: .08em;
}
.small-btn.red { background: #b71912; }
.small-btn.profile { background: var(--profile); }
.admin-tabs {
  display: flex;
  background: rgba(0,0,0,.42);
  padding: 5px;
  border-radius: 18px;
  margin-bottom: 18px;
}
.admin-tabs .profile-tab { min-height: 48px; border-radius: 14px; }
.admin-tools {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  margin-bottom: 20px;
}
.search {
  width: 100%;
  min-height: 48px;
  color: #fff;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  outline: 0;
  font-size: 1rem;
}
.counter {
  min-width: 110px;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.res-list { display: grid; gap: 12px; }
.res-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 18px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 17px;
}
.res-main { min-width: 0; }
.res-main h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.res-meta {
  color: #aab0bb;
  font-size: .82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.status {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: .65rem;
  line-height: 1.2;
  text-transform: uppercase;
  font-weight: var(--weight-bold);
}
.status.yes { color: #9df5b4; background: rgba(33,170,77,.14); }
.status.no { color: #ffaaa6; background: rgba(225,6,0,.14); }
.card-actions { display: flex; gap: 8px; }
.icon-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  min-height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 1.05rem;
}
.icon-btn.edit { color: #91c7ff; background: rgba(0,115,230,.15); }
.icon-btn.delete { color: #ff9f99; background: rgba(225,6,0,.15); }
.empty {
  text-align: center;
  color: #9ba2ae;
  border: 1px dashed rgba(255,255,255,.15);
  padding: clamp(38px, 9vw, 56px) 18px;
  border-radius: 24px;
  line-height: 1.5;
}
.danger-link {
  display: block;
  min-height: 44px;
  margin: 30px auto 0;
  padding: 10px 14px;
  background: transparent;
  color: rgba(255,118,110,.74);
  font-size: .65rem;
  font-weight: var(--weight-bold);
  line-height: 1.4;
  letter-spacing: .18em;
  text-transform: uppercase;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  overflow-y: auto;
  background: rgba(0,0,0,.86);
  display: grid;
  place-items: center;
  padding:
    max(18px, calc(var(--safe-top) + 12px))
    max(18px, calc(var(--safe-right) + 12px))
    max(18px, calc(var(--safe-bottom) + 12px))
    max(18px, calc(var(--safe-left) + 12px));
}
.modal {
  width: min(450px,100%);
  max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  background: #12151c;
  border: 3px solid var(--yellow);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 30px 100px #000;
}
.modal h2 { margin: 0 0 20px; }
.modal .field { color: #111; }
.modal-actions {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 10px;
  margin-top: 20px;
}
.modal-actions button {
  min-height: 48px;
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
}
.save { background: #16853b; }
.cancel { background: #3c414b; }

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255,255,255,.18);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 60px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-18px); } }
@keyframes card-in { from { opacity: 0; transform: translateX(22px); } }
@keyframes success-pop { from { opacity: 0; transform: scale(.78); } }

@media (hover: hover) and (pointer: fine) {
  .racer-card:hover { transform: scale(1.045) translateY(-4px); }
  .racer-card:hover .racer-image-wrap::before { opacity: .5; }
  .racer-card:hover h2 { color: var(--glow); }
  .primary-btn:hover { filter: brightness(.94); transform: translateY(2px); box-shadow: 0 6px 0 rgba(0,0,0,.23); }
  .admin-link:hover, .text-btn:hover { color: #fff; }
  .small-btn:hover, .icon-btn:hover { filter: brightness(1.18); }
}

@media (max-width: 760px) {
  .admin-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .admin-header h1 { text-align: center; }
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
  .small-btn { padding-inline: 8px; }
}

@media (max-width: 620px) {
  :root {
    /* Native mobile fonts render consistently across iOS and Android. The
       mobile scale is intentionally one step stronger than the desktop scale. */
    --font-display: var(--font-display-mobile);
    --weight-medium: 600;
    --weight-semibold: 700;
    --weight-bold: 800;
    --weight-heavy: 800;
  }
  body { font-weight: 500; }
  .racing-title {
    font-weight: 800;
    letter-spacing: -.035em;
    -webkit-text-stroke: .15px currentColor;
  }
  .home-page { gap: 12px; }
  .home-header h1 { font-size: clamp(2rem, 11vw, 3.15rem); }
  .home-header p {
    max-width: 100%;
    font-size: .63rem;
    letter-spacing: .17em;
  }
  .racer-grid {
    /* Keep VS in a dedicated centre column on phones. It no longer floats
       above either artwork, so every racer keeps a clear touch target. */
    position: relative;
    grid-template-columns: minmax(0, 1fr) clamp(28px, 8.5vw, 36px) minmax(0, 1fr);
    column-gap: clamp(5px, 1.8vw, 9px);
    row-gap: 0;
  }
  .racer-image-wrap {
    width: 100%;
    max-width: 245px;
    min-width: 0;
  }
  .racer-card h2 {
    min-height: 1.55em;
    margin-top: -6px;
    font-size: clamp(1.4rem, 7.6vw, 2.55rem);
    line-height: .96;
  }
  .evangeline-card h2 {
    font-size: clamp(1.02rem, 5.85vw, 1.95rem);
    letter-spacing: -.06em;
  }
  .evangeline-card .racer-name-text {
    transform: scaleX(.94);
    transform-origin: center;
  }
  .ryan-card .racer-image-wrap img { transform: scale(1.11); }
  .racer-card small {
    min-height: 1.2em;
    font-size: clamp(.47rem, 2.4vw, .68rem);
    letter-spacing: .11em;
  }
  .vs {
    width: 100%;
    min-width: 0;
    position: static;
    align-self: center;
    z-index: 2;
    border: 2px solid rgba(255, 76, 0, .9);
    background: rgba(255, 255, 255, .96);
    font-size: clamp(.64rem, 3.2vw, .86rem);
    box-shadow:
      0 0 0 3px rgba(0, 0, 0, .72),
      0 8px 20px rgba(0, 0, 0, .55);
    transform: rotate(-5deg);
  }
  .home-footer { font-size: .55rem; letter-spacing: .18em; }

  .content { padding-top: 22px; }
  .rsvp-card { border-width: 3px; }
  .admin-tools { grid-template-columns: 1fr; }
  .counter { min-height: 44px; }
  .res-card { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .card-actions {
    width: 100%;
    justify-content: stretch;
  }
  .icon-btn { flex: 1 1 0; width: auto; }
}

@media (max-width: 480px) {
  .home-page {
    padding-top: max(16px, calc(var(--safe-top) + 10px));
    padding-right: max(10px, calc(var(--safe-right) + 8px));
    padding-bottom: max(14px, calc(var(--safe-bottom) + 10px));
    padding-left: max(10px, calc(var(--safe-left) + 8px));
  }
  .home-header h1 { line-height: .92; }
  .home-header p { margin-top: 8px; }
  .racer-card {
    border-radius: 20px;
    padding: 4px 2px 10px;
  }
  .racer-image-wrap { width: 100%; max-width: 210px; }

  .topbar { min-height: calc(56px + var(--safe-top)); }
  .topbar-inner { min-height: 56px; }
  .nav-home { flex-basis: 54px; min-width: 48px; }
  .profile-tab { font-size: .92rem; }
  .content {
    padding-top: 14px;
    padding-right: max(10px, calc(var(--safe-right) + 8px));
    padding-left: max(10px, calc(var(--safe-left) + 8px));
  }
  .rsvp-card { border-radius: 24px; }
  .banner { min-height: 118px; height: 31vw; max-height: 150px; }
  .form-body { padding: 0 16px 24px; }
  .profile-badge {
    margin-top: -27px;
    margin-bottom: 24px;
    padding: 11px 17px;
    border-radius: 14px;
    box-shadow: 0 7px 0 rgba(0,0,0,.25);
  }
  .profile-badge h1 { font-size: clamp(1.42rem, 8vw, 1.9rem); }
  .form-grid { gap: 13px; }
  .field { min-height: 52px; padding: 14px; font-size: 16px; }
  .choice { min-height: 56px; padding-inline: 8px; font-size: .92rem; }
  .primary-btn { min-height: 56px; font-size: clamp(1.2rem, 7vw, 1.55rem); }
  .admin-link { margin-top: 28px; letter-spacing: .18em; }
  .success-card { border-width: 3px; padding: 34px 18px; }
  .success-card p { letter-spacing: .11em; }

  .center-page {
    align-items: center;
    padding-right: max(12px, calc(var(--safe-right) + 10px));
    padding-left: max(12px, calc(var(--safe-left) + 10px));
  }
  .login-card { border-width: 2px; padding: 24px 18px; }

  .admin-page {
    padding-top: max(16px, calc(var(--safe-top) + 12px));
    padding-right: max(10px, calc(var(--safe-right) + 8px));
    padding-left: max(10px, calc(var(--safe-left) + 8px));
  }
  .admin-header { margin-bottom: 18px; }
  .admin-header h1 { font-size: 1.8rem; }
  .header-actions { gap: 6px; }
  .small-btn {
    min-height: 46px;
    padding: 9px 5px;
    font-size: .61rem;
    letter-spacing: .03em;
  }
  .admin-tabs { border-radius: 14px; margin-bottom: 14px; }
  .admin-tabs .profile-tab { min-height: 46px; border-radius: 10px; }
  .admin-tools { gap: 9px; margin-bottom: 14px; }
  .search { min-height: 50px; font-size: 16px; }
  .res-list { gap: 10px; }
  .res-card { border-radius: 16px; padding: 14px; }
  .icon-btn { min-height: 48px; height: 48px; }
  .danger-link { margin-top: 22px; font-size: .61rem; letter-spacing: .13em; }

  .modal-backdrop {
    place-items: end center;
    padding-right: max(8px, var(--safe-right));
    padding-bottom: max(8px, var(--safe-bottom));
    padding-left: max(8px, var(--safe-left));
  }
  .modal {
    width: 100%;
    max-height: calc(100dvh - max(12px, var(--safe-top)) - max(8px, var(--safe-bottom)));
    border-width: 2px;
    border-radius: 24px 24px 14px 14px;
    padding: 22px 16px 18px;
  }
  .modal h2 { text-align: center; }
}

@media (max-width: 350px) {
  .home-header h1 { font-size: 1.8rem; }
  .home-header p { font-size: .56rem; }
  .racer-card h2 { font-size: 1.32rem; }
  .evangeline-card h2 { font-size: .98rem; letter-spacing: -.065em; }
  .evangeline-card .racer-name-text { transform: scaleX(.91); }
  .racer-card small { font-size: .43rem; }
  .vs { width: 100%; font-size: .62rem; }
  .choice-grid { grid-template-columns: 1fr; gap: 10px; }
  .header-actions { grid-template-columns: 1fr; }
  .small-btn { min-height: 44px; }
  .modal-actions { grid-template-columns: 1fr; }
}

@media (max-width: 300px) {
  .racer-grid {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
    column-gap: 4px;
  }
  .vs { font-size: .56rem; border-width: 1px; }
  .evangeline-card h2 { font-size: .84rem; letter-spacing: -.07em; }
  .evangeline-card .racer-name-text { transform: scaleX(.88); }
}

@media (max-height: 620px) and (orientation: landscape) {
  .home-page { overflow-y: auto; }
  .home-header h1 { font-size: clamp(1.8rem, 7vw, 3rem); }
  .home-header p { margin-top: 5px; }
  .racer-image-wrap { width: min(34vh, 220px); }
  .racer-card h2 { min-height: auto; font-size: clamp(1.3rem, 5vw, 2.25rem); }
  .evangeline-card h2 { font-size: clamp(.98rem, 4vw, 1.8rem); }
  .home-footer { margin-top: 4px; }
  .content { padding-top: 14px; }
}

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

@media print {
  #toast, #confetti-canvas { display: none !important; }
}
