@font-face { font-family: "DHW Pixelify"; src: url("fonts/pixelify-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "DHW Courier Prime"; src: url("fonts/courier-prime-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DHW Courier Prime"; src: url("fonts/courier-prime-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DHW Courier Prime"; src: url("fonts/courier-prime-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

/* Layout: ein 1-Bit-Schreibtisch über die ganze Fläche. Menüleiste oben, Laufwerke rechts, Fenster frei verschiebbar; auf schmalen oder flachen Bildschirmen werden Fenster zu Blättern über die volle Breite. */
/* Grundlage: die Seite läuft ohne Theme, darum eigene Basis */
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
:root {
  --ink: #000000;
  --paper: #ffffff;
  --dim: #808080;
  --menu-h: 26px;
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --f-ui: "DHW Pixelify", "Geneva", system-ui, sans-serif;
  --f-doc: "DHW Courier Prime", "Monaco", "Courier New", monospace;
  --pattern: repeating-conic-gradient(var(--ink) 0 25%, var(--paper) 0 50%) 0 0 / 2px 2px;
  color-scheme: light;
}
html, body { height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--f-ui); font-size: 15px; line-height: 1.25;
  overflow: hidden; -webkit-font-smoothing: none; font-smooth: never;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
:focus-visible { outline: 1px dotted var(--ink); outline-offset: 1px; }

/* ---------- Bildschirm ---------- */
#screen { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--paper); }
#menubar {
  flex: none; height: var(--menu-h); display: flex; align-items: stretch;
  background: var(--paper); border-bottom: 1px solid var(--ink);
  padding-left: calc(var(--gut) - 6px); padding-right: var(--gut-r);
  padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box;
  position: relative; z-index: 9000; font-size: 15px;
}
.mtitle { padding: 0 10px; display: flex; align-items: center; height: var(--menu-h); white-space: nowrap; }
.mtitle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.mtitle.logo svg { width: 20px; height: 20px; display: block; }
.mtitle.logo[aria-expanded="true"] svg { filter: invert(1); }
#clock { margin-left: auto; display: flex; align-items: center; padding: 0 4px; font-variant-numeric: tabular-nums; }
.menu {
  position: absolute; top: calc(var(--menu-h) + env(safe-area-inset-top, 0px)); min-width: 200px;
  background: var(--paper); border: 1px solid var(--ink); box-shadow: 1px 1px 0 var(--ink);
  padding: 1px 0; z-index: 9001;
}
.menu button, .menu a { display: flex; width: 100%; padding: 2px 16px 2px 18px; text-align: left; text-decoration: none; color: var(--ink); white-space: nowrap; position: relative; box-sizing: border-box; }
.menu button:not([disabled]):hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.menu button[disabled] { color: var(--dim); }
.menu .chk::before { content: "✓"; position: absolute; left: 5px; }
.menu .kb { margin-left: auto; padding-left: 24px; }
.menu hr { border: 0; border-top: 1px dotted var(--ink); margin: 2px 0; }

#desk { flex: 1; position: relative; background: var(--pattern); overflow: hidden; }

/* ---------- Symbole ---------- */
.icon {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 118px; padding: 2px 0; text-align: center;
}
.icon svg { width: 32px; height: 32px; display: block; shape-rendering: crispEdges; }
.icon .lbl {
  background: var(--paper); padding: 0 3px; max-width: 116px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 14px; line-height: 17px; overflow-wrap: break-word; hyphens: auto;
}
.icon.sel svg { filter: invert(1); }
.icon.sel .lbl { background: var(--ink); color: var(--paper); }
.icon.open svg { opacity: .55; }
#deskicons { position: absolute; top: 10px; right: var(--gut-r); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; align-items: center; }
#deskicons .spacer { flex: 1; }

/* ---------- Fenster ---------- */
.win {
  position: absolute; background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 1px 1px 0 var(--ink); display: flex; flex-direction: column; min-width: 200px; min-height: 120px;
}
.tb { flex: none; height: 23px; position: relative; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--ink); touch-action: none; }
.tb::before { content: ""; position: absolute; inset: 4px 1px 4px; background: repeating-linear-gradient(var(--ink) 0 1px, var(--paper) 1px 2px); }
.win:not(.active) .tb::before, .win:not(.active) .tb .box { visibility: hidden; }
.tb .ttl { position: relative; background: var(--paper); padding: 0 6px; max-width: calc(100% - 70px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.tb .box { position: absolute; top: 4px; width: 15px; height: 15px; background: var(--paper); border: 1px solid var(--ink); box-sizing: border-box; box-shadow: 0 0 0 1px var(--paper); }
.tb .box.close { left: 8px; }
.tb .box.zoom { right: 8px; }
.tb .box.zoom::after { content: ""; position: absolute; left: 0; top: 0; width: 6px; height: 6px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.tb .box:active { background: var(--ink); }
.info { flex: none; display: flex; justify-content: space-between; gap: 12px; padding: 2px 8px; border-bottom: 1px solid var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; }
.info::after { content: ""; }
.info + .rule { flex: none; height: 1px; border-bottom: 1px solid var(--ink); margin-top: 1px; }
.body { flex: 1; min-height: 0; overflow: auto; position: relative; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.grow { position: absolute; right: 0; bottom: 0; width: 15px; height: 15px; border-left: 1px solid var(--ink); border-top: 1px solid var(--ink); background: var(--paper); touch-action: none; }
.grow::before, .grow::after { content: ""; position: absolute; border: 1px solid var(--ink); background: var(--paper); }
.grow::before { left: 2px; top: 2px; width: 6px; height: 6px; }
.grow::after { left: 5px; top: 5px; width: 6px; height: 6px; }
.win.sheet .grow { display: none; }

/* klassische Rollbalken */
.body::-webkit-scrollbar { width: 16px; height: 16px; }
.body::-webkit-scrollbar-track { background: var(--pattern); border-left: 1px solid var(--ink); }
.body::-webkit-scrollbar-track:horizontal { border-left: 0; border-top: 1px solid var(--ink); }
.body::-webkit-scrollbar-thumb { background: var(--paper); border: 1px solid var(--ink); }
.body::-webkit-scrollbar-button:single-button { display: block; height: 16px; width: 16px; background: var(--paper) center / 9px 9px no-repeat; border-left: 1px solid var(--ink); }
.body::-webkit-scrollbar-button:single-button:vertical:decrement { border-bottom: 1px solid var(--ink); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath d='M4.5 1 L8.5 5 H6.5 V8.5 H2.5 V5 H.5 Z' fill='white' stroke='black'/%3E%3C/svg%3E"); }
.body::-webkit-scrollbar-button:single-button:vertical:increment { border-top: 1px solid var(--ink); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath d='M4.5 8 L8.5 4 H6.5 V.5 H2.5 V4 H.5 Z' fill='white' stroke='black'/%3E%3C/svg%3E"); }
.body::-webkit-scrollbar-button:single-button:horizontal { display: none; }
.body::-webkit-scrollbar-corner { background: var(--paper); }
@supports not selector(::-webkit-scrollbar) { .body { scrollbar-color: var(--ink) var(--paper); } }

/* Ordnerinhalt */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px 4px; padding: 12px 8px 24px; align-content: start; }
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 400; padding: 3px 8px; border-bottom: 1px solid var(--ink); position: sticky; top: 0; background: var(--paper); }
.list td { padding: 2px 8px; white-space: nowrap; }
.list td:first-child { white-space: normal; display: flex; align-items: center; gap: 6px; min-width: 0; }
.list td:first-child svg { width: 16px; height: 16px; flex: none; shape-rendering: crispEdges; }
.list tr.sel td { background: var(--ink); color: var(--paper); }
.list tr.sel svg { filter: invert(1); }
.list td.num { font-variant-numeric: tabular-nums; }

/* Textfenster */
.doc { padding: 18px clamp(14px, 4vw, 34px) 34px; font-family: var(--f-doc); font-size: 17px; line-height: 1.55; max-width: 66ch; user-select: text; -webkit-user-select: text; color: var(--ink); }
.doc h1 { font-family: var(--f-ui); font-weight: 600; font-size: 26px; line-height: 1.2; margin: 0 0 6px; text-wrap: balance; }
.doc .meta { font-family: var(--f-ui); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; border-bottom: 1px dotted var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.doc h2, .doc h3, .doc h4 { font-family: var(--f-ui); font-weight: 600; line-height: 1.25; margin: 1.4em 0 .4em; text-wrap: balance; }
.doc h2 { font-size: 20px; } .doc h3 { font-size: 18px; } .doc h4 { font-size: 17px; }
.doc p { margin: 0 0 .9em; }
.doc a { color: var(--ink); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.doc blockquote { margin: 1em 0; padding: 6px 12px; border-left: 3px solid var(--ink); }
.doc ul, .doc ol { padding-left: 1.4em; margin: 0 0 .9em; }
.doc img.dither { display: block; width: 400px; max-width: 100%; height: auto; image-rendering: pixelated; margin: 1em 0 .3em; border: 1px solid var(--ink); background: var(--paper); }
.doc .noimg { border: 1px solid var(--ink); background: var(--pattern); padding: 26px 8px; text-align: center; margin: 1em 0; }
.doc .noimg span { background: var(--paper); padding: 1px 6px; font-family: var(--f-ui); font-size: 14px; }
.doc figcaption { font-size: 14px; margin-bottom: 1em; }
.doc pre, .doc code { font-family: var(--f-doc); font-size: 16px; }
.doc pre { white-space: pre-wrap; border: 1px dotted var(--ink); padding: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 2px 14px; border: 1px solid var(--ink); border-radius: 7px; background: var(--paper); color: var(--ink); text-decoration: none; font-family: var(--f-ui); font-size: 15px; }
.btn:active, .btn:hover { background: var(--ink); color: var(--paper); }
.btn.def { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); border-radius: 7px; }
.doc .endnote { margin-top: 26px; padding-top: 12px; border-top: 1px dotted var(--ink); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-family: var(--f-ui); font-size: 14px; }

/* Über-Fenster */
.about { padding: 14px 16px 18px; display: grid; gap: 10px; font-size: 14px; }
.about .hd { display: flex; gap: 12px; align-items: center; }
.about .hd svg { width: 48px; height: 48px; shape-rendering: crispEdges; }
.about .bar { display: grid; grid-template-columns: minmax(0, 9em) 1fr 3.5em; gap: 8px; align-items: center; }
.about .bar i { display: block; height: 10px; border: 1px solid var(--ink); background: var(--paper); position: relative; }
.about .bar i b { position: absolute; inset: 0 auto 0 0; background: var(--pattern); border-right: 1px solid var(--ink); }
.about .bar span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.about .bar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Zoom-Rahmen beim Öffnen */
.zr { position: absolute; border: 1px dotted var(--ink); pointer-events: none; z-index: 8999; mix-blend-mode: difference; border-color: var(--paper); }

/* Start und Ausschalten */
#boot, #off { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; }
#boot { background: var(--pattern); }
#off { background: var(--ink); }
.dlg { background: var(--paper); border: 1px solid var(--ink); box-shadow: 0 0 0 1px var(--paper), 0 0 0 3px var(--ink), 2px 2px 0 3px var(--ink); padding: 18px 26px 16px; display: grid; justify-items: center; gap: 10px; text-align: center; max-width: min(320px, calc(100vw - 48px)); }
.dlg svg { width: 32px; height: 32px; shape-rendering: crispEdges; }
.dlg .big { font-size: 19px; font-weight: 600; }
.prog { width: 180px; max-width: 100%; height: 10px; border: 1px solid var(--ink); position: relative; }
.prog b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); }
.toast { position: absolute; z-index: 9500; left: 50%; top: 30%; transform: translateX(-50%); }

/* ---------- Schmale und flache Bildschirme ---------- */
@media (max-width: 520px) {
  .mtitle { padding: 0 7px; }
  .mtitle.hide-s { display: none; }
  .doc { font-size: 18px; }
}
@media (max-height: 460px) {
  #deskicons { gap: 4px; top: 6px; }
  #deskicons .icon .lbl { -webkit-line-clamp: 1; }
}
@media (prefers-reduced-motion: reduce) { .zr { display: none; } }

/* ---------- Live-Version: Bilder als gerastertes Canvas ---------- */
.doc canvas.dither { display: block; width: 400px; max-width: 100%; height: auto; image-rendering: pixelated; margin: 1em 0 .3em; border: 1px solid var(--ink); background: var(--pattern); }
.loading { padding: 18px 12px; font-size: 14px; }
#clock { cursor: default; }

/* ---------- Brille aufsetzen ---------- */
#screen.brille { zoom: 1.25; }
@supports not (zoom: 1) { #screen.brille { font-size: 125%; } }

/* ---------- VINCI läuft über den Schreibtisch ---------- */
#vinci { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: -90px; z-index: 9400; display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
#vinci svg { width: 56px; height: 56px; shape-rendering: crispEdges; animation: hop .32s steps(2) infinite; }
#vinci .say { background: var(--paper); border: 1px solid var(--ink); box-shadow: 1px 1px 0 var(--ink); padding: 4px 8px; font-size: 14px; white-space: nowrap; margin-bottom: 40px; opacity: 0; }
#vinci.talk .say { opacity: 1; }
#vinci.talk svg { animation: none; }
@keyframes hop { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { #vinci svg { animation: none; } }

/* ---------- Systemfehler ---------- */
.err { position: absolute; z-index: 9600; left: 50%; top: 28%; transform: translateX(-50%); text-align: left; justify-items: start; max-width: min(380px, calc(100vw - 48px)); }
.err .row { display: flex; gap: 14px; align-items: flex-start; }
.err .row svg { width: 40px; height: 40px; flex: none; }
.err .acts { justify-self: end; display: flex; gap: 10px; }
