/* style.css: how the page looks: its sizes, spacing and fonts.
   It must not decide what is on the page. The words come from index.html, and
   the answer comes from draw.js. */

/* Count padding and borders as part of an element's width. Without this, a box
   that is 100% wide sticks out past the edge of a phone by the size of its padding. */
* {
  box-sizing: border-box;
}

/* An element that index.html or a script marks as hidden is off the page,
   whatever a rule further down says about how it is laid out. Without this,
   a rule such as "display: flex" would show a hidden row again.
   "!important" lets this rule win over the others. */
[hidden] {
  display: none !important;
}

body {
  /* The game's font, for every text on the page: the font the map's tiles
     are drawn in. Decided by Tim on 26 Nov 2026: "Make the rest of the font
     on the webpage the same as the tileset font", with "Cousine as default,
     Courier New as fallback and Courier as absolute fallback." Cousine is
     the file named at the end of this sheet. This list and MAP_FONT_FAMILY
     in draw.js must say the same. The font buttons change it for the whole
     page (showMapFont in draw.js). */
  font-family: "Cousine", "Courier New", Courier, monospace;

  /* On a wide screen, keep everything in one readable column in the middle.
     On a phone the column is the whole screen, with a small gap at the edges. */
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem;
  /* A dark page, like a terminal, with the light grey the map writes its
     words in. Tim on 27 Nov 2026: "change the background colour for the
     page", first to the deep blue behind the crawler, and then: "Change the
     background of the site's color to #1E1F1C." */
  color: #cccccc;
  background-color: #1e1f1c;
}

/* The game's name, "netCrawler:_", in the lime of the crawler's eye. Tim on
   27 Nov 2026: "change the colour to one already used". */
h1 {
  color: #ceff1a;
}

/* The label sits on its own line above the text box. */
label {
  display: block;
  margin-bottom: 0.5rem;
}

/* The text box and the button fill the column, and the padding makes them tall
   enough to tap with a thumb. So do the lists to pick from on the replays
   page. */
input,
select,
button {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.75rem;

  /* Use the page's own font and size, not the browser's smaller one for form
     parts. An iPhone zooms the whole page in when a text box with small text
     is tapped, and this size is big enough to stop that. */
  font: inherit;
}

/* The difficulty picker, the Dive button and the I'm Feeling Lucky button share
   one line, so that they cost the map below no height. "display: flex" lays the two out side
   by side with a gap between them. "flex: 1 1 auto" with "width: auto" makes
   each as wide as its own text needs and then shares out the room that is
   left, so that on a phone "I'm Feeling Lucky" still fits on one line beside the
   other two. The line keeps the gap below itself that a button had, so the
   three need no margin of their own. The row of development tools below the
   map is laid out the same way. */
#dive-start,
#dev-tools,
#map-tools,
#home-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#dive-start select,
#dive-start button,
#dev-tools button,
#map-tools button,
#home-actions button {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
}

/* The difficulty picker: -, the box with the difficulty, + and Highest,
   close together as one part of the line, each as wide as its own text
   needs. The box is as wide as four digits, with them in its middle. Its
   selector names the form too, so that it wins over the rules for every
   box of the form. Since 30 Nov 2026 difficulties have no top, so a
   number box takes the place of the list of three. */
#difficulty-picker {
  display: flex;
  gap: 0.25rem;
}
/* On a phone the line is too narrow for the picker, Dive, I'm Feeling Lucky
   and the list of groups: "flex-wrap: wrap" lets them go on in a second
   line instead of past the screen's edge. */
#dive-start {
  flex-wrap: wrap;
}
#dive-start #difficulty-picker button {
  flex: 0 0 auto;
}
#url-form #difficulty-input {
  width: 4.5em;
  margin-bottom: 0;
  text-align: center;
}

/* The row of development tools holds five buttons, which is more than a
   phone has room for on one line: "flex-wrap: wrap" lets them go on in a
   second line. */
#dev-tools {
  flex-wrap: wrap;
}

/* The development settings: a checkbox before its words, the boxes side by
   side and on as many lines as they need. The rule for every input further
   up makes an input as wide as the page; a checkbox is as wide as itself. */
#dev-options-switch {
  margin: 0 0 0.5rem;
}

#dev-options-switch label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
}

#dev-options-switch input {
  width: auto;
  margin: 0;
  padding: 0;
}

/* The saved crawler at the top of the page: the line about it, its three
   buttons, and between dives the lines about what it has at home.
   "white-space: pre-line" lets the line breaks in that text show, and the
   margins keep the three close together, so that they read as one block. */
#home-info {
  margin: 0 0 0.5rem;
}

