html,
body {
  height: 100%;
  overflow: hidden;
  background: #faf9f6;
}
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
select {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
#stage:focus-visible {
  outline: 2px solid #2c4bff;
  outline-offset: 5px;
}
header,
footer {
  position: fixed;
  z-index: 3;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  pointer-events: none;
}
header {
  top: 0;
}
footer {
  bottom: 0;
  font-size: 12px;
}
header > *,
footer > * {
  pointer-events: auto;
}
header .word {
  text-decoration: none;
  letter-spacing: -0.04em;
}
.sub {
  font-family: var(--body);
  font-size: 13px;
  color: #73716c;
  letter-spacing: 0;
  margin-left: 8px;
}
.top-actions,
.travel,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.top-actions {
  font-size: 13px;
}
.make {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  background: #111418;
  color: white;
  text-decoration: none;
  border-radius: 3px;
  font-size: 13px;
  white-space: nowrap;
}
#stage {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: grab;
}
#stage.dragging {
  cursor: grabbing;
}
#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  width: 90%;
  transition: opacity 0.45s;
}
#intro.away {
  opacity: 0;
}
.eyebrow {
  font: 10px var(--mono);
  letter-spacing: 0.2em;
  color: #6b7076;
  margin-bottom: 16px;
}
#intro h1 {
  font: clamp(38px, 5vw, 74px)/1.04 var(--display);
  letter-spacing: -0.045em;
}
#intro > p:last-child {
  font-size: 13px;
  color: #6b7076;
  margin-top: 22px;
}
#hint {
  color: #6b7076;
}
select {
  font: inherit;
  color: #111418;
  border: 0;
  background: transparent;
  padding: 10px;
  max-width: 150px;
}
.filter {
  color: #6b7076;
  background: #faf9f6e6;
  border-radius: 4px;
  padding: 0 8px;
}
.travel {
  gap: 6px;
  background: #faf9f6ed;
  border-radius: 4px;
  padding: 0 6px;
}
.travel button {
  min-width: 40px;
  height: 44px;
  font-size: 18px;
}
#reset {
  font-size: 12px;
  padding: 0 8px;
}
#status {
  position: fixed;
  top: 90px;
  left: 32px;
  z-index: 5;
  font-size: 12px;
  color: #6b7076;
  max-width: 270px;
}
#status:empty {
  display: none;
}
#hover {
  position: fixed;
  z-index: 4;
  pointer-events: none;
  padding: 8px 12px;
  background: #111418;
  color: white;
  font-size: 12px;
  border-radius: 3px;
}
#render {
  position: absolute;
  left: -2000px;
  top: 0;
  pointer-events: none;
  visibility: hidden;
}
#gallery {
  position: absolute;
  inset: 85px 0 90px;
  overflow: auto;
  padding: 24px 32px;
}
#gallery h1 {
  font: 32px var(--display);
  margin: 20px 0 32px;
}
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 36px 24px;
}
.tile {
  text-align: left;
}
.tile .art {
  aspect-ratio: 1;
  background: #f2f0ec;
  overflow: hidden;
}
.tile svg {
  width: 100%;
  height: 100%;
}
.tile span {
  display: block;
  margin-top: 12px;
  font-size: 13px;
}
.tile small {
  display: block;
  margin-top: 4px;
  color: #6b7076;
  font-size: 11px;
}
dialog {
  border: 0;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  background: #faf9f6;
  padding: 24px 32px;
  overflow: auto;
}
dialog::backdrop {
  background: #faf9f6;
}
#close {
  font-size: 13px;
  min-height: 44px;
}
#detail-art {
  height: min(68vh, 720px);
  margin: 0 auto;
  text-align: center;
}
#detail-art svg {
  height: 100%;
  max-width: 100%;
  width: auto;
  aspect-ratio: 1;
}
.detail-caption {
  max-width: 950px;
  margin: 16px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.detail-caption h2 {
  font-size: 30px;
  text-transform: capitalize;
}
.detail-caption p {
  font-size: 12px;
  color: #6b7076;
  margin-top: 6px;
}
.detail-actions {
  gap: 16px;
  font-size: 12px;
}
.detail-actions button {
  min-height: 44px;
}
body.flat #stage,
body.flat #intro {
  display: none;
}
body.flat #hint,
body.flat .travel {
  visibility: hidden;
}
@media (max-width: 650px) {
  header,
  footer {
    padding: 16px;
  }
  header .word {
    font-size: 20px;
  }
  .sub {
    font-size: 11px;
    margin-left: 4px;
  }
  .top-actions {
    gap: 12px;
    font-size: 11px;
  }
  .make {
    font-size: 11px;
    padding: 11px 12px;
  }
  #hint {
    display: none;
  }
  #intro {
    top: 27%;
  }
  #intro h1 {
    font-size: 42px;
  }
  #intro > p:last-child {
    font-size: 12px;
  }
  #gallery {
    padding: 16px;
  }
  #grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
  }
  dialog {
    padding: 16px;
  }
  #detail-art {
    height: 55vh;
  }
  .detail-caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  .detail-actions {
    flex-wrap: wrap;
    gap: 18px;
  }
  .detail-caption h2 {
    font-size: 26px;
  }
  #status {
    left: 16px;
    font-size: 11px;
  }
  select {
    max-width: 128px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (max-width: 650px) {
  header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }
  header .word {
    grid-row: 1;
    grid-column: 1;
  }
  .top-actions {
    display: contents;
  }
  .top-actions .make {
    grid-row: 1;
    grid-column: 2;
  }
  .top-actions #flat {
    grid-row: 2;
    grid-column: 2;
    justify-self: end;
    font-size: 11px;
    min-height: 32px;
  }
  #gallery {
    top: 112px;
  }
}
