@font-face {
  font-family: Onest;
  src: url('../assets/onest-cyrillic-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Onest;
  src: url('../assets/onest-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
* {
  box-sizing: border-box;
}
:root {
  font:
    16px/1.55 Onest,
    Arial,
    sans-serif;
  color: #122f29;
  background: #f7f3e9;
}
body,
p,
h1 {
  margin: 0;
}
[hidden] {
  display: none !important;
}
header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 60px);
  background: #122f29;
  color: #fffbed;
}
header > a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: 0.9rem;
  text-decoration: none;
  color: inherit;
}
header > a span {
  color: #e7c993;
  font-size: 1.4rem;
  transition: transform 0.2s;
}
header > a:hover span {
  transform: translateX(-4px);
}
header > span {
  font:
    1.65rem Georgia,
    serif;
}
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 24vw, 420px);
  min-height: calc(100svh - 68px);
}
#stage {
  position: relative;
  min-height: 420px;
  background: radial-gradient(ellipse at 50% 53%, #f9f6ef, #d5dfd7);
  isolation: isolate;
  overflow: hidden;
}
#frame {
  position: absolute;
  inset: 0;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
canvas:active {
  cursor: grabbing;
}
aside {
  padding: clamp(24px, 4vw, 70px) clamp(20px, 2.5vw, 48px);
  border-left: 1px solid #c2cdc0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
}
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 650;
  color: #586d60;
}
h1 {
  font:
    400 clamp(1.75rem, 2.4vw, 3.2rem)/1.06 Georgia,
    serif;
  letter-spacing: -0.045em;
  margin: 12px 0;
}
.date,
#caption,
#free-view-help {
  color: #506359;
}
.date {
  font-size: 0.9rem;
}
.controls {
  border-top: 1px solid #bfccbd;
  padding-top: 24px;
}
label {
  font-size: 0.9rem;
  font-weight: 650;
  display: block;
  margin-bottom: 6px;
}
select,
button {
  font: inherit;
  color: inherit;
}
select,
#walk {
  width: 100%;
  border-radius: 4px;
  min-height: 46px;
  border: 1px solid #899b8c;
  background: #fffdf7;
  padding: 8px 12px;
}
button,
select {
  cursor: pointer;
}
button:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.58;
}
#caption,
#free-view-help {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 10px;
}
#walk {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #163c32;
  color: #fffdf4;
  border: 1px solid #163c32;
  font-weight: 600;
}
#walk:hover {
  background: #275245;
}
#walk span:first-child {
  font-size: 1.2rem;
}
.stage-tools {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 6px;
}
.stage-tools button,
#pad button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #99aa9f;
  border-radius: 4px;
  background: #f9faf1ed;
  color: #13352c;
}
.stage-tools button {
  font-size: 1.5rem;
  line-height: 1;
}
#loading,
#problem {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(85%, 320px);
  text-align: center;
  background: #f7f3e9f2;
  padding: 24px;
  border: 1px solid #bdc8bb;
  border-radius: 6px;
}
#loading strong,
#problem strong {
  font:
    1.5rem Georgia,
    serif;
  display: block;
}
#progress-label {
  display: block;
  color: #53695a;
}
progress {
  accent-color: #326654;
  width: 100%;
  height: 6px;
  margin: 15px 0;
}
#problem p {
  margin: 12px 0;
}
#problem button,
#problem a {
  padding: 8px;
  color: inherit;
}
#pad {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 4px;
  position: absolute;
  bottom: 12px;
  left: 12px;
  touch-action: none;
  user-select: none;
}
#pad [data-motion='forward'] {
  grid-column: 2;
}
#pad [data-motion='up'] {
  grid-column: 4;
}
#pad button {
  font-size: 0.8rem;
}
:focus-visible {
  outline: 3px solid #9b6b1a;
  outline-offset: 2px;
}
main:fullscreen {
  background: #f7f3e9;
}
@media (max-width: 800px) {
  header {
    height: 54px;
  }
  main {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }
  #stage {
    height: 57svh;
    min-height: 300px;
    max-height: 700px;
    flex: none;
  }
  aside {
    display: block;
    padding: 22px 20px 28px;
    border-left: 0;
  }
  .intro {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 6px;
    align-items: baseline;
  }
  .eyebrow {
    grid-column: 1/-1;
  }
  h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin: 8px 0;
  }
  .date {
    font-size: 0.78rem;
  }
  .controls {
    margin-top: 10px;
    padding-top: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 12px;
  }
  label {
    grid-column: 1/-1;
  }
  select {
    grid-column: 1;
    grid-row: 2;
  }
  #walk {
    margin: 0;
    grid-column: 2;
    grid-row: 2;
    font-size: 0.88rem;
  }
  #caption,
  #free-view-help {
    grid-column: 1/-1;
    margin-top: 8px;
  }
  .stage-tools {
    top: 10px;
    right: 10px;
  }
}
@media (max-width: 480px) {
  .intro {
    display: block;
  }
  .eyebrow {
    font-size: 0.65rem;
  }
  h1 {
    font-size: 1.65rem;
  }
  .date {
    font-size: 0.8rem;
  }
  #walk svg {
    display: none;
  }
}
@media (max-height: 480px) and (min-width: 620px) {
  header {
    height: 44px;
  }
  main {
    display: grid;
    grid-template-columns: 1fr 245px;
    min-height: calc(100svh - 44px);
  }
  #stage {
    height: auto;
    min-height: 300px;
  }
  aside {
    padding: 14px;
    gap: 8px;
  }
  .controls {
    display: block;
    margin: 0;
    padding-top: 6px;
  }
  .intro {
    display: block;
  }
  h1 {
    font-size: 1.5rem;
  }
  .eyebrow,
  .date,
  #caption {
    display: none;
  }
  #walk {
    margin-top: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
.header-end {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-end > span {
  font:
    1.65rem Georgia,
    serif;
}
[data-theme-toggle] {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid #a3b5a769;
  border-radius: 50%;
  color: #f5ebd7;
}
[data-theme-toggle] svg {
  width: 19px;
  height: 19px;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  background: #19251f;
  color: #f1eadc;
}
[data-theme='dark'] #stage {
  background: radial-gradient(ellipse at 50% 48%, #48544d, #1f302a);
}
[data-theme='dark'] aside,
[data-theme='dark'] .controls {
  border-color: #46584e;
}
[data-theme='dark'] .date,
[data-theme='dark'] #caption,
[data-theme='dark'] #free-view-help,
[data-theme='dark'] .eyebrow {
  color: #bbc8b9;
}
[data-theme='dark'] select,
[data-theme='dark'] .stage-tools button,
[data-theme='dark'] #pad button {
  background: #293c32;
  color: #f5efdf;
  border-color: #758a78;
}
[data-theme='dark'] #walk {
  background: #dcca9e;
  color: #20382a;
}
[data-theme='dark'] #loading,
[data-theme='dark'] #problem,
[data-theme='dark'] main:fullscreen {
  color: #f1eadc;
  background: #1c2d25;
}
[data-theme='dark'] #progress-label {
  color: #bbc8b9;
}

.stage-tools svg,
#walk svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stage-tools button {
  display: grid;
  place-items: center;
}
@media (max-width: 480px) {
  #walk svg {
    display: none;
  }
}