#home-actions {
  margin-top: 0;
}

/* The browser's own tool for picking a file stays off the page: a tap on
   "Load Crawler" opens it. index.html marks it as hidden, but the rule for
   every text box further up would show it again, so it is taken off here. */
#crawler-file-input {
  display: none;
}

/* The crawler's care: its lines in the small print of the lines above,
   with their line breaks kept, and its buttons side by side, onto a next
   line when the row is full. */
#care-info {
  margin: 0 0 0.25rem;
  white-space: pre-line;
  font-size: 0.85rem;
}

#care-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
}

#care-actions button,
#care-actions select {
  flex: 0 1 auto;
  width: auto;
  margin-bottom: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

/* The default loadout under the map, as wide as the map: a small heading,
   and the pictures and lists of each part in five equally wide columns, as
   the slot buttons of a dive stand. minmax(0, 1fr) lets a column be
   narrower than its longest line. Tim on 27 Nov 2026: "move the loadout to
   below the game view." */
#equipped {
  margin: 0.5rem auto 0;
}

/* During a dive a subprogram's picture is a button that picks its slot: no
   border or padding of its own, so that it looks like the picture it
   holds. The picked one is framed in the lime of the crawler's eye, and a
   switched-off one (empty, or locked by a Ransomware, whose colour draw.js
   gives it) is faint. */
#equipped .slot-button {
  width: auto;
  margin: 0;
  padding: 0.15rem;
  border: 2px solid transparent;
  background-color: transparent;
  cursor: pointer;
}

#equipped .slot-button[aria-pressed="true"] {
  border-color: #ceff1a;
}

#equipped .slot-button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* The lists of a dive's loadout are switched off: greyed, and the arrow
   stays an arrow over them. */
#equipped select:disabled {
  opacity: 0.6;
  cursor: default;
}

#equipped h3 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
}

#equipped .loadout-part {
  margin-bottom: 0.4rem;
}

#equipped .loadout-part h3 {
  font-size: 0.75rem;
}

#equipped .loadout-group {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.3rem;
}

#equipped select {
  min-width: 0;
  padding: 0.2rem;
  font-size: 0.7rem;
}

/* The bookmarks: a row of buttons under the form, each as wide as its
   address, which goes on in a next line when the row is full. The <span>
   around the bookmarks' own buttons is not a box of its own ("display:
   contents"), so that they stand in the same row as the two buttons behind
   them. A bookmark is yellow, like a link on a map. */
#bookmark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

#bookmark-list {
  display: contents;
}

#bookmark-row button {
  flex: 0 1 auto;
  width: auto;
  margin-bottom: 0;
  padding: 0.4rem 0.75rem;
}

.bookmark-button {
  color: #3d3200;
  background-color: #fff3bf;
  border: 1px solid #c9a700;
  overflow-wrap: anywhere;
}

/* The note about what last happened to the saved crawler stands under the
   answer to the typed address. Tim on 26 Nov 2026: "make the "home-note"
   more prominent." So it is a box of its own in the bookmarks' pale yellow,
   with a thick line down its left side and bold text a little bigger than
   the page's. */
#home-note {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.6rem;
  color: #3d3200;
  background-color: #fff3bf;
  border: 1px solid #c9a700;
  border-left-width: 0.4rem;
  font-size: 1.05rem;
  font-weight: bold;
  overflow-wrap: anywhere;
}

/* With no text the note takes no room: ":empty" is an element with nothing
   inside it, and without this rule its padding and its border would still
   show as an empty box. */
#home-note:empty {
  display: none;
}

/* An address can be long and has no spaces in it. Let it break anywhere, so
   that it wraps onto the next line instead of running off the screen. */
#url-result {
  overflow-wrap: anywhere;
}

/* The playing field: the banner and the map under it. "display: table"
   makes the box as wide as what is inside it, the map, and "margin: 0 auto"
   then stands it in the middle of the column. The menu over the map is
   placed from this box's corner: "position: relative" makes it the one
   that is measured from. Tim on 27 Nov 2026: "Center the playing field or
   have it next to the right bar if in wide mode." */
#field {
  display: table;
  position: relative;
  margin: 0 auto;
}

/* The banner over the map: the site's address and its group, in the middle,
   bold, on the group's own colour, which draw.js sets with the text's
   colour (drawSiteBanner). An address can be long: it may break anywhere. */
#site-banner {
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.75rem;
  text-align: center;
  font-weight: bold;
  border-radius: 0.25rem;
  overflow-wrap: anywhere;
}

