:root {
  color-scheme: light;
  --ink: #1f504b;
  --muted: #708681;
  --paper: #fffdf8;
  --cream: #f7f2e4;
  --line: #ddd6bd;
  --green: #3f9c79;
  --green-dark: #28735b;
  --blue: #4b95c5;
  --blue-dark: #296a94;
  --gold: #efae3c;
  --red: #d86d61;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  overflow-x: hidden;
}

html {
  background: #edf5eb;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 9%, rgba(239, 174, 60, .18), transparent 25rem),
    radial-gradient(circle at 92% 14%, rgba(75, 149, 197, .18), transparent 31rem),
    linear-gradient(180deg, #edf6ec, #fbf5e8 62%, #edf4eb);
}

button {
  min-height: 46px;
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 4px solid rgba(57, 142, 185, .3);
  outline-offset: 3px;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 50px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 900;
  letter-spacing: .04em;
  text-decoration: none;
}

.brand:focus-visible {
  border-radius: 18px;
  outline: 4px solid #f0c35a;
  outline-offset: 4px;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 2px solid #cbd9d2;
  border-radius: 18px;
  color: white;
  background: var(--blue);
  box-shadow: 0 5px 0 var(--blue-dark);
  font-size: 27px;
}

.sound-button,
.small-button {
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.sound-button:hover,
.small-button:hover {
  border-color: #9dc4b4;
  background: #f5fbf7;
}

.hero,
.panel {
  border: 3px solid var(--line);
  border-radius: 38px;
  background: rgba(255, 253, 248, .96);
  box-shadow: 0 18px 42px rgba(63, 80, 61, .11);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(430px, 1.1fr);
  gap: 36px;
  padding: 48px;
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--green-dark);
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(45px, 6vw, 70px);
  line-height: .98;
  letter-spacing: -.04em;
}

.lead {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.52;
}

.note {
  display: flex;
  gap: 10px;
  margin: 0 0 26px;
  padding: 13px 15px;
  border: 1px solid #cbdccf;
  border-radius: 16px;
  color: #4e6b59;
  background: #eef7e9;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.hero-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.primary-button,
.secondary-button {
  min-height: 58px;
  padding: 0 26px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border: 0;
  color: white;
  background: var(--green);
  box-shadow: 0 8px 0 var(--green-dark);
}

.primary-button:hover {
  background: #48a783;
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 var(--green-dark);
}

.secondary-button {
  border: 2px solid var(--line);
  background: var(--paper);
}

.secondary-button:hover {
  border-color: #9fc3b2;
  background: #f5fbf7;
}

.hero-cycle {
  min-height: 400px;
  overflow: hidden;
  border: 3px solid white;
  border-radius: 31px;
  background: #dff0f4;
  box-shadow: 0 18px 29px rgba(45, 104, 126, .2);
}

.cycle-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 340px;
}

.cycle-sky {
  fill: #75bddd;
}

.cycle-ground {
  fill: #8dbb80;
}

.cycle-water {
  fill: #4d9bc8;
}

.cycle-water-light {
  fill: #79c3e4;
}

.cycle-mountain {
  fill: #778f83;
}

.cycle-snowcap {
  fill: #f5fbf9;
}

.cycle-sun {
  fill: #ffd35b;
  stroke: rgba(255, 229, 134, .6);
  stroke-width: 16;
}

.cycle-cloud {
  fill: #f5faf9;
  stroke: rgba(38, 91, 108, .1);
  stroke-width: 4;
}

.cycle-arrow {
  fill: none;
  stroke: #fff6ad;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 12 10;
}

.cycle-arrow.success {
  stroke: #63e5af;
  stroke-width: 11;
}

.cycle-drop {
  fill: #def6ff;
}

.hero-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: -65px 16px 15px;
  position: relative;
  z-index: 3;
}

.hero-legend span {
  padding: 11px 7px;
  border-radius: 13px;
  color: white;
  background: rgba(24, 76, 91, .86);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 52px 0 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.04;
}

.section-heading > p {
  max-width: 390px;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
  text-align: right;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.route-card {
  display: flex;
  min-height: 318px;
  flex-direction: column;
  padding: 27px;
  border: 3px solid var(--line);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 12px 0 #d8d1b9;
}

.route-icon {
  display: grid;
  width: 65px;
  height: 65px;
  margin-bottom: 25px;
  place-items: center;
  border-radius: 21px;
  color: var(--route-color);
  background: color-mix(in srgb, var(--route-color) 14%, white);
  font-size: 34px;
  font-weight: 900;
}

.route-card h3 {
  margin-bottom: 9px;
  font-size: 25px;
  line-height: 1.15;
}

.route-card > p:not(.eyebrow) {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.route-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.route-progress {
  color: var(--route-color);
  font-size: 14px;
  font-weight: 900;
}

.route-start {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 15px;
  color: white;
  background: var(--route-color);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--route-color) 72%, black);
  cursor: pointer;
  font-weight: 900;
}

.route-start:hover {
  filter: brightness(1.07);
}

.route-start:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--route-color) 72%, black);
}

.journal {
  margin-top: 42px;
  padding: 25px;
  border: 2px solid #d4dfcf;
  border-radius: 26px;
  background: #edf5e9;
}

.journal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.journal-head h2 {
  margin: 0;
  font-size: 26px;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 7px;
}

.stamp {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #c7d4c2;
  border-radius: 50% 50% 50% 12px;
  color: #8fa18b;
  background: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 900;
  transform: rotate(45deg);
}

.stamp > span {
  transform: rotate(-45deg);
}

.stamp.done {
  border-color: #6bb994;
  color: white;
  background: var(--blue);
}

