@font-face { font-family: "Archivo"; src: url("fonts/archivo-100-900-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibmplexmono-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --schwarz: #0a0a0a; --flaeche: #111317; --flaeche2: #181b20; --linie: #24282e; --linie2: #30353c;
  --text: #f4f4f4; --leise: #9aa0a8; --leise2: #6c737c; --rot: #e8331f; --rot-weich: rgba(232,51,31,.14);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace; --rund: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--schwarz); color: var(--text); font-family: "Archivo", system-ui, sans-serif; font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1 { font-weight: 800; font-size: 1.75rem; margin: 0 0 .5rem; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-weight: 700; font-size: 1.1rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
h3 { font-weight: 600; font-size: .95rem; margin: 1.2rem 0 .4rem; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; }
p { margin: .3rem 0; }
.leise { color: var(--leise); }
.klein { font-size: .82rem; }
.fehler { color: var(--rot); }
.hinweis { color: #e6b35a; }
.mono { font-family: var(--mono); font-size: .85em; }
.akzent::before { content: ""; display: block; width: 28px; height: 2px; background: var(--rot); margin: 0 0 .9rem; }

/* ---------- Seitenrahmen ---------- */
.kopf { display: flex; align-items: center; gap: 1.6rem; padding: .9rem 1.6rem; border-bottom: 1px solid var(--linie); background: rgba(10,10,10,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.kopf-titel a { text-decoration: none; font-weight: 800; letter-spacing: .01em; display: inline-flex; align-items: center; gap: .55rem; }
.kopf-titel a::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rot); }
.kopf-nav { display: flex; gap: 1.3rem; align-items: center; margin-left: auto; font-size: .9rem; }
.kopf-nav a:not(.knopf) { text-decoration: none; color: var(--leise); padding-bottom: 2px; border-bottom: 1px solid transparent; }
.kopf-nav a:not(.knopf):hover { color: var(--text); border-bottom-color: var(--rot); }
.kopf-nutzer { color: var(--leise2); }
.kopf-logo { height: 24px; }
.inhalt { max-width: 1120px; margin: 0 auto; padding: 2.4rem 1.6rem 4rem; }
.fuss { color: var(--leise2); font-size: .78rem; text-align: center; padding: 1.4rem; border-top: 1px solid var(--linie); }

/* ---------- Karten und Formulare ---------- */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 1.4rem 1.5rem; }
.karte.inaktiv { opacity: .55; }
.anmeldung { max-width: 400px; margin: 4rem auto; padding: 1.8rem 1.9rem 1.6rem; }
.anmeldung h1::before { content: ""; display: block; width: 28px; height: 2px; background: var(--rot); margin: 0 0 .9rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.projekt { display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.projekt:hover { border-color: var(--linie2); transform: translateY(-1px); }
.projekt h2 { padding-left: .9rem; border-left: 2px solid var(--rot); }
.projekt .stand { font-family: var(--mono); font-size: .78rem; color: var(--leise); }
.projekt .knopf { margin-top: auto; align-self: flex-start; margin-top: 1rem; }
.kennzahl { font-family: var(--mono); font-size: .8rem; color: var(--leise); }
.kennzahl b { color: var(--text); font-weight: 400; }

label { display: block; margin: .75rem 0; font-size: .82rem; color: var(--leise); letter-spacing: .01em; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .62rem .75rem; background: var(--flaeche2); border: 1px solid var(--linie2); border-radius: 7px; color: var(--text); font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rot); box-shadow: 0 0 0 3px var(--rot-weich); }
textarea { font-family: var(--mono); font-size: .82rem; min-height: 8rem; }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 .45rem 0 0; accent-color: var(--rot); }
form.inline { display: inline; margin: 0; }
label.zeile { display: flex; gap: .5rem; align-items: flex-start; color: var(--leise); font-size: .82rem; line-height: 1.4; }
label.zeile input { margin-top: .15rem; flex: none; }
input[type=file] { padding: .4rem; }
.knopf { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.15rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, color .15s, border-color .15s; }
.knopf:hover { background: #fff; color: var(--schwarz); border-color: #fff; }
.knopf.klein { padding: .32rem .8rem; font-size: .8rem; }
.knopf.rot { border-color: var(--rot); color: #fff; }
.knopf.rot:hover { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.voll { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.voll:hover { background: #ff4a36; border-color: #ff4a36; }
.knopf:disabled { opacity: .45; cursor: default; }

table.liste { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .5rem 0 1.4rem; }
table.liste th, table.liste td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.liste th { color: var(--leise2); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.zeilenform { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.zeilenform input { width: auto; margin: 0; padding: .32rem .55rem; font-size: .85rem; }
.reiter { display: flex; gap: .3rem; margin: 0 0 1.6rem; flex-wrap: wrap; border-bottom: 1px solid var(--linie); }
.reiter a { padding: .5rem .9rem; text-decoration: none; color: var(--leise); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .9rem; }
.reiter a:hover { color: var(--text); }
.reiter a.aktiv { color: var(--text); border-bottom-color: var(--rot); }
.meldung { padding: .65rem .95rem; border-left: 2px solid var(--rot); background: var(--flaeche); margin: 0 0 1.3rem; border-radius: 0 7px 7px 0; }
details { margin: .6rem 0 1rem; }
summary { cursor: pointer; color: var(--leise); font-size: .88rem; }
summary:hover { color: var(--text); }

/* ---------- Betrachter ---------- */
body.welt { position: fixed; inset: 0; overflow: hidden; height: 100%; height: 100dvh; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }   /* fest verankert: kein Gummiband, kein 100vh-Versatz in Safari am iPhone */
#leinwand { display: block; width: 100%; height: 100%; }
.deck { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,10,10,.94); z-index: 20; }
.deck[hidden] { display: none; }
.deck-kasten { width: min(520px, 92vw); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 1.8rem 2rem 1.5rem; text-align: center; }
.deck-logo { height: 26px; margin-bottom: 1.1rem; }
.deck-kasten h1 { font-size: 1.5rem; }
.deck-kasten h2::before { content: ""; display: block; width: 28px; height: 2px; background: var(--rot); margin: 0 auto .8rem; }
.balken { height: 2px; background: var(--linie2); margin: 1.1rem 0; overflow: hidden; }
#laden-balken { height: 100%; width: 0; background: var(--rot); transition: width .2s; }
#laden-text { font-family: var(--mono); font-size: .8rem; color: var(--leise); }
#start { margin: .5rem 0 1.1rem; }
table.tasten { margin: .5rem auto 1.1rem; border-collapse: collapse; text-align: left; font-size: .9rem; }
table.tasten td { padding: .3rem .8rem; border-bottom: 1px solid var(--linie); }
table.tasten td:first-child { font-family: var(--mono); color: var(--rot); white-space: nowrap; font-size: .82rem; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-size: .84rem; }
#hud[hidden] { display: none; }
#hud > div { position: absolute; pointer-events: auto; }
.hud-oben-links { top: 14px; left: 18px; }
.hud-oben-rechts { top: 14px; right: 18px; display: flex; gap: .35rem; }
.hud-unten-links { bottom: 16px; left: 18px; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.hud-unten-rechts { bottom: 16px; right: 18px; }
.hud-titel { font-weight: 700; font-size: .98rem; text-shadow: 0 1px 3px rgba(0,0,0,.7); display: flex; align-items: center; gap: .5rem; }
.hud-titel::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rot); box-shadow: 0 0 0 3px rgba(232,51,31,.25); }
.hud-titel span { color: var(--leise); font-weight: 400; font-size: .85rem; }
.hud-werte { font-family: var(--mono); font-size: .78rem; color: var(--text); display: flex; gap: 1.1rem; margin-top: .2rem; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
#hud .knopf { background: rgba(10,10,10,.68); border-color: rgba(255,255,255,.35); font-weight: 500; backdrop-filter: blur(6px); }
#hud .knopf:hover { background: #fff; color: var(--schwarz); border-color: #fff; }
#hud select.knopf { width: auto; margin: 0; appearance: none; -webkit-appearance: none; padding-right: 1.7rem; background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
#hud select.knopf option { color: var(--schwarz); }

#teile { display: flex; flex-direction: column; gap: 1px; background: rgba(10,10,10,.78); backdrop-filter: blur(8px); border: 1px solid var(--linie2); border-radius: 10px; padding: .45rem .45rem; min-width: 300px; }
#teile[hidden] { display: none; }
.teil { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: .55rem; padding: .3rem .45rem; border-radius: 6px; }
.teil:hover { background: rgba(255,255,255,.05); }
.teil .punkt { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--leise2); background: transparent; cursor: pointer; padding: 0; justify-self: center; transition: background .15s, border-color .15s; }
.teil.an .punkt { background: var(--rot); border-color: var(--rot); box-shadow: 0 0 0 3px var(--rot-weich); }
.teil.ersetzt .punkt { border-style: dashed; cursor: default; }
.teil .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teil.ersetzt .name, .teil.aus .name { color: var(--leise2); }
.teil .mb { font-family: var(--mono); font-size: .72rem; color: var(--leise2); }
.teil .knopf.laden { padding: .18rem .6rem; font-size: .72rem; border-color: var(--rot); background: transparent; }
.teil .knopf.laden:hover { background: var(--rot); color: #fff; border-color: var(--rot); }
.teil .knopf.laden:disabled { border-color: var(--leise2); color: var(--leise); background: transparent; }
.teil-gruppe { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--leise2); padding: .45rem .45rem .15rem; }
.vermerk { font-size: .72rem; color: var(--leise); background: rgba(10,10,10,.6); padding: .22rem .65rem; border-radius: 999px; backdrop-filter: blur(6px); }
.hud-mitte { left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(10,10,10,.78); padding: .6rem 1.2rem; border-radius: 999px; border: 1px solid var(--linie2); font-size: .9rem; }
.hud-mitte[hidden] { display: none; }
@media (max-width: 700px) { .inhalt { padding: 1.2rem 1rem 3rem; } }

/* ---------- Touch und kleine Bildschirme ---------- */
#leinwand { touch-action: none; }
.nur-touch { display: none; }
body.touch .nur-touch { display: table; }
body.touch p.nur-touch { display: block; }
body.touch .nur-maus { display: none; }
#hud > #touch { position: fixed; inset: 0; pointer-events: none; z-index: 12; }   /* höhere Spezifität als „#hud > div“, sonst fängt das Overlay alle Finger ab */
#touch[hidden] { display: none; }
#stick { position: absolute; left: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.45); background: rgba(10,10,10,.45); pointer-events: auto; touch-action: none; backdrop-filter: blur(6px); }
#stick::before { content: ""; position: absolute; inset: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--rot); }
#stick-knopf { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.touch-rechts { position: absolute; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.t-knopf { width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.45); background: rgba(10,10,10,.5); color: #fff; font: inherit; font-size: 1.1rem; touch-action: none; backdrop-filter: blur(6px); -webkit-user-select: none; user-select: none; }
.t-knopf.t-text { font-size: .8rem; font-weight: 600; }
.t-knopf.aktiv { background: var(--rot); border-color: var(--rot); }
.t-knopf, #stick { -webkit-touch-callout: none; }
body.touch #hinweis-maus { display: none; }
body.touch .hud-unten-links { bottom: calc(160px + env(safe-area-inset-bottom)); }
body.touch .hud-unten-rechts { bottom: calc(210px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  .kopf { gap: .8rem; padding: .7rem 1rem; }
  .kopf-nutzer { display: none; }
  .kopf-nav { gap: .8rem; font-size: .85rem; }
  .hud-oben-links { top: calc(10px + env(safe-area-inset-top)); left: 12px; max-width: 48vw; }
  .hud-titel { font-size: .85rem; }
  .hud-titel span { display: none; }
  .hud-oben-rechts { top: calc(10px + env(safe-area-inset-top)); right: 12px; flex-wrap: wrap; justify-content: flex-end; max-width: 50vw; }
  #hud .knopf.klein { padding: .3rem .65rem; font-size: .75rem; }
  #teile { min-width: 0; width: calc(100vw - 24px); max-height: 46vh; overflow-y: auto; }
  .hud-unten-links { left: 12px; }
  .deck-kasten { padding: 1.3rem 1.2rem 1.1rem; }
  .hud-unten-rechts { display: none; }
}
