:root {
  --ink-navy: #17233f;
  --screen-cream: #fff1b8;
  --route-green: #62ad58;
  --route-dark: #397349;
  --lake-blue: #4e91c7;
  --berry-red: #d9574d;
  --shadow-plum: #58416f;
  --paper-white: #fff9dc;
  --screen-shadow: #d5c77f;
  --focus-yellow: #ffd851;
  --display-font: "Press Start 2P", monospace;
  --body-font: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow-x: hidden;
  color: var(--ink-navy);
  background: #75b85f;
  font-family: var(--body-font);
  font-size: 15px;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: #75b85f;
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 7%) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / 7%) 1px, transparent 1px),
    linear-gradient(135deg, rgb(57 115 73 / 12%) 25%, transparent 25% 75%, rgb(255 255 255 / 7%) 75%);
  background-size: 32px 32px;
}

.world {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.world-route {
  position: absolute;
  border: 5px solid #9c7a48;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 14%) 50%, transparent 50%),
    linear-gradient(#d5ad68 50%, #c99a58 50%);
  background-size: 32px 32px, 32px 32px;
  box-shadow: inset 0 0 0 5px #e7c77e, 8px 8px 0 rgb(23 35 63 / 16%);
}

.world-route-vertical {
  top: -8%;
  left: 9%;
  width: 142px;
  height: 116%;
  clip-path: polygon(8px 0, calc(100% - 14px) 0, 100% 7%, calc(100% - 8px) 18%, 100% 31%, calc(100% - 12px) 45%, 100% 61%, calc(100% - 9px) 78%, 100% 92%, calc(100% - 8px) 100%, 12px 100%, 0 92%, 8px 76%, 0 62%, 11px 48%, 0 30%, 8px 15%, 0 5%);
}

.world-route-horizontal {
  right: -5%;
  bottom: 13%;
  width: 74%;
  height: 118px;
  clip-path: polygon(0 10px, 14% 0, 29% 8px, 46% 0, 64% 9px, 81% 0, 100% 11px, 100% calc(100% - 9px), 85% 100%, 68% calc(100% - 8px), 49% 100%, 30% calc(100% - 10px), 14% 100%, 0 calc(100% - 8px));
}

.grass-patch {
  position: absolute;
  border: 4px solid var(--route-dark);
  background-color: #4d934b;
  background-image:
    linear-gradient(45deg, transparent 42%, #a6d56e 42% 54%, transparent 54%),
    linear-gradient(-45deg, transparent 42%, #2f7445 42% 54%, transparent 54%);
  background-position: 0 0, 8px 0;
  background-size: 16px 16px;
  box-shadow: 6px 6px 0 rgb(23 35 63 / 18%);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.grass-patch-one {
  top: 16%;
  left: 1.5%;
  width: 108px;
  height: 152px;
}

.grass-patch-two {
  right: 2%;
  bottom: 3%;
  width: 190px;
  height: 96px;
}

.grass-patch-three {
  top: 5%;
  left: 28%;
  width: 180px;
  height: 78px;
}

.world-tree {
  position: absolute;
  width: 64px;
  height: 76px;
  background: transparent;
  filter: drop-shadow(6px 6px 0 rgb(23 35 63 / 24%));
}

.world-tree::before {
  content: "";
  position: absolute;
  inset: 0 0 18px;
  border: 5px solid var(--ink-navy);
  background: linear-gradient(90deg, #397349 0 34%, #5da856 34% 70%, #8bcc66 70%);
  clip-path: polygon(31% 0, 69% 0, 69% 10%, 83% 10%, 83% 24%, 94% 24%, 94% 42%, 100% 42%, 100% 75%, 88% 75%, 88% 90%, 66% 90%, 66% 100%, 34% 100%, 34% 90%, 12% 90%, 12% 75%, 0 75%, 0 42%, 6% 42%, 6% 24%, 17% 24%, 17% 10%, 31% 10%);
  box-shadow: inset 7px -7px 0 #2f6541;
}

.world-tree::after {
  content: "";
  position: absolute;
  left: 25px;
  bottom: 0;
  width: 15px;
  height: 23px;
  border: 4px solid var(--ink-navy);
  border-top: 0;
  background: #9c6a43;
}

.world-tree-one {
  top: 3%;
  left: 2%;
}

.world-tree-two {
  top: 2%;
  left: 6%;
}

.world-tree-three {
  top: 2.5%;
  right: 26%;
}

.world-tree-four {
  top: 3%;
  right: 21.5%;
}

.world-tree-five {
  right: 2%;
  bottom: 25%;
}

.world-tree-six {
  right: 6.5%;
  bottom: 25%;
}

.world-tree-seven {
  right: 2.5%;
  bottom: 34%;
}

.world-water {
  position: absolute;
  top: 13%;
  right: -36px;
  width: 224px;
  height: 220px;
  border: 7px solid var(--ink-navy);
  background:
    repeating-linear-gradient(0deg, transparent 0 18px, rgb(255 255 255 / 24%) 18px 22px, transparent 22px 34px),
    var(--lake-blue);
  box-shadow: inset 0 0 0 6px #75bed6, 8px 8px 0 rgb(23 35 63 / 20%);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 14px, 14px 14px);
}

.world-water::after {
  content: "";
  position: absolute;
  top: 54px;
  left: 48px;
  width: 26px;
  height: 12px;
  border: 4px solid var(--ink-navy);
  border-top: 0;
  background: var(--route-green);
  box-shadow: 84px 75px 0 -2px var(--route-green), 84px 75px 0 2px var(--ink-navy);
}

.world-flowers {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--paper-white);
  box-shadow:
    16px 0 var(--berry-red),
    32px 0 var(--focus-yellow),
    0 16px var(--berry-red),
    16px 16px var(--paper-white),
    32px 16px var(--berry-red);
}

.world-flowers-one {
  left: 4%;
  bottom: 12%;
}

.world-flowers-two {
  top: 15%;
  left: 30%;
  transform: rotate(90deg);
}

.world-sign {
  position: absolute;
  top: 31%;
  left: calc(9% + 42px);
  width: 58px;
  height: 42px;
  border: 5px solid var(--ink-navy);
  background: #d89b55;
  box-shadow: inset 0 0 0 4px #f0c77d, 5px 5px 0 rgb(23 35 63 / 22%);
}

.world-sign::before {
  content: "DEV";
  position: absolute;
  inset: 10px 0 0;
  color: var(--ink-navy);
  font-family: var(--display-font);
  font-size: 6px;
  text-align: center;
}

.world-sign i {
  position: absolute;
  top: 37px;
  left: 20px;
  width: 10px;
  height: 30px;
  border: 4px solid var(--ink-navy);
  border-top: 0;
  background: #9c6a43;
}

.world-explorer {
  position: absolute;
  left: calc(9% + 56px);
  bottom: 24%;
  width: 28px;
  height: 36px;
  border: 4px solid var(--ink-navy);
  background: linear-gradient(var(--berry-red) 0 42%, var(--paper-white) 42% 56%, var(--lake-blue) 56%);
  box-shadow: 4px 4px 0 rgb(23 35 63 / 30%);
}

.world-explorer::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 3px;
  width: 14px;
  height: 13px;
  border: 4px solid var(--ink-navy);
  background: #efb06c;
  box-shadow: -5px -4px 0 var(--berry-red);
}

.world-explorer::after {
  content: "";
  position: absolute;
  left: -4px;
  bottom: -10px;
  width: 10px;
  height: 8px;
  background: var(--ink-navy);
  box-shadow: 18px 0 var(--ink-navy);
}

.world-explorer i {
  position: absolute;
  top: 11px;
  left: -9px;
  width: 8px;
  height: 13px;
  border: 3px solid var(--ink-navy);
  background: var(--paper-white);
  box-shadow: 29px 0 0 -3px var(--paper-white), 29px 0 0 0 var(--ink-navy);
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 20;
  padding: 10px 12px;
  border: 3px solid var(--ink-navy);
  background: var(--focus-yellow);
  font-family: var(--display-font);
  font-size: 9px;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

.console {
  width: min(940px, 100%);
  border: 6px solid var(--ink-navy);
  border-radius: 24px 24px 54px 24px;
  background: var(--shadow-plum);
  box-shadow: 10px 10px 0 rgb(23 35 63 / 40%), inset 0 0 0 5px #75608e;
}

.console-header {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 34px 22px;
  color: var(--paper-white);
}

.console-kicker {
  margin-bottom: 8px;
  color: #d9cdef;
  font-family: var(--display-font);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.console-title {
  font-family: var(--display-font);
  font-size: clamp(15px, 3vw, 26px);
  line-height: 1.3;
  text-shadow: 4px 4px 0 var(--ink-navy);
}

.console-title span {
  color: var(--focus-yellow);
}

.power {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display-font);
  font-size: 8px;
}

.power-light {
  width: 14px;
  height: 14px;
  border: 3px solid var(--ink-navy);
  border-radius: 50%;
  background: var(--berry-red);
  box-shadow: 0 0 0 3px rgb(255 241 184 / 18%);
}

.game-screen {
  margin: 0 24px;
  overflow: hidden;
  border: 7px solid var(--ink-navy);
  border-radius: 6px;
  background: var(--screen-cream);
  box-shadow: inset 0 0 0 5px var(--screen-shadow);
}

.screen-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 10px;
  border-bottom: 4px solid var(--ink-navy);
  color: var(--paper-white);
  background: var(--lake-blue);
  font-family: var(--display-font);
  font-size: 8px;
  line-height: 1.5;
}

.screen-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.6fr);
  gap: 20px;
  padding: 24px;
}

.player-card {
  align-self: start;
}

.portrait-frame {
  aspect-ratio: 1;
  display: grid;
  place-items: end center;
  overflow: hidden;
  border: 4px solid var(--ink-navy);
  background:
    linear-gradient(45deg, rgb(255 255 255 / 18%) 25%, transparent 25% 75%, rgb(255 255 255 / 18%) 75%),
    linear-gradient(45deg, rgb(255 255 255 / 18%) 25%, transparent 25% 75%, rgb(255 255 255 / 18%) 75%),
    var(--route-green);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  box-shadow: 5px 5px 0 var(--screen-shadow);
}

.pixel-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  image-rendering: pixelated;
}

.player-stats {
  margin-top: 16px;
  border: 3px solid var(--ink-navy);
  background: var(--paper-white);
}

.player-stats div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 8px 10px;
}

