/* Sehtest – Styles für Tablet-Anzeige und Handy-Fernbedienung */
:root {
  --ui-bg: #f2f3f5;
  --ui-card: #ffffff;
  --ui-text: #1c1e21;
  --ui-dim: #6b7280;
  --ui-line: #d9dce1;
  --ui-accent: #0a5cd6;
  --ui-accent-text: #ffffff;
  --ui-warn: #b45309;
  --ui-ok: #15803d;
  --ui-bad: #b91c1c;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ui-text);
  background: var(--ui-bg);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; }
[hidden] { display: none !important; }

/* ---------- Tablet: Anzeigefläche (immer schwarz auf weiß) ---------- */
#stage {
  position: fixed; inset: 0;
  background: #fff; color: #000;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
}
#row {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
}
#row .opto { flex: none; }
#info {
  position: absolute; left: 12px; bottom: 8px;
  font-size: 13px; color: #888; letter-spacing: 0.02em;
  pointer-events: none;
}
#hint {
  position: absolute; left: 0; right: 0; bottom: 8px; text-align: center;
  font-size: 15px; color: #555; pointer-events: none;
}
#portraitHint {
  position: fixed; inset: 0; z-index: 30; background: #fff; color: #333;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 22px; padding: 40px;
}

/* Amsler-Gitter */
#amsler { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#amsler .note { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #777; font-size: 13px; }

/* Nahsehprobe */
#near {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 44px 40px 60px 40px; background: #fff; color: #000;
  font-family: Arial, Helvetica, sans-serif; /* Versalhöhe ≈ 0,716 em */
}
#near .para { display: flex; align-items: flex-start; gap: 18px; margin: 0 0 1.1em 0; }
#near .para .tag { flex: none; width: 44px; font-size: 13px; color: #999; text-align: right; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; padding-top: 0.2em; font-variant-numeric: tabular-nums; }
#near .para p { margin: 0; line-height: 1.35; max-width: 34em; }
#near .single { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; }
#near .single p { margin: 0; line-height: 1.35; max-width: 34em; }
#near .single .tag { margin-top: 30px; font-size: 12px; color: #999; }

/* Zahnrad / Öffner */
#gear {
  position: fixed; top: 6px; right: 6px; z-index: 20;
  width: 44px; height: 44px; border-radius: 22px; border: 0;
  background: rgba(0,0,0,0.06); color: #999; font-size: 22px; cursor: pointer;
}
#gear:active { background: rgba(0,0,0,0.15); }
#status {
  position: fixed; top: 14px; left: 12px; z-index: 20;
  font-size: 12px; color: #aaa; pointer-events: none;
}
#status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #ccc; margin-right: 5px; vertical-align: middle; }
#status.connected .dot { background: #22c55e; }
#status.waiting .dot { background: #f59e0b; }
#status.connecting .dot { background: #f59e0b; animation: blink 1s infinite; }
#status.error .dot { background: #ef4444; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- Sheets (Tablet-Overlay: Setup und Bedienfeld) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 22, 26, 0.35);
  display: flex; justify-content: center; align-items: flex-end;
}
.sheet .inner {
  width: 100%; max-width: 980px; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--ui-bg); border-radius: 16px 16px 0 0; padding: 12px 16px 24px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.2);
}
.sheet .bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sheet .bar h2 { margin: 0; font-size: 18px; flex: 1; }
.sheet.setup { align-items: center; }
.sheet.setup .inner { border-radius: 16px; max-height: 96vh; }

