:root {
  --route-navy: #292559;
  --route-navy-deep: #191638;
  --route-blue: #2463eb;
  --route-cyan: #35c8db;
  --route-green: #11875d;
  --route-green-soft: #dff7ea;
  --route-yellow: #f6e926;
  --route-orange: #f59e42;
  --route-red: #d94d59;
  --route-ink: #1e293b;
  --route-muted: #64748b;
  --route-border: #dfe5ef;
}

.edu-game-wide-slot {
  width: 100%;
  margin: clamp(2.6rem, 6vw, 5rem) 0 1rem;
}

.edu-game-wide-slot:empty {
  display: none;
}

.edu-card--savings-game {
  width: 100%;
  max-width: none;
  padding: 0 !important;
  overflow: visible;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.budget-forest,
.budget-forest * {
  box-sizing: border-box;
}

.budget-forest {
  --game-aspect: 16 / 9;
  position: relative;
  width: min(100%, 1540px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(41, 37, 89, .12);
  border-radius: 28px;
  background: #f7f9fc;
  color: var(--route-ink);
  box-shadow: 0 26px 70px rgba(24, 32, 58, .13);
}

.budget-game-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto minmax(310px, .8fr);
  gap: 1.25rem;
  align-items: center;
  min-height: 176px;
  padding: clamp(1.4rem, 3vw, 2.3rem);
  overflow: hidden;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, .09), transparent 42%),
    linear-gradient(135deg, var(--route-navy-deep), var(--route-navy));
  color: #fff;
}

.budget-game-head::after {
  position: absolute;
  right: -80px;
  bottom: -115px;
  width: 270px;
  height: 270px;
  border: 36px solid rgba(246, 233, 38, .09);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.budget-game-head__copy,
.budget-game-mascot,
.budget-game-head__meta {
  position: relative;
  z-index: 1;
}

.budget-game-head__copy {
  max-width: 720px;
}

.budget-game-eyebrow {
  display: inline-flex;
  gap: .48rem;
  align-items: center;
  margin-bottom: .65rem;
  color: #e8e6ff;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.budget-game-eyebrow i {
  color: var(--route-yellow);
}

.budget-game-title {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 700;
  letter-spacing: -.055em;
  line-height: 1.05;
}

.budget-game-title > i {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 15px;
  background: rgba(255, 255, 255, .1);
  color: var(--route-yellow);
  font-size: 1.35rem;
}

.budget-game-description {
  max-width: 760px;
  margin: .9rem 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: .88rem;
  line-height: 1.65;
}

.budget-game-description strong {
  color: #fff;
}

.budget-game-mascot {
  display: flex;
  gap: .7rem;
  align-items: center;
  min-width: 195px;
  padding: .7rem;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  background: rgba(255, 255, 255, .075);
}

.budget-game-mascot img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .2));
}

.budget-game-mascot > div {
  display: grid;
  min-width: 0;
}

.budget-game-mascot span,
.budget-game-mascot small {
  color: rgba(255, 255, 255, .64);
  font-size: .58rem;
}

.budget-game-mascot strong {
  margin: .08rem 0;
  color: #fff;
  font-size: .86rem;
}

.budget-game-head__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}

.budget-game-head-chip {
  display: grid;
  min-height: 76px;
  place-content: center;
  padding: .65rem;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 15px;
  background: rgba(255, 255, 255, .075);
  text-align: center;
}

.budget-game-head-chip i {
  margin-bottom: .25rem;
  color: var(--route-yellow);
}

.budget-game-head-chip span {
  color: rgba(255, 255, 255, .58);
  font-size: .54rem;
  text-transform: uppercase;
}

.budget-game-head-chip strong {
  margin-top: .12rem;
  color: #fff;
  font-size: .64rem;
}

.budget-game-body {
  padding: clamp(.9rem, 2vw, 1.5rem);
}

.budget-game-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: .85rem;
}

.budget-stat {
  display: grid;
  gap: .15rem;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  padding: .7rem .85rem;
  border: 1px solid var(--route-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(30, 41, 59, .055);
}

.budget-stat span {
  display: flex;
  gap: .35rem;
  align-items: center;
  overflow: hidden;
  color: var(--route-muted);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.budget-stat span i {
  color: var(--route-blue);
}

.budget-stat strong {
  overflow: hidden;
  color: var(--route-navy);
  font-size: 1.12rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-stat--balance strong {
  color: var(--route-red);
}

.budget-stat--seeds strong {
  color: var(--route-green);
}

.budget-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 355px);
  gap: 1rem;
  align-items: start;
}

.budget-game-play {
  min-width: 0;
}

.budget-game-screen {
  position: relative;
  width: 100%;
  aspect-ratio: var(--game-aspect);
  min-height: 460px;
  overflow: hidden;
  border: 4px solid #17142f;
  border-radius: 20px;
  background: #14203f;
  box-shadow: 0 20px 42px rgba(23, 28, 56, .2);
  touch-action: pan-y;
}

.budget-game-screen:focus-visible {
  outline: 4px solid rgba(36, 99, 235, .3);
  outline-offset: 3px;
}

.budget-game-screen canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

.budget-game-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(145deg, #17142f, #292559);
  color: #fff;
}

.budget-game-loader[hidden] {
  display: none !important;
}

.budget-game-loader__inner {
  display: grid;
  justify-items: center;
  gap: .45rem;
  text-align: center;
}

.budget-game-loader__inner strong {
  font-size: 1rem;
}

.budget-game-loader__inner small {
  color: rgba(255, 255, 255, .68);
  font-size: .68rem;
}

.budget-game-loader__spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(255, 255, 255, .2);
  border-top-color: var(--route-yellow);
  border-radius: 50%;
  animation: route-spin .8s linear infinite;
}

