:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: #232724;
  background: #f1f0eb;
}

* { box-sizing: border-box; }

body { display: grid; grid-template-rows: auto minmax(0, 1fr); margin: 0; height: 100dvh; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.25rem);
  border-bottom: 1px solid #d5d7d0;
}

h1 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.65rem); font-weight: 650; }

.header-tools, .header-tools nav { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1.1rem; }
.header-tools { margin-inline-start: auto; justify-content: flex-end; }
.header-tools a { color: #315642; font-size: .9rem; font-weight: 600; text-underline-offset: .2em; }
.header-tools a:hover { color: #192e22; }
#status { margin: 0; color: #535d56; font-size: .9rem; text-align: right; }
#status:empty { display: none; }

@media (max-width: 660px) {
  .header-tools { margin-inline-start: 0; justify-content: flex-start; }
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
}

.viewport { position: relative; background: #262b2a; }

canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; cursor: grab; }
canvas.is-dragging { cursor: grabbing; }
.viewport.is-locked canvas { cursor: none; }

#error { position: absolute; inset: 1rem auto auto 1rem; color: #f7f6f1; }

.walk-controls {
  position: absolute;
  inset: auto auto 1.25rem 1.25rem;
  padding: .75rem .9rem;
  color: #f8f7f3;
  background: #232724e8;
  border-radius: 5px;
  max-width: min(22rem, calc(100% - 2.5rem));
}

.walk-controls button { margin: 0; color: #232724; }
.walk-controls p { margin: 0 0 .45rem; font-size: .83rem; line-height: 1.4; }
.viewport.is-locked .walk-controls { display: none; }

aside {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  background: #f8f7f3;
  border-left: 1px solid #d5d7d0;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .25rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid #d5d7d0;
}

.settings-tabs button { border-color: transparent; background: transparent; }
.settings-tabs [aria-selected="true"] { border-color: #b8c8be; background: #e5ece6; font-weight: 650; }

.settings-panel { display: grid; align-content: start; gap: .85rem; overflow: auto; padding: 1rem; }
.settings-panel[hidden], .material-option[hidden] { display: none; }

.control { display: grid; gap: .35rem; }
.control > span { display: flex; justify-content: space-between; gap: .5rem; }
.control output { color: #535d56; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: .45rem; }
label { font-weight: 560; font-size: .88rem; }

select, button, .material-current {
  padding: .6rem .7rem;
  font: inherit;
  font-size: .9rem;
  color: inherit;
  border-radius: 5px;
  border: 1px solid #b9c0b8;
  background: #fff;
}

button, .material-current { cursor: pointer; }
.material-current {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem;
  list-style: none;
}
.material-current::-webkit-details-marker { display: none; }
.material-current::after { content: "▾"; margin-left: auto; padding-right: .2rem; color: #535d56; }
.material-picker[open] .material-current::after { content: "▴"; }
.material-current[aria-disabled="true"] { cursor: default; }
.material-current[aria-disabled="true"]::after { content: none; }
.current-thumbnail { flex: 0 0 128px; }
.current-thumbnail:empty { display: none; }
.current-label { display: grid; flex: 1; min-width: 0; gap: .25rem; }
.material-label, .current-footprint { color: #535d56; font-size: .78rem; }
.material-thumb {
  display: block;
  width: min(128px, 100%);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: #e9ebe5;
}
.material-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem;
  margin-top: .45rem;
}
.material-option {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: .35rem;
  padding: .3rem;
  font-size: .8rem;
  text-align: center;
}
.material-option:hover { border-color: #365b48; }
.material-option[aria-pressed="true"] { border-color: #365b48; background: #e5ece6; }
.panel-status { margin: 0; color: #535d56; font-size: .8rem; }
.panel-status:empty { display: none; }

input[type="range"], input[type="checkbox"] { accent-color: #365b48; }
input[type="range"] { width: 100%; margin: 0; }
:focus-visible { outline: 2px solid #365b48; outline-offset: 3px; }

@media (max-width: 700px) {
  body { height: auto; min-height: 100dvh; }
  main { grid-template-columns: 1fr; }
  .viewport { min-height: 57dvh; }
  aside { border-left: 0; border-top: 1px solid #d5d7d0; }
  .settings-panel { overflow: visible; }
}
