@font-face { font-family: 'Fredoka'; src: url('/fonts/fredoka-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Cinzel'; src: url('/fonts/cinzel-latin.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }

:root {
  --ink: #fff8ec;
  --ink-dim: rgba(255, 248, 236, .72);
  --panel: rgba(18, 26, 40, .78);
  --panel-line: rgba(255, 236, 200, .16);
  --orange: #ff8a3d;
  --coral: #ff5e57;
  --teal: #22c7a0;
  --violet: #a05cf0;
  --gold: #ffcf5a;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1522; color: var(--ink); font-family: 'Fredoka', system-ui, sans-serif; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font-family: inherit; }
input { font-family: inherit; -webkit-user-select: text; user-select: text; }

.screen { position: fixed; inset: 0; display: none; pointer-events: none; }
.screen.show { display: block; }
.screen.show > * { pointer-events: auto; }

.panel { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 22px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); }

/* Logo */
.logo { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(30px, 5.4vw, 52px); letter-spacing: .02em; line-height: 1; color: #fff3d6; text-shadow: 0 2px 0 #b2552a, 0 4px 0 #7a3418, 0 10px 24px rgba(0, 0, 0, .45); }
.logo-small { display: block; font-size: .36em; letter-spacing: .5em; margin-bottom: .25em; color: #ffd9a0; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }

/* Buttons */
.btn { position: relative; border: 0; border-radius: 16px; padding: 12px 22px 13px; font-size: 18px; font-weight: 650; color: #fff; cursor: pointer; transition: transform .08s ease, filter .15s ease, opacity .2s; letter-spacing: .01em; touch-action: manipulation; }
.btn:active { transform: translateY(3px); }
.btn:disabled { filter: grayscale(.8) brightness(.7); opacity: .6; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, #ffa24f 0%, #ff6e3a 100%); box-shadow: 0 5px 0 #b8431c, 0 10px 22px rgba(255, 110, 58, .35), inset 0 1px 0 rgba(255, 255, 255, .45); text-shadow: 0 1px 0 rgba(140, 50, 10, .6); }
.btn-primary:active { box-shadow: 0 2px 0 #b8431c, 0 4px 10px rgba(255, 110, 58, .3), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn-secondary { background: linear-gradient(180deg, #3fe0b8 0%, #17a886 100%); box-shadow: 0 5px 0 #0c6e57, 0 10px 22px rgba(34, 199, 160, .3), inset 0 1px 0 rgba(255, 255, 255, .45); text-shadow: 0 1px 0 rgba(6, 80, 60, .6); }
.btn-secondary:active { box-shadow: 0 2px 0 #0c6e57, inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn-ghost { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.btn.small { font-size: 14px; padding: 8px 14px; border-radius: 12px; }

/* Lader */
#loader { background: radial-gradient(ellipse at 50% 40%, #27406a 0%, #121c2d 60%, #0b111c 100%); display: none; place-items: center; }
#loader.show { display: grid; }
.loader-inner { text-align: center; }
.bar { width: min(340px, 60vw); height: 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); margin: 26px auto 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; border-radius: 10px; background: linear-gradient(90deg, #ffb35a, #ff6e3a); transition: width .25s; }
.loader-text { color: var(--ink-dim); font-size: 15px; }

/* Start */
#start.show { display: flex; align-items: center; justify-content: flex-start; padding-left: calc(5vw + var(--safe-l)); }
.start-card { width: min(400px, 46vw); padding: 22px 24px 20px; }
.start-card .logo { font-size: clamp(28px, 4.2vw, 44px); }
.tag { margin: 10px 0 14px; color: var(--ink-dim); font-size: 14.5px; line-height: 1.35; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-dim); margin-bottom: 5px; }
.field input, .code-input { width: 100%; font-size: 18px; padding: 10px 14px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(0, 0, 0, .28); color: #fff; outline: none; }
.field input:focus, .code-input:focus { border-color: #ffb35a; box-shadow: 0 0 0 3px rgba(255, 179, 90, .2); }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.join-row .code-input { flex: 0 0 120px; text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--ink-dim); font-size: 12.5px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .14); }
.err { min-height: 18px; color: #ff9b8f; font-size: 14px; margin-top: 8px; }

/* Lobby */
#lobby.show { display: flex; align-items: center; justify-content: center; padding: 14px calc(14px + var(--safe-r)) calc(12px + var(--safe-b)) calc(14px + var(--safe-l)); }
.lobby-wrap { display: flex; gap: 14px; width: 100%; max-width: 1100px; height: 100%; max-height: 520px; }
.lobby-room { flex: 0 0 clamp(170px, 22vw, 240px); padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lobby-room { position: relative; }
.back-btn { position: absolute; top: 10px; left: 10px; border: 0; border-radius: 11px; padding: 6px 10px 6px 24px; font: 600 12.5px Fredoka, sans-serif; color: #fff; background: rgba(255, 255, 255, .1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") 6px center/14px no-repeat; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); z-index: 2; }
.back-btn:active { transform: translateY(2px); }
.lobby-room .room-label { margin-top: 26px; }
.confirm { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(6, 10, 18, .6); }
.confirm.show { display: flex; }
.confirm-card { width: min(380px, 80vw); padding: 18px 20px; text-align: center; animation: pop .18s ease-out; }
.confirm-title { font-family: 'Cinzel', serif; font-weight: 900; font-size: 22px; margin-bottom: 6px; }
.confirm-text { color: var(--ink-dim); font-size: 14.5px; line-height: 1.35; margin-bottom: 14px; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.end-actions { margin-top: 4px; }
.room-label { font-size: 12px; text-transform: uppercase; letter-spacing: .2em; color: var(--ink-dim); }
.room-code { font-size: clamp(30px, 4.6vw, 46px); font-weight: 700; letter-spacing: .14em; color: #ffd27a; margin: 2px 0 8px; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.qr { background: #fff8ec; border-radius: 14px; padding: 8px; width: min(150px, 100%); aspect-ratio: 1; flex-shrink: 1; min-height: 0; }
.qr img, .qr svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.lobby-room .btn { margin-top: 10px; }
.room-hint { font-size: 12px; color: var(--ink-dim); margin-top: 8px; line-height: 1.3; }
.lobby-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lobby-title { font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(18px, 2.6vw, 26px); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); margin: 2px 0 10px 4px; }
.roles { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; min-height: 0; }
.role { position: relative; border-radius: 18px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 34%, #1a2233) 0%, rgba(18, 26, 40, .92) 62%); border: 2px solid rgba(255, 255, 255, .08); box-shadow: 0 10px 26px rgba(0, 0, 0, .3); transition: transform .18s, border-color .18s, box-shadow .18s; }
.role:active { transform: scale(.98); }
.role.mine { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent), 0 12px 30px rgba(0, 0, 0, .35); transform: translateY(-3px); }
.role.taken:not(.mine) { cursor: default; }
.role.taken:not(.mine) .role-img { filter: saturate(.75); }
.role-img { flex: 1; min-height: 0; background-size: contain; background-position: center bottom; background-repeat: no-repeat; margin-top: 6px; }
.role-info { padding: 6px 10px 10px; }
.role-name { font-weight: 700; font-size: clamp(13px, 1.7vw, 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-power { font-size: 12px; color: var(--c); font-weight: 600; margin-top: 1px; filter: brightness(1.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-text { font-size: 11.5px; color: var(--ink-dim); line-height: 1.25; margin-top: 3px; }
.role-player { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: center; }
.role-player span { background: var(--c); color: #111; font-weight: 700; font-size: 12.5px; padding: 3px 10px; border-radius: 20px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.role-player span.off { opacity: .55; }
.lobby-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.length { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.length-label { font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-dim); }
.length-sel { display: flex; gap: 4px; padding: 3px; border-radius: 13px; background: rgba(14, 20, 32, .7); border: 1px solid rgba(255, 255, 255, .1); }
.len { border: 0; border-radius: 10px; padding: 4px 10px; background: transparent; color: var(--ink-dim); line-height: 1.05; text-align: center; }
.len b { display: block; font-size: 14px; font-weight: 650; }
.len small { font-size: 10.5px; }
.len.on { background: linear-gradient(180deg, #3fe0b8, #17a886); color: #032a21; }
.len:disabled { cursor: default; }
.len:disabled:not(.on) { opacity: .6; }
.length-info { font-size: 12.5px; color: #ffd27a; font-weight: 600; white-space: nowrap; }
.lobby-head { display: flex; align-items: baseline; gap: 12px; }
.lobby-head .lobby-title { flex-shrink: 0; }
.lobby-status { flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-dim); font-size: 14px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }

/* HUD */
.hud-top { position: absolute; top: 8px; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip { display: flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 40px; background: rgba(14, 20, 32, .72); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .25s, box-shadow .25s, background .25s; }
.chip.turn { background: color-mix(in srgb, var(--c) 30%, rgba(14, 20, 32, .85)); border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent), 0 6px 18px rgba(0, 0, 0, .35); transform: translateY(2px); }
.chip.off { opacity: .5; }
.chip-face { width: 34px; height: 34px; border-radius: 50%; background: var(--c) center/cover; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); flex-shrink: 0; }
.chips.many { gap: 5px; }
.chips.many .chip { padding: 3px 9px 3px 3px; gap: 5px; }
.chips.many .chip-face { width: 28px; height: 28px; }
.chips.many .chip-name { max-width: 58px; font-size: 12px; }
.chips.many .chip-stats { gap: 6px; font-size: 12px; }
.chip-name { font-weight: 650; font-size: 13.5px; line-height: 1.05; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-stats { display: flex; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink-dim); margin-top: 1px; }
.chip-stats b { color: #fff; font-weight: 700; }
.gem { display: inline-block; width: 11px; height: 13px; margin-right: 3px; vertical-align: -1px; background: linear-gradient(160deg, #e9d6ff 0%, #b06cff 45%, #6b2fd0 100%); clip-path: polygon(50% 0, 100% 35%, 50% 100%, 0 35%); }
.flag { display: inline-block; width: 10px; height: 11px; margin-right: 3px; vertical-align: -1px; background: #ffd27a; clip-path: polygon(0 0, 100% 25%, 25% 50%, 25% 100%, 0 100%); }
.star-ic { display: inline-block; width: 12px; height: 12px; margin-right: 2px; vertical-align: -1px; background: #ffd27a; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.lap-ic { display: inline-block; width: 11px; height: 11px; margin-right: 2px; vertical-align: -1px; border: 2px solid #7fd8ff; border-right-color: transparent; border-radius: 50%; }
.shield-ic { display: inline-block; width: 11px; height: 13px; vertical-align: -1px; background: #7fd8ff; clip-path: polygon(50% 0, 100% 15%, 90% 60%, 50% 100%, 10% 60%, 0 15%); }
.round { flex-shrink: 0; padding: 7px 14px; border-radius: 14px; background: rgba(14, 20, 32, .72); border: 1px solid rgba(255, 255, 255, .1); font-weight: 650; font-size: 14px; text-align: right; line-height: 1.15; }
.round-biome { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #ffd27a; font-weight: 600; }
.hud-bottom { position: absolute; bottom: calc(12px + var(--safe-b)); left: calc(14px + var(--safe-l)); right: calc(14px + var(--safe-r)); display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none; }
.status { font-size: 16px; font-weight: 600; padding: 9px 16px; border-radius: 14px; background: rgba(14, 20, 32, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); max-width: 60%; }
.status:empty { display: none; }
.btn-roll { pointer-events: auto; font-size: 22px; padding: 16px 30px 17px 22px; border-radius: 22px; display: none; align-items: center; gap: 12px; background: linear-gradient(180deg, #ffa24f 0%, #ff6e3a 100%); box-shadow: 0 6px 0 #b8431c, 0 14px 30px rgba(255, 110, 58, .45), inset 0 1px 0 rgba(255, 255, 255, .5); animation: pulse 1.6s ease-in-out infinite; }
.btn-roll.show { display: inline-flex; }
.roll-die { width: 30px; height: 30px; border-radius: 8px; background: #fff8ec; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); position: relative; }
.roll-die::before, .roll-die::after { content: ''; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ff6e3a; box-shadow: 0 0 0 0 transparent; }
.roll-die::before { top: 6px; left: 6px; box-shadow: 12px 12px 0 #ff6e3a; }
.roll-die::after { top: 6px; right: 6px; box-shadow: -12px 12px 0 #ff6e3a; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

#labels { position: absolute; inset: 0; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #111; background: var(--c); box-shadow: 0 3px 8px rgba(0, 0, 0, .3); white-space: nowrap; will-change: transform; }
.label.me::after { content: ' (du)'; font-weight: 500; }
#pops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 26px; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 18px rgba(0, 0, 0, .4); animation: popUp 1.5s ease-out forwards; white-space: nowrap; }
.pop.good { color: #ffe08a; }
.pop.bad { color: #ff8a80; }
.pop .gem { width: 18px; height: 22px; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 30% { transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* Banner */
.banner { position: fixed; left: 0; right: 0; top: 34%; display: flex; justify-content: center; pointer-events: none; opacity: 0; }
.banner.show { animation: banner 1.5s cubic-bezier(.2, .9, .3, 1) forwards; }
.banner-in { padding: 10px 60px 12px; text-align: center; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c, #ff8a3d) 70%, #111) 18%, color-mix(in srgb, var(--c, #ff8a3d) 70%, #111) 82%, transparent); }
.banner-small { font-size: 13px; text-transform: uppercase; letter-spacing: .25em; opacity: .85; }
.banner-big { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(26px, 4.5vw, 44px); text-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
@keyframes banner { 0% { opacity: 0; transform: scaleX(.3); } 14% { opacity: 1; transform: scaleX(1.03); } 22% { transform: scaleX(1); } 80% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: translateY(-20px); } }

.toast { position: fixed; left: 50%; top: 18%; transform: translate(-50%, -10px); padding: 10px 20px; border-radius: 16px; background: rgba(14, 20, 32, .85); border: 1px solid rgba(255, 255, 255, .14); font-weight: 600; font-size: 17px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center; max-width: 80vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Ereigniskarte */
.card-wrap { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; perspective: 1200px; background: radial-gradient(ellipse at center, rgba(10, 6, 24, .35), rgba(10, 6, 24, .7)); }
.card-wrap.show { display: flex; }
.card { position: relative; width: min(300px, 40vw); height: min(380px, 92vh); transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); transform: rotateY(180deg) scale(.6) translateY(40px); }
.card.flip { transform: rotateY(0deg) scale(1); }
.card-front, .card-back { position: absolute; inset: 0; border-radius: 22px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card-back { transform: rotateY(180deg); background: radial-gradient(circle at 50% 40%, #8d4ef0 0%, #4b1f96 70%); border: 6px solid #f2d9a6; display: grid; place-items: center; }
.card-back-emblem { width: 50%; aspect-ratio: 1; border: 4px solid rgba(242, 217, 166, .7); transform: rotate(45deg); border-radius: 12px; }
.card-front { background: linear-gradient(180deg, #fbf1dd 0%, #f1dfbd 100%); border: 6px solid #8d4ef0; color: #2a1d3a; padding: 12px 16px 14px; display: flex; flex-direction: column; box-shadow: 0 30px 60px rgba(0, 0, 0, .45); }
.card-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .3em; color: #8d4ef0; font-weight: 700; text-align: center; }
.card-art { height: 34%; margin: 8px 0; border-radius: 12px; background: radial-gradient(circle at 50% 60%, #b98cff 0%, #5a2ab0 80%); display: grid; place-items: center; overflow: hidden; }
.card-art svg { width: 56%; height: 80%; }
.card-title { font-family: 'Cinzel', serif; font-weight: 900; font-size: 22px; text-align: center; line-height: 1.05; }
.card-text { font-size: 14px; line-height: 1.3; text-align: center; margin-top: 6px; color: #4a3a5c; flex: 1; }
.card-choices { display: flex; flex-direction: column; gap: 8px; }
.card-choices .btn { font-size: 14.5px; padding: 9px 12px 10px; border-radius: 12px; }
.card-wait { font-size: 13px; text-align: center; color: #7a6890; font-weight: 600; }

/* Rettung */
.rescue { position: fixed; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); display: none; justify-content: center; pointer-events: none; }
.rescue.show { display: flex; }
.rescue-in { pointer-events: auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 90vw; border-color: rgba(255, 120, 100, .4); }
.rescue-text { font-weight: 600; font-size: 16px; }
.rescue-bar { width: 120px; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.rescue-bar i { display: block; height: 100%; width: 100%; background: #ff8a80; transform-origin: left; }

/* Minigame */
#mg .mg-top { position: absolute; top: 8px; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.mg-name { font-family: 'Cinzel', serif; font-weight: 900; font-size: 20px; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.mg-timer { min-width: 64px; padding: 6px 12px; border-radius: 14px; background: rgba(14, 20, 32, .75); font-weight: 700; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.mg-timer.low { color: #ff8a80; }
.mg-scores { flex: 1; display: flex; gap: 8px; justify-content: flex-end; }
.mg-score { display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; border-radius: 30px; background: rgba(14, 20, 32, .75); border: 2px solid var(--c); font-weight: 700; font-size: 18px; }
.mg-score .chip-face { width: 30px; height: 30px; }
.mg-score.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.18); } }
.mg-center { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.mg-bottom { position: absolute; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: center; gap: 12px; }
.mg-intro.show { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(8, 12, 22, .2), rgba(8, 12, 22, .65)); }
.mg-intro-card { width: min(600px, 78vw); padding: 16px 26px; text-align: center; }
.mg-kind { display: inline-block; font-size: 12px; text-transform: uppercase; letter-spacing: .25em; font-weight: 700; padding: 4px 12px; border-radius: 20px; background: var(--orange); color: #2a1406; }
.mg-kind.koop { background: var(--teal); color: #05302a; }
.mg-title { font-family: "Cinzel", serif; font-weight: 900; font-size: clamp(22px, 3.4vw, 32px); margin: 8px 0 6px; line-height: 1.05; }
.mg-how { color: var(--ink-dim); font-size: 15px; line-height: 1.35; }
.mg-role { margin-top: 10px; font-weight: 700; font-size: 16px; color: #ffd27a; }
.mg-role:empty { display: none; }
.mg-ready { margin: 10px 0 12px; display: flex; gap: 6px; justify-content: center; }
.mg-ready .chip-face { width: 30px; height: 30px; opacity: .35; transition: opacity .2s; }
.mg-ready .chip-face.on { opacity: 1; box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px var(--teal); }
.count { position: fixed; inset: 0; display: none; place-items: center; pointer-events: none; font-family: 'Cinzel', serif; font-weight: 900; font-size: 120px; color: #fff3d6; text-shadow: 0 6px 0 #b2552a, 0 12px 30px rgba(0, 0, 0, .5); }
.count.show { display: grid; }
.count span { animation: countIn .9s ease-out forwards; }
@keyframes countIn { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.8); opacity: 0; } }

/* Lichtung: Joystick und Aktion */
.joy-zone { position: absolute; left: 0; bottom: 0; width: 46vw; height: 72vh; touch-action: none; pointer-events: auto; }
.joy { position: absolute; left: calc(70px + var(--safe-l)); top: calc(100% - 90px); width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .08), rgba(255, 255, 255, .16)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28); opacity: .55; transition: opacity .15s; }
.joy.on { opacity: 1; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff8ec, #cfd8e6); box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
.joy-hint { position: absolute; left: calc(18px + var(--safe-l)); bottom: 8px; font-size: 12px; color: var(--ink-dim); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.joy-zone.used .joy-hint { display: none; }
.act-btn { position: absolute; right: calc(26px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); width: clamp(96px, 14vw, 124px); height: clamp(96px, 14vw, 124px); border-radius: 50%; border: 0; color: #fff; font-weight: 700; font-size: 14px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 80%, #fff), color-mix(in srgb, var(--c) 85%, #000)); box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 50%, #000), 0 12px 26px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .5); touch-action: none; pointer-events: auto; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.act-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 50%, #000); }
.act-name { position: relative; z-index: 1; }
.act-cd { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.act-cd circle { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 5; stroke-dasharray: 100; stroke-dashoffset: 100; }
.seal-bar { padding: 8px 16px 10px; border-radius: 16px; background: rgba(14, 20, 32, .72); border: 1px solid rgba(160, 120, 255, .3); min-width: 280px; }
.seal-label { font-size: 11px; text-transform: uppercase; letter-spacing: .2em; color: #d2b8ff; font-weight: 700; }
.seal-track { height: 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); margin: 6px 0 8px; overflow: hidden; }
.seal-track i { display: block; height: 100%; background: linear-gradient(90deg, #5fffd6, #b06cff); transform-origin: left; transform: scaleX(0); transition: transform .12s linear; }
.plates { display: flex; gap: 8px; justify-content: center; }
.plate { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: rgba(255, 255, 255, .08); color: var(--ink-dim); }
.plate.on { background: #22c7a0; color: #03231c; box-shadow: 0 0 14px rgba(34, 199, 160, .6); }
.mg-kills { padding: 6px 12px; border-radius: 14px; background: rgba(14, 20, 32, .75); font-weight: 650; font-size: 15px; }
.mg-center { top: 52px !important; }
#mg .mg-top { align-items: flex-start; }

/* Ende */
#end.show { display: flex; align-items: center; justify-content: flex-end; padding-right: calc(5vw + var(--safe-r)); }
.end-card { width: min(420px, 50vw); padding: 18px 22px; }
.end-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .25em; color: var(--ink-dim); }
.end-title { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(24px, 3.6vw, 34px); margin: 4px 0 10px; color: #ffd27a; }
.end-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.end-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.end-row:first-child { background: color-mix(in srgb, var(--c) 28%, transparent); box-shadow: inset 0 0 0 2px var(--c); }
.end-place { font-weight: 700; font-size: 20px; width: 24px; text-align: center; }
.end-name { flex: 1; font-weight: 650; }
.end-detail { font-size: 12px; color: var(--ink-dim); }
.end-total { font-weight: 700; font-size: 20px; }

.net { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 12px; background: #b8431c; font-weight: 600; font-size: 14px; display: none; z-index: 50; }
.net.show { display: block; }
.fullbtn { position: fixed; right: calc(10px + var(--safe-r)); top: calc(12px + env(safe-area-inset-top, 0px)); width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgba(14, 20, 32, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E") center/20px no-repeat; z-index: 40; display: none; }
body.on-start .fullbtn.show { display: block; }
.rotate { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 24px; background: #121c2d; font-size: 20px; font-weight: 600; text-align: center; padding: 30px; }
.rotate-phone { width: 60px; height: 100px; border: 5px solid #ffd27a; border-radius: 14px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%, 20% { transform: rotate(0); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) and (max-width: 900px) { .rotate { display: flex; } }

@media (max-height: 430px) {
  .role-power { font-size: 11px; }
  .lobby-status { font-size: 12.5px; }
  .start-card { padding: 16px 20px 14px; }
  .tag { margin: 8px 0 10px; font-size: 13.5px; }
  .field { margin-bottom: 9px; }
  .field input, .code-input { padding: 8px 12px; font-size: 16px; }
  .btn { padding: 10px 18px 11px; font-size: 16px; }
  .divider { margin: 9px 0; }
  .role-text { display: none; }
  .card { height: 92vh; }
  .card-art { height: 26%; }
  .card-text { font-size: 13px; }
}
#btnStart { white-space: nowrap; }
.length-info { font-size: 11.5px; }
