:root {
  /* Maßstab der Bedienelemente (app.js, setzeBedienMass): 1 in Chrome an der Tafel, kleiner bei schmalem Fenster */
  --m: 1;
  --grund: #4b5058;
  --leiste: #23262b;
  --text: #f2f2f2;
  --akzent: #2f80ed;
  --taste: #ffffff;
  --taste-text: #1d1f23;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--grund); color: var(--text);
  font-family: "DejaVu Sans", Roboto, Arial, sans-serif; overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }

/* Code-Eingabe */
#start { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; }
#start h1 { margin: 0; font-size: 6vh; font-weight: 600; }
#start p { margin: 0; font-size: 3vh; }
#code-anzeige { display: flex; gap: 1.2vh; }
#code-anzeige span { width: 9vh; height: 12vh; border-radius: 1.2vh; background: #fff; color: var(--taste-text);
  font-size: 8vh; display: flex; align-items: center; justify-content: center; font-weight: 600; }
#start-meldung { min-height: 4vh; color: #ffb4a8; }
#tasten { display: grid; grid-template-columns: repeat(3, 14vh); gap: 1.5vh; }
#tasten button { height: 11vh; border: 0; border-radius: 1.5vh; background: var(--taste); color: var(--taste-text);
  font-size: 5.5vh; font-weight: 600; }
#tasten button:active { background: #d7dce3; }
#taste-ok { background: var(--akzent) !important; color: #fff !important; }

/* Anzeige */
#anzeige { position: relative; height: 100%; display: flex; flex-direction: column; }
#seiten { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 20px 0 40px; }
.seite { position: relative; margin: 0 auto 20px; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.seite img, .seite canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.seite img { object-fit: fill; }
#leiste { display: flex; align-items: center; padding: calc(6px * var(--m)) calc(10px * var(--m)); background: var(--leiste);
  font-size: calc(22px * var(--m));
  overflow-x: auto; overflow-y: hidden; user-select: none; -webkit-user-select: none; }
#leiste > * { flex-shrink: 0; }
#leiste .luecke { flex: 1 1 0; min-width: calc(8px * var(--m)); }
#leiste .gruppe { display: flex; align-items: center; gap: calc(4px * var(--m)); padding: 0 calc(6px * var(--m));
  border-left: 1px solid #4a4f57; }
#leiste button { min-width: calc(54px * var(--m)); height: calc(64px * var(--m)); padding: 0 calc(7px * var(--m)); border: 1px solid #555b63;
  border-radius: calc(10px * var(--m)); background: #343840; color: var(--text); font-size: calc(24px * var(--m)); display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; }
#leiste button small { font-size: calc(15px * var(--m)); line-height: 1; margin-top: calc(3px * var(--m)); }
#leiste button.an { background: var(--akzent); border-color: var(--akzent); }
#leiste button:disabled { opacity: .4; }
.icon { width: calc(30px * var(--m)); height: calc(30px * var(--m)); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; flex-shrink: 0; }
#info { display: flex; flex-direction: column; justify-content: center; padding-right: calc(12px * var(--m));
  max-width: calc(220px * var(--m)); }
#titel { font-weight: 600; white-space: nowrap; font-size: calc(20px * var(--m)); }
#status { color: #b8bec7; font-size: calc(15px * var(--m)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#seitenzahl { color: #d0d5dc; white-space: nowrap; min-width: calc(70px * var(--m)); text-align: center; font-size: calc(20px * var(--m)); }
#b-leiste-auf { position: absolute; right: calc(14px * var(--m)); bottom: calc(14px * var(--m)); z-index: 6; width: calc(64px * var(--m));
  height: calc(64px * var(--m)); border: 0; border-radius: calc(32px * var(--m)); background: rgba(35, 38, 43, .85); color: var(--text); display: flex; align-items: center;
  justify-content: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
#hinweis { position: absolute; left: 50%; top: calc(24px * var(--m)); transform: translateX(-50%); padding: calc(14px * var(--m)) calc(24px * var(--m));
  border-radius: calc(12px * var(--m)); background: rgba(30, 32, 36, .92); font-size: calc(24px * var(--m)); box-shadow: 0 4px 16px rgba(0, 0, 0, .4); z-index: 7; }

/* Schreiben an der Tafel */
#seiten.schreiben { touch-action: none; }
#zug, #laser { position: absolute; left: 0; top: 0; pointer-events: none; }
#zeiger-punkt { position: fixed; left: calc(-11px * var(--m)); top: calc(-11px * var(--m)); width: calc(22px * var(--m)); height: calc(22px * var(--m)); border-radius: 50%;
  background: rgba(230, 20, 20, .85); border: 2px solid #fff; box-sizing: border-box; pointer-events: none; z-index: 5; }
