.flight-quiz {
  max-width: none;
}

.flight-quiz [hidden] {
  display: none !important;
}

.race-panel {
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgb(126 196 255 / 24%);
  border-radius: 22px;
  background: #0c1d32;
  box-shadow: 0 24px 80px rgb(0 0 0 / 24%);
}

.race-entry {
  display: grid;
  grid-template-columns: 1fr minmax(240px, .75fr);
  gap: 2rem;
  align-items: start;
}

.race-panel h2,
.race-panel h3 {
  color: #fff;
  font-weight: 800;
}

.race-panel p,
.race-instructions {
  color: #c4d6e8;
}

.race-label {
  margin-bottom: .35rem;
  color: #62f4e3 !important;
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .14em;
}

.race-instructions {
  display: grid;
  gap: .6rem;
  padding-left: 1.3rem;
}

.race-entry form,
.race-question {
  display: grid;
  gap: .65rem;
}

.race-entry form {
  padding: 1.25rem;
  border: 1px solid rgb(126 196 255 / 16%);
  border-radius: 16px;
  background: #081728;
}

.race-entry-note {
  margin: 0;
  font-size: .85rem;
}

.flight-quiz.is-classroom-host #raceRoomCode {
  font-size: clamp(1.6rem, 4vw, 3rem);
}

.flight-quiz.is-classroom-host .race-sky {
  min-height: 210px;
}

.flight-quiz.is-classroom-host .race-track {
  min-height: 74px;
}

.flight-quiz.is-classroom-player .race-room-top {
  display: none;
}

.race-entry label,
.race-question label {
  color: #eaf5ff;
  font-weight: 700;
}

.race-entry input,
.race-question input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: .7rem .85rem;
  border: 1px solid #6a8aa8;
  border-radius: 10px;
  background: #f7fbff;
  color: #10233a;
  font: inherit;
}

.race-button {
  display: inline-block;
  width: fit-content;
  min-height: 46px;
  padding: .7rem 1.25rem;
  border: 0;
  border-radius: 12px;
  background: #62f4e3;
  color: #06202a;
  font: inherit;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.race-entry .race-button {
  width: 100%;
}

.race-button:hover,
.race-button:focus-visible {
  background: #fff;
  color: #06202a;
}

.race-button:disabled {
  opacity: .6;
  cursor: wait;
}

.race-button-secondary {
  border: 1px solid #62f4e3;
  background: transparent;
  color: #62f4e3;
}

.race-divider {
  margin: .55rem 0 .1rem;
  color: #a9bfd5;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-align: center;
}

.race-message {
  padding: .8rem 1rem;
  border: 1px solid #ffbd69;
  border-radius: 12px;
  background: #392b27;
  color: #fff4e5;
}

.race-room-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

#raceRoomCode {
  color: #fff;
  letter-spacing: .1em;
  overflow-wrap: anywhere;
}

.race-copy {
  padding: .2rem .55rem;
  border: 1px solid #5b829c;
  border-radius: 8px;
  background: transparent;
  color: #d3fdf8;
  font-size: .8rem;
  cursor: pointer;
}

.race-status {
  align-self: start;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: #143c4b;
  color: #a2fff0;
  font-size: .85rem;
  font-weight: 800;
}