.player-stats div + div {
  border-top: 2px solid var(--ink-navy);
}

.player-stats dt,
.energy > span:first-child {
  font-family: var(--display-font);
  font-size: 7px;
}

.player-stats dd {
  font-size: 12px;
  font-weight: 600;
}

.energy {
  margin-top: 14px;
}

.energy-bar {
  display: block;
  height: 12px;
  margin-top: 7px;
  padding: 2px;
  border: 2px solid var(--ink-navy);
  background: var(--paper-white);
}

.energy-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--route-dark) 0 12px, var(--route-green) 12px 15px);
}

.dialogue-box {
  min-height: 386px;
  padding: 24px;
  border: 4px solid var(--ink-navy);
  outline: 4px double var(--ink-navy);
  outline-offset: -10px;
  background: var(--paper-white);
  box-shadow: 6px 6px 0 var(--screen-shadow);
}

.game-panel {
  min-height: 320px;
  padding: 10px;
}

.game-panel + .game-panel {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 3px solid var(--ink-navy);
}

.js .game-panel:not(.is-active) {
  display: none;
}

.js .game-panel + .game-panel {
  margin-top: 0;
  padding-top: 10px;
  border-top: 0;
}

.js .game-panel.is-active {
  animation: panel-in 180ms steps(3, end);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-label {
  margin-bottom: 13px;
  color: var(--berry-red);
  font-family: var(--display-font);
  font-size: 8px;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin-bottom: 18px;
  font-family: var(--display-font);
  font-size: clamp(16px, 2.5vw, 22px);
  line-height: 1.55;
}

.game-panel > p:not(.panel-label) {
  margin-bottom: 16px;
}

strong {
  font-weight: 600;
}

.quest-note {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
  padding: 12px;
  border-left: 6px solid var(--berry-red);
  background: #f3dda0;
}

.quest-note > span {
  color: var(--berry-red);
  font-size: 24px;
}

.quest-note p {
  font-size: 13px;
  line-height: 1.5;
}

.inventory {
  display: grid;
  gap: 9px;
  margin-top: 20px;
  list-style: none;
}

.inventory li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  padding-bottom: 7px;
  border-bottom: 2px dotted var(--screen-shadow);
  font-size: 12px;
  font-weight: 600;
}

