/* GDV – Bildbearbeitung auf Pixelebene (1994), im Browser nachgebaut. Entwurf vom 2026-11-25.
   Das Programm selbst sieht aus wie ein Programm aus Visual Basic 3.0 unter Windows: graue Fenster mit erhabenen
   Kanten, dunkelblaue Titelleisten, weiße Arbeitsfläche (wie auf dem Screenshot von 1994). Drei Fenster tragen Percys
   eigene Hintergründe von damals (bilder/fenster-*.png); die Bedienelemente liegen genau auf den gezeichneten Feldern,
   in Pixeln des Originals gemessen und mit --s vergrößert (setzt gdv.js passend zur Breite).
   Um das Programm herum (Leiste, Vorspann, Tiefe) gilt das Licht des Besuchers: Abend oder Tag, wie in der Hütte. */

@font-face { font-family: "Nunito"; src: url("../../assets/schrift/nunito-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --tisch: #0d1124; --text: #dfe3f2; --leise: #a3abc8; --linie: #2a3150; --verweis: #8fd3ff; --leiste: #121733;
  --flaeche: #c0c0c0; --licht: #ffffff; --schatten: #808080; --dunkel: #000000; --titel: #000080;
  --sys: "MS Sans Serif", "Microsoft Sans Serif", "Segoe UI", Tahoma, Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-licht="abend"]) { --tisch: #e9ebf2; --text: #1b2033; --leise: #4b536e; --linie: #c8ccda; --verweis: #0b5fa5; --leiste: #dfe2ec; color-scheme: light; }
}
:root[data-licht="tag"] { --tisch: #e9ebf2; --text: #1b2033; --leise: #4b536e; --linie: #c8ccda; --verweis: #0b5fa5; --leiste: #dfe2ec; color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--tisch); color: var(--text); }
body { font: 16px/1.6 Nunito, system-ui, sans-serif; min-height: 100vh; }
a { color: var(--verweis); }

.leiste { display: flex; align-items: center; gap: 1rem; padding: .45rem 1rem; background: var(--leiste); border-bottom: 1px solid var(--linie); min-height: 2.6rem; }
.leiste a { text-decoration: none; white-space: nowrap; }
.leiste a:hover, .leiste a:focus-visible { text-decoration: underline; }
.leiste p { margin: 0; flex: 1; text-align: center; color: var(--leise); font-size: .9rem; }
@media (max-width: 640px) { .leiste p span { display: none; } }
html.eingebettet .leiste { display: none; }

.buehne { max-width: 1240px; margin: 0 auto; padding: clamp(12px, 2.4vw, 32px) clamp(10px, 2vw, 24px) 48px; }
.vorspann { max-width: 46rem; margin: 0 0 clamp(14px, 2.4vw, 26px); }
.vorspann h1 { margin: 0 0 .3rem; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.1; }
.vorspann h1 span { display: block; font-size: .5em; font-weight: 600; color: var(--leise); letter-spacing: .02em; }
.vorspann p { margin: 0; }
.ohne-skript { margin: 0 0 2rem; }
.ohne-skript img, .tiefe__bild img { max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--linie); }
.ohne-skript figcaption, .tiefe__bild figcaption { font-size: .9rem; color: var(--leise); margin-top: .4rem; }