.game-shell {
  padding: 30px;
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.game-header h1 {
  margin: 0 0 4px;
  font-size: clamp(31px, 4vw, 47px);
}

.game-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.progress-track {
  width: min(320px, 34vw);
  height: 13px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7e4d7;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.progress-text {
  min-width: 48px;
  font-weight: 900;
}

.mission-layout {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(430px, 1.05fr);
  gap: 22px;
}

.scene-card,
.control-card {
  border: 2px solid var(--line);
  border-radius: 28px;
}

.scene-card {
  overflow: hidden;
  background: #e6f2f4;
}

.scene-top {
  position: relative;
  min-height: 290px;
}

.scene-top .cycle-svg {
  min-height: 290px;
}

.mission-labels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  color: #315c58;
  background: #f6fbf7;
  font-weight: 900;
}

.mission-chip {
  padding: 9px 12px;
  border: 2px solid #c5d9d2;
  border-radius: 13px;
  background: white;
}

.mission-arrow {
  color: var(--blue);
  font-size: 24px;
}

.control-card {
  padding: 26px;
  background: #fbfaf3;
}

.question {
  margin: 6px 0 19px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.15;
}

.answers {
  display: grid;
  gap: 12px;
}

.action-option {
  min-height: 85px;
  padding: 13px 16px;
  border: 3px solid #ddd9ca;
  border-radius: 18px;
  background: white;
  box-shadow: 0 5px 0 #d9d5c5;
  cursor: pointer;
  text-align: left;
}

.action-option:hover {
  border-color: #82b5c9;
  background: #f3fafc;
}

.action-option.correct {
  border-color: var(--green);
  color: #226d55;
  background: #e9f7ef;
  box-shadow: 0 5px 0 #9bceb6;
}

.action-option.wrong {
  border-color: #e58c83;
  color: #9b3f37;
  background: #fff0ee;
  box-shadow: 0 5px 0 #e1b0aa;
}

.action-option:disabled {
  cursor: default;
}

.action-single {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 13px;
}

.action-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  color: var(--blue-dark);
  background: #e6f4f8;
  font-size: 28px;
  font-weight: 900;
}

.action-copy strong,
.action-copy span {
  display: block;
}

.action-copy strong {
  font-size: 18px;
}

.action-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sequence {
  display: grid;
  grid-template-columns: 1fr 20px 1fr 20px 1fr;
  align-items: center;
  gap: 4px;
}

.sequence-step {
  min-width: 0;
  text-align: center;
}

.sequence-step b {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 5px;
  place-items: center;
  border-radius: 13px;
  color: var(--blue-dark);
  background: #e7f4f8;
  font-size: 23px;
}

.sequence-step span {
  display: block;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.sequence-arrow {
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.feedback-zone {
  min-height: 101px;
  margin-top: 17px;
}

.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 85px;
  padding: 15px 18px;
  border: 2px solid #d5e0d1;
  border-radius: 18px;
  background: #eff7ed;
}

.feedback.error {
  border-color: #ecc2bc;
  background: #fff3f1;
}

.feedback strong,
.feedback span {
  display: block;
}

.feedback span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.hint {
  min-height: 85px;
  padding: 17px 18px;
  border: 2px solid #e8d18b;
  border-radius: 18px;
  color: #70551c;
  background: #fff8dc;
  font-weight: 800;
  line-height: 1.45;
}

.game-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
}

.result {
  padding: 57px 44px;
  text-align: center;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 23px;
  padding: 15px 23px;
  border-radius: 20px;
  color: white;
  background: var(--blue-dark);
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.result h1 {
  max-width: 820px;
  margin-right: auto;
  margin-left: auto;
}

.result-summary {
  color: var(--muted);
  font-size: 19px;
  font-weight: 800;
}

.stars {
  margin: 23px 0;
  color: var(--gold);
  font-size: 51px;
  letter-spacing: .12em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 29px 0;
}

.stat {
  padding: 20px 12px;
  border: 2px solid #d7e2d3;
  border-radius: 20px;
  background: #eff7ed;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 34px;
}

.stat span {
  color: var(--muted);
  font-weight: 800;
}

.result-actions {
  justify-content: center;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .route-card {
    min-height: 235px;
  }

  .stamp-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .mission-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .app {
    width: min(1120px, calc(100% - 20px));
    padding-top: 12px;
  }

  .brand small {
    display: none;
  }

  .sound-button {
    width: 48px;
    padding: 0;
    font-size: 0;
  }

  .sound-button::before {
    font-size: 20px;
    content: "♪";
  }

  .hero,
  .game-shell,
  .result {
    padding: 23px 17px;
    border-radius: 28px;
  }

  h1 {
    font-size: 42px;
  }

  .lead {
    font-size: 16px;
  }

  .hero-cycle {
    min-height: 325px;
  }

  .hero-cycle .cycle-svg {
    min-height: 300px;
  }

  .hero-legend {
    grid-template-columns: 1fr;
    margin-top: -112px;
  }

  .section-heading {
    display: block;
    margin-top: 37px;
  }

  .section-heading > p {
    margin-top: 12px;
    text-align: left;
  }

  .route-card {
    min-height: 275px;
    padding: 22px;
  }

  .stamp-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .game-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-row,
  .progress-track {
    width: 100%;
  }

  .scene-top,
  .scene-top .cycle-svg {
    min-height: 230px;
  }

  .mission-labels {
    align-items: stretch;
    flex-direction: column;
  }

  .mission-arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .control-card {
    padding: 22px 14px;
  }

  .sequence {
    grid-template-columns: 1fr 15px 1fr 15px 1fr;
  }

  .sequence-step span {
    font-size: 9px;
  }

  .feedback {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback .primary-button {
    width: 100%;
  }

  .game-actions {
    flex-direction: column-reverse;
  }

  .game-actions button {
    width: 100%;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
  }
}

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