.inventory i {
  height: 9px;
  border: 2px solid var(--ink-navy);
  background: repeating-linear-gradient(90deg, var(--lake-blue) 0 9px, var(--paper-white) 9px 12px);
}

.contact-list {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  font-style: normal;
}

.contact-list a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 8px;
  border-bottom: 2px solid var(--screen-shadow);
  text-decoration: none;
}

.contact-list a:hover {
  background: var(--screen-cream);
}

.contact-list a:focus-visible {
  outline: 3px solid var(--ink-navy);
  outline-offset: 2px;
  background: var(--screen-cream);
}

.contact-list span {
  color: var(--shadow-plum);
  font-family: var(--display-font);
  font-size: 7px;
}

.contact-list strong {
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 12px;
}

.command-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 5px solid var(--ink-navy);
  background: var(--screen-cream);
}

.command {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--ink-navy);
  background: var(--paper-white);
  font-family: var(--display-font);
  font-size: 8px;
  line-height: 1.5;
  text-decoration: none;
}

.command + .command {
  border-left: 4px solid var(--ink-navy);
}

.command span {
  visibility: hidden;
  color: var(--berry-red);
}

.command:hover,
.command.is-active {
  background: var(--focus-yellow);
}

.command:hover span,
.command:focus-visible span,
.command.is-active span {
  visibility: visible;
}