/* The names of a site's website defences, in the banner and on the loadout
   screen. Each is a button that looks like the words around it, with a
   dotted line under it: the rules undo what the rule for every button sets.
   "cursor: help" makes the mouse pointer a question mark over a name.
   Behind each name stands a box that says what the defence does. It lies
   under the line that holds the names, as wide as that line and over what
   stands below: "position: absolute" places it from the line's corner,
   which "position: relative" makes the one it is measured from, and
   z-index lays it over the map and the menu over the map. It shows while
   the mouse rests on the name, and once a tap has opened the name
   (listenForDefenceTips in input.js). "@media (hover: hover)" keeps the
   first to screens with a mouse: a phone would keep a tapped name "under
   the mouse" until something else was tapped. "+" picks the element right
   after the name: its box. */
#site-banner,
.defence-line {
  position: relative;
}

.defence-name {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 2px dotted currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: help;
}

.defence-tip {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0.4rem 0.6rem;
  font-weight: normal;
  text-align: left;
  color: #cccccc;
  background-color: #000000;
  border: 1px solid #999999;
}

.defence-name.is-open + .defence-tip {
  display: block;
}

@media (hover: hover) {
  .defence-name:hover + .defence-tip {
    display: block;
  }
}

/* The box around everything about the dive. "display: flex" with
   "flex-direction: column" stacks its parts from top to bottom, as they
   would stand anyway. In such a box the gaps of two parts add up where they
   meet, so each part below keeps its gap on one side only. */
#dive-area {
  display: flex;
  flex-direction: column;
}

/* The crawler's status sits close under the line about the dive, so that the
   two read as one block and cost the map below as little height as they
   can. The status itself stands on a small patch in the colour of that
   status, black on white for "Healthy", the way the crawler is drawn on the
   map. The thin border keeps a white patch visible on a white page. */
#map-info {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

#crawler-status {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

/* The crawler's Integrity as a bar. Tim on 26 Nov 2026: "make the current
   status bar bigger and format them bigger with the health bar." The box is
   dark, and the filling inside it is as wide as the crawler has Integrity
   left: draw.js sets its width and its colour. "position: relative" on the
   box lets the numbers lie over the filling: "position: absolute" takes
   them out of the flow, and "inset: 0" stretches them over the whole box.
   "display: flex" with the two "center" lines puts the numbers in the
   middle. The thin dark edge around each character (text-shadow) keeps
   them readable on any colour of the filling. */
#integrity-bar {
  position: relative;
  height: 1.9rem;
  margin-bottom: 0.3rem;
  border: 1px solid #444444;
  border-radius: 0.3rem;
  background-color: #1c1c1c;
  overflow: hidden;
}

#integrity-fill {
  width: 100%;
  height: 100%;
  background-color: #2f9e44;
}

#integrity-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: bold;
  text-shadow: 0 0 3px #000000, 0 0 3px #000000;
}

/* The crawler's version in big letters, and beside it the bar of the
   commits it has toward the next version: Tim on 27 Nov 2026, "Make the
   crawler version more prominent on the main screen with commits a bar
   instead of a number." The bar is built like the bar of Integrity above
   it, with two fillings side by side ("display: flex"): the commits at home,
   and the paler ones a copy has earned in the dive it is on. */
#version-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

#version-badge {
  flex: 0 0 auto;
  font-size: 1.6rem;
  font-weight: bold;
  line-height: 1;
  color: #e599f7;
}

#commit-bar {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  height: 1.4rem;
  border: 1px solid #444444;
  border-radius: 0.3rem;
  background-color: #1c1c1c;
  overflow: hidden;
}

#commit-fill {
  width: 0;
  height: 100%;
  background-color: #7950f2;
}

#commit-pending {
  width: 0;
  height: 100%;
  background-color: #b197fc;
  opacity: 0.6;
}

#commit-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: bold;
  text-shadow: 0 0 3px #000000, 0 0 3px #000000;
}

/* The line about the crawler's stats sits close under its status, for the
   same reason. An empty line takes no room at all. */
#crawler-stats {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

/* The lines about the dive and about the crawler's stats are written a
   little smaller than the rest of the page. In the game's font every
   character is equally wide, which makes a line longer than it was, and at
   this size each of the two still fits on one line of the column. The
   status line between them is bigger: Tim asked for that on 26 Nov 2026. */
#map-info,
#crawler-stats {
  font-size: 0.85rem;
}

#crawler-status {
  font-size: 1.05rem;
  font-weight: bold;
  line-height: 1.7;
}

