/* Monochrome LCD handset. Everything sits on an 8px cell grid; the only
   colour that ever appears is the alert brown, so it means something. */

:root {
  --lcd:      #a8b88a;
  --lcd-dim:  #98aa78;
  --lcd-lit:  #b9c79c;
  --ink:      #16200f;
  --ink-soft: #4d5c3c;
  --alert:    #6e2113;
  --frame:    #23241e;
  --cell: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The handset frame is fixed; only main scrolls inside it. The document
   itself never scrolls, so content can never slide behind the translucent
   iOS tab bar / home-indicator glass. */
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--frame);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: calc(var(--cell) * 2.5);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#screen {
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--lcd);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* The pixel grid. This is the one decorative element and it earns its place
   by making the block-glyph gauges read as a segmented display. */
#screen::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background-image:
    linear-gradient(rgba(0,0,0,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.045) 1px, transparent 1px);
  background-size: 3px 3px;
}

/* ---------------------------------------------------------- status bar */

.status {
  display: flex;
  justify-content: space-between;
  gap: var(--cell);
  padding: var(--cell) calc(var(--cell) * 1.5);
  border-bottom: 2px solid var(--ink);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--lcd-dim);
}
.status b { font-weight: 700; }
.warn { color: var(--alert); }

/* -------------------------------------------------------------- layout */

main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--cell) 0 calc(var(--cell) * 2);
}

h1 {
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: var(--cell) calc(var(--cell) * 1.5) 0;
  color: var(--ink-soft);
}

h2 {
  font-size: 15px;
  letter-spacing: .06em;
  padding: 0 calc(var(--cell) * 1.5);
}

p.lede {
  padding: 0 calc(var(--cell) * 1.5) var(--cell);
  font-size: 13px;
  line-height: calc(var(--cell) * 2.25);
  color: var(--ink-soft);
}

.rule {
  height: 2px;
  background: var(--ink);
  margin: var(--cell) 0;
}

/* ---------------------------------------------------------------- rows */

/* Numbered rows are honest here: the old handsets these copy were driven by
   the number keys, and the numbers are how you learn the menu by muscle. */
.row {
  display: flex;
  align-items: baseline;
  gap: calc(var(--cell) * 1.25);
  width: 100%;
  min-height: calc(var(--cell) * 6);
  padding: var(--cell) calc(var(--cell) * 1.5);
  border: 0;
  border-bottom: 1px dashed var(--ink-soft);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:active, .row:focus-visible { background: var(--lcd-lit); outline: none; }
.row:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }

.row .key {
  flex: 0 0 auto;
  width: calc(var(--cell) * 3);
  font-weight: 700;
  color: var(--ink-soft);
}
.row .body { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .sub {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.row .end {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: .08em;
  text-align: right;
}
.row.alert .key, .row.alert .end { color: var(--alert); }

/* --------------------------------------------------------------- gauge */

/* Block-glyph bars: the signature. Reads like a battery meter, prints the
   real number beside it so it is never only a picture. */
.gauge {
  font-size: 13px;
  letter-spacing: -.5px;
  white-space: nowrap;
  display: block;
}
.gauge .full { color: var(--ink); }
.gauge .empty { color: var(--ink-soft); opacity: .45; }
.gauge.low .full { color: var(--alert); }

/* --------------------------------------------------------------- forms */

.field {
  display: block;
  padding: var(--cell) calc(var(--cell) * 1.5);
}
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: var(--cell);
  font: inherit;
  font-size: 16px; /* stops iOS zooming on focus */
  color: var(--ink);
  background: var(--lcd-lit);
  border: 2px solid var(--ink);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus, .field select:focus { outline: 2px solid var(--alert); outline-offset: -4px; }

.btnrow { display: flex; gap: var(--cell); padding: var(--cell) calc(var(--cell) * 1.5); }

button.btn {
  flex: 1;
  min-height: calc(var(--cell) * 6);
  padding: var(--cell);
  font: inherit;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--lcd);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}
button.btn.ghost { color: var(--ink); background: none; }
button.btn.warn { background: var(--alert); border-color: var(--alert); color: var(--lcd-lit); }
button.btn:active { transform: translateY(1px); }

/* ------------------------------------------------------------ softkeys */

/* In-flow footer of the fixed frame: always visible, always opaque, and its
   padding carries the buttons clear of the home-indicator region. */
.softkeys {
  flex: 0 0 auto;
  display: flex;
  border-top: 2px solid var(--ink);
  background: var(--lcd-dim);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.softkeys button {
  flex: 1;
  min-height: calc(var(--cell) * 6);
  padding: var(--cell);
  font: inherit;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 0;
  border-right: 1px dashed var(--ink-soft);
  cursor: pointer;
}
.softkeys button:last-child { border-right: 0; }
.softkeys button:active { background: var(--lcd-lit); }

/* --------------------------------------------------------------- misc */

.note {
  padding: var(--cell) calc(var(--cell) * 1.5);
  font-size: 13px;
  line-height: calc(var(--cell) * 2.25);
  border-bottom: 1px dashed var(--ink-soft);
}
.note cite {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-style: normal;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.note.unverified { border-left: 4px solid var(--alert); }
.note.unverified cite::before { content: "unconfirmed / "; color: var(--alert); }

.empty {
  padding: calc(var(--cell) * 4) calc(var(--cell) * 1.5);
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.offline {
  padding: 4px calc(var(--cell) * 1.5);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lcd-lit);
  background: var(--alert);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
