:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --paper: #eeeae1;
  --plate: #fcfaf5;
  --ink: #1e343b;
  --muted: #5b6e71;
  --line: #d4d9cf;
  --teal: #24685e;
  --amber: #915025;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2 { letter-spacing: .035em; }
.frame { max-width: 680px; width: calc(100% - 34px); margin-inline: auto; }
.top {
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--ink);
  color: var(--plate);
}
.top-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 19px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8ac75;
  flex: none;
}
.status[data-state="live"]::before { background: #7bd0a7; }

main { padding-block: 23px calc(28px + env(safe-area-inset-bottom, 0px)); }
.plate, .sign-in {
  background: var(--plate);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 4px 4px 10px 10px;
}
.main-reading {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(105px, .86fr);
  align-items: center;
  gap: 18px;
  min-height: 133px;
  padding: 14px 19px 11px;
}
.caption, dt { font-size: 13px; color: var(--muted); }
.charge, dd, .cell-value {
  font-family: "DIN Alternate", Bahnschrift, -apple-system, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.charge {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: clamp(46px, 13vw, 67px);
  font-weight: 700;
  letter-spacing: -.06em;
  line-height: 1.15;
}
.unit { font-size: 20px; letter-spacing: 0; }
.pack { padding-right: 9px; }
.pack progress {
  display: block;
  width: 100%;
  height: 20px;
  appearance: none;
  border: 2px solid var(--teal);
  border-radius: 3px;
  background: #e8ebe0;
  position: relative;
}
.pack progress::after {
  content: "";
  position: absolute;
  top: 4px;
  height: 8px;
  width: 5px;
  right: -7px;
  background: var(--teal);
  border-radius: 0 2px 2px 0;
}
.pack progress::-webkit-progress-bar { background: #e8ebe0; }
.pack progress::-webkit-progress-value { background: var(--teal); }
.pack progress::-moz-progress-bar { background: var(--teal); }
.pack p { margin-top: 9px; font-size: 12px; color: var(--muted); }
.readings { display: grid; grid-template-columns: 1fr 1fr; }
.readings > div { padding: 12px 19px 13px; border-top: 1px solid var(--line); }
.readings > div:nth-child(odd) { border-right: 1px solid var(--line); }
dd { font-size: 24px; font-weight: 650; }
dd small { font-size: 12px; font-weight: 500; color: var(--muted); }
.plate[data-fresh="false"] .charge,
.plate[data-fresh="false"] dd { color: var(--muted); }

.cells-panel { margin-top: 24px; }
.cells-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid #aebbb5;
  padding-bottom: 8px;
}
.cells-heading h2, .sign-in h2 { font-size: 17px; }
.cells-heading span { font-size: 12px; color: var(--muted); }
.cells {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 0;
  margin: 7px 0 0;
  list-style: none;
}
.cells li { padding: 4px 6px 6px; background: var(--plate); border-top: 3px solid #a8bdb0; }
.cells li.cell-low { border-color: #b87543; }
.cells li.cell-high { border-color: #358975; }
.cell-index { display: block; font-size: 11px; color: var(--muted); }
.cell-value { font-size: 18px; font-weight: 650; }

.sign-in { padding: 20px; }
.sign-in label { display: block; font-size: 14px; margin-top: 18px; }
.login-row { display: flex; gap: 8px; margin-top: 7px; }
.login-row input, .login-row button {
  border-radius: 5px;
  padding: 10px 12px;
  font: inherit;
  min-height: 45px;
}
.login-row input { min-width: 0; flex: 1; border: 1px solid #7d8e8f; background: #fff; }
.login-row button { background: var(--teal); color: #fff; border: 1px solid var(--teal); white-space: nowrap; }
.login-row input:focus-visible, .login-row button:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.login-row button:disabled { opacity: .7; }
#login-error, #initial-error { font-size: 13px; color: #983916; }
#login-error:not(:empty) { margin-top: 10px; }

@media (min-width: 570px) {
  .cells { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .main-reading { padding: 18px 24px 15px; }
  .readings { grid-template-columns: repeat(4, 1fr); }
  .readings > div:not(:last-child) { border-right: 1px solid var(--line); }
}