/* The items the crawler carries. This is how the list looks on a narrow
   screen, such as a phone: one line of text above the map, its heading
   first and then each item with its count. It always keeps room for two
   lines, so that the map below doesn't jump when the first item is picked
   up. The heading is written like the text around it, with a colon behind
   it, which "::after" adds. "display: inline" lets the heading and the list
   follow each other on a line like words, and "inline-block" does the same
   for each item while keeping it in one piece, so that a line only breaks
   between two items. "list-style: none" takes the dots off the list, and
   "white-space: nowrap" keeps an item and its count together. The small pictures of the items are left out
   here. Further down, a rule for wide screens moves the list to the right of
   the map. */
#carried {
  margin: 0 0 0.25rem;
  min-height: 2.8em;
  font-size: 0.85rem;
  line-height: 1.4;
}

#carried-title {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: normal;
}

#carried-title::after {
  content: ":";
}

#carried-list {
  display: inline;
  margin: 0;
  padding: 0;
  list-style: none;
}

#carried-list li {
  display: inline-block;
  margin-left: 0.6em;
  white-space: nowrap;
}

#carried .end-tile {
  display: none;
}

/* A status of the crawler: a small patch in the colour of that status, black
   on white for "Healthy", the way the crawler's square shows on the minimap.
   draw.js makes one for each status and gives it its colour. The thin
   border keeps a white patch visible on a white page. "display:
   inline-block" keeps a patch in one piece, so that a line only breaks
   between two patches, and "white-space: nowrap" keeps its words
   together. */
.status-chip {
  display: inline-block;
  margin-right: 0.3em;
  padding: 0 0.5em;
  border: 1px solid #999999;
  border-radius: 0.25em;
  color: #000000;
  background-color: #ffffff;
  white-space: nowrap;
}

/* What the last move caused, one thing on each line. "white-space: pre-line"
   makes the line breaks that draw.js puts into the text count as line breaks.
   The box always keeps room for three lines: a line is 1.4 times as tall as
   its text, and 4.2em is three of those. So the map below it stays where it
   is, whether a move causes nothing or three hits. When a move causes more
   than three things, the rest can be scrolled to inside the box. */
#dive-events {
  white-space: pre-line;
  line-height: 1.4;
  height: 4.2em;
  margin: 0 0 0.5rem;
  overflow-y: auto;
}

/* The box is a log of the dive: every line stays and can be scrolled back
   to, with the turn it happened on in front. Tim on 26 Nov 2026: "Maybe all
   status messages don't disappear but can be scrolled back with a turn/time
   signature." Each line is a row of its own ("display: block"), and its
   turn is a little paler than its words. What the last move caused is in
   bold, so that it stands out from the lines before it: his "Bold the
   dive-events" of the same day. A hint about a picked subprogram, under the
   log, is written slanted. */
.event-entry,
.event-line,
.event-hint {
  display: block;
}

/* The older lines of the log: a grey that still reads on the dark page. */
.event-entry {
  color: #8c8c8c;
}

.event-entry.event-new {
  color: inherit;
  font-weight: bold;
}

.event-turn {
  display: inline-block;
  min-width: 3.5em;
  color: #888888;
  font-weight: normal;
}

.event-hint {
  font-style: italic;
}

/* The row with the Delta Patch button, the exit button and the button for
   buying, between the texts and the map. "display: flex" lays them out side
   by side, with a gap between them, and "flex-wrap: wrap" lets a button drop
   onto the next line when the screen is too narrow for all three, as on a
   phone. A paragraph normally keeps a gap of a whole line above and below
   itself. Half of that is enough here, and it leaves more of the screen's
   height to the map. */
#dive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

/* "flex: 1 1 10rem" asks for a width of 10rem for each button and lets them
   grow evenly into the room that is left. The gap above already keeps them
   apart, so they need no margin of their own. Their text is smaller than the
   page's and they have less padding at the sides, so that "Use [Delta
   Patch] (0)" fits on one line in half the width of a phone, in a font whose
   characters are all equally wide. A button whose
   text needed a second line would be taller, and the map below would jump. */
#dive-actions button {
  flex: 1 1 10rem;
  margin-bottom: 0;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  font-size: 0.75rem;
}

/* The button for buying asks a whole question, the longest text of the three,
   so it asks for more width. 10rem, 10rem and 17rem with the two gaps are
   38rem, exactly the width of the page's column, so on a wide screen all
   three share one line. On a phone the first two share a line, and this one
   gets the line below to itself. The rule names the row as well as the
   button: of two rules for the same thing, the one that says more exactly
   where it applies wins, and the rule above already names the row. */
#dive-actions #buy-button {
  flex-basis: 17rem;
}

