:root {
    --bg: #f6f6f4; --panel: #ffffff; --text: #1d1d1b; --muted: #6b6b66;
    --border: #e2e1dc; --accent: #2f6fdb; --accent-text: #fff;
    --bar: #2f6fdb; --bar-bg: #ecebe6; --warn-bg: #fff4d6; --warn: #7a5600;
    --ok-bg: #e5f4ea; --ok: #1f6b3a; --tension: #c2571a; --chip: #efeee9;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #161615; --panel: #20201f; --text: #ececea; --muted: #a0a09a;
      --border: #34342f; --accent: #6b9cf0; --accent-text: #0d1220;
      --bar: #6b9cf0; --bar-bg: #2c2c29; --warn-bg: #3a2f12; --warn: #f1cf7a;
      --ok-bg: #173323; --ok: #8fd6a7; --tension: #f0965a; --chip: #2c2c29;
    }
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--text);
         font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  header { padding: 16px 20px 4px; }
  h1 { font-size: 20px; margin: 0 0 4px; }
  .headrow { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
  .lang { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .lang button { border: 0; border-radius: 0; padding: 6px 12px; font-size: 14px; }
  .lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
  header p { margin: 0; color: var(--muted); font-size: 13px; }
  main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; padding: 16px 20px 32px; align-items: start; }
  @media (max-width: 900px) { main { grid-template-columns: 1fr; } }
  .panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
  .left { position: sticky; top: 12px; }
  @media (max-width: 900px) { .left { position: static; } }
  .stage { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 8px; overflow: hidden; }
  .stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
  .stage video { transform: scaleX(-1); }
  #countdown { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
               font-size: 140px; font-weight: 700; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.6); pointer-events: none; }
  #flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
  button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
           background: var(--panel); color: var(--text); cursor: pointer; }
  button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
  button:disabled { opacity: .45; cursor: default; }
  label.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
  .controls label.toggle { margin-left: auto; }
  .status { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 1.4em; }
  .notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
  .notice.warn { background: var(--warn-bg); color: var(--warn); }
  .notice.ok { background: var(--ok-bg); color: var(--ok); }
  h2 { font-size: 15px; margin: 0 0 10px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  h2 small { font-weight: 400; color: var(--muted); }
  h2 .toggle { margin-left: auto; font-weight: 400; }
  h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
  .section { margin-bottom: 20px; }
  .interp { margin: 0; padding-left: 20px; }
  .interp li { margin: 3px 0; }
  .row { display: grid; grid-template-columns: 200px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; margin: 3px 0; }
  @media (max-width: 520px) { .row { grid-template-columns: 1fr 1fr 40px; } }
  .row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar { height: 10px; background: var(--bar-bg); border-radius: 5px; overflow: hidden; }
  .bar > span { display: block; height: 100%; background: var(--bar); border-radius: 5px; }
  .bar.tension > span { background: var(--tension); }
  .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
  .empty { color: var(--muted); font-size: 14px; }
  .hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

  .au { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
  .au.inactive { opacity: .5; }
  .au-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .au-id { font-weight: 700; font-size: 12px; background: var(--chip); border-radius: 4px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
  .au-name { font-weight: 600; font-size: 14px; }
  .au-level { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .au-muscle { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 1px; }
  .au-bar { display: grid; grid-template-columns: 1fr 40px; gap: 8px; align-items: center; margin-top: 6px; }
  .au-desc { font-size: 13px; margin-top: 4px; }
  .asym { font-size: 12px; color: var(--warn); margin-top: 3px; }

  details.raw { border-top: 1px solid var(--border); padding-top: 12px; }
  details.raw summary { cursor: pointer; font-weight: 600; font-size: 15px; }
  details.raw summary small { font-weight: 400; color: var(--muted); }
  /* Einwilligung */
  .consent-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center;
                      padding: 24px 16px; overflow-y: auto; z-index: 10; }
  .consent-backdrop[hidden] { display: none; }
  .consent { background: var(--panel); color: var(--text); border-radius: 12px; max-width: 640px; width: 100%; padding: 20px 22px;
             box-shadow: 0 20px 60px rgba(0,0,0,.35); }
  .consent h2 { font-size: 18px; margin: 0 0 4px; }
  .consent .version { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
  .consent dl { margin: 0; font-size: 14px; }
  .consent dt { font-weight: 600; margin-top: 10px; }
  .consent dd { margin: 2px 0 0; }
  .consent .checks { margin: 16px 0 4px; display: grid; gap: 8px; font-size: 14px; }
  .consent .checks label { display: flex; gap: 8px; align-items: flex-start; }
  .consent .checks input { margin-top: 3px; }
  .consent .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
  .consent .err { color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 12px; }
  .stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
               color: #fff; text-align: center; padding: 20px; font-size: 15px; }
  .stage-msg[hidden] { display: none; }
  .consent-info { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
  .consent-info[hidden] { display: none; }
  .consent-info code { font-size: 11px; }
  .linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 12px; }
  #allShapes { max-height: 520px; overflow-y: auto; padding-right: 4px; margin-top: 10px; }
