/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;
  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-2: #f3f3f2;
  --surface-3: #e9e9e7;
  --border: #e7e7e4;
  --border-2: #d9d9d5;
  --text: #1a1a19;
  --text-2: #63635e;
  --text-3: #9c9c96;
  --inverse: #1a1a19;
  --inverse-text: #ffffff;
  --seg-sel: #ffffff;
  --ok: #16a34a;
  --ok-strong: #15803d;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --bad-border: #fecaca;
  --warn: #d97706;
  --brand: #e5484d;
  --dot-border: rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px -8px rgba(0, 0, 0, 0.1);

  --c-red: #e5484d;
  --c-blue: #3e7bfa;
  --c-yellow: #f5c518;
  --c-white: #ffffff;
  --c-black: #1c1c1c;
  --c-green: #2fb35d;

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --surface: #141415;
    --surface-2: #1b1b1d;
    --surface-3: #252528;
    --border: #232325;
    --border-2: #313134;
    --text: #ededec;
    --text-2: #a1a19c;
    --text-3: #6b6b67;
    --inverse: #ededec;
    --inverse-text: #111111;
    --seg-sel: #2c2c2f;
    --ok: #4ade80;
    --ok-strong: #86efac;
    --ok-bg: rgba(34, 197, 94, 0.08);
    --ok-border: rgba(34, 197, 94, 0.24);
    --bad: #f87171;
    --bad-bg: rgba(239, 68, 68, 0.08);
    --bad-border: rgba(239, 68, 68, 0.26);
    --warn: #fbbf24;
    --dot-border: rgba(255, 255, 255, 0.22);
    --shadow-sm: none;
    --shadow: none;
    --c-white: #f4f4f2;
    --c-black: #0a0a0a;
  }
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

code,
kbd,
.mono {
  font-family: var(--mono);
}

