:root {
  --bg: #0b0910; --panel: #17141f; --panel2: #221d2d; --line: #3a3248; --txt: #f3eee6; --muted: #a99fb5;
  --acc: #ffcf3a; --acc2: #ff7a2f; --good: #5cff7a; --bad: #ff5a5a; --blue: #4dc3ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.gold { color: var(--acc); }
.up { color: var(--good); } .dn { color: var(--bad); }
a { color: var(--acc); }
.nowrap { white-space: nowrap; }

/* Buttons */
.btn { font: inherit; font-weight: 600; color: var(--txt); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; transition: transform .08s, background .15s; }
.btn:hover:not(:disabled) { background: #2e2740; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #ffd85a, #f0a92a); color: #2a1a05; border-color: #ffdf7a; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe27a, #ffb93a); }
.btn.big { padding: 12px 18px; font-size: 1.05em; }
.btn.small { padding: 5px 9px; font-size: 0.85em; border-radius: 8px; margin: 1px; }
.ib { font-size: 18px; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(20,16,28,.8); color: #fff; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.field { display: block; margin: 10px 0; font-size: .9em; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 1.05em; color: var(--txt); background: #0f0c15; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; user-select: text; }

/* Menue */
.screen, .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; overflow: auto; }
.overlay { background: rgba(5,3,10,.72); z-index: 40; }
#s-menu { background: radial-gradient(ellipse at 50% 30%, rgba(10,8,16,.35), rgba(10,8,16,.85)); }
.menu-card { width: min(460px, 100%); background: rgba(23,20,31,.94); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-height: 100%; overflow: auto; }
.logo { font-size: clamp(34px, 9vw, 52px); margin: 0; letter-spacing: 2px; font-weight: 900; line-height: 1; }
.logo span { color: var(--acc); text-shadow: 0 0 24px rgba(255,180,40,.5); }
.tag { color: var(--muted); margin: 8px 0 14px; }
.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; font: inherit; font-size: 1.15em; letter-spacing: 4px; text-transform: uppercase; text-align: center; color: var(--txt); background: #0f0c15; border: 1px solid var(--line); border-radius: 10px; padding: 9px; user-select: text; }
.err { color: #ffb0a0; background: rgba(255,60,40,.12); border: 1px solid rgba(255,90,60,.35); padding: 8px 10px; border-radius: 10px; }
.cols { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.sw.on { border-color: #fff; transform: scale(1.12); }
.help { margin-top: 12px; }
.help summary { cursor: pointer; color: var(--acc); font-weight: 600; }
.helpbody ul, #panel-body ul { padding-left: 18px; margin: 8px 0; line-height: 1.45; }
.helpbody li, #panel-body li { margin-bottom: 6px; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--acc); border-radius: 50%; margin: 16px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.code { font-family: ui-monospace, monospace; letter-spacing: 3px; color: var(--acc); font-size: 1.2em; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud .slot { pointer-events: auto; }
.hud-tl { position: absolute; left: max(10px, env(safe-area-inset-left)); top: 10px; width: min(230px, 42vw); display: flex; flex-direction: column; gap: 5px; }
.bar { position: relative; height: 20px; background: rgba(10,8,14,.78); border: 1px solid rgba(255,255,255,.15); border-radius: 7px; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f0a92a, #ffd85a); transition: width .15s; }
.bar.hull .fill { background: linear-gradient(90deg, #2fa86a, #5cff7a); }
.bar.heat .fill { background: linear-gradient(90deg, #ff9a2a, #ff3a2a); }
.bar span { position: relative; display: block; font-size: 12px; font-weight: 700; padding-left: 7px; line-height: 18px; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.bar.warn { animation: blink .6s infinite alternate; border-color: #ff5a5a; }
@keyframes blink { to { box-shadow: 0 0 12px rgba(255,60,60,.8); } }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(10,8,14,.8); border: 1px solid rgba(255,255,255,.15); white-space: nowrap; }
.chip.warn { color: #ff8a8a; border-color: #ff5a5a; }
.cds { font-size: 11px; color: var(--muted); text-shadow: 0 1px 2px #000; }
.hud-tc { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); text-align: center; width: min(460px, 46vw); }
#depth-t { font-weight: 800; font-size: 15px; text-shadow: 0 2px 4px #000; background: rgba(10,8,14,.55); border-radius: 10px; padding: 3px 10px; display: inline-block; }
#ticker { margin-top: 5px; font-size: 12px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; text-shadow: 0 1px 2px #000; }
#ticker .ev { font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(10,8,14,.7); }
#bossbar { margin: 8px auto 0; width: min(360px, 90%); background: rgba(10,8,14,.85); border: 1px solid #ff5a3a; border-radius: 8px; height: 22px; position: relative; overflow: hidden; }
#bossbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #a01a3a, #ff5a2a); }
#bossbar span { position: relative; z-index: 1; font-weight: 800; font-size: 12px; line-height: 22px; }
.hud-tr { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hud-tr .btns { flex-direction: row; margin: 0; gap: 5px; align-items: center; }
#mini { width: 128px; height: 180px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; background: #08070c; image-rendering: pixelated; opacity: .92; pointer-events: auto; }
#prompt { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); font: inherit; font-weight: 800; font-size: 15px; color: #1a1205; background: linear-gradient(180deg, #ffe27a, #f5b52f); border: 0; border-radius: 999px; padding: 10px 20px; box-shadow: 0 6px 20px rgba(0,0,0,.5); cursor: pointer; animation: pop .25s; white-space: nowrap; }
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }
#hotbar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; }
.slot { position: relative; width: 50px; height: 50px; border-radius: 12px; background: rgba(15,12,22,.85); border: 1px solid rgba(255,255,255,.2); color: #fff; font: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.slot span { font-size: 24px; }
.slot i { position: absolute; left: 4px; top: 2px; font-size: 10px; font-style: normal; color: var(--muted); }
.slot b { position: absolute; right: 4px; bottom: 2px; font-size: 12px; }
.slot.empty { opacity: .45; }
#banner { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); background: rgba(20,10,10,.88); border: 1px solid #ff7a4a; color: #ffd8c8; font-weight: 800; padding: 12px 18px; border-radius: 14px; text-align: center; max-width: 88vw; font-size: 15px; }
#emerg { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); width: min(520px, 92vw); background: rgba(30,10,14,.94); border: 2px solid #ff4a4a; border-radius: 16px; padding: 14px 16px; pointer-events: auto; font-size: 14px; line-height: 1.4; box-shadow: 0 10px 40px rgba(255,0,0,.25); }
#emerg .row { margin-bottom: 0; }
#toasts { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 30; pointer-events: none; width: min(560px, 94vw); }
.toast { background: rgba(14,11,20,.9); border: 1px solid var(--line); padding: 8px 14px; border-radius: 12px; font-size: 14px; text-align: center; transition: opacity .5s, transform .5s; animation: tin .25s; }
.toast.big { border-color: var(--acc); font-weight: 700; font-size: 15px; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* Touch */
#touch { display: none; }
body.touch #touch:not(.hidden) { display: block; }
.pad { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); width: 168px; height: 168px; z-index: 11; }
.pad .k, .acts .a { position: absolute; width: 58px; height: 58px; border-radius: 16px; background: rgba(20,16,30,.55); border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 22px; touch-action: none; }
.pad .k.on, .acts .a:active { background: rgba(255,200,60,.5); }
.pad .up { left: 55px; top: 0; } .pad .down { left: 55px; bottom: 0; } .pad .left { left: 0; top: 55px; } .pad .right { right: 0; top: 55px; }
.acts { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 140px; height: 140px; z-index: 11; }
.acts .a { width: 60px; height: 60px; border-radius: 50%; font-size: 22px; }
.acts .use { right: 0; bottom: 0; background: rgba(255,200,60,.45); font-weight: 900; }
.acts #a-sonar { right: 70px; bottom: 0; } .acts #a-shock { right: 0; bottom: 70px; } .acts .a:last-child { right: 70px; bottom: 70px; }
.acts .a[data-cd]:not([data-cd=""])::after { content: attr(data-cd); position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; }
body.touch #hotbar { bottom: 190px; left: auto; right: max(14px, env(safe-area-inset-right)); transform: none; flex-direction: column; }
body.touch #hotbar .slot { width: 46px; height: 46px; }
body.touch #prompt { bottom: 24px; }
body.touch .cds { display: none; }

/* Fenster */
#panel-wrap { position: absolute; inset: 0; z-index: 35; background: rgba(5,3,10,.6); display: flex; align-items: center; justify-content: center; padding: 12px; }
.panel { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.panel header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel header h2 { margin: 0; flex: 1; font-size: 1.25em; }
#panel-body { padding: 12px 16px 18px; overflow: auto; -webkit-overflow-scrolling: touch; user-select: text; }
#panel-body h3 { margin: 16px 0 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card.wide { margin-bottom: 8px; }
.card.done { border-color: rgba(92,255,122,.4); }
.card-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .btn { margin-top: 4px; }
.dots { display: flex; gap: 3px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: #3a3248; display: inline-block; } .dots i.on { background: var(--acc); }
.maxed { color: var(--good); font-weight: 700; }
.pbar { height: 10px; background: #0f0c15; border-radius: 6px; overflow: hidden; margin: 4px 0 8px; border: 1px solid var(--line); }
.pbar div { height: 100%; background: linear-gradient(90deg, #f0a92a, #ffd85a); }
.pbar.hull div { background: linear-gradient(90deg, #2fa86a, #5cff7a); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px; }
.tbl td { padding: 5px 4px; border-top: 1px solid rgba(255,255,255,.06); vertical-align: middle; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid rgba(255,255,255,.3); }
.spark { width: 60px; height: 20px; }
.evbox { padding: 8px 12px; border-radius: 10px; background: rgba(255,200,60,.1); border: 1px solid rgba(255,200,60,.35); margin: 8px 0; }
.evbox.up { background: rgba(92,255,122,.08); border-color: rgba(92,255,122,.35); color: var(--txt); }
.evbox.dn { background: rgba(255,90,90,.08); border-color: rgba(255,90,90,.35); color: var(--txt); }
.museum { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0; }
.art { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.art.got { border-color: rgba(255,200,60,.45); background: linear-gradient(180deg, rgba(255,200,60,.08), var(--panel2)); }
.art summary { cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.lore { font-style: italic; color: #e8dcc8; line-height: 1.5; }
.finale .lore { font-size: 1.05em; }

/* Karte */
.map-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; max-height: 100%; display: flex; flex-direction: column; }
.map-box h2 { margin: 0 0 8px; font-size: 1.1em; }
.map-wrap { position: relative; overflow: auto; height: min(78vh, 900px); }
#bigmap, #bigmap-ov { width: 256px; height: 2096px; image-rendering: pixelated; display: block; }
#bigmap-ov { position: absolute; left: 0; top: 0; image-rendering: auto; }

@media (max-width: 640px) {
  .hud-tl { width: 46vw; }
  .bar { height: 17px; } .bar span { font-size: 10.5px; line-height: 15px; }
  .chip { font-size: 11px; padding: 2px 7px; }
  .hud-tc { top: 64px; width: 60vw; left: auto; right: 10px; transform: none; text-align: right; }
  #depth-t { font-size: 12px; }
  #ticker { justify-content: flex-end; font-size: 10.5px; }
  #mini { width: 76px; height: 107px; }
  .hud-tr { top: 10px; }
  .ib { width: 32px; height: 32px; font-size: 15px; }
  .hud-tc { top: 160px; }
  #toasts { top: 60%; }
}
