:root {
  color-scheme: dark;
  --bg: #0d0b09;
  --ink: #efe9de;
  --dim: #a39b8d;
  --faint: #665f54;
  --line: rgba(239, 233, 222, 0.14);
  --card: #16130f;
  --acc: #ffb454;
  --acc-ink: #1a1006;
  --f-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 6px;
}
a {
  color: inherit;
}
.app {
  max-width: var(--ob-page-max);
  margin: 0 auto;
  padding: 20px var(--ob-gutter) 56px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}
.pal,
.work,
.card {
  min-width: 0;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.topr {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.pvs {
  font: 500 11px var(--f-mono);
  letter-spacing: 0.06em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.pvs::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6fd08c;
  margin-right: 7px;
  vertical-align: 1px;
}
.eyebrow {
  font: 400 11px var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow b {
  color: var(--acc);
  font-weight: 500;
}
h1 {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.98;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}
.sub {
  font: 400 1.25rem/1.35 var(--f-display);
  color: var(--dim);
  max-width: 48ch;
  margin: 0;
}
.back {
  font: 500 12px var(--f-body);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(22, 19, 15, 0.8);
  white-space: nowrap;
}
.back:hover {
  border-color: var(--dim);
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.card.main {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.work {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.view {
  position: relative;
  line-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #0a0806;
  border: 1px solid var(--line);
  width: 100%;
  aspect-ratio: 16/10;
  max-height: calc(100vh - 150px);
  min-height: 260px;
}
#gl {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font: 400 11px var(--f-mono);
  letter-spacing: 0.04em;
  color: rgba(239, 233, 222, 0.55);
  pointer-events: none;
  line-height: 1.4;
}
@media (max-width: 899px) {
  .card.main {
    display: flex;
    flex-direction: column;
  }
  .work {
    display: contents;
  }
  .view {
    order: 1;
  }
  .pal {
    order: 2;
  }
  .work > .row {
    order: 3;
  }
  .gr {
    grid-template-columns: repeat(4, 1fr);
  }
  .hint {
    display: none;
  }
}
@media (min-width: 900px) {
  .card.main {
    grid-template-columns: 288px minmax(0, 1fr);
    align-items: start;
  }
  .pal {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding-right: 4px;
  }
}
.pal {
  display: grid;
  gap: 8px;
}
.grp {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 6px;
}
.grp:first-child {
  margin-top: 0;
}
.grp b {
  font: 500 11px var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc);
}
.gr {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.el {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 3px;
  font: 500 11.5px var(--f-body);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 3px 6px;
  cursor: pointer;
}
.el canvas {
  width: 64px;
  height: 48px;
}
.el span {
  color: var(--dim);
  font: 400 10.5px var(--f-mono);
}
.el:hover {
  border-color: var(--dim);
}
.el[aria-pressed='true'] {
  border-color: var(--acc);
  background: rgba(255, 180, 84, 0.12);
}
.sw {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.sw button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}
.sw button[aria-pressed='true'] {
  border-color: #fff;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: flex-end;
}
.tg {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.tl {
  font: 400 10px var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.tr {
  gap: 6px;
}
.scene {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sc {
  gap: 14px;
}
.fld {
  display: grid;
  gap: 4px;
  min-width: 150px;
}
.fld > span {
  font: 400 11px var(--f-mono);
  letter-spacing: 0.06em;
  color: var(--dim);
}
.fld b {
  color: var(--acc);
  font-weight: 500;
}
select {
  font: 500 13px var(--f-body);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
}
select:hover {
  border-color: var(--dim);
}
input[type='range'] {
  width: 100%;
  accent-color: var(--acc);
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.chip,
.b {
  font: 500 13px var(--f-body);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
}
.chip:hover,
.b:hover {
  border-color: var(--dim);
}
.chip:disabled,
.b:disabled {
  opacity: 0.4;
  cursor: default;
}
.b.pri {
  background: var(--acc);
  color: var(--acc-ink);
  border-color: var(--acc);
}
.lab {
  font: 400 11px var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.b.danger {
  color: #ff8a7a;
  border-color: rgba(255, 110, 90, 0.55);
  background: rgba(255, 80, 60, 0.12);
}
.b.danger:hover {
  background: #d8402d;
  border-color: #d8402d;
  color: #fff;
}
#tools .b[aria-pressed='true'] {
  font-weight: 700;
  color: #1a1006;
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.25);
}
#tools .b[data-tool='hammer'][aria-pressed='true'] {
  background: #6fb4ff;
  border-color: #6fb4ff;
  box-shadow: 0 0 0 3px rgba(111, 180, 255, 0.28);
}
#tools .b[data-tool='bomb'][aria-pressed='true'] {
  background: #ff6a45;
  border-color: #ff6a45;
  box-shadow: 0 0 0 3px rgba(255, 106, 69, 0.3);
}
.mode {
  position: absolute;
  left: 12px;
  top: 10px;
  font: 600 11px var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  color: #1a1006;
  background: var(--acc);
  pointer-events: none;
}
.mode.hammer {
  background: #6fb4ff;
}
.mode.bomb {
  background: #ff6a45;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal.on {
  display: flex;
}
.modal .box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  max-width: 360px;
  width: 100%;
}
.modal h3 {
  margin: 0 0 8px;
  font: 400 22px var(--f-serif, Georgia, serif);
}
.modal p {
  margin: 0 0 18px;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.45;
}
.modal .row {
  justify-content: flex-end;
}
.stat {
  font: 500 12px var(--f-mono);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
  margin: 0;
}
p {
  margin: 0;
  color: var(--dim);
  max-width: 64ch;
}
.try {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: t;
}
.try li {
  counter-increment: t;
  color: var(--dim);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 6px;
  max-width: 72ch;
}
.try li::before {
  content: counter(t);
  font: 500 11px var(--f-mono);
  color: var(--acc);
  padding-top: 4px;
}
.try b {
  color: var(--ink);
  font-weight: 500;
}
.how {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}
.how summary {
  cursor: pointer;
  padding: 14px 18px;
  font: 500 11px var(--f-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  list-style: none;
}
.how summary::-webkit-details-marker {
  display: none;
}
.how summary::before {
  content: '+';
  display: inline-block;
  width: 1.2em;
  color: var(--acc);
}
.how[open] summary::before {
  content: '-';
}
.how .hb {
  padding: 0 18px 16px;
  display: grid;
  gap: 10px;
  font: 400 14px var(--f-body);
  color: var(--dim);
  line-height: 1.6;
  max-width: 78ch;
}
.how .hb p {
  margin: 0;
}
.how b {
  color: var(--ink);
  font-weight: 500;
}
.home {
  display: inline-block;
  font: 500 12px var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acc);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  justify-self: start;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #0d0b09;
  font: 500 13px var(--f-body);
  padding: 9px 16px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.on {
  opacity: 1;
}
@media (max-width: 700px) {
  .app {
    padding: 14px 14px 40px;
  }
  .card {
    padding: 12px;
  }
  .stat {
    margin-left: 0;
  }
  .el canvas {
    width: 52px;
    height: 40px;
  }
}

/* Wide screens: the 3D view takes the full width next to the parts and as much height as
   fits with the tool row under it still on the first screen. */
@media (min-width: 900px) {
  .view {
    aspect-ratio: auto;
    height: clamp(360px, calc(100dvh - 290px), 1300px);
    max-height: none;
  }
}
