:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #212722;
  background: #f7f5ee;
  font-synthesis: none;
  --ink: #242d25;
  --muted: #566054;
  --edge: #deded1;
  --white: #fcfbf7;
  --active: #2d4435;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, a { color: inherit; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible, #viewport:focus-visible {
  outline: 2px solid #7b6a36;
  outline-offset: -2px;
}
button[aria-pressed="true"] { color: #fff; border-color: var(--active); background: var(--active); }
button:disabled { opacity: .52; cursor: progress; }
[hidden] { display: none !important; }
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; min-height: 70px; gap: 12px;
  border-bottom: 1px solid var(--edge); background: var(--white);
}
.heading { display: flex; gap: 14px; align-items: baseline; }
h1, h2, p { margin: 0; }
h1 { font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.8px; }
.heading p { color: var(--muted); font-size: 13px; }
.heading p span { margin: 0 2px; }
.header-link { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.header-link:hover, .links a:hover { text-decoration: underline; }
.header-link span { margin-left: 4px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 288px; height: calc(100dvh - 70px); min-height: 420px; }
.stage { position: relative; min-width: 0; min-height: 0; background: #ced9d6; overflow: hidden; }
#viewport { position: absolute; inset: 0; touch-action: none; }
#viewport canvas { display: block; width: 100%; height: 100%; }
.toolbar { position: absolute; inset: 18px 18px auto 18px; display: flex; justify-content: space-between; pointer-events: none; }
.toolbar > * { pointer-events: auto; }
.mode { display: flex; gap: 2px; padding: 4px; background: var(--white); border: 1px solid #fefdf6; border-radius: 9px; box-shadow: 0 2px 10px #252b231f; }
.mode button { background: transparent; border: 0; border-radius: 6px; min-width: 64px; min-height: 34px; font-size: 13px; font-weight: 600; }
.mode button[aria-pressed="true"] { background: var(--active); }
.float-button { background: var(--white); border: 0; border-radius: 8px; width: 44px; height: 44px; font-size: 23px; box-shadow: 0 2px 10px #252b231f; }
.loading { position: absolute; inset: 48% auto auto 50%; transform: translate(-50%,-50%); padding: 12px 18px; text-align: center; background: var(--white); border-radius: 9px; width: max-content; max-width: 88%; }
.direction { position: absolute; right: 21px; bottom: 21px; width: 40px; height: 45px; border-radius: 7px; background: #fcfbf7ee; display: grid; place-content: center; text-align: center; font-size: 10px; font-weight: 700; gap: 0; pointer-events: none; }
#north { line-height: 18px; font-size: 19px; transform-origin: 50% 50%; }
.view-caption { color: var(--ink); position: absolute; left: 18px; bottom: 18px; padding: 12px 14px; pointer-events: none; background: #fcfbf7ee; border-radius: 8px; }
#view-name { font-family: Georgia, serif; font-size: 19px; }
#view-help { margin-top: 5px; color: var(--muted); font-size: 12px; }
.sidebar { background: var(--white); padding: 9px 20px 16px; border-left: 1px solid var(--edge); overflow: auto; }
.panel { padding: 16px 0; border-bottom: 1px solid var(--edge); }
h2, summary { font-weight: 650; font-size: 14px; }
summary { cursor: pointer; }
#views { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-top: 11px; }
#views button { background: #f6f5ef; border: 1px solid var(--edge); border-radius: 6px; font-size: 12px; min-height: 37px; padding: 5px 4px; }
#stops { margin: 7px 0 9px; display: grid; }
#stops button, #guided-stair {
  text-align: left; display: flex; align-items: center; justify-content: space-between;
  min-height: 32px; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px;
  background: none; font-size: 13px;
}
#stops button:hover, #views button:hover, #guided-stair:hover { border-color: #8c9b8a; }
#stops button[aria-pressed="true"], #views button[aria-pressed="true"] { color: white; background: var(--active); border-color: var(--active); }
#guided-stair { width: 100%; border-color: #cbd4c9; color: #2e4c3b; background: #edf1ea; font-weight: 625; min-height: 35px; }
#layers, .links { display: grid; gap: 7px; margin: 13px 0 0; padding: 0; }
#layers label { display: flex; align-items: center; gap: 7px; font-size: 13px; }
#layers input { accent-color: var(--active); }
.links { list-style: none; font-size: 13px; }
.footnote { font-size: 12px; color: var(--muted); padding-top: 13px; line-height: 1.35; }
.motion-pad { position: absolute; right: 17px; bottom: 88px; display: grid; grid-template-columns: repeat(3,42px); gap: 3px; touch-action: none; }
.motion-pad button { background: var(--white); border: 1px solid #e1e1d7; border-radius: 6px; font-size: 19px; width: 42px; height: 40px; touch-action: none; user-select: none; }
.motion-pad button:first-child { grid-column: 2; }
.motion-pad button:nth-child(2) { grid-column: 1; }
.motion-pad button:active { background: #dbe4d7; }
#stage:fullscreen .motion-pad { bottom: 94px; }
@media (max-width: 720px) {
  .masthead { min-height: 59px; padding: 8px 13px; }
  .heading { display: block; }
  h1 { font-size: 24px; line-height: 1.1; }
  .heading p { font-size: 11px; }
  .header-link { font-size: 12px; }
  .workspace { display: block; height: auto; min-height: 0; }
  .stage { height: 58dvh; min-height: 300px; }
  .sidebar { padding: 0 14px 15px; border-left: 0; border-top: 1px solid var(--edge); }
  #views { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  #stops { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; }
  #stops button { min-height: 36px; }
  .toolbar { inset: 10px 10px auto; }
  .view-caption { bottom: 10px; left: 10px; padding: 7px 9px; }
  #view-name { font-size: 16px; }
  #view-help { font-size: 11px; }
  .direction { bottom: 10px; right: 10px; width: 31px; height: 37px; }
  .motion-pad { bottom: 58px; right: 10px; }
}
