:root {
  color-scheme: light;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: #172c30;
  background: #102126;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #172c30;
  --muted: #718184;
  --mint: #bdf36b;
  --teal: #176b66;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #102126;
}

button {
  font: inherit;
}

.experience {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  height: 100dvh;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 48% 38%, rgba(74, 113, 94, 0.18), transparent 48%),
    #102126;
}

.map-stage {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.map-frame {
  position: relative;
  width: min(100vw, 183.333dvh);
  aspect-ratio: 1408 / 768;
  overflow: hidden;
  background: #b7d2c9;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.24);
}

.map-world {
  position: absolute;
  inset: 0;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: top left;
  transition: transform 950ms cubic-bezier(0.2, 0.75, 0.2, 1);
  will-change: transform;
}

.campus-image,
.route-map {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.campus-image {
  object-fit: fill;
}

.route-map {
  overflow: visible;
}

.route-line {
  fill: none;
  stroke: #f4ffce;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2 11;
  filter: drop-shadow(0 2px 4px rgba(18, 46, 39, 0.75));
}

.route-stop {
  cursor: pointer;
  outline: none;
  pointer-events: all;
}

.route-stop.is-complete {
  cursor: default;
  pointer-events: none;
}

.route-stop.is-locked {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}

.route-stop circle {
  fill: rgba(16, 33, 38, 0.9);
  stroke: #f4ffce;
  stroke-width: 3;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
  transition: fill 180ms ease, stroke 180ms ease;
}

.route-stop text {
  fill: #fff;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.route-stop.is-info-stop rect {
  fill: #bdf36b;
  stroke: #153c39;
  stroke-width: 3;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

.route-stop.is-info-stop text {
  fill: #153c39;
  letter-spacing: 0.04em;
}

.route-stop.is-info-stop:hover rect,
.route-stop.is-info-stop:focus-visible rect {
  fill: #fff;
  stroke: #bdf36b;
  stroke-width: 5;
}

.route-stop.is-info-stop:hover text,
.route-stop.is-info-stop:focus-visible text {
  fill: #153c39;
}

.route-stop:hover circle,
.route-stop:focus-visible circle {
  fill: #fff;
  stroke: #bdf36b;
  stroke-width: 5;
}

.route-stop.is-complete circle {
  fill: #bdf36b;
  stroke: #153c39;
}

.route-stop.is-complete text {
  fill: #153c39;
}

.route-stop.is-current circle {
  fill: #fff;
  stroke: #bdf36b;
  stroke-width: 5;
  animation: pulse 1.8s ease-in-out infinite;
}

.route-stop.is-current text {
  fill: #153c39;
}

.route-start circle {
  fill: #bdf36b;
  stroke: #153c39;
  stroke-width: 3;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

.route-start {
  cursor: pointer;
  outline: none;
}

.route-start.is-complete {
  cursor: default;
  pointer-events: none;
}

.route-start.is-locked {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}

.route-start.is-current circle,
.route-start:hover circle,
.route-start:focus-visible circle {
  fill: #fff;
  stroke: #bdf36b;
  stroke-width: 5;
}

.route-start.is-current circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: start-pulse 1.8s ease-in-out infinite;
}

.route-start.is-complete circle {
  fill: #bdf36b;
  stroke: #153c39;
}

.route-start text {
  fill: #153c39;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.route-start.is-current text,
.route-start:hover text,
.route-start:focus-visible text {
  fill: #153c39;
}

.map-hint {
  position: absolute;
  top: 18px;
  left: 18px;
  max-width: calc(100% - 36px);
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  color: #f5f8ee;
  background: rgba(16, 33, 38, 0.78);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.quiz-panel {
  position: absolute;
  z-index: 2;
  left: max(22px, calc((100vw - min(100vw, 183.333dvh)) / 2 + 24px));
  bottom: 24px;
  width: min(460px, calc(100vw - 36px));
  padding: 20px 22px 13px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  background: rgba(250, 252, 246, 0.97);
  box-shadow: 0 20px 65px rgba(7, 23, 25, 0.3);
  backdrop-filter: blur(14px);
}

.quiz-panel[hidden] {
  display: none;
}

.quiz-panel.is-reading {
  display: flex;
  height: min(760px, calc(100dvh - 48px));
  flex-direction: column;
  overflow: hidden;
}

.quiz-panel.is-reading .quiz-topline,
.quiz-panel.is-reading .progress-track {
  display: none;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.location {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.location-icon {
  position: relative;
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: #e5f4d7;
}

.location-icon::before {
  width: 10px;
  height: 10px;
  border: 3px solid #347563;
  border-radius: 50% 50% 50% 0;
  content: "";
  transform: rotate(-45deg);
}

.eyebrow {
  margin: 0 0 3px;
  color: #69807c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.location h1 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-count {
  flex: 0 0 auto;
  margin: 0;
  color: #536b69;
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 4px;
  margin: 14px 0 16px;
  overflow: hidden;
  border-radius: 8px;
  background: #e1e9e1;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #78b65a;
  transition: width 350ms ease;
}

.question-area h2,
.finish-message h2 {
  margin: 0 0 13px;
  color: #1a3032;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid #dce5dd;
  border-radius: 10px;
  color: #314748;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.answer:hover:not(:disabled),
.answer:focus-visible {
  border-color: #80b778;
  background: #f6faef;
  outline: none;
  transform: translateY(-1px);
}

.answer:disabled {
  cursor: default;
}

.answer-letter {
  display: grid;
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  color: #4d716a;
  background: #edf3eb;
  font-size: 11px;
  font-weight: 800;
}

.answer-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.answer.is-correct {
  border-color: #9ac879;
  background: #eff8e7;
}

.answer.is-correct .answer-letter {
  color: #fff;
  background: #4e915d;
}

.answer.is-wrong {
  border-color: #e6a19a;
  background: #fff1ef;
}

.answer.is-wrong .answer-letter {
  color: #fff;
  background: #cb655b;
}

.feedback {
  min-height: 16px;
  margin: 8px 1px 0;
  color: #4e7f4c;
  font-size: 12px;
  font-weight: 700;
}

.feedback.is-wrong {
  color: #b45249;
}

.finish-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 0 0;
}

.finish-message[hidden] {
  display: none;
}

.finish-message h2 {
  margin: 5px 0 0;
}

.explanation-view {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.explanation-view[hidden] {
  display: none;
}

.explanation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e9e1;
}

.explanation-heading h2 {
  margin: 3px 0 0;
  color: #1a3032;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

.close-explanations {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid #dce5dd;
  border-radius: 9px;
  color: #314748;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.close-explanations:hover,
.close-explanations:focus-visible {
  border-color: #80b778;
  background: #f6faef;
  outline: none;
}

.explanation-scroll {
  min-height: 0;
  flex: 1;
  margin-top: 4px;
  padding-right: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.explanation-item {
  padding: 12px 0;
  border-bottom: 1px solid #e7ede6;
}

.explanation-item h3 {
  margin: 0 0 5px;
  color: #24413e;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.explanation-item p {
  margin: 0;
  color: #435b59;
  font-size: 12px;
  line-height: 1.55;
}

.restart-button {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  color: #193632;
  background: #c8ed9c;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.restart-button:hover,
.restart-button:focus-visible {
  background: #b4e57e;
  outline: 2px solid #458363;
  outline-offset: 2px;
}

@keyframes pulse {
  0%, 100% { r: 12px; }
  50% { r: 17px; }
}

@keyframes start-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@media (max-width: 700px) {
  .experience {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
  }

  .map-stage {
    flex: 0 0 auto;
    width: 100%;
    padding-top: 8px;
  }

  .map-frame {
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  }

  .map-hint {
    top: 10px;
    left: 10px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .quiz-panel {
    position: relative;
    left: auto;
    bottom: auto;
    width: calc(100% - 24px);
    max-width: 520px;
    margin: 12px auto 18px;
    padding: 17px 16px 11px;
    border-radius: 16px;
  }

  .quiz-panel.is-reading {
    height: min(72dvh, 760px);
  }

  .progress-track {
    margin: 11px 0 12px;
  }

  .question-area h2,
  .finish-message h2 {
    margin-bottom: 10px;
    font-size: 16px;
  }
}

@media (max-width: 370px) {
  .quiz-panel {
    padding-right: 13px;
    padding-left: 13px;
  }

  .location h1 {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
