:root {
  color-scheme: light;
  font: 16px/1.6 "Atkinson Hyperlegible Next", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: #182820;
  background: #eff2ed;
  --ink: #182820;
  --muted: #536459;
  --line: #c9d2c9;
  --green: #256345;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: clamp(1rem, 5vw, 4rem) 1rem; }
main { max-width: 49rem; margin: 0 auto; }
header, .title-row, .bar, #target-bar, .actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: .75rem;
}
header { justify-content: space-between; padding: 0 .1rem 1.3rem; }
.brand { display: inline-flex; align-items: center; gap: .8rem; color: var(--ink); text-decoration: none;
  font: 750 1.75rem/1 "Geist", system-ui, sans-serif; letter-spacing: -.055em; }
.brand i { width: 1.12rem; height: 1.12rem; border: 2px solid var(--green); transform: skewY(-12deg); box-shadow: 4px 4px var(--green); margin-right: 4px; }
.models, #side, label span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .84rem; }
.models { color: var(--muted); }
.workspace { background: #fbfcf8; border: 1px solid var(--line); border-radius: .8rem; overflow: clip; }
.connect { background: #172d24; color: #f5f9ef; padding: clamp(1.3rem, 5vw, 3rem); }
.title-row { justify-content: space-between; }
h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.65rem); line-height: 1.25; letter-spacing: -.045em; }
#side { display: inline-flex; align-items: center; gap: .45rem; color: #d5e0d6; }
#side::before { content: ""; width: .5rem; height: .5rem; border: 1px solid currentColor; border-radius: 50%; }
#side[data-connected="true"]::before { background: #c2ed94; color: #c2ed94; }
#status { margin: .85rem 0 1.55rem; color: #d5e0d6; }
button, select { min-height: 2.8rem; border: 1px solid var(--line); border-radius: .4rem; padding: .5rem 1rem; background: white; color: var(--ink); font: inherit; }
button { cursor: pointer; font-weight: 650; }
button:enabled:hover { filter: brightness(.93); }
button:disabled, select:disabled { opacity: .55; cursor: default; }
.bar button { border-color: #769283; background: transparent; color: #f4f9ee; }
.bar #connection { border-color: #c2ed94; background: #c2ed94; color: #182820; }
.bar #demo { border-color: transparent; text-decoration: underline; text-underline-offset: .28em; }
details { margin-top: 1.4rem; border-top: 1px solid #456053; padding-top: .8rem; color: #d5e0d6; font-size: .9rem; }
summary { cursor: pointer; width: fit-content; padding: .3rem 0; }
details p { max-width: 60ch; }
#target-bar, form { padding: 1.3rem clamp(1.3rem, 5vw, 3rem); }
#target-bar { border-bottom: 1px solid var(--line); background: #f0f4ed; }
#reload { margin-left: auto; }
label { font-weight: 700; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1.5rem; }
.slot { display: grid; align-content: start; gap: .45rem; min-width: 0; }
.slot select { width: 100%; }
label span, small, #edit-state { color: var(--muted); }
label span { margin-left: .4rem; }
small, #edit-state { font-size: .85rem; }
.actions { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1rem; }
#save { background: var(--green); border-color: var(--green); color: white; }
:focus-visible { outline: 3px solid #067baf; outline-offset: 3px; }
.connect :focus-visible { outline-color: #d5f6b4; }
@media (max-width: 30rem) {
  body { padding: 1.2rem .75rem; }
  .title-row { align-items: flex-start; flex-direction: column-reverse; }
  .bar, #target-bar { gap: .45rem; }
  .bar button, #target-bar button { padding-inline: .65rem; }
}

fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; font-weight: 700; }
.halves legend { margin-bottom: .45rem; color: var(--muted); font-size: .85rem; }
.halves label, .choices label { position: relative; cursor: pointer; }
.halves input, .choices input {
  position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0;
}
.halves label > span, .choices label > span {
  display: inline-flex; align-items: center; color: var(--ink); margin: 0;
  font-family: inherit; font-size: .94rem; line-height: 1.35;
}
.halves label > span {
  gap: .65rem; min-height: 2.8rem; padding: .55rem 1rem; background: white;
  border: 1px solid var(--line); border-radius: .4rem;
}
.halves i {
  width: 1.35rem; height: .95rem; transform: rotate(9deg);
  background: repeating-linear-gradient(90deg, transparent 0 4px, var(--key-gap, white) 4px 6px),
              repeating-linear-gradient(transparent 0 3px, var(--key-gap, white) 3px 5px), currentColor;
}
.halves [value="right"] + span i { transform: rotate(-9deg); }
.halves input:checked + span { background: var(--ink); color: white; --key-gap: var(--ink); }
.slot { display: block; }
.slot legend { margin-bottom: .65rem; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
.choices label > span {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  height: 100%; min-height: 5.6rem; border: 1px solid var(--line); border-radius: .35rem;
  background: white; padding: .55rem .65rem; overflow-wrap: anywhere;
}
.choices label > span::before {
  content: ""; position: absolute; right: .55rem; top: .6rem;
  width: .55rem; height: .55rem; border-radius: 50%; border: 1px solid #789081;
}
.choices input:checked + span { background: #e5f1e0; border-color: var(--green); font-weight: 700; }
.choices input:checked + span::before { background: var(--green); border-color: var(--green); }
.choices small { font: .74rem/1.5 ui-monospace, monospace; }
.slot > small { display: block; margin-top: .65rem; }
input:focus-visible + span { outline: 3px solid #067baf; outline-offset: 2px; }
@media (hover:hover) {
  .choices label:hover > span, .halves label:hover > span { border-color: var(--green); }
}

.module-icon { width: 2rem; height: 2rem; flex: none; margin-bottom: .3rem; }