.budget-game-loader.is-error {
  background: #4f1d2b;
}

.budget-game-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .35rem .8rem;
  align-items: center;
  margin-top: .75rem;
  padding: .75rem .9rem;
  border: 1px solid var(--route-border);
  border-radius: 14px;
  background: #fff;
}

.budget-game-progress > div:first-child {
  display: grid;
}

.budget-game-progress > div > span {
  color: var(--route-muted);
  font-size: .56rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.budget-game-progress > div > strong {
  color: var(--route-ink);
  font-size: .78rem;
}

.budget-game-progress__value {
  color: var(--route-green);
  font-size: .78rem;
  font-weight: 700;
}

.budget-game-progress__track {
  grid-column: 1 / -1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.budget-game-progress__track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--route-cyan), var(--route-green));
  transition: width .25s ease;
}

.budget-zone-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .7rem;
}

.budget-zone-button {
  display: flex;
  gap: .45rem;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  padding: .55rem .6rem;
  border: 0;
  border-radius: 13px;
  background: var(--route-navy);
  color: #fff;
  font: inherit;
  font-size: .7rem;
  font-weight: 700;
  box-shadow: 0 9px 18px rgba(41, 37, 89, .15);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.budget-zone-button > i {
  font-size: 1.05rem;
}

.budget-zone-button__key {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .13);
  font-size: .55rem;
}

.budget-zone-button--savings {
  background: var(--route-green);
}

.budget-zone-button--debt {
  background: #4f46a5;
}

.budget-zone-button--wants {
  background: #146c80;
}

.budget-zone-button:hover,
.budget-zone-button:focus-visible,
.budget-zone-button.is-active {
  outline: 0;
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(41, 37, 89, .22), 0 0 0 3px rgba(36, 99, 235, .14);
}

.budget-zone-button:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

.budget-game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .48rem;
  margin-top: .65rem;
}

