/* Keep the page quiet and dark on a phone at night. */
:root {
  font-family: system-ui, sans-serif;
  font-size: 20px;
  color: #b5bec9;
  background: #10151c;
  color-scheme: dark;
}
/* Fill the screen height. */
body {
  margin: 0;
  min-height: 100svh;
}
/* Center the page with room at its edges. */
main {
  box-sizing: border-box;
  width: 100%;
  max-width: 48rem;
  margin: auto;
  padding: 1.5rem 1rem;
}
/* Center the page title. */
h1 {
  font-size: 1.5rem;
  text-align: center;
}

/* Stable-width digits make the live clock easy to read. */
#decimal-clock {
  display: block;
  text-align: center;
  color: #edf3fa;
  font-size: clamp(4rem, 20vw, 9rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* Large controls leave comfortable room for fingers. */
button, input, select, textarea {
  font: inherit;
  box-sizing: border-box;
  min-height: 58px;
  border: 1px solid #526174;
  border-radius: .5rem;
  background: #1b2531;
  color: #edf3fa;
  padding: .65rem;
}
/* Show that buttons can be pressed. */
button {
  cursor: pointer;
}
/* Dim unavailable buttons. */
button:disabled {
  opacity: .45;
  cursor: default;
}
/* Make keyboard focus easy to see. */
:focus-visible {
  outline: 3px solid #92bce8;
  outline-offset: 2px;
}
/* Let text controls fill their labels. */
input:not([type="checkbox"]), select, textarea {
  width: 100%;
}
/* Keep checkboxes easy to tap. */
input[type="checkbox"] {
  width: 26px;
  min-height: 26px;
  vertical-align: middle;
  margin: .65rem;
}
/* Place labels above controls. */
label {
  display: block;
  line-height: 1.6;
}
/* Start labeled controls on their own line. */
label > input:not([type="checkbox"]), label > select, label > textarea {
  display: block;
}
/* Arrange the four punches in a row. */
.punches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  align-items: stretch;
  margin: 1.5rem 0;
}
/* Fit the lunch label and field beneath OL without widening its column. */
.lunch-length {
  grid-column: 2;
  min-width: 0;
  align-self: start;
  font-size: .6rem;
  line-height: normal;
  white-space: nowrap;
}
/* Keep the decimal field within the OL column. */
.lunch-length > input {
  min-width: 0;
  min-height: 0;
  padding: .2rem;
}
/* Align tools with the same four columns and height as the punches. */
.tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
}
/* Keep every main control the same height. */
.punches button, .tools button {
  height: 3rem;
  padding: .4rem;
}
/* Make the lunch reminder stand out. */
#lunch-banner {
  width: 100%;
  margin-bottom: 1rem;
  background: #3b4323;
  border-color: #abbc76;
}
/* Hide inactive controls. */
[hidden] {
  display: none !important;
}

/* Show entries without list markers. */
#entries {
  list-style: none;
  padding: 0;
}
/* Place the buttons to the left of each entry. */
#entries > li {
  border: 1px solid #394758;
  border-radius: .75rem;
  padding: .4rem;
  margin: .75rem 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: start;
}
/* Wrap long entries within their row. */
.entry-line {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: normal;
  font-variant-numeric: tabular-nums;
}
/* Place open editors in the entry's grid. */
.entry-editors {
  display: contents;
}
/* Keep the time beside the buttons in the top row. */
.entry-editors > label {
  grid-column: 2;
  grid-row: 1;
}
/* Give the text and code editors the full row below. */
.entry-editors > div {
  grid-column: 1 / -1;
  grid-row: 2;
}
/* Keep the open entry's swatch at the top right. */
.entry-editors + .entry-color {
  grid-column: 3;
  grid-row: 1;
}
/* Stack Delete above Edit or Done. */
.entry-actions {
  display: grid;
  gap: .5rem;
}
/* Make Delete, Edit and Done thirty percent smaller. */
.entry-actions button {
  min-height: 40.6px;
  font-size: .7rem;
  padding: .455rem;
  border-width: .7px;
}
/* Keep the current code and its clear button beside each other. */
.code-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
  font-size: .75rem;
}
/* Keep the code button small beside the suggestion columns. */
.code-controls button {
  min-height: 0;
  padding: .35rem .5rem;
}
/* Keep editor contents within the entry instead of sizing it to labels. */
.entry-editors > *, .entry-editors label, .entry-editors select, .entry-editors textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
/* Keep resizing the text box within its column. */
.entry-editors textarea {
  resize: vertical;
}
/* Give both suggestion columns the same share of the entry. */
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .5rem;
}
/* Allow long labels to wrap within either column. */
.suggestions > section {
  min-width: 0;
  overflow-wrap: anywhere;
}
/* Reserve the same space for empty and full lists, scrolling each separately. */
.suggestion-list {
  height: 12rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
/* Keep every suggestion readable and inside its column. */
.suggestion-list button {
  display: block;
  width: 100%;
  margin-bottom: .5rem;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
/* Hide an empty status message. */
#status:empty {
  display: none;
}

/* Keep reported errors readable even when a filename is long. */
#status {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Fit the outlined color swatch within the existing line height. */
.entry-color {
  width: 1.2rem;
  height: 1.2rem;
  min-height: 0;
  padding: 0;
  border: 1px solid #b5bec9;
  border-radius: .25rem;
  box-shadow: inset 0 0 0 1px #394758;
  line-height: 1;
}