/* The map is drawn on a canvas, and draw.js picks a text size that fits the
   column. If the screen gets narrower afterwards, for example when a phone is
   turned, the canvas shrinks with it instead of sticking out. "height: auto"
   keeps its shape while it shrinks. */
#map canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* A tap on the map moves the crawler, and taps come quickly one after another.
   "touch-action: manipulation" tells a phone that two quick taps are not a
   request to zoom in, so that every tap counts at once. Dragging to scroll and
   pinching to zoom still work. "user-select: none" stops quick taps and clicks
   from marking the text around the map as selected. The -webkit- line says the
   same to older iPhones. */
#map {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;

  /* The minimap below is placed by its distance from this element's own
     corner. "position: relative" is what makes this element the one those
     distances are measured from. */
  position: relative;
}

/* The minimap: a small canvas that draw.js lays over the top right corner of
   the tile view. "position: absolute" takes it out of the page's flow, so
   that it lies on top of the map instead of below it, and draw.js sets its
   distance from the left and from the top. "pointer-events: none" lets a tap
   on it through to the tile under it, so that the corner of the map can
   still be tapped. The thin border and the slight see-through keep it apart
   from the tiles it covers. "image-rendering: pixelated" keeps its small
   squares sharp. "max-width: none" undoes the rule above for canvases in the
   map: the minimap must keep its own size. */
#map #minimap {
  position: absolute;
  max-width: none;
  border: 1px solid #999999;
  opacity: 0.9;
  pointer-events: none;
  image-rendering: pixelated;
}

/* The small bars of Integrity on the enemies: a see-through canvas that
   tile-view.js lays over the whole tile view, in the way the minimap lies
   over its corner. A tap passes through it to the tile under it. */
#map #enemy-bars {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

/* The sparks of a hit: a see-through canvas that sparks.js lays over the
   whole tile view, on top of the bars. A tap passes through it too. */
#map #hit-sparks {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

/* The aim of a picked subprogram: a see-through canvas that tile-view.js
   lays over the whole tile view while an aimed subprogram is picked. A tap
   passes through it to the tile under it, which picks the direction. */
#map #aim-tiles {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

/* A canvas that draw.js has marked as hidden takes no room and shows
   nothing. The rule for canvases in the map above says "display: block",
   which would otherwise bring a hidden minimap back. */
#map canvas[hidden] {
  display: none;
}

/* The menu of a piece of furniture lies over the map: "position: absolute"
   places it from the corner of the part of the page that holds the map,
   which "position: relative" makes the one it is measured from. It is as
   wide as it needs up to 36rem, never wider than the map, scrolls when it
   is taller than the map, and lies above the map's canvases (z-index).
   Light text on black, like the map, with the furniture's pastel green
   for its edge. */
#dive-main {
  position: relative;
}

#place-menu {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  width: min(36rem, calc(100% - 1rem));
  max-height: calc(100% - 1rem);
  overflow-y: auto;
  padding: 0.75rem 1rem;
  color: #cccccc;
  background-color: rgba(0, 0, 0, 0.94);
  border: 1px solid #b2f2bb;
}

#place-menu h2 {
  margin: 0 0 0.5rem;
  color: #b2f2bb;
}

#place-menu p {
  margin: 0 0 0.5rem;
}

/* The things a menu lists, without the dots of a list: three things a row, at Tim's word of 27 Nov 2026: "The inventory menus
   the icons are too big. Make it so the items are shown 3 per row." A grid
   of three equal columns ("minmax(0, 1fr)" lets a column be narrower than
   its longest word), each thing's small picture above its name and what it
   does. */
#place-menu-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem 0.75rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

#place-menu-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

#place-menu-list .end-tile {
  font-size: 8px;
}

#place-menu-list .menu-effect {
  display: block;
  font-size: 0.75rem;
  color: #aaaaaa;
}

/* What a recipe of the Compiler or the Patcher takes, under the thing's
   name: a little brighter than what the thing does. */
#place-menu-list .menu-recipe {
  display: block;
  font-size: 0.75rem;
  color: #dddddd;
}

/* A workshop's Build button, under the thing it builds, and the Restore
   Point's button of a heal. "margin-top: auto" pushes it to the bottom of
   its cell, so that the buttons of a row stand in one line however long
   the words above them are. */
#place-menu-list .build-button,
#place-menu-list .heal-button {
  margin-top: auto;
  font-size: 0.8rem;
}

/* The table of a menu: the Backup's lines, the crawler now beside its
   backup, and the Registry's addresses. */
#place-menu-table {
  margin: 0 0 0.5rem;
  border-collapse: collapse;
}

#place-menu-table th,
#place-menu-table td {
  padding: 0.15rem 0.8rem 0.15rem 0;
  text-align: left;
}