.command:focus-visible,
.classic-link:focus-visible {
  outline: 4px solid var(--ink-navy);
  outline-offset: -6px;
}

.console-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 94px;
  padding: 22px 34px 26px;
  color: var(--paper-white);
}

.control-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d9cdef;
  font-family: var(--display-font);
  font-size: 7px;
  line-height: 1.8;
}

kbd {
  min-width: 26px;
  padding: 3px 5px;
  border: 2px solid var(--ink-navy);
  border-bottom-width: 4px;
  background: var(--paper-white);
  color: var(--ink-navy);
  font-family: var(--body-font);
  font-size: 11px;
  text-align: center;
}

.classic-link {
  padding: 10px 0;
  color: var(--paper-white);
  font-size: 12px;
  text-decoration: none;
}

.classic-link:hover {
  color: var(--focus-yellow);
}

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

@media (max-width: 760px) {
  body {
    display: block;
    padding: 0;
    background: var(--shadow-plum);
  }

  .world {
    display: none;
  }

  .console {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .console-header {
    min-height: 88px;
    padding: 20px;
  }

  .game-screen {
    margin: 0 12px;
    border-width: 5px;
  }

  .screen-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }

  .dialogue-box {
    min-height: 330px;
    padding: 16px;
  }

  .game-panel {
    min-height: 276px;
    padding: 7px;
  }

  .player-stats div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .console-footer {
    padding: 20px;
  }
}

@media (max-width: 580px) {
  body {
    font-size: 14px;
  }

  .console-header {
    align-items: flex-end;
  }

  .console-kicker,
  .screen-status,
  .control-hint {
    display: none;
  }

  .power {
    font-size: 7px;
  }

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

  .player-card {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }

  .portrait-frame {
    grid-row: 1 / span 2;
  }

  .player-stats,
  .energy {
    margin-top: 0;
  }

  .dialogue-box {
    min-height: 390px;
  }

  .game-panel {
    min-height: 338px;
  }

  .command {
    min-height: 62px;
    padding: 9px 4px;
    font-size: 7px;
  }

  .command span {
    display: none;
  }

  .contact-list a {
    display: grid;
    gap: 3px;
  }

  .contact-list strong {
    text-align: left;
  }

  .console-footer {
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .power {
    display: none;
  }

  .console-title {
    font-size: 15px;
  }

  .game-screen {
    margin: 0 8px;
  }

  .screen-layout {
    padding: 12px;
  }

  .player-card {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .dialogue-box {
    padding: 12px;
  }

  h1,
  h2 {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .game-panel.is-active {
    animation: none;
  }
}
