:root {
  --green: #3f6;
  --green-dim: #1a7f3a;
  --panel-bg: rgb(0 12 4 / 0.88);
  --line: rgb(51 255 102 / 0.25);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Als app op het beginscherm rekent iOS de pagina zonder de statusbalk, maar
   laat hem wel bovenin beginnen: zonder de extra hoogte blijft onderin een
   zwarte strook over. Daarom ook absolute in plaats van fixed posities: iOS
   knipt fixed-elementen af op die te korte hoogte. */
html,
body {
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--green);
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  overscroll-behavior: none;
}

/* Alleen html krijgt de extra hoogte; body vult html. Kreeg body hem ook, dan
   telde de strook dubbel en viel alles onderin (zoals het info-knopje) buiten beeld. */
html {
  --sat: env(safe-area-inset-top, 0px);
  height: calc(100% + var(--sat));
}

body {
  position: relative;
  height: 100%;
}

/* Precies schermvullend: niet groter, niet kleiner. */
#matrix {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

#info-btn {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgb(0 0 0 / 0.6);
  color: var(--green);
  font: bold 14px/1 inherit;
  font-family: inherit;
  opacity: 0.25;
  cursor: pointer;
  transition: opacity 0.2s;
  z-index: 2;
}

#info-btn:hover,
#info-btn:focus-visible,
#info-btn[aria-expanded="true"] {
  opacity: 1;
}

#panel {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(50px, calc(env(safe-area-inset-bottom) + 50px));
  width: min(460px, calc(100vw - 20px));
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 0 30px rgb(51 255 102 / 0.15);
  backdrop-filter: blur(3px);
  z-index: 3;
}

#panel[hidden] {
  display: none;
}

.p-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.p-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.2em;
  text-shadow: 0 0 8px var(--green);
}

.p-sub {
  color: var(--green-dim);
  flex: 1;
}

.p-close {
  background: none;
  border: 0;
  color: var(--green);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.p-stats {
  margin-top: 8px;
  color: var(--green-dim);
  font-size: 11px;
}

.p-stream {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  color: #b8ffc9;
}

#panel h3 {
  margin: 14px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}

#panel h3 small {
  text-transform: none;
  letter-spacing: 0;
  color: var(--green-dim);
  font-weight: normal;
}

.p-param {
  display: grid;
  grid-template-columns: 8.5em 1fr 3.5em;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin: 3px 0;
}

.p-bar {
  position: relative;
  height: 6px;
  background: rgb(51 255 102 / 0.1);
  border-radius: 3px;
}

.p-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--green-dim);
  border-radius: 3px;
}

.p-tgt {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 10px;
  background: #b8ffc9;
}

.p-pval {
  text-align: right;
}

.p-src {
  border-bottom: 1px dashed rgb(51 255 102 / 0.12);
  padding: 4px 0;
}

.p-src summary {
  display: grid;
  grid-template-columns: 12px 1fr auto auto auto;
  column-gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.p-src summary::-webkit-details-marker {
  display: none;
}

.p-val {
  grid-column: 2 / -1;
  color: var(--green-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-origin {
  font-size: 10px;
  color: var(--green-dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

.p-count {
  font-size: 10px;
  color: var(--green-dim);
  min-width: 4em;
  text-align: right;
}

.p-desc,
.p-infl {
  margin: 4px 0 2px 20px;
  font-size: 11px;
  color: #9fdcae;
}

.p-infl:empty {
  display: none;
}

.p-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
  transition: box-shadow 0.15s;
}

.p-dot.s-live,
.p-dot.s-eenmalig {
  background: var(--green-dim);
}

.p-dot.s-fout {
  background: #e33;
}

.p-dot.s-uit {
  background: transparent;
  border: 1px solid #444;
}

.p-dot.on {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.p-foot {
  margin-top: 14px;
  font-size: 11px;
  color: var(--green-dim);
}

.p-foot a {
  color: var(--green);
}

kbd {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  font-family: inherit;
}

noscript p {
  position: fixed;
  inset: 40% 10% auto;
  text-align: center;
}

#toast {
  position: absolute;
  left: 50%;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 4;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.p-count.priv {
  color: var(--green);
}

.p-count.pub {
  color: var(--green-dim);
  font-style: italic;
}

.p-note {
  margin-left: 0;
}

.p-fx {
  font: inherit;
  font-size: 10px;
  padding: 0 5px;
  border: 1px solid var(--green-dim);
  border-radius: 3px;
  background: rgb(51 255 102 / 0.15);
  color: var(--green);
  cursor: pointer;
}

.p-fx.off {
  background: none;
  border-color: #444;
  color: #555;
  text-decoration: line-through;
}

.p-legend {
  margin-top: 10px;
  font-size: 11px;
}

.p-legend summary {
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
}

.p-legend dl {
  margin: 6px 0 0;
}

.p-legend dt {
  color: var(--green);
  margin-top: 5px;
}

.p-legend dd {
  margin: 1px 0 0 12px;
  color: #9fdcae;
}

/* Op een telefoon het info-knopje groter en beter zichtbaar. */
@media (pointer: coarse) {
  #info-btn {
    width: 40px;
    height: 40px;
    font-size: 17px;
    opacity: 0.55;
  }
}

.p-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  font-size: 11px;
}

.p-fx-all {
  padding: 2px 8px;
  font-size: 11px;
}