#place-menu-actions button {
  margin-right: 0.4rem;
}

/* The Kernel's Dependency tree (tree-screen.js). The drawing is as wide as
   the menu, up to about its own size, in the middle, and "height: auto"
   keeps it square. A node takes a tap, which the hand of the pointer
   shows. */
#tree-drawing {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 0 auto 0.5rem;
}

#tree-drawing .tree-node {
  cursor: pointer;
}

#tree-node-select {
  max-width: 100%;
  margin: 0 0 0.5rem;
}

/* The box about the picked node, with the node's name as its heading. */
#tree-details {
  padding: 0.4rem 0.6rem;
  border: 1px solid #4a4a4a;
}

#tree-details .tree-node-name {
  color: #ffffff;
  font-weight: bold;
}

/* The parts of a workshop's menu: a row of buttons as wide as their words,
   the open part's white on black. */
/* A workshop's queue: a row a build, its picture, its words, and for the
   build that runs a bar of how far it is, in the furniture's green on the
   black of the bars of the crawler's page. */
#place-menu-queue {
  margin: 0 0 0.6rem;
}

#place-menu-queue h3 {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: #b2f2bb;
}

.queue-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}

.queue-row .end-tile {
  font-size: 8px;
}

.queue-text {
  flex: 1 1 auto;
  min-width: 0;
}

.build-progress {
  height: 0.6rem;
  margin-top: 0.2rem;
  border: 1px solid #444444;
  background-color: #1c1c1c;
}

.build-progress-fill {
  height: 100%;
  background-color: #b2f2bb;
}

#place-menu-parts button {
  display: inline-block;
  width: auto;
  margin: 0 0.4rem 0.4rem 0;
  padding: 0.3rem 0.75rem;
}

#place-menu-parts button[aria-pressed="true"] {
  color: #000000;
  background-color: #b2f2bb;
  border-color: #b2f2bb;
}

/* The screen at the end of a dive, which takes the map's place: light text
   on black, like the map itself, with a little room inside its edge. */
#end-screen {
  margin: 0.5rem 0;
  padding: 1rem;
  color: #cccccc;
  background-color: #000000;
}

#end-screen h2,
#end-screen h3 {
  margin: 0 0 0.5rem;
}

/* The lines under the heading. "white-space: pre-line" lets the line breaks
   in the text show, so that each line has a line of its own. */
#end-lines {
  margin: 0 0 1rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* What the dive did to the saved crawler at home, under the lists: in bold,
   because it is what the dive was worth in the end. */
#end-home {
  margin: 0 0 1rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-weight: bold;
}

/* One of the screen's lists: what came home, or what was lost. */
.end-section {
  margin-bottom: 1rem;
}

.end-section p {
  margin: 0.25rem 0;
}

/* The things that are counted, side by side, and onto a next line when the
   row is full. "list-style: none" takes the dots off the list. Each thing
   is its picture with its name and count beside it: "align-items: center"
   puts the words at half the picture's height. */
.end-loot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.end-loot li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The picture of a thing: its tile, 7 by 4 characters. "line-height: 1"
   stacks the four rows without gaps, as on the map. */
.end-tile {
  margin: 0;
  font-size: 13px;
  line-height: 1;
}

/* A slot of the loadout screen and of the Default Loadout: the picture of
   what stands in it above its list or its box, both in the middle of the
   slot. Tim on 27 Nov 2026: "can you make the loadout selector more
   visual?" "min-width: 0" lets a slot be narrower than its longest line. */
.loadout-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.loadout-slot select,
.loadout-slot label {
  width: 100%;
}

.loadout-picture {
  margin: 0;
  font-size: 11px;
  line-height: 1;
}


/* The two buttons under the lists, side by side like the rows of buttons
   above the map. */
#end-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

#end-actions button {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
}

/* On a wide screen the map stands on the left, and everything else about
   the dive is a panel on its right: the lines about the dive, the buttons,
   what the last move caused and the items carried. Nothing needs scrolling
   then. Tim on 26 Nov 2026 asked for the "page layout", after: "I need to
   scroll up and down." "@media (min-width: 64rem)" means: the rules inside
   only count while the window is at least 64rem wide, which is 1024 pixels
   at the usual text size. A phone keeps the one column above. */
