/* Der begehbare Turm (tower.js): Halle, Unterbau, Ausrüstung. Ersetzt Basis und Tab-Leiste */
.tw-host { position: absolute; inset: 0; overflow: hidden; background: #0B0818; user-select: none; -webkit-user-select: none; }
.tw-cv { display: block; width: 100%; height: 100%; touch-action: none; }
.tw-hud { position: absolute; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.tw-hud > * { pointer-events: auto; }
.tw-hl { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tw-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 14px !important; background: var(--hud); color: var(--ink); box-shadow: var(--sh); font-size: 13px; font-weight: 800; }
.tw-pill small { font-weight: 700; color: var(--muted); font-size: 11px; }
.tw-hearts { color: #D9694E; letter-spacing: 1px; font-size: 13px; }
.tw-hearts i { color: var(--muted); opacity: .4; font-style: normal; }
.tw-mini { width: 104px; height: 104px; border-radius: 16px !important; background: var(--hud); box-shadow: var(--sh), inset 0 0 0 2px rgba(255,255,255,.5); cursor: pointer; }
/* Große Karte */
.tw-map { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: calc(16px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px)); background: rgba(11,8,24,0); transition: background .2s; }
.tw-map.on { background: rgba(11,8,24,.55); }
.tw-map-card { display: flex; flex-direction: column; width: 100%; max-width: 560px; height: 100%; max-height: 760px; border-radius: 22px !important; background: #F4ECDC; box-shadow: var(--sh); overflow: hidden; transform: scale(.94); opacity: 0; transition: transform .2s, opacity .2s; }
.tw-map.on .tw-map-card { transform: none; opacity: 1; }
.tw-map-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 12px 6px 16px; color: var(--ink); }
.tw-map-head b { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; }
.tw-map-head small { flex: 1; min-width: 0; color: var(--muted); font-weight: 700; font-size: 12px; }
.tw-map-z, .tw-map-x { width: 36px; height: 36px; border: 0; border-radius: 12px !important; background: rgba(0,0,0,.06); color: var(--ink); font-size: 16px; font-weight: 900; }
.tw-map canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; cursor: pointer; }
.tw-back { position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); min-height: 40px; padding: 0 16px; border: 0; border-radius: 14px !important; background: var(--hud); color: var(--ink); font-weight: 800; box-shadow: var(--sh); }
.tw-bottom { position: absolute; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.tw-hint { margin: 0; padding: 7px 13px; border-radius: 14px !important; background: var(--hud); color: var(--ink); box-shadow: var(--sh); font-size: 12.5px; font-weight: 700; text-align: center; max-width: 100%; }
.tw-hint small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.tw-act { pointer-events: auto; min-height: 50px; min-width: 190px; padding: 0 22px; border: 0; border-radius: 18px !important; background: var(--mint); color: #10302E; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 17px; box-shadow: var(--sh); }
.tw-toast { position: absolute; left: 50%; bottom: calc(132px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: max-content; max-width: 330px; padding: 9px 14px; border-radius: 14px !important; background: var(--hud); color: var(--ink); box-shadow: var(--sh); font-size: 13px; font-weight: 700; text-align: center; transition: opacity .3s; pointer-events: none; }
.tw-fade { position: absolute; inset: 0; background: #0B0818; opacity: 0; pointer-events: none; transition: opacity .25s; }
.tw-host [hidden] { display: none !important; }
/* Alte Menüs, solange ein Ort noch nicht umgebaut ist: ohne Tab-Leiste, mit Weg zurück in die Halle */
.mode[data-mode="menu"] .tabs { display: none !important; }
.tw-tohall { pointer-events: auto; flex: none; min-height: 38px; padding: 0 12px; margin-right: 8px; border: 0; border-radius: 12px; background: var(--hud); color: var(--ink); font-weight: 800; font-size: 13px; box-shadow: var(--sh); }
.menu-head { align-items: center; }
.tw-dna { display: inline-block; width: 11px; height: 11px; border-radius: 50% 0; background: #5FA05A; transform: rotate(45deg); }
/* Blatt am Gegenstand: echter Inhalt liegt auf Buch, Radio oder Bauplan und zoomt mit */
.tw-sheet { position: absolute; z-index: 1; overflow: hidden; border-radius: 10px !important; background: var(--page); color: var(--ink); box-shadow: 0 6px 24px rgba(0,0,0,.3); transition: opacity .15s; }
.tw-sheet > section.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.tw-sheet canvas.scene, .tw-sheet .scene-box { display: none !important; }
.tw-sheet .mpage { padding-top: 12px; }
.tw-sheet.book { background: linear-gradient(90deg, var(--page) 0 48%, rgba(0,0,0,.07) 50%, var(--page) 52% 100%); }
.tw-sheet.book > section.view { inset: 4px 6px; }
.tw-sheet.radio { background: var(--surface); }
.tw-sheet.blue { background: var(--page); }
.tw-sheet.blue .ws { padding-bottom: 8px !important; height: 100%; }
.tw-lexq { position: absolute; z-index: 2; border: 0; border-radius: 6px !important; background: #ECE5D8; color: #2E3A35; padding: 0 8px; font: 700 12px Nunito, sans-serif; outline: none; }
/* Nahansicht: Zurück oben links, die Währung bleibt daneben sichtbar */
.tw-host.tw-focus .tw-hl { margin-left: 104px; }
.tw-host.tw-focus .tw-floor { display: none; }
.tw-funk, .tw-sieg { display: inline-block; width: 11px; height: 11px; margin-left: 4px; }
.tw-funk { background: #F59A3A; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.tw-sieg { border-radius: 50%; background: #C9533F; box-shadow: inset 0 0 0 3px #E07A5F; }
/* Mal-Raster auf dem Bauplan */
.tw-ed { position: absolute; z-index: 1; }
.tw-ed .ed-wrap { width: 100% !important; height: 100% !important; margin: 0 !important; max-width: none !important; aspect-ratio: auto !important; }
.tw-ed .ed-wrap { padding: 6px !important; overflow: hidden; border-radius: 10px !important; }
.tw-ed #wsscene { display: none !important; }
.look-daemmer .tw-map-card { background: #1E1838; }

/* ---------- Geschichte (story.js) ---------- */
.st-ov { position: fixed; inset: 0; z-index: 9000; background: rgba(14, 11, 26, .94); display: flex; align-items: center; justify-content: center; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); -webkit-user-select: none; user-select: none; }
.st-ov[hidden] { display: none; }
.st-box { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.st-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #CFC6E8; font: 800 12px Nunito, sans-serif; }
.st-akt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-ov button { font: 800 13px Nunito, sans-serif; border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.st-skipall, .st-skip { background: rgba(255, 255, 255, .1); color: #CFC6E8; }
.st-skip[hidden] { display: none; }
.st-next { background: #7FE0C8; color: #1C2A26; min-width: 110px; }
.st-cv { width: 100%; aspect-ratio: 3 / 2; border-radius: 16px; display: block; background: #1C1730; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); cursor: pointer; }
.st-card { display: flex; gap: 12px; align-items: flex-start; background: #FBF7EF; color: #2E3A35; border-radius: 16px; padding: 12px 14px; min-height: 92px; cursor: pointer; }
.st-card.narr { background: #2E2843; color: #F1ECFA; }
.st-por { width: 56px; height: 56px; flex: none; }
.st-por[hidden] { display: none; }
.st-txt { flex: 1; min-width: 0; }
.st-who { display: block; font: 600 16px Fredoka, sans-serif; margin-bottom: 2px; color: #3E9C80; }
.st-say { margin: 0; font: 700 15.5px/1.45 Nunito, sans-serif; min-height: 3em; }
.st-card.narr .st-say { font-style: italic; font-weight: 600; }
.st-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-pg { color: #8F86AA; font: 800 12px Nunito, sans-serif; text-align: center; flex: 1; }
.st-intro { position: absolute; inset: 0; background: #2E2843; color: #F1ECFA; border-radius: 18px; padding: 22px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; justify-content: center; }
.st-intro[hidden] { display: none; }
.st-intro h3 { font: 600 22px Fredoka, sans-serif; margin: 0; }
.st-intro p { margin: 0; font: 700 15px/1.45 Nunito, sans-serif; color: #D8D0EE; }
.st-intro small { color: #8F86AA; font: 700 12px Nunito, sans-serif; }
.st-icv { width: 120px; height: 100px; }
.st-go { background: #7FE0C8; color: #1C2A26; width: 100%; max-width: 280px; }
.st-later { background: rgba(255, 255, 255, .1); color: #F1ECFA; width: 100%; max-width: 280px; }
/* Übergang Tor → Run und zurück (tower.js: warpIn, warpOut) */
.tw-host .tw-hud, .tw-host .tw-back, .tw-host .tw-bottom, .tw-host .tw-toast { transition: opacity .3s; }
.tw-host.tw-diving .tw-hud, .tw-host.tw-diving .tw-back, .tw-host.tw-diving .tw-bottom, .tw-host.tw-diving .tw-toast { opacity: 0 !important; pointer-events: none; }
.pxl-warp { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
.pxl-warp.on { pointer-events: auto; }
.pxl-warp.out, .pxl-warp.fade { pointer-events: none; }
.pxl-warp-c { position: absolute; inset: 0; }
.pxl-warp.fade { opacity: 0; transition: opacity .5s ease; }
.pxl-warp-t { position: absolute; left: 16px; right: 16px; top: 38%; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #2E2A22; text-align: center; opacity: 0; transform: translateY(10px) scale(.96); transition: opacity .35s ease, transform .5s cubic-bezier(.2,.8,.2,1); }
.pxl-warp.on .pxl-warp-t { opacity: 1; transform: none; }
.pxl-warp.out .pxl-warp-t { opacity: 0; transform: translateY(-14px) scale(1.04); transition: opacity .45s ease, transform .6s ease; }
.pxl-warp.noT .pxl-warp-t { display: none; }
.pxl-warp-t span { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.pxl-warp-t b { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 30px; line-height: 1.1; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
/* Run-Ansicht kommt herein: oben die Anzeige von oben, unten das Blatt von unten */
@keyframes runInTop { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes runInSheet { from { transform: translateY(70%); } to { transform: none; } }
.mode.run-in .hud, .mode.run-in .wavebar { animation: runInTop .6s .35s cubic-bezier(.2,.8,.2,1) both; }
.mode.run-in .sheet { animation: runInSheet .7s .2s cubic-bezier(.2,.8,.2,1) both; }
@media (prefers-reduced-motion: reduce) { .mode.run-in .hud, .mode.run-in .wavebar, .mode.run-in .sheet { animation: none; } }
/* Upgrade-Blatt im Run im Stil der Halle: Holzleiste oben wie am Bautisch, Papier darunter, Reiter wie an der Pinnwand,
   Upgrades als Zettel. Einklappen bleibt sofort (die Feldgröße darf sich nicht in vielen Schritten ändern), der Inhalt gleitet herein */
:root { --wd: #C2925C; --wd2: #A87A48; --wdl: #E2BE8C; --pp: #FBF7EF; --pp2: #F2E9D8; --pp-line: rgba(120,90,60,.10); --note-sh: 0 1px 0 rgba(120,90,60,.18), 0 3px 8px rgba(120,90,60,.13); --tab: #E8D6B6; --tab-ink: #6E5236; }
:root.look-daemmer { --wd: #5A4470; --wd2: #46355A; --wdl: #7A6292; --pp: #2B2348; --pp2: #241D3E; --pp-line: rgba(201,190,240,.07); --note-sh: 0 0 0 1px rgba(201,190,240,.14), 0 4px 10px rgba(8,5,18,.35); --tab: #3A3060; --tab-ink: #C2B8DE; }
.mode[data-mode="run"] .sheet { background: repeating-linear-gradient(180deg, transparent 0 27px, var(--pp-line) 27px 28px), linear-gradient(var(--pp), var(--pp2)) !important; border-top: 9px solid var(--wd) !important; box-shadow: inset 0 2px 0 rgba(0,0,0,.08), 0 -2px 0 var(--wd2), 0 -10px 24px rgba(30,20,10,.22) !important; }
.mode[data-mode="run"] .sheet::before { content: ''; position: absolute; left: 50%; top: -15px; width: 64px; height: 10px; margin-left: -32px; border-radius: 6px 6px 3px 3px !important; background: var(--wd2); box-shadow: inset 0 2px 0 rgba(255,255,255,.18); pointer-events: none; }
.mode[data-mode="run"] .stats b { font-family: 'Fredoka', sans-serif; }
.mode[data-mode="run"] .hpbar { height: 8px; background: var(--tab); box-shadow: inset 0 1px 2px rgba(0,0,0,.18); }
.mode[data-mode="run"] .hpbar i { background: linear-gradient(180deg, #67C9A6, var(--mint)) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.mode[data-mode="run"] #shoptog { background: var(--tab); color: var(--tab-ink); box-shadow: var(--note-sh); }
.mode[data-mode="run"] .uptabs { gap: 4px; }
.mode[data-mode="run"] .uptabs button { height: 34px; padding: 0 16px; background: var(--tab); color: var(--tab-ink); font-family: 'Fredoka', sans-serif; font-weight: 600; border-radius: 10px 10px 4px 4px !important; box-shadow: inset 0 -2px 0 rgba(0,0,0,.08); transition: transform .15s, background .15s; }
.mode[data-mode="run"] .uptabs button.on { background: var(--wd); color: #FFF8EA; transform: translateY(-2px); box-shadow: 0 2px 0 var(--wd2); }
.mode[data-mode="run"] #ups button.up { background: #FFFDF8; box-shadow: var(--note-sh); transition: transform .12s; }
:root.look-daemmer .mode[data-mode="run"] #ups button.up { background: #352C56; }
.mode[data-mode="run"] #ups button.up:nth-child(4n+1) { transform: rotate(-.5deg); }
.mode[data-mode="run"] #ups button.up:nth-child(4n+2) { transform: rotate(.4deg); }
.mode[data-mode="run"] #ups button.up:nth-child(4n+3) { transform: rotate(.35deg); }
.mode[data-mode="run"] #ups button.up:nth-child(4n) { transform: rotate(-.3deg); }
.mode[data-mode="run"] #ups button.up:not(:disabled):active { transform: scale(.97); }
.mode[data-mode="run"] #ups button.up:disabled { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); border: 0; }
.mode[data-mode="run"] #ups button.up:disabled { background-image: repeating-linear-gradient(135deg, transparent 0 7px, var(--pp-line) 7px 8px); }
@keyframes upIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
.mode[data-mode="run"]:not(.shop-min) .uptabs, .mode[data-mode="run"]:not(.shop-min) #ups { animation: upIn .28s cubic-bezier(.2,.8,.2,1) both; }
.mode[data-mode="run"]:not(.shop-min) #ups { animation-delay: .05s; }
@media (prefers-reduced-motion: reduce) { .mode[data-mode="run"] .uptabs, .mode[data-mode="run"] #ups { animation: none !important; } }

/* v1.28: Kristallgrund (mine.js) – eigene Ebene über dem Turm */
.mn-wrap { position: absolute; inset: 0; z-index: 30; background: #0B0818; overflow: hidden; }
.mn-wrap .tw-hud > * { pointer-events: auto; }
.mn-wrap .mn-r { align-items: flex-end; }
.mn-wrap .tw-pill .gem { display: inline-block; width: 10px; height: 10px; background: var(--mint); transform: rotate(45deg) scale(.9); border-radius: 2px; }
.mn-up { border: 0; cursor: pointer; font: inherit; font-weight: 800; }
.mn-bag { display: inline-flex; gap: 2px; flex-wrap: wrap; max-width: 140px; }
.mn-bag i { width: 9px; height: 9px; border-radius: 3px; background: rgba(120,120,120,.25); }
.mn-bag i.roh { background: #9A8E7C; } .mn-bag i.klar { background: #8FD3F0; } .mn-bag i.fac { background: #4FA8D6; } .mn-bag i.masse { background: #E98B4A; } .mn-bag i.kri { background: var(--mint); }
.mn-meter { width: 52px; height: 7px; border-radius: 4px; background: rgba(120,120,120,.25); overflow: hidden; display: inline-block; }
.mn-meter i { display: block; height: 100%; background: var(--mint); }
.mn-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.mn-acts button { min-height: 46px; padding: 0 16px; border: 0; border-radius: 16px !important; background: var(--mint); color: #10302E; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 15.5px; box-shadow: var(--sh); cursor: pointer; }
.mn-acts button.alt { background: var(--hud); color: var(--ink); }
.mn-acts button:disabled { opacity: .45; }
.mn-wrap .tw-toast { bottom: auto; top: calc(96px + env(safe-area-inset-top, 0px)); }
.mn-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 74%; overflow: auto; background: var(--surface, #F6F2EA); color: var(--ink); border-radius: 24px 24px 0 0 !important; box-shadow: 0 -8px 30px rgba(0,0,0,.25); padding: 16px 14px calc(20px + env(safe-area-inset-bottom, 0px)); }
.mn-sheet h3 { margin: 0; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; }
.mn-sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.mn-x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border: 0; border-radius: 12px !important; background: var(--hud); color: var(--ink); font-weight: 800; box-shadow: var(--sh); }
.mn-card { background: var(--hud); border-radius: 16px !important; box-shadow: var(--sh); overflow: hidden; }
.mn-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid rgba(120,120,120,.15); }
.mn-row:first-child { border-top: 0; }
.mn-row div { flex: 1; min-width: 0; }
.mn-row b { display: block; font-size: 14px; }
.mn-row span { display: block; font-size: 12px; color: var(--muted); }
.mn-row span.mn-cost { color: var(--ink); font-weight: 700; }
.mn-row button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 12px !important; background: var(--mint); color: #10302E; font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.mn-row button:disabled { opacity: .45; }
.mn-done { font-size: 12px; font-weight: 800; color: var(--mint); }
.mn-pay { margin: 8px 2px 0; font-size: 11.5px; color: var(--muted); }
