@font-face { font-family: Pixel; src: url(/schrift/PixelifySans.ttf) format("truetype"); font-weight: 400 700; font-display: swap; }
:root {
  --tief: #0b0a18; --nacht: #141433; --nacht2: #1f2150; --nacht3: #2d3170; --eis: #8fa8d8;
  --schnee: #e6edf8; --gold: #e6ac2e; --gold-hell: #ffe070; --rot: #d43a3a; --holz: #4a2a1c; --gruen: #58aa5c;
  --kopf: 44px; --leiste: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--tief); color: var(--schnee); font-family: Pixel, system-ui, sans-serif; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100dvh; max-width: 1400px; margin: 0 auto; }
#kopf { height: var(--kopf); flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: var(--nacht); border-bottom: 2px solid var(--nacht3); }
#kopf button { background: var(--nacht2); border: 2px solid var(--nacht3); border-radius: 4px; padding: 4px 8px; font-size: 16px; display: flex; gap: 6px; align-items: center; }
#kopf button span { font-size: 14px; }
#k-titel { flex: 1; text-align: center; color: var(--gold-hell); font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#spiel { flex: 1; display: flex; flex-direction: column; min-height: 0; align-items: center; }
#buehne { position: relative; flex: none; width: min(100vw, calc((100dvh - var(--kopf) - 150px) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; }
#bild { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; touch-action: manipulation; }
#etikett { position: absolute; pointer-events: none; transform: translate(-50%, -130%); background: rgba(11,10,24,.85); color: var(--gold-hell); padding: 2px 8px; border-radius: 3px; font-size: 15px; white-space: nowrap; }
#menue { position: absolute; display: flex; gap: 6px; transform: translate(-50%, -110%); z-index: 5; }
#menue button { background: var(--nacht); border: 2px solid var(--gold); border-radius: 4px; padding: 6px 10px; font-size: 16px; white-space: nowrap; box-shadow: 0 3px 0 var(--tief); }
#menue button:active { transform: translateY(2px); box-shadow: none; }
#b-zurueck { position: absolute; left: 6px; bottom: 6px; background: rgba(11,10,24,.85); border: 2px solid var(--eis); border-radius: 4px; padding: 4px 10px; font-size: 15px; }
#steuert { position: absolute; right: 6px; top: 6px; background: rgba(11,10,24,.75); border: 1px solid var(--nacht3); border-radius: 3px; padding: 1px 8px; font-size: 13px; color: var(--eis); pointer-events: none; }

