@font-face {
  font-family: Golos;
  src: url('../fonts/golos-cyrillic.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Golos;
  src: url('../fonts/golos-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF;
}
:root {
  font-family: Golos, Arial, sans-serif;
  color: #293731;
  background: #f4f1ea;
  font-synthesis: none;
  --paper: #f4f1ea;
  --green: #344f3c;
  --muted: #7a8077;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #c69c42;
  outline-offset: 5px;
}
button:hover {
  filter: brightness(1.09);
}
[hidden] {
  display: none !important;
}
#world {
  position: fixed;
  inset: 0;
}
#world canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.topbar {
  position: fixed;
  inset: 0 0 auto;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 46px;
  z-index: 3;
  border-bottom: 1px solid #344f3c18;
  background: linear-gradient(#f4f1eae8, #f4f1ea75);
}
.brand {
  text-decoration: none;
  color: #293731;
  font-size: 29px;
  letter-spacing: -1.8px;
  font-weight: 750;
}
.brand span {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 500;
  margin-top: 5px;
}
.world-name {
  font-size: 12px;
  letter-spacing: 0.25px;
  color: #626e60;
}
.status-dot {
  display: inline-block;
  background: #7d9471;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 9px;
}
.dark {
  background: #293b30;
  color: #fff;
  border-radius: 6px;
}
.small {
  padding: 13px 19px;
  font-size: 12px;
}
.small span {
  margin-left: 24px;
}
.intro {
  position: fixed;
  top: 27%;
  left: 6%;
  max-width: 540px;
  pointer-events: none;
}
.intro button {
  pointer-events: auto;
}
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #798472;
}
.intro h1 {
  font-size: clamp(36px, 4.5vw, 70px);
  line-height: 1.08;
  letter-spacing: -3.5px;
  font-weight: 550;
  margin: 22px 0;
}
.intro em {
  font-style: normal;
  color: #7d9471;
}
.intro p {
  font-size: 15px;
  line-height: 1.85;
  color: #788070;
  margin-bottom: 30px;
}
.primary {
  background: var(--green);
  color: #fff;
  padding: 17px 23px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  font-weight: 550;
}
.primary span:last-child {
  margin-left: auto;
}
.intro-meta {
  display: flex;
  gap: 20px;
  font-size: 10px;
  color: #7d8378;
  margin-top: 25px;
}
.intro-meta span + span:before {
  content: '·';
  margin-right: 20px;
}
#resume-note {
  font-size: 11px;
  color: #7d8378;
  margin-top: 15px;
}
.toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 77px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  border-top: 1px solid #344f3c15;
  background: #f4f1eae8;
  z-index: 3;
}
.keys {
  display: flex;
  gap: 23px;
  font-size: 10px;
  color: #7b8175;
  align-items: center;
}
kbd {
  font: inherit;
  border: 1px solid #bcc3b4;
  border-radius: 4px;
  padding: 5px 7px;
  margin-right: 5px;
  color: #53614c;
  font-size: 10px;
  background: #fafaf4;
}
.tools {
  display: flex;
  gap: 8px;
}
.tools button {
  border: 1px solid #ccd1c4;
  border-radius: 5px;
  background: transparent;
  padding: 9px 12px;
  color: #475a42;
  font-size: 13px;
}
.tools span {
  font-size: 11px;
  margin-left: 6px;
}
.scene-label {
  position: fixed;
  right: 10%;
  bottom: 16%;
  text-align: center;
  pointer-events: none;
}
.scene-label span {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: #7b8373;
}
.scene-label b {
  display: block;
  font-size: 14px;
  margin-top: 10px;
  font-weight: 450;
}
.mission {
  position: fixed;
  top: 133px;
  left: 30px;
  width: 247px;
  padding: 22px;
  background: #faf9f2f2;
  border: 1px solid #d6dacd;
  border-radius: 10px;
}
.mission h2 {
  font-size: 20px;
  letter-spacing: -0.7px;
  margin: 12px 0;
}
.mission p {
  font-size: 12px;
  line-height: 1.6;
  color: #7a8273;
  min-height: 38px;
}
.progress-title {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-top: 24px;
}
.progress-track {
  height: 5px;
  background: #e2e6dc;
  border-radius: 4px;
  margin: 11px 0 23px;
  overflow: hidden;
}
#progress {
  height: 100%;
  width: 0;
  background: #7d9471;
  transition: width 0.4s;
}
.stage {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 11px;
  padding: 11px 0;
  color: #737f69;
}
.stage i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.stage b {
  margin-left: auto;
  font-weight: 500;
  font-size: 10px;
}
.text-button {
  padding: 17px 0 0;
  margin-top: 9px;
  border-top: 1px solid #e0e3d9;
  background: none;
  font-size: 11px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: #344f3c;
}
.map {
  position: fixed;
  right: 30px;
  top: 133px;
  background: #faf9f2ef;
  border: 1px solid #d6dacd;
  border-radius: 10px;
  padding: 17px;
  text-align: center;
}
.map .eyebrow {
  font-size: 8px;
  letter-spacing: 1.5px;
}
.map canvas {
  width: 150px;
  height: 150px;
  display: block;
}
.map > div:last-child {
  font-size: 9px;
  color: #7d8378;
}
.map-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #344f3c;
  margin: 0 4px 0 8px;
}
.gold {
  background: #caac60;
}
#prompt {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  white-space: nowrap;
}
#prompt kbd {
  color: #fff;
  background: #ffffff15;
  border-color: #ffffff50;
}
#toast {
  position: fixed;
  top: 116px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #344f3c;
  background: #faf9f2;
  padding: 12px 20px;
  border: 1px solid #d6dacd;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 8;
}
#toast.visible {
  opacity: 1;
}
dialog {
  color: #293731;
  border: 1px solid #d0d6c6;
  border-radius: 16px;
  background: #fbfaf5;
  max-height: 82dvh;
  overflow: auto;
  box-shadow: 0 25px 100px #28352222;
}
dialog::backdrop {
  background: #26372544;
  backdrop-filter: blur(5px);
}
#lesson {
  width: 510px;
  padding: 35px;
}
dialog h2 {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 18px 0;
}
dialog p {
  color: #77816f;
  font-size: 14px;
  line-height: 1.75;
}
.lesson-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 30px;
  gap: 15px;
}
.lesson-bottom > span {
  font-size: 11px;
  color: #6f7b65;
}
#info {
  width: 900px;
  padding: 40px;
}
.close {
  float: right;
  background: #e9ede2;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 22px;
  color: #54634a;
}
.course-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.course-meta span {
  padding: 9px 14px;
  background: #e9ede2;
  font-size: 11px;
  border-radius: 5px;
}
.pricing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.plan {
  border: 1px solid #d9dece;
  border-radius: 9px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.plan:nth-child(2) {
  background: #edf0e5;
}
.plan h3 {
  font-size: 14px;
}
.price {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -1px;
}
.plan ul {
  padding-left: 15px;
  font-size: 11px;
  line-height: 1.7;
  color: #748068;
  flex: 1;
}
.plan a,
.course-link {
  display: inline-block;
  background: #344f3c;
  color: #fff;
  padding: 14px;
  text-decoration: none;
  text-align: center;
  border-radius: 6px;
  font-size: 12px;
}
.fine {
  font-size: 11px !important;
}
.fine a {
  color: inherit;
}
.lesson-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0;
  list-style: none;
}
.lesson-list li {
  background: #edf0e5;
  padding: 13px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.lesson-list b {
  color: #7e8c72;
  margin-right: 8px;
}
#loading {
  position: fixed;
  bottom: 100px;
  left: 45px;
  font-size: 12px;
  color: #687b60;
}
#exit-cinema {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #f4f1ea90;
  color: #40533a;
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 10px;
  z-index: 10;
}
.cinema .topbar,
.cinema .toolbar,
.cinema .hud,
.cinema .scene-label {
  display: none;
}
.cinema #prompt {
  bottom: 30px;
}
.touch-controls {
  position: fixed;
  bottom: 100px;
  left: 20px;
  right: 20px;
  display: none;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
}
.touch-controls button {
  pointer-events: auto;
  touch-action: none;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #f4f1eadd;
  border: 1px solid #adbba2;
  color: #344f3c;
  font-size: 21px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 4px;
}
.dpad button:first-child {
  grid-column: 2;
}
.dpad button:nth-child(2) {
  grid-column: 1;
}
.touch-controls > button {
  margin-bottom: 0;
}
@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .keys {
    display: none;
  }
}
@media (max-width: 800px) {
  .topbar {
    height: 76px;
    padding: 0 20px;
  }
  .world-name {
    display: none;
  }
  .intro {
    left: 7%;
    top: 17%;
    max-width: 85%;
  }
  .intro h1 {
    font-size: 43px;
    letter-spacing: -2px;
  }
  .intro p {
    font-size: 12px;
  }
  .intro-meta {
    font-size: 9px;
    gap: 10px;
  }
  .intro-meta span + span:before {
    margin-right: 10px;
  }
  .toolbar {
    height: 65px;
    padding: 0 18px;
  }
  .keys {
    gap: 8px;
  }
  .keys span:nth-child(n + 3) {
    display: none;
  }
  .scene-label {
    right: 7%;
    bottom: 14%;
    font-size: 11px;
  }
  .scene-label b {
    font-size: 11px;
  }
  .mission {
    top: 90px;
    left: 12px;
    width: 180px;
    padding: 16px;
  }
  .mission h2 {
    font-size: 16px;
  }
  .mission p {
    font-size: 10px;
    margin-bottom: 0;
    min-height: 0;
  }
  .stage {
    padding: 7px 0;
    font-size: 9px;
  }
  .progress-title {
    margin-top: 13px;
  }
  .progress-track {
    margin-bottom: 10px;
  }
  .map {
    right: 12px;
    top: 90px;
    padding: 8px;
  }
  .map canvas {
    width: 100px;
    height: 100px;
  }
  .map .eyebrow {
    display: none;
  }
  #prompt {
    bottom: 215px;
    max-width: 94vw;
    white-space: normal;
  }
  #prompt .primary {
    font-size: 11px;
    padding: 12px 15px;
    gap: 8px;
  }
  #info {
    padding: 24px;
    width: 94vw;
  }
  .pricing {
    grid-template-columns: 1fr;
  }
  .lesson-list {
    grid-template-columns: 1fr;
  }
  #lesson {
    width: 92vw;
    padding: 25px;
  }
  dialog h2 {
    font-size: 25px;
  }
  .intro .primary {
    padding: 14px 20px;
  }
  #toast {
    top: 80px;
    width: 90%;
    text-align: center;
  }
  body.playing .scene-label {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
body:not(.playing)::before {
  content: '';
  position: fixed;
  inset: 104px 38% 77px 0;
  background: linear-gradient(90deg, #f4f1ea 0%, #f4f1eaee 40%, #f4f1ea00 100%);
  pointer-events: none;
}
body:not(.playing) .scene-label {
  padding: 12px 18px;
  background: #f4f1eaee;
  border-radius: 6px;
}
@media (max-width: 800px) {
  body:not(.playing)::before {
    inset: 76px 0 65px;
    background: linear-gradient(#f4f1eafa 0%, #f4f1eae0 40%, #f4f1ea00 72%);
  }
  body:not(.playing) .scene-label {
    display: none;
  }
}
body:not(.playing)::before {
  z-index: 1;
}
.intro,
.scene-label {
  z-index: 2;
}
@media (max-width: 800px) {
  .intro {
    top: 14%;
  }
  .intro h1 {
    font-size: 37px;
  }
  .intro p {
    font-size: 11px;
  }
  .intro-meta {
    gap: 7px;
    font-size: 8px;
  }
}
/* Lesson content lives on the 3D brick; this is its keyboard/screen-reader control. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
body.inspecting .topbar,
body.inspecting main {
  visibility: hidden;
}
body.inspecting #world {
  cursor: pointer;
}
#lesson {
  position: fixed;
  inset: auto 12px 7%;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
#lesson .lesson-bottom {
  margin: 0;
  display: block;
}
#lesson #continue {
  font-size: 12px;
  box-shadow: 0 6px 30px #29373118;
}
@media (max-width: 800px) {
  #lesson {
    bottom: 9%;
  }
  #lesson #continue {
    font-size: 11px;
    padding: 14px 18px;
  }
}
/* Touch-first controls and safe viewport sizing. */
html,
body {
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
}
#world {
  height: 100dvh;
}
button,
a {
  touch-action: manipulation;
}
.touch-controls {
  user-select: none;
  -webkit-user-select: none;
}
.joystick {
  position: relative;
  pointer-events: auto;
  touch-action: none;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #81947780;
  background: #f4f1eadb;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 10px #fff5;
}
.joystick-arrows {
  font-size: 90px;
  line-height: 1;
  color: #7d947140;
  pointer-events: none;
}
.joystick-thumb {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #526e47;
  border: 5px solid #eef0e7;
  box-shadow: 0 3px 10px #344f3c25;
  pointer-events: none;
}
.joystick.active {
  background: #f4f1eaf5;
  border-color: #526e47;
}
.joystick-label {
  position: absolute;
  bottom: -21px;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: #53614c;
  pointer-events: none;
}
.touch-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}
.touch-controls .touch-actions button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #f4f1eaed;
  font-size: 29px;
  color: #344f3c;
}
.touch-actions button small {
  font-size: 10px;
  font-weight: 600;
}
.touch-actions button[aria-pressed='true'],
.touch-actions button:active {
  background: #344f3c;
  color: #fff;
}
.touch-controls #touch-sprint {
  margin-bottom: 53px;
}
@media (pointer: coarse), (max-width: 600px) {
  .topbar {
    height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0
      max(14px, env(safe-area-inset-left));
  }
  .brand {
    font-size: 25px;
  }
  .brand span {
    font-size: 8px;
    letter-spacing: 1.3px;
    margin-top: 2px;
  }
  .world-name {
    display: none;
  }
  .topbar button {
    min-height: 44px;
    padding: 10px 15px;
  }
  .small span {
    margin-left: 13px;
  }
  .toolbar {
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 0 max(14px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
      max(14px, env(safe-area-inset-left));
    justify-content: center;
  }
  .keys {
    display: none;
  }
  .tools {
    gap: 12px;
  }
  .tools button {
    min-width: 48px;
    min-height: 44px;
    padding: 10px 14px;
  }
  .tools span {
    font-size: 12px;
  }
  .touch-controls {
    display: flex;
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(86px + env(safe-area-inset-bottom));
    align-items: end;
    z-index: 4;
  }
  .touch-actions {
    gap: 9px;
  }
  .touch-controls .touch-actions button {
    width: 58px;
    height: 58px;
  }
  .mission {
    top: calc(70px + env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: calc(100% - 136px);
    max-width: 250px;
    padding: 12px 14px 2px;
    background: #faf9f2eb;
  }
  .mission > .eyebrow,
  .mission h2,
  .mission p,
  #stages {
    display: none;
  }
  .progress-title {
    margin: 0;
    font-size: 13px;
  }
  .progress-track {
    margin: 10px 0 0;
    height: 5px;
  }
  #journal {
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    align-items: center;
    font-size: 12px;
  }
  .map {
    top: calc(70px + env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    padding: 5px;
    border-radius: 12px;
    background: #faf9f2d9;
  }
  .map canvas {
    width: 88px;
    height: 88px;
  }
  .map .eyebrow {
    display: none;
  }
  .map > div:last-child {
    max-width: 88px;
    font-size: 8px;
    line-height: 1.7;
  }
  .map-dot {
    margin: 0 2px 0 3px;
    width: 5px;
    height: 5px;
  }
  #prompt,
  .cinema #prompt {
    bottom: calc(247px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100% - 24px);
    white-space: normal;
  }
  #prompt .primary {
    min-height: 52px;
    padding: 14px 18px;
    font-size: 14px;
    gap: 0;
    box-shadow: 0 5px 25px #344f3c22;
  }
  #prompt kbd {
    display: none;
  }
  #toast {
    top: calc(186px + env(safe-area-inset-top));
    max-width: calc(100% - 32px);
    width: max-content;
    padding: 10px 15px;
    font-size: 12px;
    line-height: 1.5;
  }
  .intro {
    top: calc(88px + env(safe-area-inset-top));
    left: 6%;
    max-width: 88%;
  }
  .intro h1 {
    font-size: clamp(30px, 9.3vw, 42px);
    margin: 16px 0;
    letter-spacing: -1.8px;
  }
  .intro p {
    font-size: 13px;
    line-height: 1.7;
    margin: 0 0 20px;
  }
  .intro .primary {
    min-height: 52px;
    font-size: 14px;
    padding: 16px 22px;
  }
  .intro-meta {
    font-size: 9px;
    margin-top: 18px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .intro-meta span + span:before {
    margin-right: 8px;
  }
  #resume-note {
    font-size: 12px;
    margin-top: 10px;
  }
  .intro .eyebrow {
    font-size: 9px;
    letter-spacing: 1.4px;
  }
  #info {
    width: calc(100% - 20px);
    max-width: 620px;
    max-height: calc(
      100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    padding: 20px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }
  .close {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  dialog h2 {
    font-size: 26px;
    line-height: 1.15;
  }
  dialog p {
    font-size: 15px;
    line-height: 1.65;
  }
  .plan ul {
    font-size: 14px;
    line-height: 1.6;
  }
  .plan h3 {
    font-size: 17px;
  }
  .plan a {
    min-height: 48px;
    font-size: 14px;
  }
  .fine {
    font-size: 13px !important;
  }
  .course-meta span {
    font-size: 12px;
  }
  .pricing,
  .lesson-list {
    grid-template-columns: 1fr;
  }
  .lesson-list li {
    font-size: 14px;
  }
  #lesson {
    bottom: calc(24px + env(safe-area-inset-bottom));
    max-width: calc(100% - 24px);
  }
  #lesson #continue {
    min-height: 52px;
    font-size: 13px;
    padding: 14px 18px;
    max-width: 100%;
    white-space: normal;
  }
  #exit-cinema {
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(9px + env(safe-area-inset-bottom));
    min-height: 44px;
    font-size: 12px;
    background: #f4f1eae8;
  }
  body:not(.playing)::before {
    inset: 0;
    background: linear-gradient(#f4f1ea 0%, #f4f1eaf0 35%, #f4f1ea00 70%);
  }
  body:not(.playing) .scene-label {
    display: none;
  }
  #loading {
    left: 16px;
    right: 16px;
    bottom: calc(75px + env(safe-area-inset-bottom));
    padding: 12px;
    background: #f4f1ea;
    font-size: 13px;
    line-height: 1.6;
    z-index: 12;
  }
}
@media (max-width: 360px) and (orientation: portrait) {
  .joystick {
    width: 112px;
    height: 112px;
  }
  .touch-controls {
    left: 14px;
    right: 14px;
  }
  .touch-controls .touch-actions button {
    width: 54px;
    height: 54px;
  }
  .touch-actions {
    gap: 7px;
  }
  .intro-meta {
    font-size: 8px;
  }
}
@media (max-height: 700px) and (orientation: portrait) and (max-width: 600px) {
  .intro {
    top: 78px;
  }
  .intro h1 {
    font-size: 30px;
    margin: 12px 0;
  }
  .intro p {
    font-size: 12px;
    margin-bottom: 14px;
  }
  .intro-meta {
    margin-top: 12px;
  }
  .intro .eyebrow {
    font-size: 8px;
  }
  .touch-controls {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .joystick {
    width: 108px;
    height: 108px;
  }
  #prompt,
  .cinema #prompt {
    bottom: calc(211px + env(safe-area-inset-bottom));
  }
  .map canvas {
    width: 76px;
    height: 76px;
  }
  .map > div:last-child {
    display: none;
  }
  .mission {
    max-width: 220px;
  }
  .intro-meta {
    display: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .topbar {
    height: calc(52px + env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .brand span {
    display: none;
  }
  .toolbar {
    inset: 4px 155px auto auto;
    width: auto;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
  }
  .toolbar .keys {
    display: none;
  }
  .tools {
    gap: 5px;
  }
  .tools button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
  }
  .tools span {
    display: none;
  }
  .mission {
    top: 60px;
    width: 180px;
    max-width: none;
    padding: 8px 12px 0;
    left: max(12px, env(safe-area-inset-left));
  }
  .map {
    top: 60px;
    right: max(12px, env(safe-area-inset-right));
    padding: 4px;
  }
  .map canvas {
    width: 68px;
    height: 68px;
  }
  .map > div:last-child {
    display: none;
  }
  .touch-controls {
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
  }
  .joystick {
    width: 104px;
    height: 104px;
  }
  .joystick-label {
    display: none;
  }
  .touch-controls #touch-sprint {
    margin-bottom: 45px;
  }
  #prompt,
  .cinema #prompt {
    bottom: calc(18px + env(safe-area-inset-bottom));
    max-width: calc(100% - 320px);
  }
  #prompt .primary {
    font-size: 12px;
    padding: 12px 15px;
    min-height: 48px;
  }
  #toast {
    top: 60px;
    max-width: calc(100% - 410px);
    font-size: 11px;
  }
  .intro {
    top: 70px;
    left: max(24px, env(safe-area-inset-left));
    max-width: 49%;
  }
  .intro h1 {
    font-size: 32px;
    line-height: 1.05;
    margin: 10px 0;
  }
  .intro p {
    font-size: 12px;
    line-height: 1.5;
    margin: 0 0 12px;
  }
  .intro .eyebrow {
    font-size: 8px;
  }
  .intro-meta {
    display: none;
  }
  .intro .primary {
    min-height: 48px;
    padding: 12px 18px;
  }
  #resume-note {
    font-size: 10px;
    margin-top: 5px;
  }
  body:not(.playing)::before {
    background: linear-gradient(
      90deg,
      #f4f1ea 5%,
      #f4f1eadd 35%,
      #f4f1ea00 65%
    );
  }
  #lesson {
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
  #lesson #continue {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 12px;
  }
  #info {
    max-width: 680px;
    padding: 18px 26px;
  }
  .pricing {
    grid-template-columns: 1fr;
  }
  #exit-cinema {
    bottom: 12px;
    right: 160px;
  }
}
.touch-actions button > span {
  font:
    600 25px/26px Golos,
    Arial,
    sans-serif;
  height: 26px;
}
.touch-actions button small {
  line-height: 12px;
}
/* Abilities stay reachable on phones and in recording mode. */
.powers {
  position: fixed;
  z-index: 5;
  right: 34px;
  bottom: 100px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.powers span {
  font-size: 11px;
  padding: 7px 10px;
  border-radius: 20px;
  background: #e4eadcf2;
  color: #344f3c;
}
.powers button {
  min-height: 44px;
  min-width: 80px;
  padding: 10px 14px;
  border: 1px solid #8b9d7e;
  border-radius: 12px;
  background: #faf9f2ed;
  color: #344f3c;
  font:
    600 12px Golos,
    Arial,
    sans-serif;
  touch-action: manipulation;
}
.powers button[aria-pressed='true'] {
  background: #344f3c;
  color: #fff;
}
.powers button:disabled {
  opacity: 0.65;
}
body:not(.playing) .powers {
  display: none;
}
body.awakening main,
body.awakening .topbar {
  visibility: hidden;
}
#awakening {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(
    #263b3126,
    transparent 25%,
    transparent 65%,
    #263b3155
  );
}
.awakening-copy {
  position: absolute;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  text-align: center;
  color: #fffdf0;
  text-shadow: 0 2px 16px #263b31;
}
.awakening-copy span {
  font-size: 11px;
  letter-spacing: 3px;
}
.awakening-copy h2 {
  font-size: clamp(22px, 4vw, 48px);
  margin: 12px 0;
}
#skip-awakening {
  pointer-events: auto;
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom));
  right: max(24px, env(safe-area-inset-right));
  min-height: 48px;
  padding: 12px 20px;
  background: #f4f1eaf2;
  color: #344f3c;
  border: 1px solid #819477;
  border-radius: 12px;
}
@media (pointer: coarse), (max-width: 600px) {
  .powers {
    inset: calc(172px + env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right)) auto
      max(12px, env(safe-area-inset-left));
    gap: 5px;
    justify-content: flex-start;
  }
  .powers span {
    font-size: 9px;
    padding: 5px 7px;
  }
  .powers button {
    font-size: 11px;
    padding: 9px 10px;
    min-width: 80px;
  }
  body:has(.powers:not([hidden])) #toast {
    top: calc(230px + env(safe-area-inset-top));
  }
  .cinema .powers {
    top: calc(16px + env(safe-area-inset-top));
  }
  .cinema .powers span {
    display: none;
  }
}
@media (max-width: 360px) {
  .powers {
    gap: 4px;
  }
  .powers span {
    font-size: 8px;
    padding: 5px;
  }
  .powers button {
    min-width: 76px;
    padding: 8px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .powers {
    top: 152px;
    left: max(12px, env(safe-area-inset-left));
    right: auto;
    max-width: 280px;
  }
  .powers span {
    display: none;
  }
  body:has(.powers:not([hidden])) #toast {
    top: 60px;
  }
  .cinema .powers {
    top: 12px;
  }
  .awakening-copy {
    bottom: 60px;
  }
  .awakening-copy h2 {
    font-size: 24px;
  }
  #skip-awakening {
    bottom: 12px;
  }
}
.powers #ability-jump.active {
  background: #e6bc42;
  color: #293731;
}
/* Short trials keep the same movement controls and a persistent way out. */
body.trial .mission,
body.trial .map,
body.trial .powers,
body.trial #prompt,
body.trial #touch-sprint {
  display: none !important;
}
#trial-hud {
  position: fixed;
  z-index: 5;
  top: 120px;
  left: 30px;
  width: 360px;
  padding: 14px 18px;
  border: 1px solid #cbd1ba;
  border-radius: 16px;
  background: #faf9f2f2;
  color: #344f3c;
}
.trial-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#trial-label {
  font-size: 9px;
  letter-spacing: 1px;
}
#trial-exit {
  min-width: 64px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #a4b096;
  border-radius: 9px;
  background: #f4f1ea;
  color: #344f3c;
  font:
    500 12px Golos,
    Arial,
    sans-serif;
}
#trial-map {
  float: right;
  width: 90px;
  height: 90px;
  margin: 10px 0 0 12px;
  border-radius: 8px;
}
#trial-title {
  font-size: 22px;
  line-height: 1.15;
  margin: 12px 0 8px;
}
#trial-instruction {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 10px;
}
#trial-status {
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
}
#trial-interact {
  position: fixed;
  z-index: 6;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  min-height: 48px;
}
.trial-choices {
  display: grid;
  gap: 12px;
}
.trial-choices button {
  justify-content: space-between;
  min-height: 48px;
}
@media (pointer: coarse), (max-width: 600px) {
  #trial-hud {
    top: calc(67px + env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: calc(
      100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)
    );
    padding: 8px 12px 12px;
  }
  #trial-map {
    width: 64px;
    height: 64px;
    margin: 4px 0 0 10px;
  }
  #trial-title {
    font-size: 18px;
    margin: 4px 0 6px;
  }
  #trial-label {
    font-size: 8px;
  }
  #trial-instruction {
    font-size: 11px;
    margin-bottom: 6px;
  }
  #trial-status {
    font-size: 11px;
  }
  #trial-interact {
    bottom: calc(225px + env(safe-area-inset-bottom));
    max-width: calc(100% - 24px);
    font-size: 13px;
    padding: 13px 18px;
  }
  .cinema #trial-hud {
    top: calc(10px + env(safe-area-inset-top));
  }
  body.trial #toast {
    display: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #trial-hud {
    top: 59px;
    width: 235px;
  }
  #trial-map {
    width: 50px;
    height: 50px;
  }
  #trial-title {
    font-size: 16px;
  }
  #trial-instruction {
    font-size: 10px;
  }
  #trial-interact {
    bottom: 18px;
  }
}

body.trial #toast,
body.trial .keys span:nth-child(2),
body.trial .keys span:nth-child(4) {
  display: none;
}