/* ---------- Bedienfeld (gemeinsam) ---------- */
.controls { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .controls { grid-template-columns: 1fr 1fr; } .controls .head, .controls .wide { grid-column: 1 / -1; } }
.card { background: var(--ui-card); border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.card h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ui-dim); }
.head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.visus-big { display: flex; flex-direction: column; min-width: 130px; }
.visus-big .lbl { font-size: 12px; color: var(--ui-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.visus-big .val { font-size: 52px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.visus-big .sub { font-size: 12px; color: var(--ui-dim); margin-top: 4px; }
.meta { flex: 1; font-size: 15px; line-height: 1.5; min-width: 200px; }
.warn { color: var(--ui-warn); font-size: 13px; }
.dim { color: var(--ui-dim); }
.small { font-size: 13px; margin-top: 6px; }
.ok { color: var(--ui-ok); font-weight: 600; }
.bad { color: var(--ui-bad); font-weight: 600; }

.btn {
  border: 1px solid var(--ui-line); background: #fff; color: var(--ui-text);
  border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer;
  font-size: 15px; font-weight: 500;
}
.btn:active { background: #e8eaee; }
.btn.on { background: var(--ui-accent); color: var(--ui-accent-text); border-color: var(--ui-accent); }
.btn.primary { background: #111; color: #fff; border-color: #111; }
.btn.mini { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.btn.big { flex: 1; min-height: 64px; font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.btn.big small { font-size: 12px; font-weight: 400; color: inherit; opacity: 0.75; }
.btn:disabled { opacity: 0.4; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.lbl2 { font-size: 13px; color: var(--ui-dim); min-width: 110px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; min-height: 32px; }
.check input { width: 20px; height: 20px; }
.num { width: 90px; font: inherit; font-size: 16px; padding: 8px; border: 1px solid var(--ui-line); border-radius: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.grow { flex: 1; }
.stepper { display: flex; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  border: 1px solid var(--ui-line); background: #fff; border-radius: 999px;
  min-width: 56px; min-height: 40px; padding: 4px 10px; font-size: 15px; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer;
}
.chip small { font-size: 10px; color: var(--ui-dim); }
.chip.on { background: var(--ui-accent); color: #fff; border-color: var(--ui-accent); }
.chip.on small { color: #dbe7fb; }
.chip.off { opacity: 0.3; text-decoration: line-through; }

.rowline { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.symbtn {
  width: 60px; height: 60px; border-radius: 10px; border: 1px solid var(--ui-line); background: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
}
.symbtn.wrong { border-color: var(--ui-bad); background: #fef2f2; }
.symbtn.wrong::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 3px; background: var(--ui-bad); transform: rotate(-30deg);
}
.rowmeta { display: flex; justify-content: space-between; font-size: 14px; flex-wrap: wrap; gap: 6px; }
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results td { padding: 6px 4px; border-top: 1px solid var(--ui-line); vertical-align: middle; }

/* ---------- Setup-Ansicht (Tablet) ---------- */
.setup-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .setup-grid { grid-template-columns: 1fr 1fr; } }
.code { font-size: 34px; font-weight: 700; letter-spacing: 0.15em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qr { margin-top: 8px; }
.qr svg, .qr img { width: 160px; height: 160px; display: block; }
.url { font-size: 12px; color: var(--ui-dim); word-break: break-all; margin-top: 6px; }
.calib-line { height: 6px; background: #000; margin: 10px 0 4px; }
.calib-card { border: 2px solid #000; border-radius: 6px; margin: 10px 0 4px; height: 40px; background: repeating-linear-gradient(45deg, #fff 0 8px, #eee 8px 16px); }
.range { width: 100%; }

/* ---------- Handy-Fernbedienung ---------- */
body.remote { padding: 10px 12px 40px; max-width: 760px; margin: 0 auto; }
.remote .topbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.remote .topbar h1 { margin: 0; font-size: 18px; flex: 1; }
.remote .conn { font-size: 13px; color: var(--ui-dim); display: flex; align-items: center; gap: 6px; }
.remote .conn .dot { width: 10px; height: 10px; border-radius: 5px; background: #ccc; }
.remote .conn.connected .dot { background: #22c55e; }
.remote .conn.connecting .dot { background: #f59e0b; animation: blink 1s infinite; }
.remote .conn.disconnected .dot, .remote .conn.error .dot { background: #ef4444; }
.remote .connect-card { text-align: center; }
.remote .connect-card input { font-size: 28px; text-align: center; letter-spacing: 0.2em; text-transform: uppercase; width: 220px; padding: 10px; border: 1px solid var(--ui-line); border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.remote .msg { font-size: 13px; color: var(--ui-dim); margin-top: 8px; min-height: 18px; }
