:root {
  color-scheme: light;
  --paper: #f7f5f2;
  --ink: #252526;
  --muted: #6b6666;
  --line: #d6d1ce;
  --accent: #815466;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100svh;
  min-height: 560px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  -webkit-font-smoothing: antialiased;
}
header {
  padding: 30px 42px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.eyebrow,
legend,
.stage-note {
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.eyebrow {
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(30px, 3.4vw, 50px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.05;
  margin: 0;
}
h1 span {
  color: #8a787f;
  font-weight: 400;
}
.credit {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 0;
}
.credit:hover {
  color: var(--ink);
}
#stage {
  min-height: 0;
  position: relative;
  isolation: isolate;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
canvas:active {
  cursor: grabbing;
}
.readout {
  position: absolute;
  left: 42px;
  top: 44px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.readout strong {
  font-size: 54px;
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.readout strong span {
  font-size: 22px;
  color: var(--muted);
  margin-left: 4px;
}
#result {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.stage-note {
  position: absolute;
  left: 42px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
#loading,
noscript {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 14px;
}
#loading[hidden] {
  display: none;
}
footer {
  padding: 0 42px 20px;
}
.controls {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: grid;
  grid-template-columns: 1fr 280px 1fr;
  align-items: center;
  gap: 28px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
fieldset:last-child {
  justify-self: end;
}
legend {
  padding: 0;
  margin-bottom: 12px;
}
.seg {
  display: flex;
  gap: 5px;
}
button {
  font:
    500 13px Arial,
    Helvetica,
    sans-serif;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 24px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  white-space: nowrap;
}
button:hover {
  background: #ebe5e5;
  border-color: #b4a6ad;
}
button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #9b637c;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inspect {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.inspect button {
  font-size: 12px;
  padding: 0 13px;
}
#reset {
  font-size: 23px;
  padding: 0;
  width: 44px;
}
#drop {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
  height: 52px;
  font-size: 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}
#drop:hover {
  background: #4b3640;
}
#drop span {
  font-size: 24px;
}
.footnote {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-size: 11px;
  color: var(--muted);
}
.footnote p {
  margin: 0;
}
#sound {
  border: 0;
  font-size: 11px;
  padding: 0 8px;
  min-height: 44px;
  margin: -12px -8px;
}
@media (max-width: 900px) {
  header {
    padding: 24px 24px 0;
  }
  footer {
    padding: 0 24px 18px;
  }
  .controls {
    grid-template-columns: 1fr 235px 1fr;
    gap: 12px;
  }
  button {
    padding: 0 12px;
  }
  .readout {
    left: 24px;
    top: 26px;
  }
  .stage-note {
    left: 24px;
  }
  .desktop {
    display: none;
  }
}
@media (max-width: 650px) {
  body {
    min-height: 640px;
  }
  header {
    padding: 20px 18px 0;
  }
  h1 {
    font-size: 32px;
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 9px;
  }
  .credit {
    max-width: 88px;
    font-size: 10px;
    line-height: 1.6;
    text-align: right;
    padding: 0;
  }
  .readout {
    left: 18px;
    top: 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 10px;
  }
  .readout .eyebrow {
    grid-column: 1 / -1;
  }
  .readout strong {
    font-size: 32px;
  }
  .readout strong span {
    font-size: 16px;
  }
  #result {
    font-size: 10px;
    margin-top: 0;
    align-self: center;
  }
  .stage-note {
    left: 18px;
    bottom: 12px;
    font-size: 8px;
  }
  footer {
    padding: 0 18px 16px;
  }
  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 14px;
  }
  fieldset,
  fieldset:last-child {
    position: relative;
    width: 100%;
    justify-self: stretch;
    padding-left: 106px;
    min-height: 44px;
  }
  legend {
    position: absolute;
    left: 0;
    top: 18px;
    font-size: 8px;
    letter-spacing: 0.12em;
    margin: 0;
  }
  .seg {
    gap: 3px;
  }
  .seg button {
    padding: 0 10px;
    min-width: 44px;
    font-size: 11px;
  }
  .actions {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: row;
    gap: 8px;
  }
  .inspect {
    gap: 3px;
  }
  .inspect button {
    padding: 0 10px;
    font-size: 11px;
  }
  #reset {
    width: 44px;
    font-size: 21px;
  }
  #drop {
    flex: 1;
    height: 46px;
    font-size: 14px;
    padding: 0 15px;
  }
  .footnote {
    margin-top: 14px;
    font-size: 9px;
    gap: 8px;
  }
  .footnote p:nth-child(2) {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
