:root {
  --navy: #173f5d;
  --navy-deep: #0d2a40;
  --sky: #66c9ef;
  --sky-light: #c8f2ff;
  --cream: #fff9df;
  --paper: #fffdf4;
  --ink: #183747;
  --muted: #5e7885;
  --coral: #f26850;
  --coral-dark: #c8483a;
  --sun: #ffd45d;
  --green: #58b86c;
  --green-dark: #2e7c4e;
  --teal: #2dc2b0;
  --line: rgba(24, 55, 71, 0.16);
  --shadow: 0 25px 70px rgba(13, 42, 64, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 212, 93, 0.24), transparent 25rem),
    radial-gradient(circle at 88% 20%, rgba(45, 194, 176, 0.16), transparent 28rem),
    #eaf7ee;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--sun);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  margin-bottom: 14px;
  padding: 9px 11px 9px 13px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 19px;
  color: #fff;
  background: rgba(13, 42, 64, 0.94);
  box-shadow: 0 13px 35px rgba(13, 42, 64, 0.19);
}

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

.brand small {
  display: block;
  color: #9fc5d4;
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--cream);
  border-radius: 14px 14px 19px 19px;
  color: var(--cream);
  background: var(--coral);
  box-shadow: inset 0 -6px 0 var(--coral-dark), 4px 4px 0 rgba(0, 0, 0, 0.17);
}

.topbar-actions {
  display: flex;
  gap: 7px;
}

.topbar-actions a,
.topbar-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: #e6f3f6;
  background: rgba(255, 255, 255, 0.09);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 850;
}

.topbar-actions a:hover,
.topbar-actions button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.game-frame {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 3px solid var(--navy-deep);
  border-radius: 26px;
  background: var(--navy-deep);
  box-shadow: var(--shadow);
}

.game-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  min-height: 88px;
  padding: 14px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0, rgba(255, 212, 93, 0.15), transparent 20rem),
    #173f5d;
}

.eyebrow,
.menu-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--sun);
  font-size: 0.65rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.game-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.7rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
}

.game-header h1 span {
  color: var(--sun);
  font-style: italic;
}

.hud {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 7px;
}

.hud > span {
  min-width: 76px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(5, 25, 38, 0.35);
  text-align: center;
}

.hud small,
.result-stats small {
  display: block;
  color: #99c0ce;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hud strong {
  font-size: 1rem;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: #6bcdf0;
  aspect-ratio: 4 / 3;
  isolation: isolate;
}

#game-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: #69c9ef;
  image-rendering: pixelated;
}

.screen {
  position: absolute;
  inset: 0;
  min-width: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background: rgba(12, 47, 68, 0.22);
  backdrop-filter: blur(2px);
}

.screen-menu {
  grid-template-columns: minmax(260px, 0.9fr) minmax(350px, 0.72fr);
  gap: clamp(20px, 5vw, 70px);
  background:
    linear-gradient(to bottom, rgba(82, 190, 233, 0.16), rgba(16, 74, 91, 0.15));
}

.menu-art {
  position: relative;
  align-self: stretch;
  min-height: 360px;
}