.auswahl { position: absolute; border: 2px dashed var(--akzent); border-radius: 4px; pointer-events: none; }
.auswahl-bild { position: absolute; }
.auswahl-knoepfe { position: absolute; left: -2px; bottom: 100%; padding-bottom: calc(8px * var(--m)); display: flex; gap: calc(6px * var(--m));
  pointer-events: auto; }
.auswahl-knoepfe button { height: calc(56px * var(--m)); padding: 0 calc(18px * var(--m)); border: 0; border-radius: calc(10px * var(--m));
  background: var(--akzent); color: #fff; font-size: calc(22px * var(--m)); display: flex; align-items: center; gap: calc(8px * var(--m)); box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  white-space: nowrap; }
/* 14 Farben in zwei Reihen */
#leiste #farben { display: grid; grid-template-columns: repeat(7, calc(34px * var(--m))); grid-auto-rows: calc(30px * var(--m));
  gap: calc(4px * var(--m)); }
#leiste #farben button { min-width: 0; width: calc(34px * var(--m)); height: calc(30px * var(--m)); padding: 0; border-radius: calc(7px * var(--m));
  background: var(--f); }
#leiste #farben button.an { background: var(--f); border: calc(2px * var(--m)) solid #fff;
  box-shadow: inset 0 0 0 calc(3px * var(--m)) var(--leiste); }

/* Vertikaler Platz: blaues Band wie in Xournal++, darunter die mitrückenden Elemente */
.platz-band { position: absolute; left: 0; right: 0; background: rgba(47, 128, 237, .18);
  border-top: 2px solid var(--akzent); border-bottom: 2px solid var(--akzent); pointer-events: none; }
.platz-bild { position: absolute; pointer-events: none; }

/* Zeiger des PCs (Maus, solange dort der Laserpointer gewählt ist) */
.pc-maus { position: absolute; left: calc(-14px * var(--m)); top: calc(-14px * var(--m)); width: calc(28px * var(--m)); height: calc(28px * var(--m)); border-radius: 50%;
  background: rgba(230, 20, 20, .9); border: calc(3px * var(--m)) solid #fff; box-shadow: 0 0 10px 3px rgba(230, 20, 20, .45);
  pointer-events: none; z-index: 3; transition: transform 60ms linear; }

/* Geodreieck */
.geodreieck { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; }
.geo-mass { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.geodreieck canvas { position: absolute; }
.geo-winkel { position: absolute; left: 0; font-weight: 600; font-family: "DejaVu Sans", Roboto, Arial, sans-serif;
  color: #087f7f; white-space: nowrap; }
.geo-dreh { position: absolute; top: 0; width: calc(56px * var(--m)); height: calc(56px * var(--m)); margin: calc(-28px * var(--m)) 0 0 calc(-28px * var(--m));
  border-radius: 50%;
  background: rgba(47, 128, 237, .85); border: 2px solid #fff; display: flex; align-items: center;
  justify-content: center; color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: auto;
  touch-action: none; }
.geo-dreh .icon { width: calc(32px * var(--m)); height: calc(32px * var(--m)); }

/* Rechner an der Tafel (Spiegel des PC-Rechners) */
#rechner { position: absolute; z-index: 5; padding: 0 calc(8px * var(--m)) calc(8px * var(--m)); border-radius: calc(14px * var(--m)); background: #2b2f38;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .55); touch-action: none; user-select: none; -webkit-user-select: none; }
#rechner-kopf { display: flex; align-items: center; gap: calc(8px * var(--m)); padding: calc(6px * var(--m)) calc(2px * var(--m)); font-size: calc(22px * var(--m));
  cursor: move; }
#rechner-kopf .luecke { flex: 1; }
#rechner-kopf button { min-width: calc(52px * var(--m)); height: calc(48px * var(--m)); border: 1px solid #555b63; border-radius: calc(10px * var(--m));
  background: #343840; color: var(--text); font-size: calc(24px * var(--m)); }
#rechner-bild { position: relative; overflow: hidden; border-radius: 8px; background: #bdbebd; }
#r-gehaeuse { display: block; width: 100%; height: 100%; }
#r-lcd { position: absolute; }
#r-gehaeuse, #r-lcd { pointer-events: none; }
#r-meldung { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; align-items: center;
  justify-content: center; padding: calc(24px * var(--m)); text-align: center; font-size: calc(22px * var(--m));
  background: rgba(30, 32, 36, .88); }