.budget-game-button {
  display: inline-flex;
  gap: .35rem;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: .52rem .72rem;
  border: 1px solid var(--route-border);
  border-radius: 11px;
  background: #fff;
  color: #465166;
  font: inherit;
  font-size: .65rem;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.budget-game-button--primary {
  border-color: var(--route-blue);
  background: var(--route-blue);
  color: #fff;
}

.budget-game-button--review {
  border-color: #d6d3eb;
  color: var(--route-navy);
}

.budget-game-button:hover,
.budget-game-button:focus-visible {
  outline: 0;
  background: #f8fafc;
  box-shadow: 0 8px 18px rgba(30, 41, 59, .1), 0 0 0 3px rgba(36, 99, 235, .12);
  transform: translateY(-1px);
}

.budget-game-button--primary:hover,
.budget-game-button--primary:focus-visible {
  background: #174fc4;
  color: #fff;
}

.budget-game-button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.budget-game-hint {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
  margin: .7rem 0 0;
  color: var(--route-muted);
  font-size: .7rem;
  line-height: 1.5;
}

.budget-game-hint i {
  flex: 0 0 auto;
  color: var(--route-blue);
}

.budget-game-side {
  display: grid;
  gap: .75rem;
}

.budget-panel {
  padding: 1rem;
  border: 1px solid var(--route-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(30, 41, 59, .05);
}

.budget-panel--mission {
  background: linear-gradient(145deg, #fff, #f2f7ff);
}

.budget-panel__eyebrow {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  margin-bottom: .55rem;
  color: var(--route-blue);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.budget-panel h4 {
  margin: 0;
  color: var(--route-ink);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.5;
}

.budget-panel > p {
  margin: .4rem 0 0;
  color: var(--route-muted);
  font-size: .7rem;
  line-height: 1.55;
}

.budget-objectives {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  padding: 0;
  margin: .8rem 0 0;
  list-style: none;
}

.budget-objective {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .05rem .45rem;
  align-items: center;
  min-width: 0;
  padding: .55rem;
  border-radius: 12px;
  background: #f7f9fc;
}

.budget-objective > i {
  display: grid;
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--route-green-soft);
  color: var(--route-green);
}

.budget-objective--debt > i,
.budget-objective--wants > i {
  background: #fff0f1;
  color: var(--route-red);
}

.budget-objective span {
  overflow: hidden;
  color: var(--route-muted);
  font-size: .56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-objective strong {
  color: var(--route-ink);
  font-size: .66rem;
  white-space: nowrap;
}

.budget-event[hidden] {
  display: none !important;
}

.budget-event__character img,
.budget-event__character span {
  display: none;
}

.budget-event__options {
  display: grid;
  gap: .42rem;
  margin-top: .65rem;
}

.budget-event__options button {
  width: 100%;
  min-height: 42px;
  padding: .55rem .65rem;
  border: 1px solid var(--route-border);
  border-radius: 10px;
  background: #fff;
  color: var(--route-ink);
  font: inherit;
  font-size: .64rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.budget-keyboard-guide {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .7rem;
}

.budget-keyboard-guide span {
  display: inline-flex;
  gap: .28rem;
  align-items: center;
  color: var(--route-muted);
  font-size: .56rem;
  font-weight: 700;
}

.budget-keyboard-guide kbd {
  min-width: 26px;
  padding: .18rem .3rem;
  border: 0;
  border-radius: 7px;
  background: var(--route-navy);
  color: #fff;
  font-family: inherit;
  font-size: .53rem;
  box-shadow: none;
}

.budget-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.budget-forest.is-paused .budget-game-screen canvas {
  filter: saturate(.55) brightness(.75);
}

.budget-forest.is-low-balance .budget-stat--balance {
  border-color: rgba(217, 77, 89, .35);
  background: #fff5f6;
  animation: route-alert .8s ease infinite alternate;
}

@keyframes route-spin {
  to { transform: rotate(360deg); }
}

@keyframes route-alert {
  to { box-shadow: 0 0 0 4px rgba(217, 77, 89, .1); }
}

@media (max-width: 1240px) {
  .budget-game-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .budget-game-head__meta {
    grid-column: 1 / -1;
  }

  .budget-game-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 991.98px) {
  .budget-forest {
    border-radius: 22px;
  }

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

  .budget-game-side {
    grid-template-columns: 1fr 1fr;
  }

  .budget-panel--mission {
    grid-row: span 2;
  }
}

@media (max-width: 767.98px) {
  .edu-game-wide-slot {
    margin: 2.2rem 0 .5rem;
  }

  .budget-forest {
    width: 100%;
    border-radius: 18px;
  }

  .budget-game-head {
    grid-template-columns: 1fr;
    gap: .9rem;
    min-height: 0;
    padding: 1.2rem 1rem 1.3rem;
  }

  .budget-game-head__copy,
  .budget-game-title,
  .budget-game-description {
    min-width: 0;
    max-width: 100%;
  }

  .budget-game-title {
    font-size: clamp(1.75rem, 8vw, 2.35rem);
  }

  .budget-game-title > i {
    width: 46px;
    height: 46px;
  }

  .budget-game-description {
    font-size: .76rem;
    overflow-wrap: anywhere;
  }

  .budget-game-mascot {
    justify-self: stretch;
  }

  .budget-game-mascot img {
    width: 58px;
    height: 58px;
  }

  .budget-game-head__meta {
    grid-column: auto;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .budget-game-head-chip {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: .4rem;
    min-height: 46px;
    align-items: center;
    justify-content: start;
    padding: .55rem .7rem;
    text-align: left;
  }

  .budget-game-head-chip i {
    margin: 0;
  }

  .budget-game-head-chip strong {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .budget-game-body {
    padding: .65rem;
  }

  .budget-game-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .42rem;
  }

  .budget-stat {
    min-height: 58px;
    padding: .55rem .62rem;
  }

  .budget-stat:nth-child(4),
  .budget-stat:nth-child(5) {
    grid-column: span 1;
  }

  .budget-stat:last-child {
    grid-column: 1 / -1;
  }

  .budget-stat strong {
    font-size: .9rem;
  }

  .budget-game-screen {
    min-height: 500px;
    border-width: 3px;
    border-radius: 15px;
    touch-action: pan-y;
  }

  .budget-zone-controls {
    grid-template-columns: 1fr 1fr;
  }

  .budget-zone-button {
    min-height: 58px;
    font-size: .72rem;
  }

  .budget-game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .budget-game-button {
    min-height: 46px;
  }

  .budget-game-side {
    grid-template-columns: 1fr;
  }

  .budget-panel--mission {
    grid-row: auto;
  }
}

@media (max-width: 420px) {
  .budget-game-screen {
    min-height: 520px;
  }

  .budget-objectives {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .budget-game-loader__spinner,
  .budget-forest.is-low-balance .budget-stat--balance {
    animation: none !important;
  }

  .budget-game-progress__track > span,
  .budget-zone-button,
  .budget-game-button {
    transition: none !important;
  }
}