.menu-cloud {
  position: absolute;
  width: 150px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.menu-cloud::before,
.menu-cloud::after {
  content: "";
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
}

.menu-cloud::before {
  left: 20px;
  width: 68px;
  height: 68px;
}

.menu-cloud::after {
  right: 19px;
  width: 88px;
  height: 88px;
}

.cloud-one {
  top: 12%;
  left: 3%;
}

.cloud-two {
  top: 25%;
  right: 2%;
  transform: scale(0.68);
}

.menu-island {
  position: absolute;
  left: 7%;
  right: 2%;
  bottom: 5%;
  height: 38%;
  border: 5px solid var(--navy-deep);
  border-radius: 50% 50% 30% 35%;
  background:
    radial-gradient(circle at 22% 24%, #8ed26d 0 6%, transparent 6.5%),
    radial-gradient(circle at 74% 37%, #8ed26d 0 8%, transparent 8.5%),
    linear-gradient(#65bd69 0 22%, #c47f48 22% 62%, #8c5338 62%);
  box-shadow: 0 24px 0 rgba(13, 42, 64, 0.18);
  transform: rotate(-3deg);
}

.menu-pip {
  position: absolute;
  left: 35%;
  bottom: 19%;
  width: 135px;
  height: 176px;
  filter: drop-shadow(9px 12px 0 rgba(13, 42, 64, 0.23));
  animation: menu-bob 2.2s ease-in-out infinite;
}

.menu-mario {
  position: absolute;
  left: 42%;
  bottom: 23%;
  width: 16px;
  height: 32px;
  background-image: url("../assets/mario/mario-luigi-transparent.png");
  background-repeat: no-repeat;
  background-position: -2px -32px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 rgba(13, 42, 64, 0.28));
  transform: scale(5);
  transform-origin: bottom center;
  animation: menu-bob-small 2.2s ease-in-out infinite;
}

.menu-pip .face {
  position: absolute;
  inset: 22px 13px 42px;
  border: 6px solid var(--navy-deep);
  border-radius: 52% 48% 42% 45%;
  background:
    radial-gradient(circle at 34% 42%, #193b4d 0 5px, transparent 6px),
    radial-gradient(circle at 66% 42%, #193b4d 0 5px, transparent 6px),
    radial-gradient(ellipse at 50% 66%, #fff0d7 0 25%, transparent 26%),
    #f58a4f;
}

.menu-pip .ear {
  position: absolute;
  top: 0;
  width: 52px;
  height: 66px;
  border: 6px solid var(--navy-deep);
  background: #f58a4f;
  clip-path: polygon(50% 0, 100% 100%, 0 82%);
}

.menu-pip .ear.left {
  left: 12px;
  transform: rotate(-17deg);
}

.menu-pip .ear.right {
  right: 12px;
  transform: scaleX(-1) rotate(-17deg);
}

.menu-pip .scarf {
  position: absolute;
  left: 27px;
  right: 19px;
  bottom: 34px;
  height: 40px;
  border: 6px solid var(--navy-deep);
  border-radius: 12px;
  background: var(--teal);
  transform: rotate(-4deg);
}

.menu-pip .boot {
  position: absolute;
  bottom: 4px;
  width: 54px;
  height: 39px;
  border: 6px solid var(--navy-deep);
  border-radius: 18px 18px 10px 10px;
  background: var(--sun);
}

.menu-pip .boot.left {
  left: 13px;
}

.menu-pip .boot.right {
  right: 4px;
}

.menu-card,
.dialog-card {
  position: relative;
  z-index: 2;
  width: min(100%, 500px);
  padding: clamp(25px, 4vw, 44px);
  border: 5px solid var(--navy-deep);
  border-radius: 25px;
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 212, 93, 0.34), transparent 29%),
    var(--paper);
  box-shadow: 10px 11px 0 rgba(13, 42, 64, 0.28);
}

.menu-card h2,
.dialog-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.menu-card p,
.dialog-card p {
  color: var(--muted);
  line-height: 1.6;
}

.menu-buttons,
.stacked-buttons {
  display: grid;
  gap: 9px;
  margin-top: 23px;
}

.menu-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 52px;
  border: 3px solid var(--navy-deep);
  border-radius: 12px;
  font-weight: 950;
}

.primary-button {
  color: var(--navy-deep);
  background: var(--sun);
  box-shadow: 4px 4px 0 var(--navy-deep);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.secondary-button {
  color: #fff;
  background: var(--coral);
  box-shadow: 4px 4px 0 var(--coral-dark);
}

.text-button {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.level-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-picker > div {
  display: flex;
  gap: 6px;
}

.level-choice {
  width: 38px;
  height: 38px;
  border: 2px solid var(--navy-deep);
  border-radius: 9px;
  color: var(--navy-deep);
  background: #fff;
  font-weight: 950;
}

.level-choice.active {
  background: var(--teal);
  box-shadow: 2px 2px 0 var(--navy-deep);
}

.compact-screen {
  background: rgba(8, 31, 45, 0.73);
  backdrop-filter: blur(7px);
}

.dialog-card {
  width: min(820px, 100%);
  max-height: 94%;
  overflow: auto;
}

.small-dialog {
  width: min(460px, 100%);
  text-align: center;
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 23px 0;
}

.instruction-grid > div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 2px 11px;
  align-items: center;
  padding: 13px;
  border: 2px solid var(--line);
  border-radius: 13px;
  background: rgba(45, 194, 176, 0.07);
  text-align: left;
}

.instruction-grid kbd,
.instruction-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 5px;
  border: 2px solid var(--navy-deep);
  border-radius: 9px;
  color: #fff;
  background: var(--navy);
  box-shadow: 2px 2px 0 var(--navy-deep);
  font: 850 0.7rem/1 system-ui, sans-serif;
}

.instruction-grid span:last-child {
  color: var(--muted);
  font-size: 0.73rem;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.result-stats > span {
  padding: 12px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
}

.celebration {
  background:
    radial-gradient(circle at 15% 15%, rgba(45, 194, 176, 0.25), transparent 24%),
    radial-gradient(circle at 90% 5%, rgba(255, 212, 93, 0.4), transparent 25%),
    var(--paper);
}

.danger-dialog {
  background:
    radial-gradient(circle at 90% 10%, rgba(242, 104, 80, 0.32), transparent 28%),
    var(--paper);
}

.toast {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 30;
  padding: 11px 17px;
  border: 3px solid var(--navy-deep);
  border-radius: 999px;
  color: var(--navy-deep);
  background: var(--sun);
  box-shadow: 4px 5px 0 rgba(13, 42, 64, 0.27);
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -20px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.touch-controls {
  width: 100%;
  min-width: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 12px 16px 15px;
  background: #102f45;
}

.touch-move {
  display: flex;
  gap: 9px;
}

.touch-controls button {
  display: grid;
  place-items: center;
  min-width: 68px;
  min-height: 62px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.45rem;
  font-weight: 950;
  user-select: none;
}

.touch-controls button.active {
  background: var(--teal);
  transform: translateY(2px);
}

.touch-controls .jump-control {
  grid-template-columns: auto auto;
  gap: 8px;
  min-width: 116px;
  color: var(--navy-deep);
  background: var(--sun);
  font-size: 0.88rem;
}

.touch-controls .run-control {
  min-width: 72px;
  color: #fff;
  background: #e52521;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.touch-controls .pipe-control {
  min-width: 48px;
  color: #fff;
  background: #307c56;
  font-size: 0.64rem;
  text-transform: uppercase;
}

.jump-control span {
  font-size: 1.35rem;
}

.game-notes {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  color: #a9c5d0;
  background: #0d2a40;
  font-size: 0.72rem;
}

.game-notes strong {
  color: #fff;
}

@keyframes menu-bob {
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes menu-bob-small {
  50% {
    transform: translateY(-2px) scale(5);
  }
}

@media (max-width: 900px) {
  .game-header {
    align-items: flex-start;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(72px, 1fr));
  }

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

  .menu-pip {
    left: 23%;
    transform: scale(0.88);
  }
}

@media (pointer: coarse), (max-width: 760px) {
  .touch-controls {
    display: flex;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100% - 12px);
    max-width: 680px;
    padding-top: 6px;
  }

  .brand > span:last-child,
  .topbar-actions a {
    display: none;
  }

  .game-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .hud {
    width: 100%;
    grid-template-columns: repeat(4, 1fr);
  }

  .hud > span {
    min-width: 0;
    padding: 7px 4px;
  }

  .canvas-wrap {
    aspect-ratio: 4 / 3;
  }

  .screen-menu {
    display: block;
    width: 100%;
    overflow: auto;
    padding: 18px;
  }

  .menu-art {
    position: absolute;
    inset: 0;
    opacity: 0.42;
  }

  .menu-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: auto;
    padding: 25px;
  }

  .menu-buttons {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 430px) {
  .hud > span {
    font-size: 0.78rem;
  }

  .hud small {
    font-size: 0.48rem;
  }

  .screen {
    padding: 10px;
  }

  .menu-card h2,
  .dialog-card h2 {
    font-size: 2.45rem;
  }

  .touch-controls {
    padding-inline: 10px;
  }

  .touch-controls button {
    min-width: 58px;
    min-height: 56px;
  }
}

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

/* NES presentation pass: samme pixelgrid og 4:3-geometri på alle skærme. */
:root {
  --pixel-font: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

body {
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 50%, transparent 50%) 0 0 / 100% 6px,
    #111820;
}

.page-shell {
  width: min(980px, calc(100% - 24px));
}

.topbar {
  border: 4px solid #050505;
  border-radius: 6px;
  background: #191919;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.42);
}

.brand,
.topbar-actions a,
.topbar-actions button {
  font-family: var(--pixel-font);
  text-transform: uppercase;
}

.brand-mark {
  border-radius: 2px;
  background: #e52521;
  box-shadow: inset 0 -6px 0 #9f1714, 3px 3px 0 #000;
}

.topbar-actions a,
.topbar-actions button {
  border-radius: 2px;
  background: #303030;
}

.game-frame {
  width: min(876px, 100%);
  margin-inline: auto;
  border: 6px solid #050505;
  border-radius: 3px;
  background: #000;
  box-shadow: 10px 12px 0 rgba(0, 0, 0, 0.38);
}

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

.game-header {
  min-height: 84px;
  padding: 13px 5%;
  color: #fff;
  background: #000;
}

.hud {
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  font-family: var(--pixel-font);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.hud > span {
  position: relative;
  min-width: 0;
  padding: 4px 5px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  text-align: center;
}

.hud small,
.result-stats small {
  color: #fff;
  font-family: var(--pixel-font);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.hud strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: clamp(0.9rem, 2.2vw, 1.18rem);
  line-height: 1;
  letter-spacing: 0.05em;
}

.hud-life {
  display: block;
  margin-top: 4px;
  color: #fbd000;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.canvas-wrap {
  aspect-ratio: 4 / 3;
  background: #5c94fc;
}

#game-canvas {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.screen {
  padding: clamp(13px, 3vw, 30px);
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: none;
}

.screen-menu {
  grid-template-columns: 1fr;
  gap: 0;
  background: rgba(0, 0, 0, 0.32);
}

.menu-card,
.dialog-card {
  width: min(620px, 94%);
  padding: clamp(20px, 4vw, 36px);
  border: 5px solid #fff;
  border-radius: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.88);
  box-shadow: 9px 9px 0 #000;
  font-family: var(--pixel-font);
}

.menu-card {
  text-align: center;
}

.menu-kicker {
  color: #fbd000;
  font-family: var(--pixel-font);
  font-size: 0.67rem;
}

.menu-card h2,
.dialog-card h2 {
  margin-top: 7px;
  color: #e52521;
  font-family: var(--pixel-font);
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 0.84;
  letter-spacing: -0.08em;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #6d120f;
}

.menu-card h2 span {
  color: #fbd000;
  text-shadow: 4px 4px 0 #9b6500;
}

.dialog-card h2 {
  color: #fbd000;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: -0.04em;
  text-shadow: 3px 3px 0 #8c5e00;
}

.menu-card p,
.dialog-card p {
  color: #fff;
  line-height: 1.55;
}

.menu-buttons {
  width: min(100%, 430px);
  margin-inline: auto;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 48px;
  border: 3px solid #fff;
  border-radius: 0;
  color: #fff;
  background: #111;
  box-shadow: 4px 4px 0 #000;
  font-family: var(--pixel-font);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.primary-button {
  color: #fff;
  background: #e52521;
  box-shadow: 4px 4px 0 #7d100e;
}

.secondary-button {
  color: #fff;
  background: #111;
  box-shadow: 4px 4px 0 #000;
}

.text-button {
  border-color: transparent;
  color: #d8d8d8;
  background: transparent;
}

.level-picker {
  width: min(100%, 430px);
  margin-inline: auto;
  color: #fff;
  font-family: var(--pixel-font);
}

.level-choice {
  width: 52px;
  height: 38px;
  border: 3px solid #fff;
  border-radius: 0;
  color: #fff;
  background: #111;
  font-family: var(--pixel-font);
}

.level-choice.active {
  color: #000;
  background: #fbd000;
  box-shadow: 3px 3px 0 #8c5e00;
}

.world-picker {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  width: min(100%, 430px);
  margin: 16px auto 0;
}

.world-choice {
  min-height: 30px;
  border: 2px solid #fff;
  border-radius: 0;
  color: #fff;
  background: #161616;
  font: 900 0.62rem/1 var(--pixel-font);
}

.world-choice.active {
  color: #000;
  background: #fbd000;
}

.world-choice:disabled,
.level-choice:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.campaign-progress {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: #fbd000;
  font: 800 0.62rem/1.35 var(--pixel-font);
  text-transform: uppercase;
}

.asset-status {
  min-height: 1.2em;
  margin: 9px 0 0;
  color: #b9d8ff;
  font: 800 0.6rem/1.35 var(--pixel-font);
  text-transform: uppercase;
}

.compact-screen {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: none;
}

.instruction-grid > div {
  border: 2px solid #fff;
  border-radius: 0;
  color: #fff;
  background: #161616;
}

.instruction-grid span:last-child {
  color: #d0d0d0;
}

.instruction-grid kbd,
.instruction-icon {
  border-color: #fff;
  border-radius: 0;
  background: #e52521;
  box-shadow: 2px 2px 0 #74100e;
}

.result-stats > span {
  border: 2px solid #fff;
  border-radius: 0;
  background: #111;
}

.celebration,
.danger-dialog {
  background: rgba(0, 0, 0, 0.92);
}

.toast {
  top: 12px;
  border: 3px solid #fff;
  border-radius: 0;
  color: #000;
  background: #fbd000;
  box-shadow: 4px 4px 0 #000;
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.touch-controls {
  border-top: 5px solid #050505;
  background: #202020;
}

.touch-controls button {
  border-color: #fff;
  border-radius: 5px;
  background: #333;
  box-shadow: 0 5px 0 #080808;
  font-family: var(--pixel-font);
}

.touch-controls button.active {
  background: #e52521;
  box-shadow: 0 2px 0 #080808;
}

.touch-controls .jump-control {
  color: #000;
  background: #fbd000;
}

.game-notes {
  color: #bdbdbd;
  background: #111;
  font-family: var(--pixel-font);
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100% - 10px);
  }

  .game-header {
    min-height: 68px;
    padding: 8px 2%;
  }

  .hud {
    gap: 0;
  }

  .hud > span {
    padding-inline: 2px;
  }

  .hud small {
    font-size: clamp(0.44rem, 2.2vw, 0.62rem);
  }

  .hud strong {
    font-size: clamp(0.7rem, 3.1vw, 0.96rem);
  }

  .hud-life {
    font-size: 0.5rem;
  }

  .screen-menu {
    display: grid;
    overflow: hidden;
    padding: 10px;
  }

  .menu-card {
    width: min(100%, 500px);
    max-height: 96%;
    margin: 0;
    padding: 14px;
    overflow: auto;
  }

  .menu-card h2 {
    font-size: clamp(1.8rem, 9vw, 2.7rem);
  }

  .menu-card p {
    display: none;
  }

  .menu-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 13px;
  }

  .primary-button,
  .secondary-button,
  .text-button {
    min-height: 40px;
    font-size: 0.62rem;
  }

  .level-picker {
    margin-top: 13px;
    font-size: 0.58rem;
  }

  .level-choice {
    width: 46px;
    height: 32px;
    font-size: 0.68rem;
  }

  .world-picker {
    margin-top: 10px;
  }

  .world-choice {
    min-height: 26px;
    font-size: 0.52rem;
  }

  .campaign-progress {
    margin-top: 8px;
    font-size: 0.52rem;
  }

  .asset-status {
    display: none;
  }
}

@media (max-width: 430px) {
  .compact-screen {
    padding: 8px;
  }

  .touch-controls {
    gap: 10px;
  }

  .touch-controls .run-control {
    min-width: 60px;
  }

  .touch-controls .pipe-control {
    min-width: 48px;
  }

  .touch-controls .jump-control {
    min-width: 96px;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 700px),
  (max-width: 760px) and (orientation: landscape) and (max-height: 700px) {
  .page-shell {
    width: 100%;
    padding: 0;
  }

  .topbar,
  .game-notes {
    display: none;
  }

  .game-frame {
    width: 100%;
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 148px;
    grid-template-rows: 64px minmax(0, 1fr);
    border-width: 3px;
  }

  .game-header {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    padding-block: 6px;
  }

  .canvas-wrap {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    justify-self: center;
    width: min(100%, calc((100dvh - 70px) * 4 / 3));
  }

  .touch-controls {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    border-top: 0;
    border-left: 4px solid #050505;
  }

  .touch-move {
    flex-direction: column;
  }

  .touch-controls button,
  .touch-controls .jump-control {
    width: 100%;
    min-width: 0;
  }
}

/* Super Mario World-inspireret konsol- og mobilpas. */
.game-frame {
  border-color: #18385f;
  background: #081527;
  box-shadow: 0 0 0 3px #79b7dc, 10px 12px 0 rgba(0, 0, 0, 0.38);
}

.game-header {
  background: linear-gradient(180deg, #173d70, #0b2344);
}

.p-meter {
  display: block;
  min-height: 13px;
  margin-top: 3px;
  color: #d9efff;
  font: 900 0.5rem/1 var(--pixel-font);
  letter-spacing: -0.08em;
}

.p-meter b {
  color: #f7d83e;
}

.p-meter.charged {
  color: #fff;
  text-shadow: 0 0 7px #f7d83e;
}

.mobile-pause-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 12;
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: rgba(10, 29, 55, 0.82);
  box-shadow: 0 3px 0 #07101c;
  font: 900 1rem/1 var(--pixel-font);
}

.touch-controls {
  gap: clamp(16px, 5vw, 42px);
  background: linear-gradient(180deg, #233a58, #101c31);
  touch-action: none;
}

.touch-move {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 54px);
  gap: 4px;
}

.touch-move button:first-child { grid-column: 1; grid-row: 1 / 3; align-self: center; }
.touch-move .down-control { grid-column: 2; grid-row: 2; }
.touch-move button:last-child { grid-column: 3; grid-row: 1 / 3; align-self: center; }

.touch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.touch-controls button {
  min-width: 58px;
  min-height: 54px;
  padding: 6px;
  border: 3px solid #e9f3ff;
  border-radius: 50%;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22), 0 5px 0 #07101c;
  touch-action: none;
}

.touch-controls button span,
.touch-controls button small {
  display: block;
  line-height: 1;
}

.touch-controls button small {
  margin-top: 3px;
  font-size: 0.46rem;
  text-transform: uppercase;
}

.touch-controls .run-control { color: #fff; background: #5378be; }
.touch-controls .spin-control { color: #fff; background: #4ea45a; }
.touch-controls .jump-control { color: #fff; background: #d94c53; }
.touch-controls .down-control { color: #fff; background: #26394f; }

@media (pointer: coarse), (max-width: 760px) {
  .mobile-pause-button { display: grid; place-items: center; }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body { min-height: 100dvh; }

  .page-shell {
    width: 100%;
    height: 100dvh;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  .topbar,
  .game-notes { display: none; }

  .game-frame {
    display: grid;
    grid-template-rows: 58px auto minmax(128px, 1fr);
    width: 100%;
    height: 100%;
    margin: 0;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .game-header {
    min-height: 0;
    padding: 5px 7px;
  }

  .hud { height: 100%; }
  .hud > span { align-self: center; padding: 2px; }
  .hud small { font-size: clamp(0.4rem, 2vw, 0.58rem); }
  .hud strong { font-size: clamp(0.66rem, 3vw, 0.9rem); }
  .hud-life { margin-top: 2px; font-size: 0.44rem; }
  .p-meter { font-size: 0.4rem; }

  .canvas-wrap {
    align-self: start;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-block: 3px solid #081527;
  }

  .touch-controls {
    display: flex;
    align-self: stretch;
    min-height: 0;
    padding: 12px max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .touch-move {
    grid-template-columns: repeat(3, minmax(47px, 1fr));
    flex: 1 1 48%;
    max-width: 220px;
  }

  .touch-actions {
    flex: 1 1 48%;
    justify-content: flex-end;
  }

  .touch-actions button { flex: 1; max-width: 72px; }
}

@media (max-width: 430px) {
  .touch-controls { gap: 9px; }
  .touch-move { gap: 2px; }
  .touch-actions { gap: 5px; }
  .touch-controls button { min-width: 46px; min-height: 50px; }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 700px),
  (max-width: 900px) and (orientation: landscape) and (max-height: 700px) {
  html, body { min-height: 100%; overflow: hidden; }
  .topbar, .game-notes { display: none; }

  .page-shell {
    min-height: 100dvh;
    padding: 0;
  }

  .game-frame {
    height: 100dvh;
    grid-template-columns: minmax(0, 1fr) 210px;
    grid-template-rows: 54px minmax(0, 1fr);
  }

  .game-header { grid-column: 1; grid-row: 1; }

  .canvas-wrap {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    width: min(100%, calc((100dvh - 58px) * 4 / 3));
    border: 0;
  }

  .touch-controls {
    grid-column: 2;
    grid-row: 1 / 3;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    padding: 7px;
    border-left: 4px solid #081527;
  }

  .touch-move {
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }

  .touch-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .touch-controls button,
  .touch-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
}
