:root {
  --ink: #d7d3c8;
  --dim: #8b8578;
  --ground: #07070a;
  --panel: #101016;
  --edge: #23232c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.5 ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace;
}

main {
  display: grid;
  /* Both tracks are minmax(0, ...) so a big canvas cannot push the row taller
     than the window: without that the grid grows to fit its content and the
     map runs off the bottom of the screen instead of being scaled down. */
  grid-template-columns: minmax(0, 1fr) 22rem;
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  height: 100%;
  padding: 1rem;
}

#stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

canvas {
  display: block;
  border: 1px solid var(--edge);
  border-radius: 3px;
  image-rendering: pixelated;
}

#status {
  margin: 0.6rem 0 0;
  color: var(--dim);
  letter-spacing: 0.04em;
}

#side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 3px;
}

h1 { margin: 0; font-size: 1.1rem; letter-spacing: 0.08em; }
h2 { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--dim); font-weight: normal; letter-spacing: 0.12em; text-transform: uppercase; }

.blurb { margin: 0; color: var(--dim); font-size: 0.82rem; }
code { color: var(--ink); }

pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}

/* The HUD block ends flush, so the sections below it need their own air. */
#worn, #log { margin-top: 0.7rem; }

.foot {
  margin: auto 0 0;
  display: flex;
  justify-content: flex-end;
  color: var(--dim);
  font-size: 0.78rem;
}

a { color: var(--dim); }
a:hover { color: var(--ink); }

/* One column on a phone: the tank first, the numbers under it. */
@media (max-width: 820px) {
  main { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
  /* The row is no longer bounded by the window here, so give the tank a
     height of its own to be measured against. */
  #stage { height: 70vh; }
  #side { max-height: none; }
}


/* Who else is here, and where this came from. Both sit in the corner of the
   window rather than in the panel: neither is about the creature. */
.corner {
  position: fixed;
  left: 1rem;
  bottom: 0.9rem;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  color: var(--dim);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.foot button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.foot button:hover { color: var(--ink); }

kbd {
  padding: 0 0.25em;
  border: 1px solid var(--edge);
  border-radius: 2px;
  color: var(--ink);
}

/* `hidden` has to be spelled out here. The browser hides a hidden element
   with `[hidden] { display: none }`, but that is a user-agent rule and this
   one is an author rule at the same specificity, so `display: grid` won it
   and the overlay rendered open - and stayed open, because setting `hidden`
   from the script did nothing either. */
.overlay[hidden] { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 3, 6, 0.82);
  z-index: 10;
}

.sheet {
  display: flex;
  flex-direction: column;
  width: min(46rem, 100%);
  max-height: min(34rem, 88vh);
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 3px;
}

.sheet h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 0.6rem;
}

.sheet .scroll { overflow: auto; min-height: 0; }

#hall-note { margin: 0 0 0.6rem; color: var(--dim); font-size: 0.8rem; }

#hall-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}
#hall-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--dim);
  font-weight: normal;
  text-align: right;
  padding: 0.15rem 0.5rem;
}
#hall-table td { padding: 0.15rem 0.5rem; text-align: right; color: var(--ink); }
#hall-table th:first-child,
#hall-table td:first-child,
#hall-table th.left,
#hall-table td.left { text-align: left; }
#hall-table tr:first-child td { color: #d7b464; }