/* ---------- Das Programm: Mutterfenster (MDI) ---------- */
.mdi { font: 600 13px/1.25 var(--sys); color: #000; background: var(--flaeche); border: 1px solid var(--dunkel); box-shadow: inset 1px 1px 0 var(--licht), inset -1px -1px 0 var(--schatten), 0 30px 70px -30px #000; padding: 3px; }
.mdi__titel { display: flex; align-items: center; gap: 6px; background: var(--titel); color: #fff; height: 22px; padding-right: 6px; }
.mdi__titel b { flex: 1; text-align: center; font-weight: 700; }
.knopf-sys { display: inline-grid; place-items: center; width: 22px; height: 22px; background: var(--flaeche); color: #000; border-right: 1px solid #000; font-weight: 700; }
.mdi__menue { position: relative; display: flex; gap: 2px; padding: 2px 4px; background: #fff; border-bottom: 1px solid #000; }
.menue { position: relative; }
.menue__kopf { font: inherit; background: none; border: 0; padding: 2px 8px; cursor: pointer; color: #000; }
.menue__kopf[aria-expanded="true"], .menue__kopf:hover, .menue__kopf:focus-visible { background: var(--titel); color: #fff; outline: none; }
.menue__liste { position: absolute; z-index: 20; left: 0; top: 100%; min-width: 220px; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; padding: 2px 0; display: grid; }
.menue__liste button { font: inherit; text-align: left; background: none; border: 0; padding: 4px 18px; cursor: pointer; color: #000; }
.menue__liste button:hover, .menue__liste button:focus-visible { background: var(--titel); color: #fff; outline: none; }
.menue__gruppe { margin: 4px 0 2px; padding: 2px 10px 0; border-top: 1px solid #000; color: #808080; font-weight: 600; font-size: 12px; }
.menue__gruppe:first-child { border-top: 0; }
.menue__gruppe:empty { padding: 0; margin: 4px 0; }

.mdi__flaeche { background: #fff; padding: clamp(8px, 1.4vw, 16px); display: grid; gap: clamp(8px, 1.4vw, 16px); align-items: start;
  grid-template-columns: auto auto minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "menue bild werkzeug" "menue histo werkzeug"; }
.mdi__status { margin: 0; padding: 3px 8px; min-height: 24px; border-top: 1px solid var(--schatten); box-shadow: inset 0 1px 0 var(--licht); font-weight: 400; }

/* ---------- Kindfenster ---------- */
.fenster { background: var(--flaeche); border: 1px solid #000; box-shadow: inset 1px 1px 0 var(--licht), inset -1px -1px 0 var(--schatten); padding: 0 3px 3px; min-width: 0; }
.fenster__titel { margin: 0 -3px 3px; height: 20px; line-height: 20px; padding: 0 6px; background: var(--titel); color: #fff; font: 700 13px/20px var(--sys); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fenster__titel:focus { outline: 1px dotted #fff; outline-offset: -3px; }
.fenster--menue { grid-area: menue; }
.fenster--bild { grid-area: bild; }
.fenster--histo { grid-area: histo; }
.fenster--werkzeug { grid-area: werkzeug; justify-self: start; max-width: 100%; }

.werkzeuge { display: grid; gap: 4px; padding: 4px; }
.werkzeuge button, .knopf, .bg__knopf, .bg__spin { font: 600 13px/1 var(--sys); color: #000; background: var(--flaeche); cursor: pointer;
  border: 2px solid; border-color: var(--licht) var(--schatten) var(--schatten) var(--licht); box-shadow: 0 0 0 1px #000; }
.werkzeuge button { min-height: 30px; padding: 4px 12px; text-align: center; white-space: nowrap; }
.werkzeuge button[aria-current="true"], .knopf[aria-pressed="true"], .bg__knopf[aria-pressed="true"], .werkzeuge button:active, .knopf:active, .bg__knopf:active, .bg__spin:active {
  border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); }
.werkzeuge button:focus-visible, .knopf:focus-visible, .bg__knopf:focus-visible, .bg__spin:focus-visible { outline: 1px dotted #000; outline-offset: -6px; }
.knopf:disabled { color: var(--schatten); text-shadow: 1px 1px 0 #fff; cursor: default; }

.bilder { display: flex; gap: 6px; padding: 3px; }
.bilder figure { margin: 0; }
.bilder canvas { display: block; width: calc(128px * var(--bs, 2)); height: auto; image-rendering: pixelated; border: 2px solid; border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); background: #000; }
.bilder figcaption { text-align: center; padding: 3px 0 0; font-weight: 400; }

/* ---------- Fenster mit Percys Hintergrund: Maße in Pixeln des Originals × --s ---------- */
.bg, .hg { --s: 1.5; position: relative; width: calc(var(--w) * var(--s) * 1px); height: calc(var(--h) * var(--s) * 1px); background: var(--flaeche) center / 100% 100% no-repeat; image-rendering: pixelated; }
.bg--kontrast { background-image: url("bilder/fenster-kontrast.png"); }
.bg--shading { background-image: url("bilder/fenster-shading.png"); }
.hg { background-image: url("bilder/fenster-histogramm.png"); }
.bg > *, .hg > * { position: absolute; left: calc(var(--x, 0) * var(--s) * 1px); top: calc(var(--y, 0) * var(--s) * 1px); }
.bg__marke { font: 600 calc(11px * var(--s)) / 1.2 var(--sys); }
.bg__zahl { width: calc(var(--bw) * var(--s) * 1px); height: calc(var(--bh) * var(--s) * 1px); font: 600 calc(10px * var(--s)) / 1 var(--sys); text-align: right; padding: 0 calc(3px * var(--s)); border: 0; background: transparent; color: #000; -moz-appearance: textfield; appearance: textfield; }
.bg__zahl::-webkit-inner-spin-button, .bg__zahl::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.bg__zahl:focus-visible { outline: 1px dotted #000; outline-offset: -2px; }
.bg__spin { width: calc(12px * var(--s)); height: calc(9px * var(--s)); padding: 0; opacity: 0; }
.bg__spin:focus-visible { opacity: .35; }
.bg__knopf { width: calc(var(--bw) * var(--s) * 1px); height: calc(var(--bh) * var(--s) * 1px); font-size: calc(10.5px * var(--s)); padding: 0; }
.bg__feld { width: calc(var(--bw) * var(--s) * 1px); height: calc(var(--bh) * var(--s) * 1px); cursor: crosshair; touch-action: none; }
.kreuz__punkt, .shading__mitte, .shading__winkel { position: absolute; width: calc(9px * var(--s)); height: calc(9px * var(--s)); margin: calc(-4.5px * var(--s)) 0 0 calc(-4.5px * var(--s)); border-radius: 50%; background: #808080; border: 1px solid #000; box-shadow: inset 1px 1px 0 #fff8; cursor: grab; }
.shading__mitte { border-radius: 0; background: #000; }
.shading__winkel { background: #fff; }
.kreuz__punkt:focus-visible, .shading__mitte:focus-visible, .shading__winkel:focus-visible { outline: 2px solid var(--titel); outline-offset: 2px; }
.bg__feld svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bg__feld line { stroke: #000; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bg__senkrecht { width: calc(var(--bh) * var(--s) * 1px); height: calc(var(--bw) * var(--s) * 1px); margin: 0; transform-origin: 0 0; transform: translateY(calc(var(--bh) * var(--s) * 1px)) rotate(-90deg); accent-color: #000080; opacity: .001; cursor: pointer; }
.bg__senkrecht + .bg__marke { pointer-events: none; }
.shading__griff { position: absolute; left: calc(146px * var(--s)); width: calc(12px * var(--s)); height: calc(10px * var(--s)); margin-top: calc(-5px * var(--s)); background: var(--flaeche); border: 1px solid #000; box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080; pointer-events: none; }

.hg__flaeche { left: calc(10px * var(--s)) !important; top: calc(2px * var(--s)) !important; width: calc(256px * var(--s)); height: calc(100px * var(--s)); image-rendering: pixelated; }
.hg__werte { left: calc(272px * var(--s)) !important; top: calc(4px * var(--s)) !important; width: calc(92px * var(--s)); margin: 0; font: 600 calc(9.5px * var(--s)) / 1.35 var(--sys); white-space: pre-line; }

/* ---------- Gewöhnliche Formulare (Fenster ohne eigenen Hintergrund) ---------- */
.form { padding: 8px; display: grid; gap: 10px; min-width: min(360px, 100%); }
.form__zeilen { display: grid; gap: 10px; }
.form__zeilen label { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.form__zeilen input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--titel); min-height: 26px; }
.form__zeilen output, .form__gruppe input { font: 600 13px/1 var(--sys); background: #fff; color: #000; border: 2px solid; border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); padding: 3px 6px; min-width: 4.6em; text-align: right; }
.form__gruppe { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.form__gruppe input { width: 4.4em; }
.form__haken { display: flex !important; gap: 6px; align-items: center; grid-template-columns: none; }
.form__wahl { margin: 0; border: 1px solid var(--schatten); box-shadow: 1px 1px 0 var(--licht); padding: 6px 10px; display: flex; gap: 16px; }
.form__wahl legend { padding: 0 4px; }
.form__knoepfe { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.form__knoepfe .knopf { min-width: 84px; min-height: 30px; padding: 4px 10px; }
.form__knoepfe--oben { justify-content: flex-start; align-items: center; }
.form .hg { justify-self: start; }

.form--crack { min-width: 0; }
.crack__gross { width: min(100%, 512px); height: auto; image-rendering: pixelated; border: 2px solid; border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); background: #000; }
.crack__zahlen { margin: 0; display: flex; gap: 18px; }
.crack__zahlen output { font: 600 13px/1 var(--sys); background: #fff; border: 2px solid; border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); padding: 3px 8px; margin-left: 6px; display: inline-block; min-width: 3em; text-align: right; }
.crack__wahl { display: flex; gap: 8px; align-items: center; }
.crack__wahl select { font: inherit; max-width: 100%; flex: 1; }
.crack__code { margin: 0; font: 400 12px/1.5 ui-monospace, Consolas, monospace; background: #fff; border: 2px solid; border-color: var(--schatten) var(--licht) var(--licht) var(--schatten); padding: 6px; max-height: 7.5em; overflow: auto; word-break: break-all; }
.crack__code:empty { display: none; }

/* ---------- Schmaler: Werkzeug unter Bild und Menü, dann ganz untereinander ---------- */
@media (max-width: 1040px) {
  .mdi__flaeche { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "menue bild" "menue histo" "werkzeug werkzeug"; }
}
@media (max-width: 640px) {
  .mdi__flaeche { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "bild" "menue" "werkzeug" "histo"; }
  .werkzeuge { grid-template-columns: 1fr 1fr; }
  .werkzeuge button { white-space: normal; }
}

/* ---------- Tiefe ---------- */
.tiefe { max-width: 46rem; margin-top: clamp(28px, 5vw, 56px); }
.tiefe h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
.tiefe details { border-top: 1px solid var(--linie); padding: .7rem 0; }
.tiefe summary { cursor: pointer; font-weight: 700; }
.tiefe details p { margin: .6rem 0 0; }
.tiefe__bild { margin: 1rem 0 0; }

@media print {
  .leiste, .mdi { display: none !important; }
  html, body { background: #fff; color: #000; }
  .tiefe details { display: block; }
  .tiefe details > * { display: block; }
}
.bg__senkrecht:focus-visible { opacity: .45; outline: 1px dotted #000; }
