:root {
  --paper: #f3f5ee;
  --card: #ffffff;
  --ink: #17251f;
  --dim: #5d6b63;
  --line: #d6dccf;
  --green: #143e2f;
  --box: #3ddc84;
  --bad: #8f1d14;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 62rem;
  padding: 1rem;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 system-ui, "Segoe UI", sans-serif;
}

h1 { margin: .4rem 0 .3rem; font-size: 1.5rem; color: var(--green); }
h2 { margin: 1.4rem 0 .6rem; font-size: 1.1rem; color: var(--green); }
.lead { margin: 0 0 1rem; max-width: 46rem; }
.note { margin: .6rem 0 0; color: var(--dim); font-size: .9rem; }

.panel { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; }
.button {
  padding: .7rem 1.2rem;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.button:focus-within, .button:hover { filter: brightness(1.25); }
.button[aria-disabled="true"] { opacity: .5; cursor: progress; }
#status { margin: 0; }
#status.failed { color: var(--bad); }

/* The canvas lies exactly over the video picture: the script gives both the recording's own aspect ratio. */
.screen { position: relative; margin-top: 1rem; background: #000; border-radius: 10px; overflow: hidden; }
.screen video { display: block; width: 100%; height: 100%; }
.screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#readings { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .5rem; }
#readings li {
  display: grid;
  grid-template-columns: 1.9rem 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
}
#readings .number { justify-self: center; min-width: 1.6rem; padding: .05rem .3rem; border-radius: 5px; background: var(--box); color: #06140d; font-size: .8rem; font-weight: 700; text-align: center; }
#readings canvas { max-width: 100%; height: 2.3rem; border-radius: 4px; background: #000; }
#readings .text { font: 600 1.25rem/1.1 ui-monospace, Consolas, monospace; text-align: right; }
#readings .text.empty { font: .9rem/1.2 system-ui, sans-serif; color: var(--dim); }
#readings .sure { display: block; color: var(--dim); font: .75rem/1.2 system-ui, sans-serif; text-align: right; }

footer { margin-top: 2rem; padding-top: .6rem; border-top: 1px solid var(--line); }
