@font-face {
  font-family: "IBM Plex Sans";
  src: url("./fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --frame: #edf0ea;
  --ink: #1c2821;
  --muted: #526057;
  --accent: #32664f;
  --sheet: #fff;
  --line: #dce3dc;
  font: 16px/1.4 "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--frame);
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, .stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, .scope { font-size: .875rem; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .65rem max(1rem, env(safe-area-inset-left));
  gap: .75rem;
}
h1, h2, p { margin: 0; }
h1 { font-size: 1.48rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.scope { color: var(--muted); font-weight: 500; }
.mark { width: 1.05rem; height: 1.05rem; background: var(--accent); clip-path: polygon(50% 0, 100% 48%, 100% 100%, 68% 100%, 68% 65%, 35% 65%, 35% 100%, 0 100%, 0 48%); }
.primary { background: #243229; border: 1px solid #243229; color: white; border-radius: 6px; padding: .48rem .9rem; min-height: 44px; font-weight: 650; }
.primary:not(:disabled):hover { background: #3b4f43; }
.workspace {
  display: grid;
  grid-template-columns: 12rem minmax(0,1fr);
  align-items: start;
  gap: .75rem;
  padding-inline: max(.5rem, env(safe-area-inset-left)) max(.5rem, env(safe-area-inset-right));
  padding-bottom: max(.5rem, env(safe-area-inset-bottom));
}
.rail { padding: .35rem .45rem .5rem; min-width: 0; }
.mode { display: flex; gap: .35rem; }
.mode button {
  flex: 1; min-height: 44px; border: 1px solid var(--line);
  border-bottom: 2px solid transparent; border-radius: 5px 5px 0 0;
  background: #f6f8f4; font-weight: 650;
}
.mode button[aria-pressed="true"] { border-bottom-color: var(--accent); background: white; }
h2 { font-size: .875rem; font-weight: 650; margin: 1.2rem 0 .45rem; }
.view-list { display: grid; gap: .43rem; }
.view-list button { min-width: 0; min-height: 44px; display: grid; grid-template-columns: 3.65rem 1fr; align-items: center; gap: .46rem; padding: .22rem .38rem .22rem .22rem; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; }
.view-list img { display: block; width: 100%; height: 2.35rem; object-fit: cover; border-radius: 3px; }
.view-list button:hover { background: #e2e9e0; }
.view-list button[aria-pressed="true"] { background: white; border-color: #c2d1c3; font-weight: 650; }
.hint { margin-top: 1.15rem; color: var(--muted); font-size: .875rem; }
.sheet { min-width: 0; padding: .32rem; background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; }
.stage {
  position: relative; aspect-ratio: 16/9;
  height: calc(100svh - 7.1rem);
  min-height: 17rem; max-height: 62rem;
  width: 100%; isolation: isolate; background: #c8d8da; border-radius: 11px;
  overflow: hidden; touch-action: none;
}
.stage canvas, .poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.poster { z-index: 1; object-fit: cover; }
.poster[hidden], .status[hidden], .movement[hidden] { display: none; }
.stage canvas { cursor: grab; }
.stage canvas:active { cursor: grabbing; }
[data-navigation="walk"] canvas { cursor: move; }
.status { position: absolute; z-index: 2; left: .6rem; bottom: .6rem; max-width: calc(100% - 1.2rem); background: white; color: var(--ink); border-radius: 5px; padding: .65rem .8rem; font-size: .875rem; }
.sheet-foot { display: flex; align-items: center; min-height: 3rem; padding-inline: .6rem; gap: .65rem; }
#view-name { font-weight: 650; font-size: .925rem; }
#feedback { color: var(--muted); font-size: .82rem; }
#reset { margin-inline-start: auto; border: 0; background: transparent; padding: .2rem .48rem; min-height: 44px; white-space: nowrap; }
.movement { position: absolute; z-index: 3; left: .65rem; bottom: .65rem; display: none; grid-template: repeat(2,44px) / repeat(3,44px); gap: .27rem; }
.movement button { border: 1px solid #b7c8b9; background: #f7faf6; border-radius: 6px; font-size: 1.2rem; font-weight: 650; line-height: 1; touch-action: none; }
.movement button:active { background: #c5d9c9; }
.movement button:first-child { grid-column: 2; }
.movement button:nth-child(2) { grid-row: 2; grid-column: 1; }
.movement button:nth-child(3) { grid-row: 2; grid-column: 2; }
.movement button:nth-child(4) { grid-row: 2; grid-column: 3; }
.no-script { padding: 1rem; }
@media (pointer: coarse) {
  .movement:not([hidden]) { display: grid; }
}
@media (max-width: 48rem) {
  .workspace { grid-template-columns: minmax(0,1fr); gap: .45rem; }
  .sheet { grid-row: 1; }
  .stage { height: 52svh; max-height: 40rem; }
  .rail { display: grid; grid-template-columns: 1fr auto; gap: .4rem .65rem; padding: .25rem .45rem .65rem; }
  .mode { grid-column: 1/-1; }
  .views { grid-column: 1/-1; }
  h2 { margin: .2rem 0 .33rem; }
  .view-list { grid-template-columns: repeat(4,minmax(0,1fr)); gap: .28rem; }
  .view-list button { display: block; padding: .24rem; font-size: .8rem; line-height: 1.2; min-height: 58px; }
  .view-list img { margin-bottom: .18rem; height: 2.15rem; }
  .hint { grid-column: 1/-1; margin-top: .16rem; }
}
@media (max-height: 31rem) and (orientation: landscape) {
  .stage { height: calc(100svh - 7rem); min-height: 12rem; }
}
