body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14161f;
  color: #e8e6df;
  font-family: "Courier New", monospace;
}
#game { text-align: center; padding: 16px; }
h1 { font-size: 2.4em; margin: 0 0 8px; color: #ffcf5c; letter-spacing: 4px; }
.hud { margin-bottom: 8px; font-size: 1.05em; }
.hud span { margin: 0 10px; white-space: nowrap; }
.hud .danger { color: #ff6b8b; animation: blink 0.5s steps(2) infinite; }
.msg { min-height: 1.4em; margin-bottom: 8px; }
.msg.good { color: #6be38f; }
.msg.bad  { color: #ff6b8b; }
.msg.info { color: #5cc8ff; }

.controls { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
button {
  font-family: inherit; font-size: 0.95em;
  background: #232735; color: #e8e6df;
  border: 1px solid #3a3f52; border-radius: 6px;
  padding: 7px 12px; cursor: pointer;
}
button:hover:not(:disabled) { background: #2e3346; border-color: #5a6075; }
button:disabled { opacity: 0.4; cursor: default; }
button.hint { color: #ffcf5c; }

/* The board is a grid of perfectly square cells */
.board { display: inline-grid; gap: 0; }
.cell {
  width: var(--cell);
  height: var(--cell);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.7);
  line-height: 1;
  overflow: hidden;
  vertical-align: middle;
  font-family: "DejaVu Sans Mono", Menlo, Consolas, "Courier New", monospace;
}

/* Each tile type fills its whole square; the character sits in the middle */
.wall   { color: #4a4f63; background: #2b2f3d; box-shadow: inset 0 0 0 1px #343949; }
.floor  { color: #2f3443; }
.goal   { color: #ff6b8b; }
.box    { color: #ffcf5c; }
.done   { color: #6be38f; }
.player { color: #5cc8ff; font-weight: bold; }
.key    { color: #ffcf5c; font-weight: bold; }
.hole   { color: #9b6be0; background: #07050c;
          box-shadow: inset 0 0 0 3px #3b2459, inset 0 0 calc(var(--cell) * 0.4) #000; }
.filled { background: #1c1726; box-shadow: inset 0 0 0 1px #2f2640; }
.door   { color: #f0b878; background: #5a391b; box-shadow: inset 0 0 0 3px #8a5a2b; }
.open   { box-shadow: inset 0 0 0 1px #5a391b; }
.ice    { background: #1f3a4d; box-shadow: inset 0 0 0 1px #2a4d66; }
.ice.floor { color: #4f86a8; }

.help { margin-top: 16px; color: #9a98a8; font-size: 0.95em; line-height: 1.7; }
.legend { margin-top: 12px; color: #9a98a8; font-size: 0.9em; }
.legend .item { margin: 0 6px; white-space: nowrap; }
.legend .cell { margin-right: 4px; }
.big { font-size: 1.25em; margin: 14px 0; }
.new { color: #6be38f; }
.blink { animation: blink 1s steps(2) infinite; color: #ffcf5c; }
@keyframes blink { 50% { opacity: 0; } }
pre { color: #ffcf5c; margin: 0 0 10px; }
