:root {
  color-scheme: light;
  -webkit-tap-highlight-color: transparent;
  --study-ink: #263c40;
  --study-muted: #526a67;
  --study-border: #d6e2dd;
  --study-accent: #246e65;
  --study-hover: #dcebe7;
}

* { box-sizing: border-box; }
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: #fff;
  color: var(--study-ink);
  font: 14px/1.4 system-ui, sans-serif;
}

.study-header {
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--study-border);
}
.study-header h1 {
  margin: 0 0 3px;
  font-size: 23px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: .03em;
}
.study-header h1 a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
}
.study-header small { color: var(--study-muted); font-size: 12px; }
.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  min-height: 0;
}
.study-stage { position: relative; isolation: isolate; overflow: hidden; }
.study-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.study-stage canvas:active { cursor: grabbing; }
.hud, .foot {
  position: absolute;
  left: 20px;
  z-index: 4;
  pointer-events: none;
  color: var(--study-muted);
  font-size: 11px;
}
.hud { top: 16px; letter-spacing: .1em; }
.hud b { display: block; color: var(--study-ink); font-size: 17px; letter-spacing: 0; }
.foot { bottom: 16px; }
.study-controls {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border-left: 1px solid var(--study-border);
}
.control-group {
  padding: 12px;
  border: 1px solid var(--study-border);
  border-radius: 8px;
}
.control-group + .control-group { margin-top: 12px; }
.control-group h2 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--study-border);
  color: var(--study-ink);
  font-size: 13px;
  font-weight: 650;
}
.subhead {
  margin: 14px 0 6px;
  color: var(--study-muted);
  font-size: 12px;
  font-weight: 650;
}
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
button {
  padding: 7px 9px;
  border: 1px solid var(--study-border);
  border-radius: 5px;
  background: #f6f8f7;
  color: var(--study-ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
button:hover, button.active { background: var(--study-hover); border-color: #6c9990; }
input[type=range], input[type=checkbox] { accent-color: var(--study-accent); }
input[type=range] { display: block; width: 100%; margin: 8px 0 10px; }
input[type=checkbox] { flex: none; margin: 0; }
.control-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}
.control-group .module-title { padding: 0; font: inherit; }
.module-title input { width: 17px; height: 17px; }
.control-group .field { display: block; }
.field :is(input:not([type=range]), select) {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--study-border);
  border-radius: 4px;
  background: #fff;
  color: var(--study-ink);
  font: inherit;
}
.number { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.number output { flex: none; font-weight: 650; }
.hint { margin: 9px 0 0; color: var(--study-muted); font-size: 12px; line-height: 1.5; }
:focus-visible { outline: 2px solid var(--study-accent); outline-offset: 2px; }

@media (max-width: 740px) {
  .study-header { padding: 12px 14px 10px; }
  .study-header h1 { font-size: 19px; }
  .study-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.05fr) minmax(0, 1fr);
  }
  .study-controls { padding: 12px; border-top: 1px solid var(--study-border); border-left: 0; }
  .hud, .foot { left: 12px; }
  .hud { top: 10px; }
  .hud b { font-size: 14px; }
  .foot { bottom: 10px; }
}
