:root {
  color-scheme: light;
  --ink: #172f2a;
  --muted: #50625a;
  --line: #dedfd2;
  --paper: #fffdf6;
  --mint: #e2f0d1;
  --green: #27513a;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: #f5f4e9;
  background-image: radial-gradient(#dcded0 0.75px, transparent 0.75px);
  background-size: 14px 14px;
  color: var(--ink);
  font-family: system-ui, sans-serif;
}
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 3px solid #d78824; outline-offset: 3px; }
.shell { width: min(1032px, calc(100% - 64px)); margin: 32px auto; }
.masthead, .brand, .stage-bar, .stage-title, .stage-mode, .control-bar, .lesson-top {
  display: flex;
  align-items: center;
}
.masthead { justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.brand { gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 51px;
  height: 51px;
  border: 1px solid #b5cbb1;
  border-radius: 12px;
  background: #deeed3;
}
.brand-mark span {
  width: 4px;
  height: 4px;
  margin: -14px 13px 0 0;
  background: #377d4b;
  box-shadow: 4px 0 #377d4b, 16px 0 #377d4b, 20px 0 #377d4b,
    0 4px #377d4b, 4px 4px #6ba948, 8px 4px #377d4b, 12px 4px #377d4b,
    16px 4px #6ba948, 20px 4px #377d4b, 4px 8px #377d4b, 8px 8px #377d4b,
    12px 8px #377d4b, 16px 8px #377d4b, 12px 12px #377d4b, 12px 16px #377d4b;
}
h1, h2, p { margin: 0; }
h1 { font: 900 clamp(26px, 4vw, 40px)/1 var(--mono); letter-spacing: -.085em; }
h1 span { color: #629647; }
.utility {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.utility:hover, .touch button:hover { background: var(--mint); }
.utility span[aria-hidden] { margin-right: 3px; font-size: 15px; line-height: 0; }
.cabinet {
  border: 2px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 5px 0 #172f2a;
}
.stage-bar { min-height: 49px; justify-content: space-between; padding: 8px 17px; background: #17342c; color: #f9f8ea; }
.stage-title { gap: 10px; font-weight: 800; font-size: 14px; }
.world-badge { padding: 4px 7px; border-radius: 4px; background: #d7eeae; color: var(--ink); font: bold 12px var(--mono); }
.stage-mode { gap: 7px; font: bold 11px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: #d7eeae; }
.stage-mode i { width: 7px; height: 7px; background: #abdb75; }
.screen { position: relative; isolation: isolate; background: #9fe3eb; }
canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.hud { position: absolute; left: 15px; top: 13px; display: flex; gap: 8px; pointer-events: none; }
.hud-item {
  min-width: 58px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #17342c;
  color: #fffbe8;
  border: 1px solid #fffbe8;
  box-shadow: 2px 2px 0 #42786a;
  font: bold 13px var(--mono);
}
.coin-icon { width: 10px; height: 13px; border: 2px solid #e5992e; border-radius: 45%; background: #ffe06b; }
.heart-icon { width: 13px; height: 12px; background: #fd806c; clip-path: polygon(0 12%, 36% 12%, 50% 27%, 64% 12%, 100% 12%, 100% 55%, 50% 100%, 0 55%); }
.control-bar { gap: 10px; justify-content: space-between; padding: 9px 14px; border-top: 2px solid var(--ink); }
.keys, .keys > span, .actions, .touch { display: flex; align-items: center; gap: 5px; }
.keys { gap: 17px; }
.keys > span > span { margin-left: 3px; font-size: 12px; color: var(--muted); font-weight: 650; }
kbd, .touch button {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid #d5d9c9;
  border-bottom: 2px solid #c3c9b6;
  border-radius: 4px;
  background: #f4f5e9;
  font: bold 12px var(--mono);
}
.touch { display: none; }
.touch button { height: 40px; min-width: 42px; padding: 0 9px; touch-action: none; }
.touch button:active { background: #b9df9a; }
.actions { gap: 7px; }
.lesson { margin-top: 22px; padding: 17px 19px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; }
.lesson-top { justify-content: space-between; gap: 12px; }
.eyebrow, .message-label { color: var(--green); font: 800 10px var(--mono); letter-spacing: .1em; }
.eyebrow span { margin: 0 3px; }
.lesson h2 { margin-top: 4px; font-size: 21px; letter-spacing: -.04em; }
.lesson p:not(.eyebrow) { margin-top: 3px; color: var(--muted); font-size: 13px; }
.secondary { border: 0; background: none; padding: 7px 1px; color: var(--green); font-size: 12px; font-weight: 800; white-space: nowrap; }
.secondary:hover { text-decoration: underline; }
.secondary span { margin-left: 3px; }
.steps { list-style: none; padding: 0; margin: 13px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid #e4e6db;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.steps li span { font: bold 10px var(--mono); }
.steps li[aria-current] { background: #e6f3d5; border-color: #b8d4a1; color: #264e30; }
.steps li.done { color: #356444; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; background: #17342c85; }
.message { text-align: center; width: min(360px, 100%); padding: clamp(10px, 3vw, 27px); background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); }
.message h2 { font: 900 clamp(18px, 3vw, 28px) var(--mono); letter-spacing: -.07em; margin: 5px 0; }
#overlay-detail { color: var(--muted); font-size: 13px; }
.primary { display: block; margin: 12px auto 0; padding: 8px 13px; border: 1px solid var(--ink); border-radius: 6px; background: #d7eeae; font-size: 13px; font-weight: 800; box-shadow: 0 2px 0 var(--ink); }
.primary:hover { background: #c3e993; }
@media (pointer: coarse), (max-width: 640px) {
  .keys { display: none; }
  .touch { display: flex; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 22px); margin: 17px auto; }
  .masthead { margin-bottom: 14px; gap: 7px; }
  .brand { gap: 7px; }
  .brand-mark { flex-basis: 40px; height: 40px; }
  .stage-bar, .control-bar { padding-inline: 8px; }
  .hud { top: 6px; left: 7px; gap: 5px; }
  .hud-item { min-width: 44px; padding: 3px 5px; font-size: 11px; }
  .lesson { margin-top: 16px; padding: 12px 9px; }
  .steps { gap: 4px; }
  .steps li { padding-inline: 4px; gap: 3px; }
}
@media (max-width: 420px) {
  .control-bar { flex-wrap: wrap; }
  .message { padding: 6px 8px; }
  .message h2 { margin: 2px 0; }
  #overlay-detail { font-size: 11px; }
  .message .primary { margin-top: 5px; padding: 5px 10px; }
  .message .secondary { padding-block: 4px; }
}
