:root {
  --paper: #eeebdf;
  --ink: #18292b;
  --muted: #435a55;
  --line: #a5aaa0;
  --board: #192c31;
  --mint: #b7e7c4;
  --accent: #a3371c;
  color: var(--ink);
  background: var(--paper);
  font: 1rem/1.45 system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
.shell { width: min(100% - 2.5rem, 66rem); margin-inline: auto; }
.masthead {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--ink);
  font: .82rem/1.4 ui-monospace, monospace;
}
.masthead a { font-weight: 750; }
main { padding-block: clamp(1.5rem, 5vw, 3.25rem); }
h1 {
  margin: 0;
  font-size: clamp(2.85rem, 10vw, 7.3rem);
  font-weight: 900;
  letter-spacing: -.085em;
  line-height: .9;
}
h1 span { color: var(--accent); }
.intro { max-width: 47ch; margin: 1rem 0 1.8rem; color: var(--muted); }
.workbench {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: .9rem 1.5rem;
  align-items: start;
}
.program, .output { border: 1px solid var(--ink); }
.program { color: var(--mint); background: var(--board); }
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .65rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  font: .8rem/1.4 ui-monospace, monospace;
}
.panel-header h2 { margin: 0; font: bold .93rem/1.4 ui-monospace, monospace; }
.program .panel-header { border-color: #5c7775; }
.listing {
  display: grid;
  padding: .85rem 1rem;
  margin: 0;
  list-style: none;
  font: .86rem/1.5 ui-monospace, monospace;
}
.listing li {
  display: grid;
  grid-template-columns: 3ch 8ch 4ch minmax(0, 1fr);
  column-gap: clamp(.3rem, 1.3vw, .9rem);
}
.listing li span:first-child { color: #a3b7ad; }
.listing li.store { color: #ffcf9a; margin-bottom: .5rem; }
.guesses {
  display: grid;
  gap: .35rem;
  margin: 0;
  padding: .85rem 1rem 0;
  list-style: none;
}
.guesses li { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; }
.guesses li > span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .35rem;
  min-height: 2.2rem;
  border: 1px solid var(--line);
  font: bold 1rem/1 ui-monospace, monospace;
}
.guesses small { font-size: .7em; }
.empty { color: var(--muted); }
.exact { background: #b5dfb9; color: #173a28; }
.moved { background: #f5cf8b; color: #432919; }
.absent { background: #e0dcd1; color: #41433f; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .85rem;
  padding: .65rem 1rem 0;
  font-size: .75rem;
}
.legend b { display: inline-grid; place-items: center; width: 1.05rem; }
form { padding: .85rem 1rem 0; }
label { display: block; margin-bottom: .35rem; font-size: .8rem; font-weight: 700; }
.input-row { display: flex; gap: .45rem; }
input, button {
  min-height: 2.8rem;
  border: 1px solid var(--ink);
  border-radius: .12rem;
  padding: .4rem .65rem;
  font: 700 .95rem/1.2 ui-monospace, monospace;
}
input { min-width: 0; flex: 1; background: #faf8ee; color: var(--ink); text-transform: uppercase; }
button { background: var(--board); color: #f9fbf0; cursor: pointer; }
button:hover { background: #31524f; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.status { min-height: 1.2rem; margin: .55rem 1rem .8rem; font-size: .78rem; }
.rules { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: .45rem; }
summary { cursor: pointer; min-height: 2.5rem; padding-block: .45rem; font-weight: 700; }
.rules dl { margin: 0 0 1rem; }
.rules dl div { display: grid; grid-template-columns: 8.5rem 1fr; gap: .4rem; margin: .32rem 0; }
dt, code { font-family: ui-monospace, monospace; }
dd { margin: 0; }
@media (max-width: 42rem) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .shell { width: min(100% - 1.5rem, 66rem); }
}
