/* Yongan — Oberfläche über dem Pixel-Canvas. Schrift „Press Start 2P“ fürs 8-Bit-Gefühl, Fallback Monospace. */
:root { --f: 3; --ink: #0d0d12; --bone: #f4f0e6; --gold: #f0d030; --rot: #d84a3a; --blau: #4a90d9; --gruen: #8ed07a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; background: var(--ink); color: var(--bone); font-family: 'Press Start 2P', 'Courier New', monospace; overflow: hidden; -webkit-user-select: none; user-select: none; touch-action: none; }
#buehne { position: relative; width: 100vw; height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center; }
#spielfeld { position: relative; line-height: 0; }
#c { image-rendering: pixelated; image-rendering: crisp-edges; background: #0d0d12; }
#fx { position: absolute; left: 0; top: 0; pointer-events: none; }
#laden { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--gold); }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; font-size: 8px; line-height: 1.5; }
#status { position: absolute; left: 10px; top: 8px; min-width: 120px; }
#status .zeile { display: flex; gap: 10px; margin-bottom: 3px; text-shadow: 1px 1px 0 var(--ink); }
#status #name { color: var(--bone); } #status #lv { color: var(--gold); } #status #yang { color: var(--gold); font-size: 7px; }
#punkte-hinweis { color: var(--gold); margin-top: 4px; animation: blink 1.2s steps(2) infinite; font-size: 7px; }
@keyframes blink { 50% { opacity: .3; } }
#ziel { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 160px; text-align: center; text-shadow: 1px 1px 0 var(--ink); }
#ziel .balken { height: 6px; margin-top: 3px; } #ziel .balken > div { background: var(--rot); }
#meldungen { position: absolute; left: 10px; bottom: 72px; width: 60%; text-shadow: 1px 1px 0 var(--ink); }
#meldungen div { margin-top: 2px; }
.balken { position: relative; height: 10px; background: rgba(13,13,18,.85); border: 1px solid #6a6a74; }
.balken > div { height: 100%; transition: width .15s; }
.balken span { position: absolute; left: 4px; top: 0; font-size: 7px; line-height: 10px; text-shadow: 1px 1px 0 var(--ink); }

/* Taskleiste unten — angelehnt an die Metin2-Leiste: TP/MP links, Fertigkeiten mittig, Knöpfe rechts, EXP als Streifen darunter */
#taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: auto;
  background: linear-gradient(#2a2a32, #151519 40%, #0d0d12); border-top: 2px solid #6a5a2a; box-shadow: inset 0 1px 0 #d4b040, 0 -6px 14px rgba(0,0,0,.5);
  display: grid; grid-template-columns: 190px 1fr 250px; grid-template-rows: 1fr 10px; gap: 0 8px; padding: 6px 10px 4px; box-sizing: border-box; }
.tb-links { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.tb-links .balken { height: 14px; border-color: #4a4a54; background: #0a0a0e; border-radius: 2px; box-shadow: inset 0 0 0 1px #000; }
.tb-links .balken .etikett { left: 4px; color: var(--bone); font-size: 7px; line-height: 14px; width: 16px; }
.tb-links .balken > div { position: absolute; left: 22px; right: 2px; top: 2px; bottom: 2px; height: auto; max-width: calc(100% - 24px); }
.tb-links .balken.tp > div { background: linear-gradient(#ff7a6a, #b8261a); } .tb-links .balken.mp > div { background: linear-gradient(#7ab8ff, #2a5cb8); }
.tb-links .balken span:last-child { left: auto; right: 6px; color: var(--bone); line-height: 14px; }
.tb-mitte { display: flex; align-items: center; justify-content: center; gap: 12px; }
#skills, #traenke { display: flex; gap: 5px; }
.slot { position: relative; width: 40px; height: 40px; border: 2px solid #6a5a2a; border-radius: 4px; background: radial-gradient(circle at 50% 35%, #2c2c38, #0d0d12 75%); box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #2a2412; overflow: hidden; }
.slot.gesperrt { opacity: .4; filter: grayscale(1); }
.slot.aktiv { border-color: var(--gold); box-shadow: 0 0 8px rgba(240,208,48,.7), inset 0 0 0 1px #000; }
.slot svg, .slot img { position: absolute; left: 4px; top: 3px; width: 30px; height: 30px; image-rendering: pixelated; }
.slot .taste { position: absolute; left: 2px; top: 1px; font-size: 6px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.slot .stufe { position: absolute; right: 2px; bottom: 1px; font-size: 6px; color: var(--bone); text-shadow: 1px 1px 0 #000; }
.slot .zahl { position: absolute; right: 2px; bottom: 1px; font-size: 7px; color: var(--bone); text-shadow: 1px 1px 0 #000; }
.slot .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.slot.rot { border-color: #7a2a20; } .slot.blau { border-color: #24407a; }
.tb-rechts { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.tb-rechts button { width: 56px; height: 40px; border: 2px solid #4a4a54; border-radius: 4px; background: linear-gradient(#2a2a32, #14141a); color: #dcd8d0; font-family: inherit; font-size: 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 0; }
.tb-rechts button svg { width: 18px; height: 18px; } .tb-rechts button:active { background: #3a3a44; }
.balken.exp { grid-column: 1 / -1; height: 10px; border-color: #4a4a54; background: #0a0a0e; margin-top: 2px; }
.balken.exp > div { position: absolute; left: 22px; right: 2px; top: 2px; bottom: 2px; height: auto; max-width: calc(100% - 24px); background: repeating-linear-gradient(90deg, #8ed07a 0 9px, #5fa64a 9px 10px); }
.balken.exp .etikett { left: 4px; color: var(--gold); width: 16px; line-height: 10px; font-size: 6px; }
.balken.exp span:last-child { left: auto; right: 6px; color: var(--bone); line-height: 10px; font-size: 6px; }
body.touch #taskbar { bottom: 120px; } body.touch #meldungen { bottom: 192px; }

/* Fenster */
#fenster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(13,13,18,.45); font-size: 9px; line-height: 1.6; }
.box { background: var(--ink); border: 2px solid var(--bone); padding: 10px 12px; min-width: 260px; max-width: 86vw; max-height: 84vh; box-shadow: 4px 4px 0 rgba(0,0,0,.6); }
.box b { display: block; color: var(--gold); margin-bottom: 6px; }
.box p { margin: 6px 0; } .box .hinweis { color: #a8a49c; font-size: 7px; margin-top: 8px; }
.box.dialog { position: absolute; left: 6%; right: 6%; bottom: 8%; min-width: 0; }
.box.tot { text-align: center; } .box.tot h2 { color: var(--rot); font-size: 12px; margin: 4px 0 8px; }
.box.liste .zeilen { max-height: 60vh; overflow-y: auto; }
.zeile { display: flex; justify-content: space-between; gap: 12px; padding: 3px 4px; cursor: pointer; }
.zeile.kopf { color: var(--gold); cursor: default; margin-top: 4px; }
.zeile.gewaehlt { background: var(--bone); color: var(--ink); }
.zeile.gewaehlt .info, .zeile.gewaehlt .preis { color: var(--ink); }
.zeile .info { color: #a8a49c; font-size: 7px; text-align: right; } .zeile .preis { color: var(--gold); } .zeile .preis.teuer { color: var(--rot); }
.zeile .wert { color: var(--gruen); } .zeile i { color: var(--gold); font-style: normal; }

/* Touch (Handy/Tablet). Stick links, wo der Daumen aufsetzt; rechts Schlag + Fertigkeiten im Bogen; Tränke; Systemknöpfe oben. */
#touch { display: none; position: absolute; inset: 0; pointer-events: none; }
body.touch #touch { display: block; }
#stick-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 46%; pointer-events: auto; touch-action: none; }
#stick { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: 28px; width: 112px; height: 112px; border-radius: 50%; background: rgba(244,240,230,.10); border: 2px solid rgba(244,240,230,.35); touch-action: none; transition: opacity .2s; }
#stick.aktiv { background: rgba(244,240,230,.16); border-color: rgba(244,240,230,.6); }
#stick-knopf { position: absolute; left: 32px; top: 32px; width: 44px; height: 44px; border-radius: 50%; background: rgba(244,240,230,.55); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
#knoepfe { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: 10px; width: 236px; height: 160px; pointer-events: auto; }
#knoepfe button, #oben-knoepfe button { position: absolute; border-radius: 50%; border: 2px solid rgba(244,240,230,.5); background: rgba(13,13,18,.62); color: var(--bone); font-family: inherit; font-size: 9px; touch-action: none; padding: 0; -webkit-tap-highlight-color: transparent; }
#knoepfe button.an, #oben-knoepfe button.an { background: rgba(244,240,230,.6); color: var(--ink); }
#knoepfe button.gross { right: 40px; bottom: 8px; width: 68px; height: 68px; background: rgba(240,208,48,.32); border-color: rgba(240,208,48,.8); font-size: 14px; }
#knoepfe button.skill { width: 46px; height: 46px; overflow: hidden; }
#knoepfe button.skill svg { position: absolute; left: 7px; top: 6px; width: 30px; height: 30px; }
#knoepfe button.skill .stufe { position: absolute; right: 4px; bottom: 3px; font-size: 5px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
#knoepfe button.skill.gesperrt { opacity: .35; filter: grayscale(1); }
#knoepfe button.skill.aktiv { border-color: var(--gold); box-shadow: 0 0 8px rgba(240,208,48,.7); }
#knoepfe button.skill .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 8px; color: var(--gold); text-shadow: 1px 1px 0 #000; border-radius: 50%; }
#knoepfe button[data-skill="1"] { right: 129px; bottom: 19px; }
#knoepfe button[data-skill="2"] { right: 119px; bottom: 58px; }
#knoepfe button[data-skill="3"] { right: 90px; bottom: 87px; }
#knoepfe button[data-skill="4"] { right: 51px; bottom: 97px; }
#knoepfe button[data-skill="5"] { right: 12px; bottom: 87px; }
#knoepfe button.trank { width: 40px; height: 40px; }
#knoepfe button.trank img { position: absolute; left: 6px; top: 4px; width: 24px; height: 24px; image-rendering: pixelated; }
#knoepfe button.trank .zahl { position: absolute; right: 3px; bottom: 2px; font-size: 6px; text-shadow: 1px 1px 0 #000; }
#knoepfe button.rot { right: 186px; bottom: 8px; border-color: var(--rot); } #knoepfe button.blau { right: 186px; bottom: 54px; border-color: var(--blau); }
#oben-knoepfe { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; }
#oben-knoepfe button { position: static; width: 34px; height: 34px; font-size: 6px; }
#oben-knoepfe button#tk-b { border-color: var(--rot); font-size: 9px; }
body.touch #meldungen { left: 50%; transform: translateX(-50%); width: 60%; text-align: center; bottom: 30px; }
/* Tablet (Touch, aber genug Höhe): Taskleiste bleibt, Stick und Knöpfe rutschen darüber */
body.touch:not(.klein) #knoepfe { bottom: 76px; } body.touch:not(.klein) #stick { bottom: 90px; }
body.touch:not(.klein) #meldungen { bottom: 74px; } body.touch:not(.klein) #oben-knoepfe { top: 8px; }
body.touch #taskbar { bottom: 0; }
body.touch #leiste { bottom: 130px; }
#status-balken { display: none; }
#drehen { display: none; }

/* Handy quer (kleine Höhe): Taskleiste weg, Mini-Balken oben links, alles kompakter */
body.klein #taskbar, body.klein #aufgaben { display: none; }
body.klein #status-balken { display: block; width: 110px; margin-top: 3px; }
#status-balken .balken { height: 6px; margin-bottom: 2px; border-color: #4a4a54; background: #0a0a0e; }
#status-balken .balken.tp > div { background: linear-gradient(#ff7a6a, #b8261a); } #status-balken .balken.mp > div { background: linear-gradient(#7ab8ff, #2a5cb8); }
#status-balken .balken.xp { height: 3px; } #status-balken .balken.xp > div { background: #8ed07a; }
body.klein #status { left: max(8px, env(safe-area-inset-left)); top: 6px; } body.klein #status #yang { font-size: 6px; }
body.klein #minimap-rahmen { width: 68px; right: max(8px, env(safe-area-inset-right)); top: 6px; } body.klein #minimap { width: 64px; height: 64px; } body.klein #minimap-ort { font-size: 5px; line-height: 9px; }
body.klein #ziel { top: 44px; width: 140px; font-size: 7px; } body.klein #boss { top: 62px; width: 180px; font-size: 7px; }
body.klein #meldungen { bottom: 4px; font-size: 6px; width: 44%; }
body.klein #punkte-hinweis { font-size: 6px; }
body.klein #fenster { font-size: 8px; }
body.klein .box { max-height: 94vh; max-width: 94vw; padding: 8px 10px; min-width: 200px; }
body.klein .box.liste .zeilen { max-height: 46vh; } body.klein .zeilen.raster { max-height: 44vh; }
body.klein .box b { margin-bottom: 3px; } body.klein .inv-kopf { margin: -2px 0 4px; } body.klein .tooltip { font-size: 6px; padding: 5px 6px; margin-top: 5px; min-height: 0; }
body.klein .tabs { margin: -2px 0 5px; }
/* Fenster offen: Stick und Kampfknöpfe ausblenden, nur das ✕ im Fenster und B oben rechts bleiben */
body.fenster-offen #stick-zone, body.fenster-offen #knoepfe, body.fenster-offen #oben-knoepfe button:not(#tk-b) { display: none; }
body.fenster-offen #oben-knoepfe { left: auto; right: max(10px, env(safe-area-inset-right)); transform: none; }
body.klein.fenster-offen #minimap-rahmen, body.klein.fenster-offen #status { display: none; }
body.klein .box.liste.inventar { min-width: 0; }
body.klein .zeile.zelle { width: 34px; height: 34px; } body.klein .zeile.zelle .ico { width: 26px; height: 26px; }
body.klein .box .hinweis { display: none; }
body.klein .box.dialog { left: 4%; right: 4%; bottom: 4%; }
.box .schliessen { display: none; position: absolute; right: 4px; top: 2px; width: 34px; height: 34px; line-height: 34px; text-align: center; color: var(--rot); font-size: 16px; pointer-events: auto; }
body.touch .box { position: relative; padding-right: 36px; } body.touch .box .schliessen { display: block; }
body.touch .box.dialog { position: absolute; }
@media (orientation: portrait) { body.touch #drehen { display: flex; position: absolute; inset: 0; z-index: 7; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--ink); font-size: 9px; color: #a8a49c; pointer-events: auto; } body.touch #drehen .titel { font-size: 26px; color: var(--gold); text-shadow: 3px 3px 0 #6a5a10; } }

/* Startbild: erster Tastendruck/Klick schaltet Vollbild und Ton frei (Browser verlangen dafür eine echte Eingabe) */
#start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(13,13,18,.78); z-index: 5; }
#start .titel { font-size: 34px; color: var(--gold); letter-spacing: 2px; text-shadow: 4px 4px 0 #6a5a10; }
#start .zeile { font-size: 9px; color: #a8a49c; } #start .los { font-size: 10px; margin-top: 18px; animation: blink 1.2s steps(2) infinite; }

/* Minimap oben rechts, große Karte als Overlay */
#minimap-rahmen { position: absolute; right: 10px; top: 8px; width: 100px; border: 2px solid var(--bone); background: var(--ink); padding: 0; line-height: 0; }
#minimap { display: block; width: 96px; height: 96px; image-rendering: pixelated; }
#minimap-ort { display: block; font-size: 7px; line-height: 12px; text-align: center; color: var(--gold); }
#grosse-karte { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(13,13,18,.8); z-index: 4; }
#karte-canvas { image-rendering: pixelated; border: 2px solid var(--bone); }
#grosse-karte .hinweis { font-size: 8px; color: #a8a49c; margin-top: 8px; }
body.touch #minimap-rahmen { top: 8px; right: 10px; }
#aufgaben { position: absolute; right: 10px; top: 124px; width: 100px; font-size: 6px; line-height: 1.6; text-align: right; text-shadow: 1px 1px 0 var(--ink); color: #dcd8d0; }
#aufgaben .fertig { color: var(--gold); }

/* Einstieg: Anmeldung, Server, Charaktere */
#bildschirme { position: absolute; inset: 0; z-index: 6; background: var(--ink); display: flex; align-items: center; justify-content: center; }
#bildschirme section { width: min(92vw, 560px); display: flex; flex-direction: column; gap: 12px; align-items: stretch; font-size: 9px; }
#bildschirme .titel { font-size: 30px; color: var(--gold); text-align: center; letter-spacing: 2px; text-shadow: 4px 4px 0 #6a5a10; margin-bottom: 6px; }
#bildschirme .titel.klein { font-size: 14px; }
#bildschirme .zeile { text-align: center; color: #a8a49c; font-size: 7px; }
#bildschirme label { display: flex; flex-direction: column; gap: 5px; color: #a8a49c; font-size: 8px; }
#bildschirme input { font-family: inherit; font-size: 11px; padding: 10px; background: #15151c; color: var(--bone); border: 2px solid #55555f; }
#bildschirme input:focus { outline: none; border-color: var(--gold); }
#bildschirme button { font-family: inherit; font-size: 9px; padding: 12px 10px; background: var(--gold); color: var(--ink); border: 0; box-shadow: 3px 3px 0 #8a7a1a; cursor: pointer; }
#bildschirme button:focus { outline: 3px solid var(--bone); outline-offset: 2px; }
#bildschirme button.leise { background: #22222c; color: var(--bone); box-shadow: 3px 3px 0 #0a0a0e; }
#bildschirme .knoepfe { display: flex; gap: 10px; } #bildschirme .knoepfe button { flex: 1; }
#bildschirme .knoepfe.unten { margin-top: 10px; }
#bildschirme .fehler { color: var(--rot); font-size: 8px; text-align: center; }
#bildschirme .karten { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
#bildschirme button.karte { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; background: #15151c; color: var(--bone); box-shadow: none; border: 2px solid #55555f; padding: 12px; min-height: 72px; }
#bildschirme button.karte b { color: var(--gold); font-size: 10px; } #bildschirme button.karte .info { color: #a8a49c; font-size: 7px; }
#bildschirme button.karte:focus, #bildschirme button.karte.gewaehlt { border-color: var(--gold); outline: none; }
#bildschirme .wahl { display: flex; gap: 8px; flex-wrap: wrap; font-size: 7px; }
#bildschirme .wahl span { padding: 6px 8px; border: 1px solid #55555f; } #bildschirme .wahl .an { border-color: var(--gold); color: var(--gold); } #bildschirme .wahl .aus { color: #6a6a74; }
#char-neu-form { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid #333; padding-top: 10px; }

/* Raster-Fenster (Inventar), Tooltips, Reiter */
.box.liste.inventar { min-width: 420px; }
.zeilen.raster { display: grid; gap: 3px; max-height: 58vh; }
.zeile.zelle { position: relative; width: 40px; height: 40px; padding: 0; border: 1px solid #3a3a44; background: #15151c; display: flex; align-items: center; justify-content: center; }
.zeile.zelle.kopf { border-color: transparent; background: transparent; }
.zeile.zelle.gewaehlt { border-color: var(--gold); background: #2a2612; color: var(--bone); }
.zeile.zelle .ico { width: 32px; height: 32px; image-rendering: pixelated; }
.zeile.zelle .zaehler { position: absolute; right: 2px; bottom: 1px; font-size: 6px; color: var(--gold); text-shadow: 1px 1px 0 var(--ink); }
.zeile.zelle .slotname { position: absolute; left: 2px; top: 2px; font-size: 5px; color: #6a6a74; }
.zeile .ico { width: 14px; height: 14px; image-rendering: pixelated; vertical-align: -3px; margin-right: 4px; }
.tooltip { margin-top: 8px; padding: 8px; border: 1px solid #3a3a44; background: #15151c; font-size: 7px; line-height: 1.6; min-height: 20px; display: grid; grid-template-columns: 36px 1fr; gap: 2px 8px; }
.tooltip .ico.gross { width: 32px; height: 32px; image-rendering: pixelated; grid-row: span 2; }
.tooltip b { color: var(--gold); display: block; font-size: 8px; } .tooltip .rot { color: var(--rot); } .tooltip .hinweis { grid-column: 2; color: #a8a49c; margin-top: 4px; }
.inv-kopf { display: flex; justify-content: space-between; font-size: 7px; color: #a8a49c; margin: -2px 0 8px; }
.tabs { display: flex; gap: 6px; margin: -2px 0 8px; font-size: 7px; }
.tabs span { padding: 4px 8px; border: 1px solid #3a3a44; color: #a8a49c; } .tabs span.an { border-color: var(--gold); color: var(--gold); }
#boss { position: absolute; left: 50%; top: 36px; transform: translateX(-50%); width: 240px; text-align: center; text-shadow: 1px 1px 0 var(--ink); color: #ff8a6a; }
#boss .balken { height: 8px; margin-top: 3px; border-color: #ff5a3a; } #boss .balken > div { background: linear-gradient(#ff7a6a, #b8261a); }
