:root {
  --bg: #0b1020;
  --panel: #141b2e;
  --line: #26304d;
  --text: #e8edf8;
  --dim: #97a3c0;
  --accent: #8ab4ff;
  --safe: #5eead4;
  --mine: #fda4af;
  --amber: #ffcf87;
  --open: #dde2ee;
  --cell: 44px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px / 1.45 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

button,
select,
input {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
button {
  cursor: pointer;
}
button:hover {
  border-color: var(--accent);
}
button.primary {
  background: var(--accent);
  color: #0b1020;
  font-weight: 700;
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
input {
  background: #0f1628;
  width: 11em;
}
input::placeholder {
  color: #5d6a8a;
}
input.refused {
  border-color: var(--mine);
  outline: 2px solid var(--mine);
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px 6px;
  flex-wrap: wrap;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}
.brand span {
  font-weight: 400;
  color: var(--dim);
  margin-left: 8px;
  font-size: 16px;
}
.notice {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid #33507f;
  border-radius: 999px;
  color: var(--accent);
  font-size: 13.5px;
  white-space: nowrap;
}

.controls,
.strip,
.number {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.strip {
  justify-content: space-between;
  padding: 0 20px 8px 20px;
  font-size: 13.5px;
}
.engine {
  color: var(--safe);
}
.engine.fallback {
  color: var(--amber);
}
.number {
  gap: 6px;
  color: var(--dim);
}
.number input {
  width: 9em;
}

main {
  display: grid;
  grid-template-columns: auto minmax(320px, 390px) auto;
  grid-template-areas: "quorra panel right";
  gap: 14px 18px;
  padding: 4px 20px 16px;
  align-items: start;
  justify-content: center;
}
/* The expert board is wide: it takes the row beside the mind, and the other player's goes underneath. */
body.expert main {
  grid-template-columns: auto minmax(300px, 1fr);
  grid-template-areas:
    "quorra panel"
    "right right";
}
.quorra {
  grid-area: quorra;
}
.wide {
  grid-area: panel;
}
.right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

h2 {
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 8px;
  font-weight: 600;
}
h2 b {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
h2 small {
  font-size: 11.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--dim);
  margin-left: 6px;
}
.hint {
  color: var(--dim);
  font-size: 13px;
  margin: 0 0 8px;
}
.dim {
  color: var(--dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.status {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  margin-left: 6px;
}
.status.won {
  color: var(--safe);
}
.status.lost {
  color: var(--mine);
}

.board {
  display: grid;
  gap: 3px;
  padding: 6px;
  background: var(--line);
  border-radius: 10px;
  width: max-content;
}
.board > i {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  font-size: calc(var(--cell) * 0.36);
  user-select: none;
  position: relative;
  transition: background 0.25s;
}
.cell.open {
  background: var(--open);
  color: #1b2340;
}
.cell.open.zero {
  color: transparent;
}
.cell.open.one {
  color: #1d4ed8;
}
.cell.open.two {
  color: #15803d;
}
.cell.open.three {
  color: #b91c1c;
}
.cell.open.four {
  color: #6d28d9;
}
.cell.open.five {
  color: #9f1239;
}
.cell.open.six {
  color: #0e7490;
}
.cell.open.seven {
  color: #111827;
}
.cell.open.eight {
  color: #6b7280;
}
.cell.fresh.open {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.cell.chosen.open {
  box-shadow: inset 0 0 0 3px var(--accent);
}
.cell.boom {
  background: #ef4444;
  color: #fff;
}
.cell.mine {
  background: #7f1d1d;
  color: #fff;
}
.other .cell {
  background: #1f2a44;
}
.other .cell.open {
  background: var(--open);
}
.cell.clickable {
  cursor: pointer;
}
.cell.clickable:hover {
  outline: 2px solid var(--accent);
  z-index: 1;
}
.cell .flag {
  font-size: calc(var(--cell) * 0.64);
  line-height: 1;
}

.caption {
  color: var(--dim);
  font-size: 13.5px;
  margin-top: 8px;
  min-height: 20px;
}
.caption b {
  color: var(--text);
}
.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  font-size: 13px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  margin-left: 8px;
}
.swatch.flag {
  background: #7f1d1d;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.wide {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.move {
  font-size: 16.5px;
  min-height: 70px;
}
.move .big {
  font-size: 21px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.move .after {
  display: block;
  font-size: 15px;
  margin-top: 6px;
}
.move .safe {
  color: var(--safe);
}
.move .risk {
  color: var(--amber);
}
.move .bad {
  color: var(--mine);
}
.move .waiting {
  color: var(--dim);
  font-size: 15px;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.tag {
  font-size: 12.5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  white-space: nowrap;
}
.tag.sure {
  border-color: var(--safe);
  color: var(--safe);
}
.tag.guess {
  border-color: var(--amber);
  color: var(--amber);
}
.tag.estimated {
  border-color: var(--mine);
  color: var(--mine);
}
.tag.time {
  border-color: var(--accent);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.steps {
  margin: 4px 0 10px;
  padding-left: 18px;
  font-size: 14px;
}
.steps li {
  margin-bottom: 2px;
}
#why {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
}
#why li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  font-size: 14px;
}
#why li .how {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
#why li .how.plus {
  color: var(--mine);
}
#why li .how.minus {
  color: var(--safe);
}
#why li .track {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: #0f1628;
  overflow: hidden;
}
#why li .track i {
  display: block;
  height: 100%;
}
#why li .track i.plus {
  background: var(--mine);
}
#why li .track i.minus {
  background: var(--safe);
}
#why li.hardly {
  display: block;
  color: var(--dim);
  font-size: 13px;
}

.record {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 14px;
  font-size: 14px;
  margin: 8px 0 0;
}
.record dt {
  color: var(--dim);
}
.record dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.record dd.zero {
  color: var(--safe);
}
.record dd.wrong {
  color: var(--mine);
}
.record.oneline {
  grid-template-columns: auto 1fr;
  margin-top: 6px;
}
.record.oneline dd {
  font-weight: 400;
  color: var(--text);
}
.measured {
  color: var(--dim);
  font-size: 13px;
  margin: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.row input {
  flex: 1 1 10em;
  min-width: 0;
}
#next.wanted {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber);
}

#prompt {
  margin: 10px 0 0;
  padding: 10px;
  max-height: 250px;
  overflow: auto;
  background: #0f1628;
  border-radius: 8px;
  white-space: pre;
  font:
    12.5px / 1.45 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: var(--text);
}

@media (max-width: 1280px) {
  main {
    grid-template-columns: auto minmax(300px, 1fr);
    grid-template-areas:
      "quorra panel"
      "right right";
  }
}
