@font-face { font-family: 'Gabarito'; src: url('./fonts/gabarito.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
:root {
  --ink: #0b1f4d; --cyan: #00d2ff; --gold: #ffc23d; --hp: #5ee36a; --sh: #3ea2ff; --red: #ff4d5e;
  --panel: rgba(9, 22, 52, 0.62); --panel2: rgba(9, 22, 52, 0.82);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1f4d; color: #fff; font-family: 'Gabarito', system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.btn { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 800; font-size: 17px; letter-spacing: 0.01em; min-height: 48px; transition: transform .12s ease, filter .12s ease, background .12s; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: linear-gradient(180deg, #ffd65c, #ffb21f); color: #3a2300; box-shadow: 0 4px 0 #c47f00, 0 10px 24px rgba(255, 178, 31, .35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { font-size: 24px; padding: 16px 28px; width: 100%; text-transform: uppercase; letter-spacing: .06em; }
.btn.ghost { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22); }
.btn.ghost:hover { background: rgba(255, 255, 255, .2); }
.btn:focus-visible, .seg button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Menü */
.screen { position: fixed; inset: 0; z-index: 20; }
.menu-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.menu-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 18, 46, .88) 0%, rgba(8, 18, 46, .55) 38%, rgba(8, 18, 46, 0) 70%); }
.back { position: absolute; top: calc(14px + var(--st)); left: calc(16px + var(--sl)); color: #fff; text-decoration: none; font-weight: 700; background: rgba(0, 0, 0, .3); padding: 8px 12px; border-radius: 10px; z-index: 2; }
.menu-panel { position: absolute; left: calc(5vw + var(--sl)); top: 50%; transform: translateY(-50%); width: min(440px, 90vw); display: flex; flex-direction: column; gap: 14px; }
.kicker { margin: 0; color: var(--gold); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 14px; }
h1 { margin: 0; font-size: clamp(52px, 8vw, 92px); line-height: .9; font-weight: 900; letter-spacing: -.02em; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
h1 span { color: var(--cyan); }
.lede { margin: 0; font-size: 17px; line-height: 1.45; color: #e6f1ff; max-width: 38ch; }
.opts { display: grid; gap: 8px; background: var(--panel); border-radius: 16px; padding: 12px; backdrop-filter: blur(6px); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt > span { font-weight: 700; color: #cfe2ff; font-size: 15px; }
.seg { display: inline-flex; background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: 15px; color: #cfe2ff; min-height: 38px; }
.seg button.on { background: var(--cyan); color: #04223a; }
.menu-row { display: flex; gap: 10px; }
.menu-row .btn { flex: 1; }
.best { margin: 0; color: #cfe2ff; font-size: 14px; min-height: 1em; }
.legal { position: absolute; bottom: calc(10px + var(--sb)); left: calc(16px + var(--sl)); margin: 0; font-size: 13px; color: #cfe2ff; z-index: 2; }
.legal a { color: inherit; }

/* Dialoge */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(5, 12, 30, .55); padding: 16px; }
.card { background: #13295c; border-radius: 22px; padding: 22px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); border: 2px solid rgba(255, 255, 255, .08); }
.card h2 { margin: 0; font-size: 28px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; color: #e6f1ff; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.keys h3 { margin: 0 0 4px; font-size: 15px; color: var(--gold); }
.keys p { margin: 0; font-size: 14px; line-height: 1.5; color: #cfe2ff; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; }
.row input[type=range] { width: 50%; accent-color: var(--cyan); }
.muted { color: #b9cbea; margin: 0; }
.res { text-align: center; align-items: stretch; }
.res h2 { font-size: 46px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: rgba(0, 0, 0, .25); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; }
.stats b { font-size: 26px; }
.stats span { font-size: 13px; color: #b9cbea; }
#result.win .card { background: linear-gradient(180deg, #2c5bd8, #13295c); }
#result.win h2 { color: var(--gold); }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button, #hud canvas, #touch, #hotbar, #buildbar { pointer-events: auto; }
#feed { position: absolute; left: calc(14px + var(--sl)); top: calc(70px + var(--st)); display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
#feed div { background: var(--panel); padding: 4px 10px; border-radius: 8px; animation: feedIn .25s ease-out; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#feed div.me { background: rgba(0, 150, 200, .7); }
@keyframes feedIn { from { transform: translateX(-20px); opacity: 0; } }
#compass { position: absolute; top: calc(10px + var(--st)); left: 50%; transform: translateX(-50%); width: min(420px, 50vw); height: 26px; overflow: hidden; background: var(--panel); border-radius: 13px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
#compassStrip { position: absolute; top: 0; height: 100%; white-space: nowrap; font-weight: 800; font-size: 14px; line-height: 26px; }
#compassStrip span { position: absolute; transform: translateX(-50%); }
#compassStrip span.c { color: var(--gold); }
#compassStrip span.mk { color: #ff7ad9; }
#compass i { position: absolute; left: 50%; top: 0; width: 2px; height: 8px; background: #fff; transform: translateX(-50%); }
#mapbox { position: absolute; right: calc(14px + var(--sr)); top: calc(12px + var(--st)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mapinfo { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#mini { width: 170px; height: 170px; border-radius: 16px; background: #1b6ea8; box-shadow: 0 0 0 3px rgba(255, 255, 255, .5), 0 6px 18px rgba(0, 0, 0, .3); cursor: pointer; }
#info { display: flex; gap: 6px; }
#info span { background: var(--panel); border-radius: 8px; padding: 3px 9px; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 5px; }
#info span::before { content: ''; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--ic) center/contain no-repeat; mask: var(--ic) center/contain no-repeat; }
#alive { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0z'/%3E%3C/svg%3E"); }
#kills { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a8 8 0 0 0-5 14v3h3v-2h1v2h2v-2h1v2h3v-3a8 8 0 0 0-5-14zm-3 10a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm6 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4z'/%3E%3C/svg%3E"); color: #ffd0d4; }
#stormInfo { background: var(--panel); border-radius: 10px; padding: 4px 10px; text-align: right; display: flex; flex-direction: column; }
#stormInfo b { font-size: 18px; }
#stormInfo small { font-size: 12px; color: #d9c2ff; }
#stormInfo.shrink b { color: #e2a6ff; }
#vitals { position: absolute; left: calc(16px + var(--sl)); bottom: calc(18px + var(--sb)); width: min(300px, calc(50vw - 250px)); display: grid; gap: 5px; }
.bar { position: relative; height: 18px; background: rgba(0, 0, 0, .45); border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); }
.bar.sh { height: 12px; }
.bar i { position: absolute; inset: 0; transform-origin: left; transition: transform .2s; }
.bar.hp i { background: linear-gradient(180deg, #8af58f, #3dbb4a); }
.bar.sh i { background: linear-gradient(180deg, #7cc6ff, #2a7ee8); }
.bar b { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.bar.sh b { font-size: 10px; }
#mats { position: absolute; left: calc(16px + var(--sl)); bottom: calc(64px + var(--sb)); display: flex; align-items: center; gap: 4px; font-weight: 800; }
#mats span { display: flex; align-items: center; gap: 5px; background: var(--panel); border-radius: 8px; padding: 3px 8px; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .15s; }
#mats span[data-m="0"] { color: #f4c890; } #mats span[data-m="1"] { color: #d6d2c8; } #mats span[data-m="2"] { color: #a9c6e0; }
#mats span.on { box-shadow: inset 0 0 0 2px currentColor; }
#mats span.gain { animation: gain .5s ease-out; }
@keyframes gain { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
#mats svg { width: 15px; height: 15px; }
#hotbar { position: absolute; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%); display: flex; gap: 6px; }
.slot { width: 62px; height: 62px; border-radius: 12px; background: var(--panel); border: 2px solid rgba(255, 255, 255, .15); position: relative; display: grid; place-items: center; padding: 0; }
.slot.sel { border-color: #fff; transform: translateY(-6px); box-shadow: 0 6px 14px rgba(0, 0, 0, .35); }
.slot .k { position: absolute; top: 2px; left: 5px; font-size: 11px; color: #cfe2ff; font-weight: 800; }
.slot .n { position: absolute; bottom: 2px; right: 5px; font-size: 12px; font-weight: 800; }
.slot .k, .slot .n { z-index: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 4px rgba(0, 0, 0, .6); }
.slot .ic { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.slot .ic img { display: block; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); -webkit-user-drag: none; user-select: none; }
.slot .ic img.w { width: 90%; height: 64%; transform: rotate(-8deg); }
.slot .ic img.c { width: 70%; height: 70%; }
.slot.r0 { background: linear-gradient(180deg, rgba(150, 160, 175, .55), rgba(9, 22, 52, .7)); }
.slot.r1 { background: linear-gradient(180deg, rgba(70, 200, 80, .6), rgba(9, 22, 52, .7)); }
.slot.r2 { background: linear-gradient(180deg, rgba(50, 150, 255, .65), rgba(9, 22, 52, .7)); }
.slot.r3 { background: linear-gradient(180deg, rgba(175, 85, 255, .65), rgba(9, 22, 52, .7)); }
.slot.r4 { background: linear-gradient(180deg, rgba(255, 170, 40, .75), rgba(9, 22, 52, .7)); }
#buildbar { position: absolute; left: 50%; bottom: calc(90px + var(--sb)); transform: translateX(-50%); display: flex; gap: 6px; }
#buildbar button { border: 0; background: var(--panel2); border-radius: 10px; padding: 6px 12px; font-weight: 800; min-height: 44px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); display: flex; align-items: center; gap: 6px; }
#buildbar button svg { width: 18px; height: 18px; opacity: .9; }
#buildbar button.mat { background: #6b4a26; min-width: 74px; justify-content: center; }
#buildbar button.mat[data-m="1"] { background: #5e5b55; } #buildbar button.mat[data-m="2"] { background: #3e5770; }
#buildbar button.on { background: #2a7ee8; box-shadow: inset 0 0 0 2px #9fd4ff; }
#ammo { position: absolute; right: calc(18px + var(--sr)); bottom: calc(18px + var(--sb)); text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
#ammo b { font-size: 34px; line-height: 1; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
#ammo small { font-size: 15px; color: #cfe2ff; font-weight: 700; }
#ammo span { font-size: 13px; color: #cfe2ff; }
#cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --g: 8px; }
#cross i { position: absolute; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, .8); }
#cross i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: calc(-8px - var(--g)); }
#cross i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: var(--g); }
#cross i:nth-child(3) { width: 8px; height: 2px; top: -1px; left: calc(-8px - var(--g)); }
#cross i:nth-child(4) { width: 8px; height: 2px; top: -1px; left: var(--g); }
#cross.build i { background: #4fd1ff; }
#hitm { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; opacity: 0; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M2 2l6 6M20 2l-6 6M2 20l6-6M20 20l-6-6' stroke='white' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
#hitm.on { animation: hitm .25s ease-out; }
#hitm.head { filter: sepia(1) saturate(8) hue-rotate(-10deg); }
@keyframes hitm { from { opacity: 1; transform: scale(1.3); } to { opacity: 0; transform: scale(1); } }
#prompt { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); background: var(--panel2); border-radius: 10px; padding: 6px 12px; font-weight: 700; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
#prompt kbd { background: #fff; color: var(--ink); border-radius: 6px; padding: 1px 7px; font-family: inherit; font-weight: 900; }
#prompt .rar { width: 10px; height: 10px; border-radius: 50%; }
#useRing { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; display: grid; place-items: center; }
#useRing svg { position: absolute; inset: 0; transform: rotate(-90deg); }
#useRing circle { fill: none; stroke: rgba(0, 0, 0, .35); stroke-width: 4; }
#useRing #useArc { stroke: var(--cyan); stroke-dasharray: 106.8; stroke-dashoffset: 106.8; stroke-linecap: round; }
#useRing span { position: absolute; top: 76px; font-weight: 700; white-space: nowrap; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
#toast { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); background: var(--panel2); border-radius: 12px; padding: 8px 14px; font-weight: 700; }
#banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); text-align: center; font-weight: 900; font-size: clamp(22px, 4vw, 38px); text-shadow: 0 3px 10px rgba(0, 0, 0, .55); animation: banner 3s ease-out forwards; white-space: nowrap; }
#banner small { display: block; font-size: .5em; font-weight: 700; color: #e6f1ff; }
@media (orientation: portrait) and (max-width: 600px) { #banner { top: 31%; white-space: normal; width: min(92vw, 420px); font-size: 24px; line-height: 1.15; } }
#banner.storm { color: #e2a6ff; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -10px) scale(1.1); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#dmgDir { position: absolute; inset: 0; }
#dmgDir i { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px; border-radius: 50%; border-top: 8px solid rgba(255, 60, 60, .85); animation: dd .9s ease-out forwards; }
@keyframes dd { to { opacity: 0; } }
#dmgNums span { position: absolute; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); transform: translate(-50%, -50%); white-space: nowrap; }
#dmgNums span.sh { color: #8fd0ff; }
#dmgNums span.hd { color: var(--gold); font-size: 24px; }
#stormFx { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(120, 40, 220, 0) 30%, rgba(120, 40, 220, .55) 100%); opacity: 0; transition: opacity .4s; }
#stormFx.on { opacity: 1; }
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 32vmin, rgba(0, 0, 0, .92) 32.4vmin); }
#scope::before, #scope::after { content: ''; position: absolute; background: rgba(0, 0, 0, .8); }
#scope::before { left: 50%; top: calc(50% - 32vmin); width: 2px; height: 64vmin; transform: translateX(-1px); }
#scope::after { top: 50%; left: calc(50% - 32vmin); height: 2px; width: 64vmin; transform: translateY(-1px); }
.icon { position: absolute; border: 0; background: var(--panel); border-radius: 12px; width: 44px; height: 44px; display: grid; place-items: center; }
.icon svg { width: 22px; height: 22px; }
#pauseBtn { left: calc(14px + var(--sl)); top: calc(12px + var(--st)); }

/* Touch */
#touch { position: absolute; inset: 0; pointer-events: auto; z-index: 0; }
/* Die Steuerfläche liegt unter allem, was man antippen kann (sie steht im HTML zuletzt) */
#pauseBtn, #hotbar, #buildbar, #mapbox { z-index: 1; }
#stick { position: absolute; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .3); left: calc(60px + var(--sl)); bottom: calc(110px + var(--sb)); pointer-events: none; opacity: .75; }
#stick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.tb { position: absolute; border: 0; border-radius: 50%; width: 58px; height: 58px; background: rgba(9, 22, 52, .55); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); display: grid; place-items: center; color: #fff; font-weight: 800; }
.tb svg { width: 26px; height: 26px; }
.tb.on { background: rgba(0, 170, 220, .7); }
.tb.fire { width: 84px; height: 84px; right: calc(34px + var(--sr)); bottom: calc(118px + var(--sb)); background: rgba(255, 77, 94, .55); }
.tb.fire svg { width: 40px; height: 40px; }
.tb.fire2 { width: 58px; height: 58px; left: calc(30px + var(--sl)); top: 42%; background: rgba(255, 77, 94, .45); }
#tAim { right: calc(132px + var(--sr)); bottom: calc(178px + var(--sb)); }
#tJump { right: calc(34px + var(--sr)); bottom: calc(216px + var(--sb)); }
#tReload { right: calc(132px + var(--sr)); bottom: calc(108px + var(--sb)); width: 48px; height: 48px; }
#tBuild { right: calc(110px + var(--sr)); bottom: calc(250px + var(--sb)); width: 48px; height: 48px; }
#tCrouch { right: calc(176px + var(--sr)); bottom: calc(150px + var(--sb)); width: 48px; height: 48px; }
.tb.use { left: 50%; transform: translateX(-50%); top: 64%; border-radius: 14px; width: auto; height: 48px; padding: 0 18px; background: rgba(255, 194, 61, .85); color: #3a2300; }
.tb.drop { left: 50%; transform: translateX(-50%); bottom: calc(120px + var(--sb)); border-radius: 16px; width: auto; height: 60px; padding: 0 28px; background: linear-gradient(180deg, #ffd65c, #ffb21f); color: #3a2300; font-size: 20px; text-transform: uppercase; }
body.touch #ammo { bottom: calc(14px + var(--sb)); right: calc(14px + var(--sr)); }
body.touch #ammo b { font-size: 26px; }
body.touch #hotbar { bottom: calc(10px + var(--sb)); }
body.touch .slot { width: 52px; height: 52px; }
body.touch .slot .k { display: none; }
body.touch #vitals { bottom: auto; top: calc(14px + var(--st)); left: calc(70px + var(--sl)); width: min(220px, 30vw); }
body.touch #mats { bottom: auto; top: calc(58px + var(--st)); left: calc(70px + var(--sl)); }
body.touch #feed { top: calc(92px + var(--st)); font-size: 12px; }
body.touch #compass { display: none; }
body.touch #mini { width: 128px; height: 128px; }
body.touch #prompt { top: 56%; }
body.touch #buildbar { bottom: calc(74px + var(--sb)); }

@media (max-width: 760px) {
  .menu-shade { background: linear-gradient(0deg, rgba(8, 18, 46, .92) 0%, rgba(8, 18, 46, .7) 55%, rgba(8, 18, 46, .15) 100%); }
  .menu-panel { top: auto; bottom: calc(40px + var(--sb)); transform: none; left: 16px; right: 16px; width: auto; gap: 10px; }
  .lede { font-size: 15px; }
  .keys { grid-template-columns: 1fr; }
  .seg button { padding: 7px 9px; font-size: 14px; }
}
@media (max-height: 500px) {
  .menu-panel { top: 50%; bottom: auto; transform: translateY(-50%); gap: 8px; }
  h1 { font-size: 48px; }
  .lede { display: none; }
  .btn.big { padding: 10px 20px; font-size: 20px; }
}
/* Handy quer: Karte klein, Info neben die Karte, Tasten unten rechts */
@media (max-height: 500px) {
  body.touch #mapbox { flex-direction: row-reverse; align-items: flex-start; top: calc(8px + var(--st)); right: calc(10px + var(--sr)); }
  body.touch #mini { width: 96px; height: 96px; border-radius: 12px; }
  body.touch #info, body.touch #stormInfo { transform-origin: top right; }
  body.touch .mapinfo { gap: 4px; }
  body.touch .tb.fire { width: 72px; height: 72px; right: calc(26px + var(--sr)); bottom: calc(66px + var(--sb)); }
  body.touch #tJump { width: 54px; height: 54px; right: calc(34px + var(--sr)); bottom: calc(150px + var(--sb)); }
  body.touch #tAim { width: 54px; height: 54px; right: calc(112px + var(--sr)); bottom: calc(118px + var(--sb)); }
  body.touch #tReload { right: calc(114px + var(--sr)); bottom: calc(60px + var(--sb)); }
  body.touch #tBuild { right: calc(178px + var(--sr)); bottom: calc(176px + var(--sb)); }
  body.touch #tCrouch { right: calc(186px + var(--sr)); bottom: calc(100px + var(--sb)); }
  body.touch #buildbar button { padding: 4px 8px; min-height: 40px; font-size: 13px; }
  body.touch #stick { bottom: calc(64px + var(--sb)); left: calc(40px + var(--sl)); }
  body.touch .slot { width: 46px; height: 46px; }
  body.touch #feed { top: calc(84px + var(--st)); }
  body.touch .tb.drop { bottom: calc(80px + var(--sb)); }
  /* linke Feuertaste über den Stick, nie darauf */
  body.touch .tb.fire2 { top: auto; bottom: calc(204px + var(--sb)); width: 52px; height: 52px; }
}
/* Sehr flach (kleines Handy quer mit Browserleisten): kein Platz für die zweite Feuertaste */
@media (max-height: 340px) { body.touch .tb.fire2 { display: none; } }
/* Handy hochkant: Fächer schmaler, Munition über die Feuertaste.
   Alle Tasten bleiben rechts von 43 % der Breite, links liegt nur der Stick. */
@media (max-width: 500px) {
  body.touch .slot { width: 46px; height: 46px; }
  body.touch #hotbar { gap: 4px; left: 8px; transform: none; }
  body.touch #ammo { bottom: calc(66px + var(--sb)); }
  body.touch #stick { left: calc(18px + var(--sl)); bottom: calc(122px + var(--sb)); }
  body.touch .tb.fire { width: 80px; height: 80px; right: calc(18px + var(--sr)); bottom: calc(124px + var(--sb)); }
  body.touch #tJump { width: 56px; height: 56px; right: calc(30px + var(--sr)); bottom: calc(218px + var(--sb)); }
  body.touch #tAim { width: 52px; height: 52px; right: calc(108px + var(--sr)); bottom: calc(176px + var(--sb)); }
  body.touch #tReload { width: 46px; height: 46px; right: calc(110px + var(--sr)); bottom: calc(116px + var(--sb)); }
  body.touch #tCrouch { width: 46px; height: 46px; right: calc(166px + var(--sr)); bottom: calc(130px + var(--sb)); }
  body.touch #tBuild { width: 46px; height: 46px; right: calc(166px + var(--sr)); bottom: calc(196px + var(--sb)); }
  body.touch .tb.fire2 { left: calc(14px + var(--sl)); top: 38%; width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) { #banner, #feed div, #hitm.on, #dmgDir i { animation-duration: .01s; } }

.legal a[data-consent-settings]::before { content: '·'; margin: 0 .4em; display: inline-block; }

/* Im Luftschiff nur „Abspringen“ zeigen */
body.inbus #touch .tb:not(.drop), body.inbus #stick { display: none; }

/* Freunde (freiwilliges basteez-Konto) */
.frbtn { position: absolute; top: calc(14px + var(--st)); right: calc(16px + var(--sr)); z-index: 2; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 12px; background: rgba(0, 0, 0, .3); color: #fff; font-weight: 700; font-size: 16px; }
.frbtn:hover { background: rgba(0, 0, 0, .45); }
.frbtn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.frbadge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font-size: 13px; line-height: 22px; text-align: center; }
.frcol { display: flex; flex-direction: column; gap: 10px; }
.frcol > .btn { text-align: center; text-decoration: none; }
.frlead { margin: 0 0 4px; color: #e6f1ff; line-height: 1.5; }
.frme { margin: 0; color: #cfe2ff; font-size: 15px; }
.frme a { color: var(--cyan); }
.frform { display: flex; gap: 8px; }
.frform input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .25); color: #fff; font: inherit; font-size: 16px; user-select: text; -webkit-user-select: text; touch-action: auto; }
.frform input:focus { outline: none; border-color: var(--cyan); }
.frmsg { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 210, 255, .14); color: #e6f8ff; font-size: 15px; }
.frmsg.bad { background: rgba(255, 77, 94, .18); color: #ffe1e4; }
.frh { margin: 8px 0 0; font-size: 16px; color: var(--gold); }
.frlist { display: grid; gap: 8px; }
.frlist:empty { display: none; }
.frreq { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: rgba(255, 194, 61, .14); }
.frreq span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.frreq .btn { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.frboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.frboard li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.frboard li.me { background: rgba(0, 210, 255, .16); }
.frboard .rk { font-weight: 900; color: var(--gold); text-align: center; }
.frboard .nm { min-width: 0; display: grid; line-height: 1.25; }
.frboard .nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frboard .nm small { color: #9fb7dc; font-size: 13px; }
.frboard .nm small.on { color: var(--hp); }
.frboard .sc { text-align: right; font-size: 14px; color: #cfe2ff; line-height: 1.3; }
.frboard .sc b { color: #fff; font-size: 16px; }
.frhint { margin: 0; color: #9fb7dc; font-size: 14px; line-height: 1.45; }
@media (max-width: 520px) { .frbtn { padding: 8px 10px; font-size: 15px; } }

/* ---------- Mit Freunden spielen ---------- */
.playrow { display: grid; gap: 10px; }
.btn.mp { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(180deg, #4fe6ff, #00b8ea); color: #04223a; box-shadow: 0 4px 0 #0079a3, 0 10px 24px rgba(0, 184, 234, .28); font-size: 18px; }
.btn.mp:hover { filter: brightness(1.06); }
.btn.mp b { font-weight: 900; letter-spacing: .08em; }
.invite { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px; background: rgba(4, 34, 58, .78); box-shadow: inset 0 0 0 2px var(--cyan); animation: invIn .35s ease-out; }
.invite span { flex: 1; min-width: 0; font-weight: 700; line-height: 1.3; }
.invite .btn { min-height: 40px; padding: 8px 12px; font-size: 15px; flex: none; }
@keyframes invIn { from { transform: translateY(8px); opacity: 0; } }
.lobby { gap: 12px; }
.lbfield { display: grid; gap: 6px; }
.lbfield span { font-weight: 700; color: #cfe2ff; font-size: 15px; }
.lbfield input, #lbCode { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .25); color: #fff; font: inherit; font-size: 16px; user-select: text; -webkit-user-select: text; touch-action: auto; }
.lbfield input:focus { outline: none; border-color: var(--cyan); }
#lbCode { text-transform: uppercase; letter-spacing: .2em; font-weight: 800; }
#lbCode::placeholder { letter-spacing: .04em; font-weight: 600; text-transform: none; }
.lbor { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; color: #9fb7dc; font-size: 14px; }
.lbor::before, .lbor::after { content: ''; flex: 1; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, .12); }
.lbcode { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 16px; background: rgba(0, 0, 0, .28); }
.lbcode span { display: block; font-size: 12px; color: #9fb7dc; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.lbcode b { display: block; font-size: 34px; line-height: 1.1; letter-spacing: .16em; color: var(--gold); }
.lbcode .btn { flex: none; }
.lbplayers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.lbplayers li { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); min-width: 0; }
.lbplayers li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbplayers li small { flex: none; font-size: 12px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.lbplayers li small.ig { color: var(--hp); }
.lbplayers li.me { background: rgba(0, 210, 255, .16); }
.lbplayers li.off { opacity: .55; }
.lbopts { background: rgba(0, 0, 0, .2); }
.lbopts .seg button { padding: 8px 10px; }
.lbopts.ro .seg { pointer-events: none; }
.lbopts.ro .seg button:not(.on) { opacity: .55; }
.lbfriends { display: grid; gap: 6px; }
.lbfriend { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.lbfriend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lbfriend small { color: var(--hp); font-weight: 600; margin-left: 6px; }
.lbfriend .btn { min-height: 38px; padding: 6px 12px; font-size: 15px; flex: none; }
#lbGo:disabled { filter: grayscale(.7) brightness(.8); }
@media (max-height: 500px) {
  .menu-panel { top: calc(56px + var(--st)); transform: none; gap: 7px; }
  .kicker, .best { display: none; }
  h1 { font-size: 40px; }
  .opts { padding: 8px 10px; gap: 4px; }
  .seg button { min-height: 34px; padding: 5px 9px; }
  .playrow { grid-template-columns: 1fr 1fr; gap: 8px; }
  .btn.big { min-height: 46px; }
  .btn.mp { font-size: 16px; padding: 8px 12px; min-height: 46px; }
  .btn.mp .lg { display: none; }
  .menu-row .btn { min-height: 42px; padding: 8px 14px; font-size: 15px; }
  .invite { position: fixed; z-index: 3; top: calc(10px + var(--st)); left: 50%; transform: translateX(-50%); width: min(460px, 56vw); animation: none; }
  .lbplayers { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 420px) {
  .lbcode b { font-size: 28px; }
  .lbopts .opt { flex-direction: column; align-items: stretch; gap: 4px; }
  .lbopts .seg { display: flex; } .lbopts .seg button { flex: 1; }
}