@media (min-width: 64rem) {
  /* The page uses the whole window, with a small gap at its edges, and the
     heading and the form take as little height as they can: the label, the
     text box and the three parts of the row beside it share one line.
     "display: grid" lays the form out in columns: the label as wide as its
     text, the text box in the room that is left, and the row as wide as it
     needs. */
  body {
    max-width: none;
    padding: 0.5rem 1rem;
  }
  h1 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
  }
  #url-form {
    display: grid;
    grid-template-columns: auto minmax(10rem, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
  }
  #url-form label,
  #url-form input,
  #dive-start {
    margin-bottom: 0;
  }
  #url-form input,
  #dive-start select,
  #dive-start button {
    padding: 0.4rem 0.75rem;
  }
  /* The game's name and the saved crawler share the top line: the name,
     the line about the crawler in the room that is left, and its three
     buttons, as wide as their words. "flex-wrap: wrap" lets the buttons go
     onto the next line on a window that is too narrow for all of it. */
  #page-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
  }
  #page-top h1 {
    margin: 0;
  }
  #home {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
  }
  #home-info {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    font-size: 0.85rem;
  }
  #home-actions {
    margin: 0;
  }
  #home-actions button {
    flex: 0 0 auto;
    padding: 0.4rem 0.75rem;
    white-space: nowrap;
  }

  /* The answer to the typed address stands close under the form. The note
     about the saved crawler is at the top of the panel on the right. */
  #url-result {
    margin: 0.25rem 0;
  }

  /* The playing field stands beside the panel: "margin-right: 0" moves it
     to the right end of its box, which is where the panel begins. */
  #field {
    margin-right: 0;
  }

  /* The two boxes side by side. "flex: 1 1 0" gives the map's box all the
     room the panel leaves, and "min-width: 0" lets it get narrower than its
     canvas, which then shrinks. The panel is three tenths of the window
     wide, never narrower than 22rem and never wider than 27rem ("clamp"
     keeps a size between two others, and 1vw is a hundredth of the
     window's width), and "order: 2" puts it on the right, though the page
     names it first. tile-view.js
     sizes the map to the box's width and to the height that is left under
     the form (findRoomForView). */
  #dive-area {
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
  }
  #dive-main {
    flex: 1 1 0;
    min-width: 0;
    order: 1;
  }
  #dive-side {
    flex: 0 0 clamp(22rem, 30vw, 27rem);
    order: 2;
    display: flex;
    flex-direction: column;
  }
  #end-screen,
  #loadout-screen {
    margin-top: 0;
  }

  /* The bookmarks sit close under the form. */
  #bookmark-row {
    margin: 0.25rem 0 0;
    gap: 0.25rem 0.5rem;
  }
  #bookmark-row button {
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
  }

  /* In the panel the three buttons share one line: the button for buying
     asks for no more than the others, and its question goes onto a second
     line inside it when it has to. */
  #dive-actions #buy-button {
    flex-basis: 10rem;
  }
  #dive-actions button {
    flex-basis: 6rem;
    white-space: normal;
    min-height: 3.2em;
  }

  /* The loadout under the map stands at the right end of its column, as
     the field does (fitLoadoutBox in draw.js makes it as wide). */
  #equipped {
    margin-right: 0;
  }

  /* What the last move caused has room for eight lines here, where a phone
     has three: 1.4em is one line. It stands under the buttons, so that the
     buttons keep their place, and the items carried under it ("order" says
     where a part of the panel stands, whatever the page names first). */
  #dive-events {
    order: 5;
    height: 11.2em;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #999999;
    font-size: 0.85rem;
  }

  /* The items carried: the last part of the panel, with a thin frame, each
     item on a line of its own with the picture of its tile in front, and
     the heading above them. */
  #carried {
    order: 6;
    min-height: 0;
    margin: 0;
    padding: 0.5rem;
    border: 1px solid #999999;
    font-size: 0.85rem;
  }
  #carried-title {
    display: block;
    font-weight: bold;
  }
  #carried-title::after {
    content: "";
  }
  /* "repeat(2, minmax(0, 1fr))" makes two equally wide columns, so that a
     full inventory is half as tall. */
  #carried-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.5rem;
    margin-top: 0.4rem;
  }
  /* A list without items takes no room under the heading. ":empty" picks an
     element with nothing in it. */
  #carried-list:empty {
    display: none;
  }
  #carried-list li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0;
  }
  #carried .end-tile {
    display: block;
    font-size: 8px;
  }
  /* The use button takes what room its line has left beside the small "×"
     that destroys the item: "flex: 1 1 auto" lets it grow and shrink, and
     "min-width: 0" lets it shrink below the width of its words, which then
     wrap. Before 1 Dec 2026 it was as wide as its whole line. */
  #carried .carried-use {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin-bottom: 0;
    text-align: left;
    white-space: normal;
  }
}

/* What is wrong with the tileset, when something is. "white-space: pre-line"
   lets the line breaks in the text show, so that each problem has a line of
   its own. */