code {
  font-size: 0.92em;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  margin-left: 6px;
  padding: 0 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.i {
  flex: none;
  width: 16px;
  height: 16px;
}

.label {
  display: block;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.hint {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 8px;
}

/* ---------- Buttons ---------- */

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background-color 0.12s,
    border-color 0.12s,
    color 0.12s,
    opacity 0.12s;
}

button:hover:not(:disabled) {
  background: var(--surface-2);
}

button:active:not(:disabled) {
  background: var(--surface-3);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

button.sel,
button.sel:hover:not(:disabled) {
  background: var(--inverse);
  border-color: var(--inverse);
  color: var(--inverse-text);
}

button.sel:disabled {
  opacity: 0.75;
}

button.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}

button.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

button.primary {
  background: var(--inverse);
  border-color: var(--inverse);
  color: var(--inverse-text);
}

button.primary:hover:not(:disabled) {
  background: var(--inverse);
  opacity: 0.86;
}

button.icon-btn {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}

input::placeholder {
  color: var(--text-3);
}

input:focus {
  outline: none;
  border-color: var(--text-2);
}

/* Segmented control */

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.seg button {
  min-height: 28px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  color: var(--text-2);
  font-size: 13px;
}

.seg button:hover:not(:disabled) {
  background: transparent;
  color: var(--text);
}

.seg button.sel,
.seg button.sel:hover:not(:disabled) {
  background: var(--seg-sel);
  color: var(--text);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 1px var(--border);
}

.seg button.sel:disabled {
  opacity: 1;
}

.seg button:disabled:not(.sel) {
  opacity: 0.35;
}

/* ---------- Header ---------- */

.bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.bar-top,
.edge {
  max-width: 1440px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.bar-top {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
}

.logo svg {
  width: 16px;
  height: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-sub {
  color: var(--text-3);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.brand-sub:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.seg.mode {
  margin-left: 8px;
}

.seg.mode[hidden] {
  display: none;
}

.seg.mode button {
  padding: 0 12px;
}

.bar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.strikes {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 3px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.strikes .label {
  margin-right: 4px;
}

.strikes.relevant {
  border-color: var(--text-3);
}

.strikes.relevant .label {
  color: var(--text);
}

.strike {
  width: 28px;
  min-height: 28px;
  padding: 0;
  background: transparent;
  border: 1px dashed var(--border-2);
  border-radius: 7px;
  box-shadow: none;
  color: var(--text-3);
}

.strike .i {
  width: 14px;
  height: 14px;
}

.strike.on,
.strike.on:hover:not(:disabled) {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
}

.new-bomb.armed,
.new-bomb.armed:hover:not(:disabled) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.edge {
  padding-bottom: 16px;
}

.edge-toggle {
  display: none;
}

.edge-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 24px;
}

.facts {
  display: contents;
}

.fact {
  display: grid;
  gap: 6px;
}

.fact .label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.fact.relevant .label {
  color: var(--text);
}

.fact.relevant .label::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

.fact.relevant.unknown .label::after {
  background: var(--warn);
}

#serial {
  width: 130px;
  height: 34px;
  font: 500 15px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 32px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 72px;
  align-items: start;
}

/* ---------- Module list ---------- */

.rail {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 2px;
}

.rail-list {
  display: grid;
  gap: 1px;
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 0 4px 10px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.rail-head.sub {
  padding-top: 16px;
}

.mini-btn {
  min-height: 28px;
  margin-left: auto;
  padding: 0 8px;
  font-size: 12px;
}

.mini-btn .i {
  width: 13px;
  height: 13px;
}

.progress {
  height: 4px;
  margin: 0 10px 10px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 2px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--ok);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.rail-mark {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
}

.rail-mark b {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.rail-item {
  position: relative;
  border-radius: var(--r);
}

.rail-open {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 80px 0 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text-2);
  text-align: left;
}

.rail-open:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.rail-item .short {
  display: none;
}

.rail-item.active .rail-open {
  background: var(--surface);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--border);
  color: var(--text);
  font-weight: 600;
}

.rail-item .meta {
  position: absolute;
  top: 50%;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(-50%);
  pointer-events: none;
}

.rail.marking .rail-item .meta {
  pointer-events: auto;
}

.rail-item.marked:not(.done) .rail-open {
  color: var(--text);
}

.rail:not(.marking) .rail-item.unmarked .rail-open {
  color: var(--text-3);
}

.rail:not(.marking) .rail-item.unmarked .rail-open:hover {
  color: var(--text);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stepper button {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 6px;
  box-shadow: none;
}

.stepper .i {
  width: 12px;
  height: 12px;
}

.stepper b {
  min-width: 20px;
  color: var(--text-3);
  font: 500 13px/1 var(--mono);
  text-align: center;
}

.rail-item.marked .stepper b {
  color: var(--text);
}

.busy {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-3);
  font: 500 12px/1 var(--mono);
  white-space: nowrap;
}

.count .i {
  width: 13px;
  height: 13px;
}

.count.done {
  color: var(--ok);
}

.count.open {
  padding: 3px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* ---------- Module panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 16px 14px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.panel-title .en {
  color: var(--text-3);
  font-size: 13px;
}

.panel-title .tag {
  align-self: center;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.panel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.panel-inner {
  display: grid;
  gap: 24px;
  padding: 24px;
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
}

.table-scroll {
  overflow-x: auto;
}

/* ---------- Callout ---------- */

.callout {
  display: grid;
  gap: 4px;
  padding: 18px 20px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  animation: fade-in 0.16s ease-out;
}

.callout-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.callout-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.callout .msg {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.callout .msg b {
  font-weight: 600;
}

.callout .msg small {
  display: block;
  margin-top: 6px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
}

.callout .opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.callout .opts button {
  min-width: 64px;
  min-height: 40px;
  font-size: 15px;
}

.callout.say {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.callout.say > .callout-label {
  color: var(--ok);
}

.callout.say > .msg {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.callout.say > .msg b {
  color: var(--ok-strong);
}

.callout.say > .msg b.no {
  color: var(--bad);
}

.callout.bad {
  background: var(--bad-bg);
  border-color: var(--bad-border);
}

.callout.bad > .callout-label {
  color: var(--bad);
}

.callout .then {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ok-border);
}

.callout .then .callout-label {
  color: var(--text-2);
}

.callout .then .msg {
  font-size: 18px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
}

/* ---------- Colours ---------- */

.c-red {
  --c: var(--c-red);
}
.c-blue {
  --c: var(--c-blue);
}
.c-yellow {
  --c: var(--c-yellow);
}
.c-white {
  --c: var(--c-white);
}
.c-black {
  --c: var(--c-black);
}
.c-green {
  --c: var(--c-green);
}

.dot {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px var(--dot-border);
  vertical-align: -1px;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-btn {
  gap: 0;
  min-height: 44px;
  padding: 0 16px 0 12px;
  font-size: 15px;
}

.swatch-btn .dot {
  width: 16px;
  height: 16px;
  margin-right: 10px;
}

.swatch-btn.sel .dot {
  box-shadow: 0 0 0 2px var(--inverse-text);
}

.word {
  font-family: var(--mono);
  font-size: 13px;
}

.word.big {
  min-width: 112px;
  min-height: 44px;
  font-size: 14px;
}

/* ---------- Wires ---------- */

.wire-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wire,
.wire-slot {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
}

.wire {
  justify-content: flex-start;
  box-shadow: none;
  border-color: var(--border);
}

.num {
  width: 16px;
  color: var(--text-3);
  font: 500 13px/1 var(--mono);
  text-align: left;
}

.wire .strand {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px var(--dot-border);
}

.wire .x {
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.12s;
}

.wire:hover .x {
  opacity: 1;
}

.wire.target,
.wire.target:hover:not(:disabled) {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.cut-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 13px;
  font-weight: 600;
}

.wire-slot {
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- Button ---------- */

.release {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.rel {
  display: inline-flex;
  align-items: center;
  padding: 5px 5px 5px 12px;
  background: var(--surface);
  border: 1px solid var(--ok-border);
  border-radius: 10px;
  font-size: 15px;
  letter-spacing: 0;
}

.callout.say .rel b {
  min-width: 34px;
  margin-left: 12px;
  padding: 3px 8px;
  background: var(--inverse);
  border-radius: 6px;
  color: var(--inverse-text);
  font: 600 20px/1.2 var(--mono);
  text-align: center;
}

/* ---------- Keypad ---------- */

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
}

.sym {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border-2);
  border-radius: 10px;
}

button.sym:hover:not(:disabled) {
  background: #ffffff;
  border-color: var(--text-3);
}

.sym img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

button.sym.sel,
button.sym.sel:hover:not(:disabled) {
  background: #ffffff;
  border-color: var(--inverse);
  box-shadow: 0 0 0 2px var(--inverse);
}

.sym.dim {
  opacity: 0.2;
}

.order {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.order .sym {
  width: 68px;
}

.badge {
  position: absolute;
  top: -8px;
  left: -8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--inverse);
  color: var(--inverse-text);
  font: 600 12px/1 var(--mono);
  letter-spacing: 0;
}

@media (prefers-color-scheme: dark) {
  .sym,
  button.sym:hover:not(:disabled),
  button.sym.sel,
  button.sym.sel:hover:not(:disabled) {
    background: #e9e9e6;
  }
}

/* ---------- Simon ---------- */

.simon-pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pad,
.pad:hover:not(:disabled),
.pad:active:not(:disabled) {
  min-height: 64px;
  background: var(--c);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.pad:hover:not(:disabled) {
  filter: brightness(1.06);
}

.pad.c-yellow,
.pad.c-green {
  color: #13200f;
}

.seq-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.seq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.seq.big {
  gap: 8px;
  margin-top: 12px;
}

.chip.solid {
  padding: 6px 14px;
  background: var(--c);
  border: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chip.solid.c-yellow,
.chip.solid.c-green {
  color: #13200f;
}

.chip.solid.new {
  box-shadow:
    0 0 0 2px var(--ok-bg),
    0 0 0 4px var(--ok);
}

table.map {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.map th,
.map td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.map thead th {
  color: var(--text-3);
  font-weight: 500;
}

.map tbody tr {
  color: var(--text-3);
}

.map tbody th {
  font-weight: 500;
}

.map tbody tr.now {
  background: var(--surface-2);
  color: var(--text);
}

.map tbody tr.now th,
.map tbody tr.now td {
  font-weight: 600;
}

/* ---------- Stage bars (WoF, Memory) ---------- */

.stages {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  font-size: 13px;
}

.stage-bars {
  display: flex;
  gap: 4px;
}

.stage-bars span {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.stage-bars span.done {
  background: var(--ok);
}

.stage-bars span.now {
  background: var(--text);
}

/* ---------- Who's on First ---------- */

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.word-grid .word {
  min-height: 40px;
  padding: 0 6px;
}

.word i {
  color: var(--text-3);
  font-style: normal;
}

.picked {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 2px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 13px;
}

.pick b {
  color: var(--text);
  font: 600 14px/1 var(--mono);
}

.pick b i {
  color: var(--text-3);
  font-style: normal;
}

.with-grid {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pos-grid {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, 26px);
  gap: 3px;
}

.pos-grid i {
  height: 18px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
}

.pos-grid i.on {
  background: var(--inverse);
  border-color: var(--inverse);
}

.wof-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 20px;
  margin: 14px 0 0;
  padding-left: 28px;
  font: 500 17px/1.6 var(--mono);
  letter-spacing: 0;
}

.wof-list li::marker {
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- Memory ---------- */

.digits {
  display: flex;
  gap: 8px;
}

.digit {
  width: 76px;
  height: 76px;
  padding: 0;
  font: 500 34px/1 var(--mono);
}

.history {
  display: grid;
  justify-items: start;
  gap: 8px;
}

table.mini {
  border-collapse: collapse;
  font-size: 13px;
}

.mini td,
.mini th {
  padding: 6px 24px 6px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.mini th {
  color: var(--text-3);
  font-weight: 500;
}

.mini td {
  font-family: var(--mono);
}

/* ---------- Morse ---------- */

.morse-keys {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr 0.8fr;
  gap: 8px;
}

.mkey {
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
}

.mkey span {
  font: 500 28px/1 var(--mono);
}

.mkey .i {
  width: 22px;
  height: 22px;
  margin: 3px 0;
}

.mkey small {
  color: var(--text-3);
  font-size: 12px;
}

.mono-input {
  height: 40px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.14em;
}

.morse-out {
  display: grid;
  gap: 16px;
}

.decoded {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font: 500 22px/1 var(--mono);
  letter-spacing: 0.12em;
}

.decoded em {
  color: var(--text-3);
  font-style: normal;
  letter-spacing: 0;
}

.morse-words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  font: 500 13px/1.3 var(--mono);
}

.morse-words div {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: opacity 0.15s;
}

.morse-words small {
  display: block;
  color: var(--text-3);
  font-size: 12px;
}

.morse-words div.hit {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-strong);
}

.morse-words div.miss {
  opacity: 0.35;
}

.chart summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
}

.morse-chart {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 4px 12px;
  margin-top: 10px;
  color: var(--text-2);
  font: 400 13px/1.7 var(--mono);
}

.morse-chart b {
  margin-right: 8px;
  color: var(--text);
  font-weight: 600;
}

/* ---------- Complicated wires ---------- */

.cw-list {
  display: grid;
  gap: 6px;
}

.cw-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.cw-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flag {
  gap: 0;
  min-height: 34px;
  padding: 0 12px;
  box-shadow: none;
}

.flag .dot {
  width: 10px;
  height: 10px;
}

.flag.sel .dot {
  box-shadow: 0 0 0 1.5px var(--inverse-text);
}

.verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
}

.verdict.cut {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
}

.verdict.keep {
  background: var(--surface-2);
  color: var(--text-3);
}

.verdict.ask {
  border: 1px dashed var(--warn);
  color: var(--warn);
}

button.add {
  min-height: 40px;
  border-style: dashed;
  box-shadow: none;
}

/* ---------- Wire sequences ---------- */

.ws-grid {
  display: grid;
  grid-template-columns: 120px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.ws-head {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.ws-color {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.ws-color small {
  margin-left: 6px;
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
}

.ws-btn {
  min-height: 48px;
  box-shadow: none;
}

.ws-btn.cut {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
  font-weight: 600;
}

.ws-btn.cut:hover:not(:disabled) {
  background: var(--ok-bg);
  border-color: var(--ok);
}

.ws-btn.keep {
  border-color: var(--border);
  color: var(--text-3);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.log {
  display: grid;
  gap: 2px;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  font-size: 13px;
}

.log li {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.log li span {
  margin-left: auto;
  font-weight: 500;
}

.log .cut span {
  color: var(--ok);
}

.log .keep span {
  color: var(--text-3);
}

/* ---------- Maze ---------- */

.maze-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.maze-id {
  color: var(--text-2);
  font-size: 13px;
}

.maze-wrap {
  display: grid;
  grid-template-columns: 20px max-content;
  grid-template-rows: 20px max-content;
  gap: 6px;
}

.axis {
  display: grid;
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
}

.axis span {
  display: grid;
  place-items: center;
}

.axis.x {
  grid-template-columns: repeat(6, 48px);
  padding-left: 2px;
}

.axis.y {
  grid-template-rows: repeat(6, 48px);
  padding-top: 2px;
}

.maze {
  display: grid;
  grid-template-columns: repeat(6, 48px);
  grid-template-rows: repeat(6, 48px);
  width: max-content;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: 6px;
}

.maze .cell {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.maze .cell:hover:not(:disabled) {
  background: var(--surface-2);
}

.maze .cell.wr {
  border-right: 2px solid var(--text);
}

.maze .cell.wb {
  border-bottom: 2px solid var(--text);
}

.maze .cell.lc {
  border-right: 0;
}

.maze .cell.lr {
  border-bottom: 0;
}

.maze .cell.path {
  background: var(--ok-bg);
  color: var(--ok);
}

.maze .cell .i {
  width: 18px;
  height: 18px;
}

.maze .circle {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--c-green);
  border-radius: 50%;
}

.maze .circle.faint {
  opacity: 0.35;
}

.maze .start {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow:
    0 0 0 2px var(--text),
    0 0 0 5px var(--surface-3);
}

.maze .goal {
  width: 20px;
  height: 20px;
  color: var(--c-red);
}

.i.dir-down {
  transform: rotate(90deg);
}

.i.dir-left {
  transform: rotate(180deg);
}

.i.dir-up {
  transform: rotate(-90deg);
}

.moves {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.move {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--ok-border);
  border-radius: 10px;
  font-size: 18px;
  letter-spacing: 0;
}

.move .i {
  width: 20px;
  height: 20px;
  color: var(--ok);
}

.callout.say .move b {
  color: var(--text);
}

/* ---------- Password ---------- */

.pw-cols {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.pw-col {
  display: grid;
  gap: 6px;
}

.pw-col input {
  height: 44px;
  padding: 0 4px;
  font: 500 18px/1 var(--mono);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.pw-col.next .label {
  color: var(--text);
}

.pw-col.next input {
  border-color: var(--text-2);
  box-shadow: 0 0 0 3px var(--surface-3);
}

.pw-out {
  display: grid;
  gap: 8px;
}

.pw-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font: 400 13px/1 var(--mono);
}

.pw-words span {
  padding: 6px 9px;
  background: var(--surface-2);
  border-radius: 6px;
}

.callout .pw {
  font-family: var(--mono);
  font-size: 32px;
  letter-spacing: 0.1em;
}

/* ---------- Needy ---------- */

.needy-block {
  display: grid;
  gap: 12px;
}

.needy-block h3,
.needy-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.needy-block h3 small,
.needy-card h3 small {
  margin-left: 6px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
}

.leds {
  display: grid;
  gap: 10px;
  justify-content: start;
}

.led-row {
  display: flex;
  gap: 10px;
}

.led-gap {
  width: 22px;
}

.led {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: none;
}

.led.sel,
.led.sel:hover:not(:disabled) {
  background: var(--c-green);
  border-color: var(--c-green);
  box-shadow: 0 0 0 3px var(--ok-bg);
}

.needy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.needy-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
}

.needy-card p {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 15px;
}


/* ---------- Manual mode (notes) ---------- */

.label small {
  margin-left: 4px;
  color: var(--text-3);
  font-weight: 400;
}

.memo {
  display: grid;
  gap: 6px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  resize: vertical;
}

textarea::placeholder {
  color: var(--text-3);
}

textarea:focus {
  outline: none;
  border-color: var(--text-2);
}

.note-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tally span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
}

.tally b {
  color: var(--text);
  font: 600 13px/1 var(--mono);
}

.tally .dot {
  margin-right: 2px;
}

.verdict-btn {
  width: 120px;
  min-height: 34px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
}

.verdict-btn.open,
.verdict-btn.open:hover:not(:disabled) {
  border-style: dashed;
  color: var(--text-3);
  font-weight: 500;
}

.verdict-btn.cut,
.verdict-btn.cut:hover:not(:disabled) {
  background: var(--inverse);
  border-color: var(--inverse);
  color: var(--inverse-text);
}

.verdict-btn.keep,
.verdict-btn.keep:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

/* Wires */

.note-wire {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.note-wire .strand {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px var(--dot-border);
}

.note-wire .name {
  width: 64px;
  color: var(--text-2);
  font-size: 13px;
}

.note-wire .icon-btn {
  margin-left: -8px;
}

.note-wire.cut {
  border-color: var(--text-3);
}

.note-wire.cut .strand {
  background: linear-gradient(
    90deg,
    var(--c) 46%,
    transparent 46%,
    transparent 54%,
    var(--c) 54%
  );
}

.note-wire .icon-btn.sel,
.note-wire .icon-btn.sel:hover:not(:disabled) {
  background: var(--inverse);
  color: var(--inverse-text);
}

/* Keypad */

.kp-picked {
  display: grid;
  grid-template-columns: repeat(4, 84px);
  gap: 12px;
}

.sym.big {
  width: 100%;
  padding: 10px;
}

.sym.empty {
  background: transparent;
  border: 1px dashed var(--border-2);
  color: var(--text-3);
  font: 500 13px/1 var(--mono);
}

/* Simon */

.simon-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.simon-pads.compact {
  grid-template-columns: repeat(4, 1fr);
}

.simon-pads.compact .pad {
  min-height: 48px;
  font-size: 14px;
}

table.simon-log {
  border-collapse: separate;
  border-spacing: 6px;
  margin: -6px;
}

.simon-log th {
  padding-right: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.simon-log thead th {
  padding: 0;
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
  text-align: center;
}

.simon-log td {
  min-width: 84px;
}

.simon-log .chip {
  justify-content: center;
  width: 100%;
  min-height: 32px;
}

.simon-log .chip.solid {
  padding: 3px 10px;
  font-size: 14px;
}

.chip.empty {
  border-style: dashed;
  color: var(--text-3);
}

/* Who's on First */

.wof-note {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.wof-module {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.wof-display,
.wof-display:hover:not(:disabled),
.wof-display:active:not(:disabled) {
  min-height: 56px;
  background: var(--inverse);
  border-color: var(--inverse);
  color: var(--inverse-text);
  font: 600 18px/1 var(--mono);
}

.wof-display .ph {
  opacity: 0.5;
  font: 500 13px/1 var(--font);
}

.wof-display i {
  opacity: 0.6;
  font-style: normal;
}

.wof-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wof-key {
  min-height: 44px;
  padding: 0 6px;
  font: 600 13px/1 var(--mono);
}

.wof-key i {
  color: var(--text-3);
  font-style: normal;
}

.wof-display.editing,
.wof-key.editing {
  box-shadow:
    0 0 0 2px var(--surface-2),
    0 0 0 4px var(--text);
}

.wof-picker {
  display: grid;
  gap: 8px;
}

/* Memory */

.mem-rows {
  display: grid;
  gap: 4px;
  max-width: 560px;
}

.mem-row {
  display: grid;
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
  justify-items: start;
  min-height: 40px;
  padding: 0 14px;
  border-color: var(--border);
  box-shadow: none;
  font: 500 15px/1 var(--mono);
}

.mem-row.head {
  min-height: 24px;
  align-items: center;
  border: 0;
  color: var(--text-3);
  font: 500 12px/1 var(--font);
}

.mem-row .empty {
  color: var(--text-3);
}

.mem-row.now {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.mem-input {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
}

.digit.sm {
  width: 56px;
  height: 56px;
  font-size: 24px;
}

/* Morse */

.morse-keys.five {
  grid-template-columns: 1fr 1fr 1.2fr 1.2fr 0.8fr;
}

.mletters {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  min-height: 64px;
}

.mletter {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-width: 48px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r);
}

.mletter b {
  font: 600 24px/1 var(--mono);
}

.mletter small {
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
}

.mletter.pending {
  background: transparent;
  border: 1px dashed var(--border-2);
}

.mletter.pending b {
  color: var(--text-3);
}

.mletter.unknown b {
  color: var(--bad);
}

.mgap {
  width: 2px;
  margin: 4px 8px;
  border-radius: 1px;
  background: var(--text-3);
}

/* Wire sequences */

.ws-btn.mono {
  font: 600 16px/1 var(--mono);
}

.notes-log {
  max-height: 320px;
}

.notes-log li {
  gap: 0;
  padding: 4px 0;
}

.notes-log .verdict-btn {
  margin-left: auto;
}

/* Maze */

.maze-note {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px 32px;
}

.maze-side {
  display: grid;
  justify-items: start;
  gap: 10px;
  max-width: 220px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 52px);
  gap: 6px;
}

.dpad button {
  min-height: 0;
  padding: 0;
}

.dpad .i {
  width: 20px;
  height: 20px;
}

.dpad .up {
  grid-column: 2;
}

.dpad .left {
  grid-column: 1;
  grid-row: 2;
}

.dpad .down {
  grid-column: 2;
  grid-row: 2;
}

.dpad .right {
  grid-column: 3;
  grid-row: 2;
}

.notes .maze .cell.path {
  background: var(--surface-2);
  color: var(--text-3);
}

.notes .maze .cell.here {
  background: var(--surface-3);
}

.moves.plain {
  margin-top: 0;
}

.moves.plain .move {
  border-color: var(--border);
  font-size: 14px;
}

.moves.plain .move .i {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

/* ---------- Manual mode (rules) ---------- */

/* More room, so notes and rules fit side by side. */
body.manual .bar-top,
body.manual .edge,
body.manual .layout {
  max-width: 1760px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.rules {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

.rules-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 20px 14px 24px;
  border-bottom: 1px solid var(--border);
}

.rules-kicker {
  color: var(--brand);
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rules-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rules-page {
  margin-left: auto;
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
  white-space: nowrap;
}

.rules-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 20px 24px 24px;
  font-size: 14px;
}

.rule-intro {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
  line-height: 1.5;
}

.rule-intro li::marker {
  color: var(--text-3);
}

.rule-note {
  margin: 0 0 8px;
  color: var(--text-2);
}

.rule-stack {
  display: grid;
  gap: 10px;
}

.rule-block {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition:
    opacity 0.15s,
    border-color 0.15s;
}

.rule-block h4 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.rule-block h4 small {
  margin-left: 6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
}

.rule-block.on {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.rule-stack.focus .rule-block:not(.on) {
  opacity: 0.45;
}

.rule-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rule;
}

.rule-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  counter-increment: rule;
}

.rule-list li:first-child {
  border-top: 0;
}

.rule-list li::before {
  content: counter(rule);
  color: var(--text-3);
  font: 400 12px/1 var(--mono);
}

.rule-list.plain li {
  grid-template-columns: minmax(0, 1fr) auto;
}

.rule-list.plain li::before {
  content: none;
}

.rule-list li.else span {
  color: var(--text-3);
}

.rule-list b {
  font-weight: 600;
  text-align: right;
}

table.rule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rule-table th,
.rule-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.rule-table thead th {
  color: var(--text-3);
  font-weight: 500;
}

.rule-table tbody th {
  color: var(--text-2);
  font-weight: 500;
}

.rule-table tr.now {
  background: var(--surface-2);
}

.rule-table tr.now th,
.rule-table tr.now td {
  color: var(--text);
  font-weight: 600;
}

.rule-table .dot {
  width: 10px;
  height: 10px;
  margin-right: 5px;
}

.ws-rules td {
  font-family: var(--mono);
}

.mem-rules th,
.mem-rules td {
  white-space: normal;
}

/* Keypad columns */

.kp-cols {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.kp-col {
  display: grid;
  gap: 4px;
  justify-items: stretch;
}

.kp-num {
  color: var(--text-3);
  font: 400 12px/1.6 var(--mono);
  text-align: center;
}

.sym.mini {
  padding: 3px;
  border-radius: 6px;
}

/* Symbols that only appear in one column. */
.sym.mini.unique {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand);
}

.sym-key {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid var(--brand);
  border-radius: 3px;
  vertical-align: -1px;
}

/* Who's on First */

.wof-step1 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
}

.wof-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.wof-card b {
  min-width: 0;
  overflow: hidden;
  font: 600 11px/1.2 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wof-card b i {
  color: var(--text-3);
  font-style: normal;
}

.wof-card .pos-grid {
  grid-template-columns: repeat(2, 10px);
  gap: 2px;
}

.wof-card .pos-grid i {
  height: 7px;
  border-radius: 2px;
}

.wof-card.on,
.wof-lists div.on {
  border-color: var(--text);
  background: var(--surface-2);
}

.wof-lists {
  display: grid;
  margin: 0;
}

.wof-lists div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  border-radius: 6px;
}

.wof-lists dt {
  font: 600 12px/1.5 var(--mono);
}

.wof-lists dd {
  margin: 0;
  color: var(--text-2);
  font: 400 12px/1.5 var(--mono);
}

/* Complicated wires */

.cw-rules td {
  text-align: center;
}

.cw-letter {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-2);
  font: 600 13px/1 var(--mono);
}

.cw-legend {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cw-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mazes */

.maze-picks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 132px));
  gap: 10px;
}

.maze-pick {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 0;
  padding: 6px 6px 4px;
  box-shadow: none;
}

.maze-pick > .maze-num {
  color: var(--text-3);
  font: 400 11px/1 var(--mono);
}

.maze-pick.sel,
.maze-pick.sel:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
  color: var(--text);
}

.maze.mini {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-width: 2px;
  border-radius: 3px;
}

.maze.mini .cell {
  display: grid;
  place-items: center;
}

.maze.mini .cell:hover:not(:disabled) {
  background: transparent;
}

.maze.mini .circle {
  width: 55%;
  height: 55%;
  border-width: 2px;
}

/* Passwords */

.rule-words span {
  font-size: 14px;
}

/* Knobs */

.knob-table {
  display: grid;
  gap: 8px;
}

.knob-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.knob-row b {
  width: 56px;
  font-weight: 600;
}

.knob-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  width: 92px;
}

.knob-grid i {
  width: 12px;
  height: 12px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
}

.knob-grid i:nth-child(6n + 3) {
  margin-right: 5px;
}

.knob-grid i.on {
  background: var(--c-green);
  border-color: var(--c-green);
}

@media (min-width: 1280px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  /* Half width: keep the notes header on one line. */
  .split .panel-title .en,
  .split .hide-sm {
    display: none;
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px 10px 12px;
  background: var(--inverse);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  color: var(--inverse-text);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.18s,
    transform 0.18s;
}

.toast .i {
  color: var(--ok);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px 16px 64px;
  }

  .rail {
    position: static;
  }

  .rail-list {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 6px;
  }

  .rail-head.sub {
    display: none;
  }

  .rail-item {
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .rail-open {
    justify-content: center;
    min-height: 42px;
    padding: 0 6px;
    text-align: center;
  }

  .rail-item .name {
    display: none;
  }

  .rail-item .short {
    display: block;
  }

  .rail-item .meta {
    top: -7px;
    right: -5px;
    gap: 4px;
    transform: none;
  }

  .rail-item .count {
    padding: 2px 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  .rail.marking .rail-item .meta {
    position: static;
    justify-content: center;
    padding: 0 6px 8px;
  }

  .rail.marking .rail-open {
    min-height: 34px;
  }

  .rail-item.active {
    border-color: var(--inverse);
  }

  .rail-item.active .rail-open {
    box-shadow: none;
  }

  .rail-mark {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .rail-list + .rail-list {
    margin-top: 6px;
  }
}

@media (max-width: 640px) {
  .bar-top {
    height: 56px;
    padding: 0 16px;
    gap: 10px;
  }

  .edge {
    padding: 0 16px 12px;
  }

  .brand-sub {
    display: none;
  }

  .strikes .label {
    display: none;
  }

  .strikes {
    padding-left: 3px;
  }

  .edge-toggle {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    text-align: left;
  }

  .edge-toggle-label {
    font-weight: 600;
  }

  .edge-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text-2);
    font-weight: 400;
    text-overflow: ellipsis;
  }

  .chev {
    color: var(--text-3);
    transition: transform 0.15s;
  }

  .edge.open .chev {
    transform: rotate(180deg);
  }

  .edge-grid {
    display: none;
    padding-top: 14px;
    gap: 14px 18px;
  }

  .edge.open .edge-grid {
    display: flex;
  }

  .panel-head {
    flex-wrap: nowrap;
    padding: 10px 10px 10px 16px;
  }

  .panel-title .en,
  .panel-title .tag,
  .hide-sm {
    display: none;
  }

  .panel-inner {
    gap: 18px;
    padding: 16px;
  }

  .callout {
    padding: 16px;
  }

  .callout .msg {
    font-size: 19px;
  }

  .callout.say > .msg {
    font-size: 23px;
  }

  .callout .opts button {
    min-width: 54px;
  }

  .swatch-btn {
    flex: 1 1 calc(33% - 8px);
    padding: 0 10px;
  }

  .simon-pads {
    grid-template-columns: repeat(2, 1fr);
  }

  .digit {
    flex: 1;
    width: auto;
    height: 68px;
  }

  .morse-keys {
    grid-template-columns: 1fr 1fr;
  }

  .mkey {
    min-height: 64px;
  }

  .cw-row {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    padding-left: 12px;
  }

  .cw-row .verdict,
  .cw-row .verdict-btn {
    grid-column: 2;
  }

  .cw-row .icon-btn {
    grid-column: 3;
    grid-row: 1;
  }

  .ws-grid {
    grid-template-columns: 76px repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .ws-color {
    flex-wrap: wrap;
  }

  .ws-color small {
    margin-left: 18px;
  }

  .ws-btn {
    padding: 0 4px;
    font-size: 13px;
  }

  .ws-btn .i {
    display: none;
  }

  .axis.x {
    grid-template-columns: repeat(6, 44px);
  }

  .axis.y {
    grid-template-rows: repeat(6, 44px);
  }

  .maze {
    grid-template-columns: repeat(6, 44px);
    grid-template-rows: repeat(6, 44px);
  }

  .pw-col input {
    font-size: 15px;
  }

  .led {
    width: 36px;
    min-height: 36px;
  }

  .led-row {
    gap: 8px;
  }

  .led-gap {
    width: 12px;
  }

  .kp-picked {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .simon-note {
    grid-template-columns: minmax(0, 1fr);
  }

  .wof-note {
    grid-template-columns: minmax(0, 1fr);
  }

  .mem-input .field {
    flex: 1 1 100%;
  }

  .digit.sm {
    width: auto;
    height: 52px;
  }

  .morse-keys.five {
    grid-template-columns: repeat(6, 1fr);
  }

  .morse-keys.five .mkey:nth-child(-n + 2) {
    grid-column: span 3;
  }

  .morse-keys.five .mkey:nth-child(n + 3) {
    grid-column: span 2;
  }

  .maze-side {
    max-width: none;
  }
}

/* The mode switch needs the room of the title. */
@media (max-width: 560px) {
  .brand h1 {
    display: none;
  }

  .seg.mode {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation: none !important;
    transition: none !important;
  }
}