#unten { width: min(100vw, max(100%, 640px)); max-width: 100%; flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 6px 8px; gap: 6px; overflow-y: auto; }
#dialog.wahl #d-text { max-height: none; }
#dialog { flex: none; }
@media (min-width: 700px) { #unten { width: min(100vw, calc((100dvh - var(--kopf) - 150px) * 16 / 9)); } }

#dialog { position: relative; display: flex; gap: 10px; align-items: flex-start; background: var(--nacht); border: 2px solid var(--gold); border-radius: 6px; padding: 8px 10px; min-height: 70px; cursor: pointer; }
#portrait { width: 64px; height: 64px; flex: none; image-rendering: pixelated; background: var(--nacht2); border: 2px solid var(--nacht3); border-radius: 4px; }
#portrait.leer { display: none; }
#d-text { flex: 1; font-size: 17px; line-height: 1.35; max-height: 9em; overflow-y: auto; }
#d-wer { display: block; color: var(--gold-hell); font-size: 15px; margin-bottom: 2px; }
#d-wer:empty { display: none; }
#d-weiter { position: absolute; right: 8px; bottom: 4px; color: var(--gold); animation: wippen 1s infinite; font-size: 13px; }
@keyframes wippen { 50% { transform: translateY(3px); } }
#d-wahl { position: absolute; inset: auto 8px 8px auto; }
#dialog.wahl #d-weiter { display: none; }
.wahl-liste { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.wahl-liste button { text-align: left; background: var(--nacht2); border: 2px solid var(--nacht3); border-radius: 4px; padding: 6px 10px; font-size: 16px; }
.wahl-liste button:hover { border-color: var(--gold); }

#leiste { display: flex; gap: 6px; align-items: center; }
#inventar { flex: 1; display: flex; gap: 6px; overflow-x: auto; min-height: var(--leiste); padding: 3px; background: var(--holz); border: 2px solid #6e3f24; border-radius: 6px; }
.ding { flex: none; width: 48px; height: 48px; background: #2a1712; border: 2px solid #6e3f24; border-radius: 4px; padding: 0; }
.ding canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.ding.gewaehlt { border-color: var(--gold-hell); background: #6e420e; }
#werkzeug { display: flex; gap: 6px; }
#werkzeug button { height: var(--leiste); min-width: 52px; background: var(--nacht2); border: 2px solid var(--nacht3); border-radius: 6px; font-size: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#werkzeug button span { font-size: 12px; margin-top: 3px; }
#status { min-height: 1.3em; color: var(--eis); font-size: 15px; text-align: center; }

.seite { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  background: radial-gradient(ellipse at top, #2d3170, #0b0a18 70%); }
.seite h1 { color: var(--gold-hell); font-size: 26px; margin: 8px 0 0; text-shadow: 2px 2px 0 var(--tief); }
.seite p { max-width: 640px; font-size: 17px; line-height: 1.4; margin: 0; }
button.gross { background: var(--rot); border: 2px solid #ff7f6a; border-radius: 6px; padding: 10px 20px; font-size: 18px; box-shadow: 0 4px 0 #4e0e1c; }
button.gross:active { transform: translateY(3px); box-shadow: 0 1px 0 #4e0e1c; }
.fehler { color: #ff7f6a; min-height: 1.4em; }
#anm-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#anm-code { font: inherit; font-size: 20px; padding: 8px 12px; width: 14ch; background: var(--nacht); color: var(--gold-hell); border: 2px solid var(--gold); border-radius: 6px; text-align: center; letter-spacing: 2px; }

#kal-tueren { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: min(100%, 720px); }
@media (max-width: 520px) { #kal-tueren { grid-template-columns: repeat(4, 1fr); } }
.tuer { aspect-ratio: 1; border-radius: 6px; border: 3px solid #6e3f24; background: linear-gradient(#94603a, #6e3f24); font-size: 26px; font-weight: 700; color: var(--gold-hell);
  text-shadow: 2px 2px 0 #2a1712; position: relative; box-shadow: inset 0 0 0 3px #4a2a1c, 0 4px 0 #2a1712; }
.tuer small { position: absolute; bottom: 4px; left: 0; right: 0; font-size: 12px; font-weight: 400; text-shadow: none; color: var(--schnee); }
.tuer.zu { filter: grayscale(.7) brightness(.6); cursor: not-allowed; }
.tuer.offen { animation: leuchten 1.6s infinite; }
.tuer.geschafft { background: linear-gradient(#e6ac2e, #b0721a); border-color: #ffe070; color: #fff; }
@keyframes leuchten { 50% { box-shadow: inset 0 0 0 3px #4a2a1c, 0 4px 0 #2a1712, 0 0 18px #ffe070; } }

#akte-karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; width: min(100%, 900px); }
.aktenkarte { text-align: left; background: #e6dcc0; color: #2a1712; border-radius: 4px; padding: 10px 12px; box-shadow: 3px 3px 0 #0b0a18; transform: rotate(-.6deg); }
.aktenkarte:nth-child(2n) { transform: rotate(.7deg); }
.aktenkarte b { display: block; color: #921a2a; font-size: 16px; margin-bottom: 4px; }
.aktenkarte small { color: #6e3f24; }
.aktenkarte.leer { background: rgba(230,220,192,.12); color: var(--eis); box-shadow: none; }

#karte, #schloss { position: fixed; inset: 0; background: rgba(11,10,24,.88); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.karte-inhalt { background: var(--nacht); border: 3px solid var(--gold); border-radius: 8px; padding: 18px 20px; max-width: 520px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.karte-inhalt h2 { margin: 0; color: var(--gold-hell); font-size: 24px; }
.karte-inhalt .unter { color: var(--eis); font-size: 15px; }
.karte-inhalt p { margin: 0; font-size: 17px; line-height: 1.4; }
.karte-inhalt .aktenkarte { transform: none; width: 100%; }

.schloss-inhalt { background: #3e3e54; border: 4px solid #8686a0; border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 560px; }
.schloss-inhalt h2 { margin: 0; color: var(--gold-hell); font-size: 20px; text-align: center; }
.schloss-inhalt .hinweis { color: var(--schnee); font-size: 15px; text-align: center; max-width: 440px; }
.raeder { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rad { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rad .sym { font-size: 14px; color: var(--eis); min-height: 1.2em; }
.rad button { width: 54px; height: 32px; background: #262636; border: 2px solid #5e5e78; border-radius: 4px; font-size: 16px; }
.rad .wert { width: 54px; height: 54px; background: #e6dcc0; color: #2a1712; border: 3px solid #262636; border-radius: 4px; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.schloss-knoepfe { display: flex; gap: 10px; }
.schloss-knoepfe button { background: #262636; border: 2px solid #8686a0; border-radius: 5px; padding: 8px 16px; font-size: 16px; }
.schloss-knoepfe button.ok { background: #2c7444; border-color: #58aa5c; }
.wackeln { animation: wackeln .4s; }
@keyframes wackeln { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

#quer { display: none; color: var(--eis); font-size: 14px; text-align: center; opacity: .8; }
@media (orientation: portrait) and (max-width: 700px) { #quer { display: block; } }