#tile-problems {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border: 1px solid #c92a2a;
  white-space: pre-line;
}

/* The list of subprograms and the list of modules that a development tool
   gives the saved crawler things from: each with its button beside it. */
#loadout-row,
#module-loadout-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#loadout-row select,
#loadout-row button,
#module-loadout-row select,
#module-loadout-row button {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
}

/* The loadout screen before a dive: a dark panel in the map's place, like
   the screen at the end of a dive. Each part has a heading and a group of
   lists or boxes under it. "display: grid" with "auto-fill" lays a group
   out in as many equally wide columns as fit, each at least 9rem wide, so
   that five lists stand side by side on a wide screen and under each other
   on a phone. */
#loadout-screen {
  margin: 0.5rem 0;
  padding: 1rem;
  color: #cccccc;
  background-color: #000000;
}

#loadout-screen h2,
#loadout-screen h3 {
  margin: 0 0 0.5rem;
}

#loadout-screen h3 {
  font-size: 1rem;
}

#loadout-lines {
  margin: 0 0 1rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.loadout-part {
  margin-bottom: 1rem;
}

.loadout-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
  align-items: end;
}

.loadout-group label,
.loadout-group select,
.loadout-group input {
  margin-bottom: 0;
}

/* A box for a number stands under its label, a little apart from it. */
.loadout-group input {
  margin-top: 0.25rem;
}

/* What is wrong with the pick. The line keeps its height when it is empty,
   so that the buttons under it don't jump. */
#loadout-problem {
  min-height: 1.4em;
  margin: 0 0 0.5rem;
  color: #ffa8a8;
  font-weight: bold;
}

#loadout-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

#loadout-actions button {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
}

/* The buttons for trying fonts and colour palettes: side by side, and onto
   a next line when the row is full. The one that is on looks pressed. */
#font-row,
#bold-row,
#palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#font-row button,
#bold-row button,
#palette-row button {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
  padding: 0.5rem;
  font-size: 0.8rem;
}

#font-row button[aria-pressed="true"],
#bold-row button[aria-pressed="true"],
#palette-row button[aria-pressed="true"] {
  color: #ffffff;
  background-color: #000000;
  border-color: #000000;
}

/* The game's font: a file in the fonts folder, with its licence beside it.
   An @font-face rule gives a font file a name, which the rule for the body
   at the top of this sheet and MAP_FONT_FAMILY in draw.js use. It is the
   one font file left: Tim on 26 Nov 2026, "Remove all fonts but keep Cousine
   as default". The other files are in git's history. */
@font-face {
  font-family: "Cousine";
  src: url("fonts/Cousine-Regular.ttf") format("truetype");
}

/* The bold font of the same family, for the enemies on the map: Tim on
   26 Nov 2026, "Try both default bold and download Cousine Bold." It has a
   family name of its own, and not the name above with a bold weight, so
   that the browser's own bold of the regular font can still be tried
   beside it (ENEMY_BOLD_FAMILY_NAME in draw.js). It is declared bold, so
   that the bold the map asks for is this file as it is, and Courier's bold
   where the file can't be loaded: Tim on 27 Nov 2026, "Keep Cousine Bold as
   default for enemies, if fall back to courier." Its licence is beside it
   in the fonts folder. */
@font-face {
  font-family: "Cousine Bold";
  font-weight: bold;
  src: url("fonts/Cousine-Bold.ttf") format("truetype");
}

/* An item of the inventory in the list of items carried is a button that
   uses it. It looks like the line of text it was: no frame of its own, the
   page's font and colour, and the hand cursor that says it can be tapped.
   One that can't be used now is paler. */
.carried-use {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.1em 0.3em;
  border: 1px solid #888888;
  border-radius: 0.2em;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* The small button beside an item carried that destroys every one of that
   kind: an "×" with a thin frame, in the page's own font and colour. The
   rules undo what the rule for every button sets: "flex: none" keeps it
   its own small size in the narrow screen's line, whose use button takes
   the rest. One that can't be pressed now is paler. */
.carried-destroy {
  display: inline-block;
  flex: none;
  width: auto;
  margin: 0 0 0 0.3em;
  padding: 0.1em 0.45em;
  border: 1px solid #888888;
  border-radius: 0.2em;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
}

.carried-destroy:disabled {
  cursor: default;
  opacity: 0.5;
}

.carried-use:disabled {
  border-color: transparent;
  cursor: default;
  opacity: 0.75;
  /* The mouse goes through to the line around it, whose title says what
     the item does: a browser shows no title over a button that is off. */
  pointer-events: none;
}