.race-sky {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 1.15rem 1rem 2.2rem;
  border: 1px solid #477f9f;
  border-radius: 18px;
  background: radial-gradient(ellipse at 75% 4%, #4767a0 0, transparent 38%), linear-gradient(165deg, #0b1c42 0%, #145277 65%, #238499 100%);
  box-shadow: inset 0 0 50px rgb(3 14 35 / 35%);
}

.race-scenery {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.race-stars,
.race-clouds {
  position: absolute;
  inset: 0;
  width: 200%;
}

.race-stars {
  background-image: radial-gradient(circle, rgb(227 255 255 / 90%) 1px, transparent 1.8px), radial-gradient(circle, rgb(115 226 255 / 65%) 1px, transparent 2px);
  background-size: 87px 61px, 131px 97px;
  background-position: 0 0, 40px 30px;
  animation: race-drift 32s linear infinite;
}

.race-clouds {
  background-repeat: repeat-x;
  background-size: 460px 100%;
}

.race-clouds-far {
  opacity: .35;
  background-image: radial-gradient(ellipse 75px 15px at 90px 27%, #d2f3ff 0 55%, transparent 58%), radial-gradient(ellipse 105px 19px at 330px 62%, #d2f3ff 0 55%, transparent 58%);
  animation: race-drift 38s linear infinite;
}

.race-clouds-near {
  opacity: .22;
  background-image: radial-gradient(ellipse 90px 18px at 260px 45%, #e0fbff 0 55%, transparent 58%), radial-gradient(ellipse 105px 22px at 50px 85%, #c4f6ff 0 55%, transparent 58%);
  animation: race-drift 22s linear infinite;
}

.race-city {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 28px;
  opacity: .52;
  background: linear-gradient(90deg, transparent 8%, #081f3a 8% 15%, transparent 15% 19%, #081f3a 19% 23%, transparent 23% 30%, #081f3a 30% 42%, transparent 42% 48%, #081f3a 48% 54%, transparent 54% 60%, #081f3a 60% 70%, transparent 70% 76%, #081f3a 76% 82%, transparent 82% 86%, #081f3a 86% 96%, transparent 96%), linear-gradient(to top, #081f3a 0 6px, transparent 6px);
  background-size: 320px 100%;
}

.race-sky-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  color: #e0f9ff;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.race-sky-header span {
  padding: .2rem .55rem;
  border: 1px solid rgb(177 236 255 / 30%);
  border-radius: 999px;
  background: rgb(5 26 48 / 55%);
}

#raceTracks {
  position: relative;
}

.race-track {
  display: grid;
  grid-template-columns: minmax(90px, 130px) 1fr auto;
  align-items: center;
  gap: .7rem;
  min-height: 70px;
  border-bottom: 1px solid rgb(198 242 255 / 14%);
}

.race-pilot {
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 2px 6px #05182b;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-lane {
  position: relative;
  height: 52px;
  background: linear-gradient(to bottom, transparent 49%, rgb(183 242 255 / 24%) 49% 53%, transparent 53%);
}

.race-flightpath {
  position: absolute;
  top: 0;
  right: 25px;
  bottom: 0;
  left: 25px;
}

.race-gate {
  position: absolute;
  top: 12px;
  width: 12px;
  height: 28px;
  border: 2px solid #ffbd72;
  border-radius: 50%;
  background: rgb(255 176 81 / 12%);
  box-shadow: 0 0 10px rgb(255 190 96 / 70%), inset 0 0 6px rgb(255 190 96 / 55%);
  transform: translateX(-50%);
}

.race-gate.is-cleared {
  border-color: #7fffe8;
  background: rgb(98 244 227 / 15%);
  box-shadow: 0 0 10px rgb(98 244 227 / 65%);
}

.race-ship {
  position: absolute;
  top: 9px;
  width: 48px;
  height: 34px;
  margin-left: -24px;
  z-index: 1;
  transition: left .8s cubic-bezier(.2,.8,.2,1);
}

.race-ship-art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  animation: race-bob 2s ease-in-out infinite;
}

.race-ship-body {
  position: absolute;
  top: 6px;
  left: 10px;
  width: 37px;
  height: 22px;
  border: 2px solid #ddffff;
  border-radius: 55% 85% 85% 55%;
  background: linear-gradient(145deg, #f8ffff 10%, #74f5ec 45%, #168db2 100%);
  box-shadow: 0 0 15px rgb(98 244 227 / 70%), inset 0 -3px 4px rgb(0 53 89 / 30%);
}

.race-ship-body::before,
.race-ship-body::after {
  content: '';
  position: absolute;
  left: 4px;
  width: 13px;
  height: 8px;
  background: #64cbe4;
  border: 1px solid #d5ffff;
}

.race-ship-body::before {
  top: -7px;
  border-radius: 8px 8px 0 0;
  transform: skewX(30deg);
}

.race-ship-body::after {
  bottom: -7px;
  border-radius: 0 0 8px 8px;
  transform: skewX(-30deg);
}

.race-ship-window {
  position: absolute;
  top: 4px;
  right: 7px;
  width: 9px;
  height: 9px;
  border: 1px solid #eaffff;
  border-radius: 50%;
  background: #165680;
}

.race-ship-flame {
  position: absolute;
  top: 12px;
  left: 0;
  width: 16px;
  height: 10px;
  border-radius: 100% 5% 5% 100%;
  background: linear-gradient(90deg, transparent, #ffbf5c, #fff4bb);
  filter: drop-shadow(0 0 5px #ff9a4f);
  animation: race-flame .4s ease-in-out infinite alternate;
}

.race-progress {
  min-width: 3.2rem;
  color: #fff;
  font-weight: 800;
  text-align: right;
  text-shadow: 0 2px 6px #05182b;
}

@keyframes race-drift {
  to { transform: translateX(-460px); }
}

@keyframes race-bob {
  50% { transform: translateY(-4px); }
}

@keyframes race-flame {
  to { transform: scaleX(.65); }
}

.race-refresh-note {
  margin: .65rem 0 1.4rem;
  font-size: .85rem;
}

.race-waiting,
.race-question,
.race-finish {
  padding: 1.25rem;
  border: 1px solid rgb(126 196 255 / 18%);
  border-radius: 16px;
  background: #081728;
}

.race-question h3,
.race-finish h3 {
  margin-bottom: .75rem;
}

.race-choices {
  display: grid;
  gap: .6rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.race-option {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .9rem;
  border: 1px solid #466985;
  border-radius: 10px;
  cursor: pointer;
}

.race-option:has(input:checked) {
  border-color: #62f4e3;
  background: #103c47;
}

.race-option input {
  accent-color: #62f4e3;
}

.race-hint,
.race-answer-feedback {
  margin: 0;
}

.race-answer-feedback {
  min-height: 1.5em;
  color: #ffcf91 !important;
}

.race-answer-feedback.correct {
  color: #62f4e3 !important;
}

@media (max-width: 650px) {
  .race-entry {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .race-track {
    grid-template-columns: minmax(52px, 75px) 1fr auto;
    gap: .35rem;
  }

  .race-pilot,
  .race-progress {
    font-size: .8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .race-ship {
    transition: none;
  }

  .race-stars,
  .race-clouds,
  .race-ship-art,
  .race-ship-flame {
    animation: none;
  }
}
