:root {
  --ink: #2b1b12;
  --muted: #7a6a5e;
  --paper: #f7f1e8;
  --card: #ffffff;
  --line: #e2d6c6;
  --accent: #3b2417;
  --danger: #a3261c;
}

* {
  box-sizing: border-box;
}

/* Rules such as `display: flex` below would otherwise beat the browser's own rule for [hidden]. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 26rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 16px or larger stops iOS zooming the page when a field takes focus. */
input {
  font: inherit;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  color: inherit;
  text-align: right;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
}

input:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:disabled,
button:disabled {
  opacity: 0.5;
}

.volume label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.volume .entry {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.volume input {
  width: 100%;
  padding: 0.3rem 0.75rem;
  font-size: 2.25rem;
  font-weight: 600;
}

.volume .unit {
  color: var(--muted);
  font-size: 1.25rem;
}

.error {
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.875rem;
}

/* C# clears a message by writing an empty string. */
.error:empty {
  display: none;
}

.results {
  margin: 1.5rem 0;
  padding: 0;
}

.results .line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.results dt {
  color: var(--muted);
}

.results dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.results .add,
.results .arrow {
  color: var(--muted);
}

/* The scale total is what you watch while pouring, so it is the largest number on the line. */
.results .total {
  font-size: 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.startup-error {
  margin: 1.5rem 0;
  color: var(--danger);
}

.settings summary {
  padding: 0.5rem 0;
  color: var(--muted);
  cursor: pointer;
}

.settings .setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.settings .boxes {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.settings input {
  width: 4.5rem;
}

.settings .note {
  color: var(--muted);
  font-size: 0.875rem;
}

button {
  margin-top: 0.75rem;
  padding: 0.5rem 0.9rem;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
}
