:root {
  --bg1: #1b1440;
  --bg2: #2b1d6b;
  --card: rgba(255, 255, 255, 0.08);
  --card-solid: #2a2160;
  --card-border: rgba(255, 255, 255, 0.14);
  --text: #fff;
  --muted: #b9b1e6;
  --primary: #ffc933;
  --primary-dark: #e6a100;
  --secondary: #3d8bff;
  --danger: #ff4d5e;
  --good: #33d17a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(8, 4, 30, 0.45);
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: radial-gradient(1200px 800px at 20% 0%, #3b2a8f 0%, transparent 60%),
              radial-gradient(900px 700px at 100% 100%, #6b1f7a 0%, transparent 55%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--text); font-family: var(--font);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
input { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; }
.hidden { display: none !important; }
.center { text-align: center; }

#bg-deco {
  position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,201,51,.25) 0 6px, transparent 7px),
    radial-gradient(circle at 80% 30%, rgba(61,139,255,.25) 0 8px, transparent 9px),
    radial-gradient(circle at 30% 80%, rgba(255,107,203,.25) 0 5px, transparent 6px),
    radial-gradient(circle at 70% 85%, rgba(51,209,122,.25) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.08) 0 3px, transparent 4px);
  background-size: 420px 420px, 520px 520px, 380px 380px, 460px 460px, 120px 120px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 420px 840px, -520px 520px, 380px -380px, 460px 920px, 120px 240px; } }

.screen { position: fixed; inset: 0; overflow: auto; }

/* ---------- Buttons & Inputs ---------- */
.btn {
  border: none; cursor: pointer; font-family: var(--font-display); font-weight: 600;
  font-size: 17px; padding: 12px 20px; border-radius: 14px; color: #1b1440;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
  box-shadow: 0 5px 0 rgba(0,0,0,.25); position: relative; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.btn-primary { background: linear-gradient(180deg, #ffe066, var(--primary)); }
.btn-secondary { background: linear-gradient(180deg, #7db3ff, var(--secondary)); color: #fff; }
.btn-danger { background: linear-gradient(180deg, #ff8a95, var(--danger)); color: #fff; }
.btn-good { background: linear-gradient(180deg, #7ef0ae, var(--good)); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.btn-big { font-size: 21px; padding: 16px 26px; border-radius: 16px; }
.btn-small { font-size: 14px; padding: 8px 12px; border-radius: 11px; }
.wide { width: 100%; }

.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15);
  background: rgba(10, 6, 35, .45); color: #fff; font-size: 17px; font-family: var(--font-display);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--primary); }
.code-input { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 6px; }
.error-msg { color: #ff8a95; font-weight: 700; min-height: 22px; margin-top: 10px; text-align: center; }
.hint { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; backdrop-filter: blur(10px);
}

/* ---------- Home ---------- */
.home-wrap { max-width: 760px; margin: 0 auto; padding: 28px 16px 40px; display: flex; flex-direction: column; align-items: center; }
.logo { margin: 8px 0 4px; text-align: center; font-family: var(--font-display); line-height: .9; }
.logo-top {
  display: block; font-size: clamp(56px, 12vw, 104px); font-weight: 700; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff6c2 0%, #ffc933 45%, #ff8a3d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 #7a2a9a) drop-shadow(0 12px 18px rgba(0,0,0,.4));
  animation: wobble 4s ease-in-out infinite;
}
.logo-bottom { display: block; font-size: clamp(22px, 5vw, 36px); font-weight: 600; color: #ff9be0; letter-spacing: 3px; margin-top: 6px; text-shadow: 0 3px 0 #4a1a6a; }
@keyframes wobble { 0%,100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.03); } }
.tagline { color: var(--muted); text-align: center; margin: 10px 0 22px; font-size: 17px; }
.home-card { width: 100%; }
.profile-editor { display: flex; gap: 22px; align-items: center; }
#home-avatar { width: 180px; height: 196px; flex-shrink: 0; background: radial-gradient(circle at 50% 70%, rgba(255,255,255,.12), transparent 65%); border-radius: 20px; }
.profile-fields { flex: 1; min-width: 0; }
.profile-fields .field-label:first-child { margin-top: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); cursor: pointer; transition: transform .12s; position: relative; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.swatch.taken { opacity: .25; cursor: not-allowed; }
.swatches.small .swatch { width: 26px; height: 26px; border-width: 2px; }
.hats { display: flex; flex-wrap: wrap; gap: 6px; }
.hat-btn { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.08); border: 2px solid transparent; cursor: pointer; padding: 0; }
.hat-btn canvas { width: 100%; height: 100%; }
.hat-btn.sel { border-color: var(--primary); background: rgba(255,201,51,.15); }
.hats.small .hat-btn { width: 36px; height: 36px; border-radius: 10px; }
.home-actions { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.home-actions > .btn { flex: 1 1 220px; }
.join-row { display: flex; gap: 8px; flex: 1 1 260px; }
.join-row .input { flex: 1; min-width: 0; }
.invite-banner { margin-top: 18px; padding: 14px; border-radius: 14px; background: linear-gradient(90deg, rgba(255,201,51,.2), rgba(255,107,203,.2)); border: 1px solid rgba(255,201,51,.4); text-align: center; font-weight: 700; }
.invite-banner b { color: var(--primary); letter-spacing: 3px; }
.home-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; width: 100%; }
.home-features div { background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.home-features b { font-family: var(--font-display); font-weight: 600; }
.home-features span { color: var(--muted); font-size: 13px; }

/* ---------- Lobby ---------- */
.lobby-wrap { max-width: 1200px; margin: 0 auto; padding: 18px 16px 30px; }
.lobby-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.logo-small { font-family: var(--font-display); font-size: 32px; margin: 0; color: var(--primary); text-shadow: 0 3px 0 #7a2a9a; }
.logo-small span { color: #ff9be0; font-weight: 500; }
.lobby-grid { display: grid; grid-template-columns: 330px 1fr 320px; gap: 16px; align-items: start; }
.invite-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.invite-code { font-family: var(--font-display); font-size: 46px; font-weight: 700; letter-spacing: 10px; text-align: center; color: var(--primary); background: rgba(0,0,0,.25); border-radius: 14px; padding: 8px 0 8px 10px; margin-bottom: 12px; text-shadow: 0 3px 0 #7a2a9a; }
.invite-link-row { display: flex; gap: 8px; margin-bottom: 10px; }
.invite-link-row .input { font-size: 13px; font-family: var(--font); }
.divider { height: 1px; background: var(--card-border); margin: 16px 0; }
.lobby-profile { display: flex; gap: 12px; align-items: center; }
#lobby-avatar { width: 110px; height: 121px; flex-shrink: 0; }
.lobby-profile-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.players-head { display: flex; justify-content: space-between; align-items: center; }
.players-head .invite-title { margin: 0; }
#lobby-count { color: var(--muted); font-weight: 500; }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.pcard { background: rgba(255,255,255,.07); border-radius: 16px; padding: 10px 10px 12px; text-align: center; position: relative; border: 2px solid transparent; animation: popIn .35s cubic-bezier(.2,1.6,.4,1); }
.pcard.me { border-color: rgba(255,201,51,.6); }
.pcard canvas { width: 100px; height: 110px; }
.pcard .pname { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .ptags { display: flex; gap: 4px; justify-content: center; margin-top: 4px; min-height: 20px; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 8px; background: rgba(255,255,255,.14); }
.tag.host { background: rgba(255,201,51,.25); color: var(--primary); }
.tag.bot { background: rgba(61,139,255,.25); color: #9cc4ff; }
.tag.off { background: rgba(255,77,94,.25); color: #ff9aa5; }
.pcard .kick { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(255,77,94,.8); color: #fff; cursor: pointer; font-weight: 800; }
.pcard.empty { border: 2px dashed rgba(255,255,255,.15); background: transparent; display: flex; align-items: center; justify-content: center; min-height: 170px; color: rgba(255,255,255,.3); font-family: var(--font-display); animation: none; }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.seg button { flex: 1; padding: 10px 0; border-radius: 10px; border: 2px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06); color: #fff; font-family: var(--font-display); font-size: 17px; cursor: pointer; min-width: 44px; }
.seg button.sel { background: var(--primary); color: #1b1440; border-color: var(--primary); }
.seg button:disabled { cursor: default; }
/* Lobby: Spielmodus & Einstellungen */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 14px; }
.mode-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px; border-radius: 14px; border: 2px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); color: #fff; cursor: pointer; font-family: var(--font); transition: transform .15s, border-color .15s, background .15s; }
.mode-card .mi { font-size: 30px; line-height: 1.1; transition: transform .2s; }
.mode-card b { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.mode-card small { font-size: 11.5px; color: var(--muted); line-height: 1.25; text-align: center; }
.mode-card:not(:disabled):hover { transform: translateY(-2px); border-color: rgba(255,201,51,.5); }
.mode-card.sel { border-color: var(--primary); background: linear-gradient(180deg, rgba(255,201,51,.24), rgba(255,138,61,.12)); box-shadow: 0 0 0 3px rgba(255,201,51,.15), 0 6px 18px rgba(0,0,0,.25); }
.mode-card.sel .mi { transform: scale(1.15) rotate(-6deg); }
.mode-card.sel small { color: #ffe8a8; }
.mode-card:disabled { cursor: default; }
#lobby-opts .seg { margin-bottom: 12px; }
#lobby-opts .seg button { font-size: 15px; padding: 8px 0; min-width: 34px; }
.host-hint { font-size: 12.5px; color: var(--muted); margin: -2px 0 6px; }
.tgl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; margin-bottom: 12px; border-radius: 12px; background: rgba(255,255,255,.05); }
.tgl-row b { display: block; font-size: 14.5px; }
.tgl-row small { display: block; font-size: 12px; color: var(--muted); }
.tgl { flex: none; width: 46px; height: 26px; border-radius: 13px; border: none; background: rgba(255,255,255,.2); position: relative; cursor: pointer; transition: background .2s; }
.tgl i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.3,1.5,.5,1); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.tgl.on { background: var(--good); }
.tgl.on i { transform: translateX(20px); }
.tgl:disabled { cursor: default; opacity: .75; }
.pool { margin-bottom: 14px; border-radius: 12px; background: rgba(255,255,255,.05); }
.pool summary { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; font-weight: 800; font-size: 14.5px; list-style: none; }
.pool summary::-webkit-details-marker { display: none; }
.pool summary::after { content: '▾'; margin-left: 8px; transition: transform .2s; }
.pool[open] summary::after { transform: rotate(180deg); }
.pool summary span { flex: 1; }
.pool summary b { color: var(--primary); font-family: var(--font-display); }
.pool-presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 8px; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.18); background: transparent; color: #fff; font-weight: 800; font-size: 12px; cursor: pointer; font-family: var(--font); }
.chip.sel { background: rgba(255,201,51,.2); border-color: var(--primary); color: var(--primary); }
.chip:disabled, .mgchip:disabled { cursor: default; }
.pool-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 10px 10px; }
.mgchip { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.1); background: rgba(0,0,0,.15); color: rgba(255,255,255,.45); font-family: var(--font); font-weight: 700; font-size: 12.5px; text-align: left; cursor: pointer; transition: all .15s; }
.mgchip .ic { font-size: 18px; filter: grayscale(1); opacity: .5; transition: all .15s; }
.mgchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgchip.on { background: rgba(51,209,122,.16); border-color: rgba(51,209,122,.6); color: #fff; }
.mgchip.on .ic { filter: none; opacity: 1; }

/* Minispiel-Abstimmung & Zwischenstand */
.final-badge { display: inline-block; margin-bottom: 6px; padding: 6px 14px; border-radius: 999px; background: linear-gradient(90deg, #ff4d5e, #ff8a3d); font-family: var(--font-display); font-weight: 700; letter-spacing: .5px; animation: pulseHot 1s ease-in-out infinite; }
@keyframes pulseHot { 50% { transform: scale(1.06); box-shadow: 0 0 24px rgba(255,120,60,.7); } }
.mg-vote, .mg-standings { width: min(760px, calc(100vw - 32px)); text-align: center; animation: popIn .4s cubic-bezier(.2,1.4,.4,1); max-height: calc(100vh - 24px); overflow-y: auto; }
.mg-vote h2, .mg-standings h2 { font-family: var(--font-display); font-size: 38px; margin: 2px 0 4px; color: var(--primary); text-shadow: 0 4px 0 #7a2a9a; }
.mg-vote .sub, .mg-standings .sub { margin: 0 0 14px; color: #ddd8ff; }
.vote-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.vote-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px 12px; border-radius: 16px; border: 2px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06); color: #fff; font-family: var(--font); cursor: pointer; animation: popIn .4s cubic-bezier(.2,1.5,.4,1) backwards; transition: transform .15s, border-color .15s, background .15s, opacity .3s; }
.vote-card:not(:disabled):hover { transform: translateY(-4px); border-color: rgba(255,201,51,.6); }
.vote-card .vk { position: absolute; top: 8px; left: 10px; font-family: var(--font-display); font-size: 13px; color: var(--muted); }
.vote-card .vi { font-size: 48px; line-height: 1.1; }
.vote-card b { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.vote-card small { font-size: 12px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vote-card .voters { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 26px; margin-top: 6px; }
.vote-card .vd { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.7); animation: popIn .3s cubic-bezier(.2,1.8,.4,1); }
.vote-card.mine { border-color: var(--primary); background: rgba(255,201,51,.14); }
.vote-card.win { border-color: var(--good); background: rgba(51,209,122,.2); transform: scale(1.06); box-shadow: 0 0 30px rgba(51,209,122,.45); animation: voteWin .6s cubic-bezier(.2,1.6,.4,1); }
.vote-card.lose { opacity: .35; transform: scale(.94); }
.vote-card:disabled { cursor: default; }
@keyframes voteWin { 0% { transform: scale(1); } 60% { transform: scale(1.12); } 100% { transform: scale(1.06); } }
.vote-time { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); margin-top: 16px; overflow: hidden; }
.vote-time i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--primary), var(--danger)); animation: voteTime 12s linear forwards; transform-origin: left; }
@keyframes voteTime { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.stand-list { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.stand-row { display: grid; grid-template-columns: 40px 44px 1fr auto; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 14px; background: rgba(255,255,255,.06); animation: slideIn .4s backwards; }
.stand-row.me { background: rgba(255,201,51,.16); }
.stand-row canvas { width: 40px; height: 44px; }
.stand-row .pl { font-family: var(--font-display); font-weight: 700; font-size: 22px; text-align: center; }
.stand-row .nm { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stand-row .up { color: var(--good); font-size: 13px; }
.stand-row .down { color: #ff8a95; font-size: 13px; }
.sbar { height: 10px; border-radius: 5px; background: rgba(0,0,0,.25); margin-top: 4px; overflow: hidden; }
.sbar i { display: block; height: 100%; border-radius: 5px; transition: width .9s cubic-bezier(.3,1.2,.5,1); box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.stand-row .pts { font-family: var(--font-display); font-size: 22px; font-weight: 700; white-space: nowrap; min-width: 92px; text-align: right; }
.stand-row .gain { display: inline-block; margin-left: 6px; font-size: 14px; color: var(--good); animation: gainPop .5s .8s cubic-bezier(.2,1.8,.4,1) backwards; }
@keyframes gainPop { from { transform: scale(0) translateY(10px); opacity: 0; } }
.stand-foot { margin-top: 14px; font-family: var(--font-display); font-size: 18px; color: #ffe8a8; }
.stand-foot.hot { color: #fff; }
.stand-foot.hot { display: inline-block; padding: 6px 16px; border-radius: 999px; background: linear-gradient(90deg, #ff4d5e, #ff8a3d); animation: pulseHot 1s ease-in-out infinite; }
.end-row.party { grid-template-columns: 40px 44px 1fr repeat(2, auto); }
.rules ul { padding-left: 0; list-style: none; margin: 0 0 16px; }
.rules li { margin: 7px 0; color: #ddd8ff; font-size: 14.5px; line-height: 1.35; }

/* ---------- HUD ---------- */
#screen-game { overflow: hidden; background: #8fd3ff; }
#board-container { position: absolute; inset: 0; }
#board-container canvas { display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none; }
.pill { background: rgba(27,20,64,.82); border: 2px solid rgba(255,255,255,.18); padding: 8px 16px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: 17px; box-shadow: var(--shadow); white-space: nowrap; }
.pill.last { background: linear-gradient(90deg, #ff4d5e, #ff8a3d); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

#hud-players { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; width: 250px; pointer-events: none; }
.hp-card {
  display: grid; grid-template-columns: 48px 1fr; gap: 4px 10px; align-items: center;
  background: rgba(27,20,64,.82); border-radius: 14px; padding: 8px 10px; border: 2px solid rgba(255,255,255,.1);
  box-shadow: 0 6px 16px rgba(0,0,0,.3); transition: transform .25s, border-color .25s; position: relative; pointer-events: auto;
}
.hp-card.turn { border-color: var(--primary); transform: translateX(8px); box-shadow: 0 0 0 3px rgba(255,201,51,.25), 0 6px 16px rgba(0,0,0,.3); }
.hp-card.offline { opacity: .6; }
.hp-card canvas { width: 48px; height: 52px; grid-row: span 2; }
.hp-card .row1 { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; }
.hp-card .nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-card .stats { display: flex; gap: 8px; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.hp-card .row2 { display: flex; align-items: center; gap: 6px; }
.hpbar { flex: 1; height: 9px; background: rgba(0,0,0,.4); border-radius: 6px; overflow: hidden; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ff4d5e, #ff8a95); border-radius: 6px; transition: width .4s; }
.hpbar.ok i { background: linear-gradient(90deg, #33d17a, #8ff0b8); }
.hpbar.mid i { background: linear-gradient(90deg, #ffb933, #ffe066); }
.hptxt { font-size: 11px; font-weight: 800; color: var(--muted); min-width: 34px; text-align: right; }
.items-mini { display: flex; gap: 2px; font-size: 14px; min-width: 50px; justify-content: flex-end; }
.items-mini span { width: 18px; text-align: center; }
.hp-card .order { position: absolute; left: -8px; top: -8px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #1b1440; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.hp-card .flash-good { animation: flashG .8s; }
@keyframes flashG { 30% { color: var(--good); transform: scale(1.3); } }
.stat-bump { animation: bump .6s; display: inline-block; }
@keyframes bump { 30% { transform: scale(1.5); color: var(--primary); } }

#hud-banner { position: absolute; top: 26%; left: 0; right: 0; text-align: center; pointer-events: none; }
.banner {
  display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: clamp(34px, 6vw, 64px);
  color: #fff; text-shadow: 0 5px 0 #7a2a9a, 0 10px 24px rgba(0,0,0,.45); padding: 0 20px;
  animation: bannerIn .5s cubic-bezier(.2,1.6,.4,1), bannerOut .4s ease-in forwards; animation-delay: 0s, var(--out, 1.8s);
}
.banner small { display: block; font-size: .42em; font-weight: 600; color: #ffe8a8; text-shadow: 0 3px 0 #7a2a9a; margin-top: 6px; }
.banner.gold { color: var(--primary); }
.banner.red { color: #ff8a95; }
@keyframes bannerIn { from { transform: scale(.3) rotate(-8deg); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bannerOut { to { transform: scale(1.3); opacity: 0; } }

#hud-status { position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.status-chip { background: rgba(27,20,64,.85); border-radius: 999px; padding: 8px 18px 8px 10px; display: flex; align-items: center; gap: 10px; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }
.status-chip .dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; }
.timer-ring { width: 26px; height: 26px; }

#hud-actions { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 20px); }
.action-roll { font-size: 26px; padding: 18px 34px; animation: rollPulse 1.4s ease-in-out infinite; }
@keyframes rollPulse { 50% { transform: translateY(-4px) scale(1.04); } }
.item-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: rgba(27,20,64,.9); color: #fff; border: 2px solid rgba(255,255,255,.2); border-radius: 14px; padding: 8px 12px; cursor: pointer; font-family: var(--font-display); min-width: 86px; box-shadow: 0 5px 0 rgba(0,0,0,.3); transition: transform .12s; }
.item-btn:hover { transform: translateY(-3px); border-color: var(--primary); }
.item-btn .ic { font-size: 26px; }
.item-btn .nm { font-size: 12px; }
.action-label { width: 100%; text-align: center; font-family: var(--font-display); font-size: 15px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.6); margin-bottom: 2px; }

#hud-log { position: absolute; left: 12px; bottom: 12px; width: 300px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.log-line { background: rgba(27,20,64,.7); padding: 5px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; animation: logIn .3s; }
.log-line b { font-weight: 800; }
@keyframes logIn { from { transform: translateX(-20px); opacity: 0; } }

#hud-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center; }
.tool-btn { width: 46px; height: 46px; border-radius: 14px; border: 2px solid rgba(255,255,255,.2); background: rgba(27,20,64,.85); color: #fff; font-size: 22px; cursor: pointer; }
.tool-btn.on { border-color: var(--primary); }

#tile-tip { position: absolute; pointer-events: none; background: rgba(27,20,64,.92); padding: 8px 12px; border-radius: 10px; font-size: 13px; max-width: 220px; border: 1px solid rgba(255,255,255,.2); transform: translate(12px, 12px); }
#tile-tip b { font-family: var(--font-display); font-size: 15px; display: block; }

/* 3D-Labels */
.token-label { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: #fff; padding: 2px 8px; border-radius: 8px; background: rgba(27,20,64,.75); white-space: nowrap; transform: translateY(-4px); pointer-events: none; }
.token-label.turn { background: var(--primary); color: #1b1440; }
/* Lebendiges Brett: Bank, Glücksrad, Duelle */
.bank-label { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #fff; padding: 3px 10px; border-radius: 10px; background: linear-gradient(180deg, #14b8a6, #0d8a7c); border: 2px solid rgba(255,255,255,.6); box-shadow: 0 3px 0 rgba(0,0,0,.25); white-space: nowrap; pointer-events: none; }
.bank-label b { color: #ffe066; }
.bank-label.pulse { animation: bankPulse .6s cubic-bezier(.2,1.8,.4,1); }
@keyframes bankPulse { 40% { transform: scale(1.35); } }
#hud-wheel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.wheel-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 18px 16px; border-radius: 22px; background: linear-gradient(180deg, rgba(51,40,122,.95), rgba(33,25,84,.95)); border: 2px solid rgba(255,255,255,.2); box-shadow: 0 20px 50px rgba(0,0,0,.45); animation: popIn .4s cubic-bezier(.2,1.5,.4,1); }
.wheel-card.out, .vs-card.out { animation: popOut .35s ease-in forwards; }
@keyframes popOut { to { transform: scale(.7); opacity: 0; } }
.wheel-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--primary); text-align: center; line-height: 1.1; }
.wheel-title small { display: block; font-size: 15px; }
.wheel-wrap { position: relative; }
.wheel-wrap canvas { display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.wheel-ptr { position: absolute; top: -6px; left: 50%; width: 0; height: 0; margin-left: -14px; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid #ff4d5e; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); z-index: 1; }
.wheel-result { min-height: 34px; padding: 4px 16px; border-radius: 999px; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; text-shadow: 0 2px 2px rgba(0,0,0,.4); }
.wheel-card.done .wheel-result { animation: popIn .4s cubic-bezier(.2,1.8,.4,1); }
.vs-card { display: flex; align-items: center; gap: 18px; padding: 18px 26px; border-radius: 26px; background: radial-gradient(circle at 50% 50%, rgba(255,77,94,.35), transparent 60%), linear-gradient(180deg, rgba(51,40,122,.96), rgba(33,25,84,.96)); border: 2px solid rgba(255,255,255,.22); box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: popIn .45s cubic-bezier(.2,1.5,.4,1); }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--font-display); font-size: 22px; }
.vs-side canvas { width: 110px; height: 121px; }
.vs-side.l { animation: vsL .5s cubic-bezier(.2,1.4,.4,1); }
.vs-side.r { animation: vsR .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes vsL { from { transform: translateX(-80px); opacity: 0; } }
@keyframes vsR { from { transform: translateX(80px); opacity: 0; } }
.vs-mid { text-align: center; }
.vs { font-family: var(--font-display); font-size: 64px; font-weight: 700; color: var(--primary); text-shadow: 0 5px 0 #b3261e, 0 0 30px rgba(255,120,60,.6); animation: vsPulse .8s ease-in-out infinite; }
@keyframes vsPulse { 50% { transform: scale(1.12) rotate(-4deg); } }
.vs-stake { font-weight: 800; color: #ffe8a8; }
.vs-mg { margin-top: 4px; font-family: var(--font-display); font-size: 17px; }
#hud-duel { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.duel-live { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: rgba(27,20,64,.88); border: 2px solid rgba(255,77,94,.7); font-family: var(--font-display); font-size: 17px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: popIn .35s cubic-bezier(.2,1.5,.4,1); }
.duel-live .lv { color: #ff4d5e; font-size: 13px; animation: blink 1s steps(2) infinite; }
.duel-live .mg { color: var(--muted); font-size: 14px; margin-left: 4px; }
@keyframes blink { 50% { opacity: .2; } }
.target-btn.sel { border-color: var(--primary); background: rgba(255,201,51,.16); }
.duel-stakes { margin: 6px 0 12px; }
.final-badge.duel { background: linear-gradient(90deg, #ff4d5e, #a06bff); }
.res-row .rw.neg { color: #ff8a95; }

.float-text { font-family: var(--font-display); font-weight: 700; font-size: 26px; text-shadow: 0 3px 0 rgba(0,0,0,.45), 0 0 12px rgba(0,0,0,.4); pointer-events: none; animation: floatUp 1.6s ease-out forwards; white-space: nowrap; }
.float-text.good { color: #7ef0ae; }
.float-text.bad { color: #ff8a95; }
.float-text.gold { color: #ffe066; }
.float-text.big { font-size: 40px; }
@keyframes floatUp { 0% { transform: translateY(10px) scale(.5); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-60px) scale(1); opacity: 0; } }
.branch-label { background: var(--primary); color: #1b1440; font-family: var(--font-display); font-weight: 700; padding: 6px 12px; border-radius: 10px; cursor: pointer; pointer-events: auto; box-shadow: 0 4px 0 rgba(0,0,0,.3); font-size: 15px; }

/* ---------- Modals ---------- */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-back { position: absolute; inset: 0; background: rgba(10,6,35,.55); display: flex; align-items: center; justify-content: center; pointer-events: auto; animation: fadeIn .2s; padding: 16px; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { background: linear-gradient(180deg, #33287a, #251c5c); border: 2px solid rgba(255,255,255,.18); border-radius: 22px; padding: 22px; min-width: 300px; max-width: 640px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: popIn .3s cubic-bezier(.2,1.5,.4,1); max-height: calc(100vh - 32px); overflow: auto; }
.modal h3 { font-family: var(--font-display); font-size: 26px; margin: 0 0 6px; text-align: center; }
.modal p { text-align: center; color: var(--muted); margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.shop-item { background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.12); border-radius: 14px; padding: 10px; cursor: pointer; text-align: left; color: #fff; display: grid; grid-template-columns: 40px 1fr; gap: 2px 8px; transition: transform .12s, border-color .12s; font-family: var(--font); }
.shop-item:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.shop-item:disabled { opacity: .4; cursor: not-allowed; }
.shop-item .ic { font-size: 30px; grid-row: span 3; align-self: center; text-align: center; }
.shop-item .nm { font-family: var(--font-display); font-weight: 600; }
.shop-item .ds { font-size: 12px; color: var(--muted); line-height: 1.25; }
.shop-item .pr { font-weight: 800; color: var(--primary); }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.target-btn { background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.12); border-radius: 14px; padding: 8px; cursor: pointer; color: #fff; text-align: center; font-family: var(--font); transition: transform .12s, border-color .12s; }
.target-btn:hover { transform: translateY(-3px); border-color: var(--danger); }
.target-btn canvas { width: 70px; height: 77px; }
.target-btn .nm { font-family: var(--font-display); font-weight: 600; }
.target-btn .st { font-size: 13px; color: var(--muted); font-weight: 700; }
.modal-timer { height: 6px; background: rgba(0,0,0,.3); border-radius: 4px; overflow: hidden; margin-top: 16px; }
.modal-timer i { display: block; height: 100%; background: var(--primary); transform-origin: left; }
.big-emoji { font-size: 64px; text-align: center; display: block; animation: wobble 2s infinite; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 60; pointer-events: none; }
.toast { background: rgba(27,20,64,.95); border: 2px solid rgba(255,255,255,.2); padding: 10px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); animation: toastIn .3s cubic-bezier(.2,1.5,.4,1); max-width: 90vw; text-align: center; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }
#conn-status { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--danger); padding: 10px 18px; border-radius: 12px; font-weight: 800; z-index: 70; }

/* ---------- Minispiele ---------- */
#screen-mg { background: #140e33; overflow: hidden; z-index: 20; }
#mg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mg-ui { position: absolute; inset: 0; pointer-events: none; }
#mg-ui > * { pointer-events: auto; }
#mg-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
#mg-overlay > * { pointer-events: auto; }
/* Karten über hellen Minispielen (z. B. Schnee) lesbar halten */
#mg-overlay > .card { background: linear-gradient(180deg, rgba(51,40,122,.95), rgba(33,25,84,.95)); border-color: rgba(255,255,255,.18); }
.mg-intro { width: min(640px, calc(100vw - 32px)); text-align: center; animation: popIn .4s cubic-bezier(.2,1.4,.4,1); }
.mg-intro .mg-icon { font-size: 80px; display: block; animation: wobble 2s infinite; }
.mg-intro h2 { font-family: var(--font-display); font-size: 44px; margin: 4px 0 8px; color: var(--primary); text-shadow: 0 4px 0 #7a2a9a; }
.mg-intro .desc { font-size: 18px; line-height: 1.4; margin: 0 0 14px; }
.mg-intro .controls { background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px 14px; font-weight: 700; color: #ffe8a8; margin-bottom: 16px; }
.ready-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.ready-chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 800; }
.ready-chip .d { width: 20px; height: 20px; border-radius: 50%; }
.ready-chip.ok { background: rgba(51,209,122,.3); }
.countdown { font-family: var(--font-display); font-size: 160px; font-weight: 700; color: #fff; text-shadow: 0 8px 0 #7a2a9a, 0 16px 40px rgba(0,0,0,.5); animation: cd .9s ease-out forwards; pointer-events: none !important; }
.countdown.go { color: var(--primary); }
@keyframes cd { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.7); opacity: 0; } }
.mg-results { width: min(560px, calc(100vw - 32px)); animation: popIn .4s cubic-bezier(.2,1.4,.4,1); }
.mg-results h2 { font-family: var(--font-display); text-align: center; margin: 0 0 14px; font-size: 34px; color: var(--primary); }
.res-row { display: grid; grid-template-columns: 44px 52px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 14px; background: rgba(255,255,255,.06); margin-bottom: 8px; animation: slideIn .4s backwards; }
.res-row.me { background: rgba(255,201,51,.18); }
.res-row .pl { font-family: var(--font-display); font-size: 26px; font-weight: 700; text-align: center; }
.res-row canvas { width: 48px; height: 52px; }
.res-row .nm { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.res-row .rw { font-weight: 800; font-size: 20px; color: var(--primary); }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }
.mg-hud { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none !important; }

/* Touch-Steuerung */
#mg-touch { position: absolute; inset: 0; pointer-events: none; }
.joy { position: absolute; left: 24px; bottom: 24px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.1); border: 3px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(255,255,255,.55); }
.act-btn { position: absolute; right: 28px; bottom: 36px; width: 120px; height: 120px; border-radius: 50%; border: 4px solid rgba(255,255,255,.4); background: rgba(255,201,51,.75); font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #1b1440; pointer-events: auto; touch-action: none; }
.act-btn.big { width: 100%; height: 34%; right: 0; bottom: 0; border-radius: 0; background: rgba(255,201,51,.12); border: none; border-top: 3px dashed rgba(255,201,51,.4); color: rgba(255,255,255,.7); font-size: 26px; }
.act-btn:active { transform: scale(.94); filter: brightness(1.2); }
.dirpad { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 84px); grid-template-rows: repeat(2, 84px); gap: 8px; pointer-events: auto; }
.dirpad button { border-radius: 18px; border: 3px solid rgba(255,255,255,.3); font-size: 38px; color: #fff; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.3); }
.dirpad button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.quiz-opts { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; grid-template-columns: repeat(2, minmax(150px, 240px)); gap: 12px; pointer-events: auto; }
.quiz-opts button { font-family: var(--font-display); font-size: 32px; font-weight: 700; padding: 18px; border-radius: 18px; border: 3px solid rgba(255,255,255,.3); color: #fff; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.3); }
.quiz-opts button small { font-size: 14px; opacity: .7; margin-right: 6px; vertical-align: middle; }
.quiz-opts button.picked { outline: 4px solid #fff; }
.quiz-opts button.right { background: var(--good) !important; }
.quiz-opts button.wrong { background: var(--danger) !important; opacity: .7; }
.quiz-opts button:disabled { cursor: default; }

/* ---------- Ende ---------- */
#screen-end { z-index: 25; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.end-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 40px; position: relative; }
.end-title { font-family: var(--font-display); text-align: center; font-size: clamp(34px, 6vw, 54px); margin: 6px 0 20px; color: var(--primary); text-shadow: 0 5px 0 #7a2a9a; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-bottom: 24px; min-height: 330px; }
.pod { display: flex; flex-direction: column; align-items: center; width: 170px; animation: rise .8s cubic-bezier(.2,1.3,.4,1) backwards; }
.pod canvas { width: 130px; height: 143px; }
.pod .nm { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 4px 0; text-align: center; }
.pod .sc { font-weight: 800; margin-bottom: 6px; }
.pod .blk { width: 100%; border-radius: 14px 14px 0 0; display: flex; align-items: flex-start; justify-content: center; font-family: var(--font-display); font-size: 48px; font-weight: 700; padding-top: 8px; color: rgba(0,0,0,.35); box-shadow: inset 0 -10px 0 rgba(0,0,0,.15); }
.pod.p1 .blk { height: 150px; background: linear-gradient(180deg, #ffe066, #e6a100); }
.pod.p2 .blk { height: 105px; background: linear-gradient(180deg, #e6e9f5, #a4a9c2); }
.pod.p3 .blk { height: 75px; background: linear-gradient(180deg, #ffb07a, #c8692a); }
.pod.p1 { animation-delay: 1.2s; } .pod.p2 { animation-delay: .6s; } .pod.p3 { animation-delay: 0s; }
@keyframes rise { from { transform: translateY(80px); opacity: 0; } }
.end-table { padding: 10px; }
.end-row { display: grid; grid-template-columns: 40px 44px 1fr repeat(4, auto); align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.end-row:nth-child(odd) { background: rgba(255,255,255,.04); }
.end-row canvas { width: 40px; height: 44px; }
.end-row .pl { font-family: var(--font-display); font-weight: 700; font-size: 22px; text-align: center; }
.end-row .nm { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.end-row .v { font-weight: 800; font-size: 14px; color: var(--muted); white-space: nowrap; }
.end-row .v b { color: #fff; font-size: 16px; }
.end-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .players-card { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 720px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .profile-editor { flex-direction: column; }
  .home-features { grid-template-columns: 1fr; }
  #hud-players { width: auto; right: 12px; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .hp-card { grid-template-columns: 30px 1fr; padding: 4px 6px; flex: 1 1 140px; }
  .hp-card canvas { width: 30px; height: 33px; }
  .hp-card.turn { transform: none; }
  .hp-card .nm { font-size: 12px; }
  .hp-card .stats { font-size: 12px; gap: 4px; }
  .items-mini { display: none; }
  #hud-top { top: auto; bottom: 64px; left: 12px; transform: none; }
  #hud-top .pill { font-size: 13px; padding: 5px 10px; }
  #hud-actions { bottom: 104px; }
  #hud-status { bottom: 170px; }
  .action-roll { font-size: 22px; padding: 14px 26px; }
  .item-btn { min-width: 70px; padding: 6px 8px; }
  #hud-tools { right: 8px; bottom: 8px; gap: 4px; }
  .tool-btn { width: 38px; height: 38px; font-size: 18px; }
  #hud-log { display: none; }
  .end-row { grid-template-columns: 30px 36px 1fr auto auto; }
  .end-row .v.opt { display: none; }
  .pod { width: 110px; }
  .pod canvas { width: 90px; height: 99px; }
  .dirpad { grid-template-columns: repeat(3, 70px); grid-template-rows: repeat(2, 70px); }
  .quiz-opts { grid-template-columns: repeat(2, 1fr); width: calc(100vw - 24px); }
}
.rotate-hint { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); background: rgba(20,14,51,.85); padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; white-space: nowrap; animation: toastIn .3s; pointer-events: none; }

/* ---------- Chat & Emotes (social.js) ---------- */
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
#social { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
#social > * { pointer-events: auto; }
#social-dock { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; }
body[data-social="game"] #social-dock { right: 12px; bottom: 68px; }
body[data-social="mg"] #social-dock { top: 60px; right: 10px; bottom: auto; flex-direction: column; }
.soc-btn {
  position: relative; width: 52px; height: 52px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); padding: 0;
  background: radial-gradient(circle at 35% 30%, #4d3cae, #241a5c); color: #fff; font-size: 26px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.3), 0 8px 20px rgba(0,0,0,.35); display: grid; place-items: center;
  transition: transform .15s cubic-bezier(.2,1.6,.4,1), border-color .15s;
}
.soc-btn .ic { line-height: 1; pointer-events: none; }
.soc-btn:hover { transform: translateY(-2px) scale(1.07); border-color: var(--primary); }
.soc-btn:active { transform: translateY(2px) scale(.95); }
.soc-btn.on { border-color: var(--primary); background: radial-gradient(circle at 35% 30%, #6a55d8, #33287a); }
.soc-btn.ping { animation: socPing .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes socPing { 30% { transform: scale(1.2) rotate(-10deg); } 60% { transform: scale(.95) rotate(6deg); } }
.soc-badge {
  position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--danger); color: #fff; font: 800 12px/18px var(--font); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  animation: popIn .3s cubic-bezier(.2,1.6,.4,1);
}
.soc-btn .cd { position: absolute; inset: -3px; border-radius: 50%; pointer-events: none; }
.soc-btn.cool .cd { background: conic-gradient(rgba(20,14,51,.6) var(--p), transparent 0); animation: cool .7s linear forwards; }
@keyframes cool { from { --p: 100%; } to { --p: 0%; } }

/* Einblendungen neuer Nachrichten */
#chat-feed { position: absolute; right: 16px; bottom: 80px; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
body[data-social="game"] #chat-feed { right: 12px; bottom: 130px; }
body[data-social="mg"] #chat-feed { top: 60px; bottom: auto; right: 72px; }
.ctoast {
  pointer-events: auto; cursor: pointer; max-width: 100%; background: rgba(20,14,51,.66);
  border-left: 4px solid var(--c, #fff); padding: 7px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; line-height: 1.3; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: ctIn .35s cubic-bezier(.2,1.5,.4,1); overflow-wrap: anywhere; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.ctoast b { font-family: var(--font-display); font-weight: 600; }
.ctoast.sys { border-left-color: rgba(255,255,255,.35); color: #ddd8ff; font-style: italic; font-size: 13px; }
.ctoast.out { animation: ctOut .45s forwards; }
@keyframes ctIn { from { transform: translateX(30px) scale(.9); opacity: 0; } }
@keyframes ctOut { to { transform: translateX(24px); opacity: 0; } }

/* Chat-Panel */
#chat-panel {
  position: absolute; right: 16px; bottom: 80px; width: min(360px, calc(100vw - 32px)); height: min(420px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: rgba(27,20,64,.95); border: 2px solid rgba(255,255,255,.18); border-radius: 18px;
  box-shadow: 0 16px 44px rgba(0,0,0,.5); overflow: hidden; animation: panelIn .25s cubic-bezier(.2,1.4,.4,1); transform-origin: bottom right;
}
body[data-social="game"] #chat-panel { right: 12px; bottom: 130px; height: min(400px, calc(100vh - 200px)); }
body[data-social="mg"] #chat-panel { top: 60px; bottom: auto; right: 72px; transform-origin: top right; height: min(380px, calc(100vh - 80px)); }
@keyframes panelIn { from { transform: scale(.85) translateY(10px); opacity: 0; } }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-bottom: 1px solid rgba(255,255,255,.1); font-family: var(--font-display); font-size: 17px; }
.chat-hint { flex: 1; font: 700 11px var(--font); color: var(--muted); text-align: right; }
.chat-x { width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: 14px; flex-shrink: 0; }
.chat-x:hover { background: rgba(255,255,255,.2); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; user-select: text; -webkit-user-select: text; overscroll-behavior: contain; }
.cm { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; padding: 3px 8px; border-radius: 10px; animation: logIn .25s; }
.cm.own { background: rgba(255,201,51,.1); }
.cm-t { font-size: 10.5px; color: rgba(185,177,230,.65); margin-right: 6px; font-weight: 700; }
.cm-n { font-family: var(--font-display); font-weight: 600; margin-right: 6px; }
.cm-n::after { content: ':'; color: rgba(255,255,255,.45); }
.cm.sys { color: var(--muted); font-style: italic; font-size: 12.5px; }
.cm.empty { text-align: center; margin: auto 0; font-size: 14px; }
.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; flex-shrink: 0; border-top: 1px solid rgba(255,255,255,.06); }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick button, .wheel-quick button {
  flex-shrink: 0; border: 2px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; font: 700 13px var(--font);
  padding: 5px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: transform .12s, background .12s, border-color .12s;
}
.chat-quick button:hover, .wheel-quick button:hover { background: rgba(255,201,51,.22); border-color: var(--primary); transform: translateY(-1px); }
.chat-err { color: #ff8a95; font-size: 12.5px; font-weight: 800; padding: 2px 14px 0; }
.chat-err:empty { display: none; }
.chat-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px 10px; position: relative; flex-shrink: 0; }
.chat-input {
  flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.28);
  color: #fff; font: 700 16px var(--font); padding: 0 40px 0 12px; outline: none;
}
.chat-input::placeholder { color: rgba(185,177,230,.7); }
.chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,201,51,.18); }
.chat-count { position: absolute; right: 68px; font-size: 11px; font-weight: 800; color: var(--muted); pointer-events: none; }
.chat-send { width: 44px; height: 44px; border-radius: 12px; border: none; background: linear-gradient(180deg, #ffe066, var(--primary)); color: #1b1440; font-size: 20px; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.25); flex-shrink: 0; }
.chat-send:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }

/* Emote-Rad */
#emote-wheel { position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(10,6,35,.6), rgba(10,6,35,.3)); display: flex; align-items: center; justify-content: center; animation: fadeIn .15s; padding: 10px; }
.wheel-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.wheel {
  --R: 116px; position: relative; width: 306px; height: 306px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle, rgba(77,60,174,.97) 0 33%, rgba(27,20,64,.94) 34% 100%);
  border: 3px solid rgba(255,255,255,.2); box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 0 0 10px rgba(255,255,255,.04);
  animation: wheelIn .32s cubic-bezier(.2,1.5,.4,1);
}
.wheel-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.wheel-center .big { display: block; font-size: 50px; line-height: 1; animation: wob 1.2s ease-in-out infinite; }
.wheel-center small { display: block; font-weight: 800; font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.wheel-btn {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); cursor: pointer;
  transform: translate(calc(var(--x) * var(--R)), calc(var(--y) * var(--R)));
  animation: wbIn .38s cubic-bezier(.2,1.6,.4,1) backwards; animation-delay: var(--d); transition: background .12s, border-color .12s;
}
.wheel-btn .em { font-size: 32px; line-height: 1; display: block; transition: transform .15s cubic-bezier(.2,1.6,.4,1); pointer-events: none; }
.wheel-btn:hover, .wheel-btn:focus-visible { background: rgba(255,201,51,.3); border-color: var(--primary); outline: none; }
.wheel-btn:hover .em { transform: scale(1.3) rotate(-8deg); }
.wheel-btn:active .em { transform: scale(.9); }
.wheel-btn small { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: #1b1440; font: 800 11px/18px var(--font); pointer-events: none; }
@keyframes wbIn { from { transform: translate(0, 0) scale(.2); opacity: 0; } }
@keyframes wheelIn { from { transform: scale(.6) rotate(-20deg); opacity: 0; } }
@keyframes wob { 50% { transform: rotate(9deg) scale(1.08); } }
.wheel-quick { display: flex; flex-direction: column; gap: 7px; background: rgba(27,20,64,.94); border: 2px solid rgba(255,255,255,.16); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); animation: wheelIn .32s .05s cubic-bezier(.2,1.5,.4,1) backwards; }
.wq-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.wheel-quick button { font-size: 14px; padding: 7px 14px; text-align: left; }

/* Emote-Karten mit Avatar (Lobby-Fallback, Minispiele ohne Figuren, Siegerehrung) */
#emote-feed { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.ef {
  position: relative; display: flex; align-items: center; gap: 8px; background: rgba(20,14,51,.82); border: 3px solid var(--c); border-radius: 999px;
  padding: 4px 12px 4px 4px; box-shadow: 0 8px 22px rgba(0,0,0,.35), 0 0 18px color-mix(in srgb, var(--c) 45%, transparent);
  animation: efIn .45s cubic-bezier(.2,1.6,.4,1); width: max-content;
}
.ef canvas { border-radius: 50%; background: rgba(255,255,255,.12); }
.ef-nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.ef-em { position: relative; font-size: 40px; line-height: 1; animation: efPop .6s .1s cubic-bezier(.2,1.8,.4,1) backwards, wob .9s .7s ease-in-out 2; }
.ef.out { animation: efOut .45s forwards; }
@keyframes efIn { from { transform: translateX(-120%) scale(.7); opacity: 0; } }
@keyframes efPop { from { transform: scale(0) rotate(-30deg); } }
@keyframes efOut { to { transform: translateX(-40px); opacity: 0; } }
.ef-burst span, .emote-bubble i {
  position: absolute; left: 50%; top: 50%; font-size: 18px; font-style: normal; line-height: 1; opacity: 0; pointer-events: none;
  animation: burst .9s ease-out forwards;
}
@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r, 0deg)); }
}

/* Blasen an den Lobby-Karten */
.card-bubble { position: absolute; left: 50%; z-index: 3; pointer-events: none; }
.card-bubble.cb-emote {
  top: -16px; width: 70px; height: 70px; margin-left: -35px; display: grid; place-items: center; font-size: 42px; line-height: 1;
  background: #fff; border: 4px solid var(--c); border-radius: 50%; box-shadow: 0 8px 20px rgba(0,0,0,.4); animation: bubLife 2.8s ease-out forwards;
}
.card-bubble.cb-chat {
  top: -24px; transform: translateX(-50%); width: max-content; max-width: 190px; background: #fff; color: #1b1440; border: 3px solid var(--c);
  border-radius: 14px; padding: 5px 10px; font-weight: 800; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.35); animation: chatLifeX 5.5s ease-out forwards;
}

/* Blasen über den Figuren auf dem Brett (CSS2D) */
.bubble-stack { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding-bottom: 14px; }
.emote-bubble {
  position: relative; width: 66px; height: 66px; border-radius: 50%; background: #fff; border: 4px solid var(--c, #fff);
  box-shadow: 0 6px 16px rgba(0,0,0,.4), 0 0 22px color-mix(in srgb, var(--c, #fff) 55%, transparent);
  display: grid; place-items: center; transform-origin: 50% 100%; animation: bubLife 2.9s ease-out forwards;
}
.emote-bubble::after, .chat-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -11px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: var(--c, #fff);
}
.chat-bubble .t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.emote-bubble .em { font-size: 40px; line-height: 1; display: block; animation: wobble 1s .3s ease-in-out 2; }
.chat-bubble {
  position: relative; width: max-content; max-width: 230px; background: #fff; color: #1b1440; border: 3px solid var(--c, #fff); border-radius: 14px;
  padding: 6px 12px; font: 800 14px/1.3 var(--font); text-align: center; overflow-wrap: anywhere; box-shadow: 0 6px 16px rgba(0,0,0,.35);
  transform-origin: 50% 100%; animation: chatLife 5.6s ease-out forwards;
}
@keyframes bubLife {
  0% { transform: scale(0) translateY(16px); opacity: 0; }
  10% { transform: scale(1.28) translateY(-4px); opacity: 1; }
  17% { transform: scale(.92); }
  24% { transform: scale(1.05); }
  30%, 84% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.8) translateY(-24px); opacity: 0; }
}
@keyframes chatLife {
  0% { transform: scale(.3) translateY(10px); opacity: 0; }
  5% { transform: scale(1.1); opacity: 1; }
  9%, 92% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: translateY(-14px); opacity: 0; }
}
@keyframes chatLifeX {
  0% { transform: translateX(-50%) scale(.3); opacity: 0; }
  5% { transform: translateX(-50%) scale(1.1); opacity: 1; }
  9%, 92% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-12px); opacity: 0; }
}
@keyframes wobble { 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(12deg) scale(1.05); } }

/* Handy quer (wenig Höhe) */
@media (max-height: 520px) {
  .mg-intro { max-height: calc(100vh - 16px); overflow-y: auto; padding: 12px 18px; }
  .vs-card { padding: 10px 16px; gap: 10px; }
  .vs-side canvas { width: 70px; height: 77px; }
  .vs-side { font-size: 16px; }
  .vs { font-size: 42px; }
  .wheel-card { padding: 8px 12px 10px; gap: 4px; }
  .wheel-title { font-size: 18px; }
  #hud-duel { top: 50px; }
  .duel-live { font-size: 14px; padding: 5px 12px; }
  .mg-intro .mg-icon { font-size: 40px; }
  .mg-intro h2 { font-size: 28px; margin: 0 0 4px; }
  .mg-intro .desc { font-size: 14px; line-height: 1.3; margin: 0 0 8px; }
  .mg-intro .controls { padding: 6px 10px; margin-bottom: 8px; font-size: 13px; }
  .mg-intro .btn-big { padding: 10px 22px; font-size: 18px; }
  .ready-row { margin-bottom: 8px; gap: 4px; }
  .ready-chip { font-size: 11px; padding: 2px 8px 2px 2px; }
  .mg-results { max-height: calc(100vh - 16px); overflow-y: auto; }
  .mg-vote, .mg-standings { padding: 10px 14px; max-height: calc(100vh - 12px); width: min(760px, calc(100vw - 130px)); margin-right: 40px; }
  .mg-vote h2, .mg-standings h2 { font-size: 24px; }
  .mg-vote .sub, .mg-standings .sub { font-size: 13px; margin-bottom: 8px; }
  .vote-card { padding: 10px 6px 8px; }
  .vote-card .vi { font-size: 32px; }
  .vote-card b { font-size: 15px; }
  .vote-card small { -webkit-line-clamp: 2; font-size: 11px; }
  .stand-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
  .stand-row { grid-template-columns: 26px 30px 1fr auto; padding: 3px 8px; gap: 6px; }
  .stand-row canvas { width: 28px; height: 31px; }
  .stand-row .pl { font-size: 16px; }
  .stand-row .nm { font-size: 14px; }
  .stand-row .pts { font-size: 16px; min-width: 64px; }
  .sbar { height: 6px; }
  .stand-foot { margin-top: 8px; font-size: 15px; }
  .soc-btn { width: 44px; height: 44px; font-size: 21px; }
  /* Dock senkrecht am rechten Rand, Panel und Einblendungen links daneben */
  #social-dock { gap: 6px; flex-direction: column; right: 10px; bottom: 12px; }
  body[data-social="mg"] #social-dock { top: 52px; right: 8px; }
  body[data-social="game"] #social-dock { bottom: 64px; right: 10px; }
  #chat-feed { width: min(260px, calc(100vw - 90px)); right: 64px; bottom: 12px; }
  body[data-social="game"] #chat-feed { right: 64px; bottom: 64px; }
  body[data-social="mg"] #chat-feed { top: 52px; right: 60px; }
  .ctoast { font-size: 13px; padding: 5px 10px; }
  #chat-panel, body[data-social] #chat-panel {
    top: calc(var(--vvt, 0px) + 8px); bottom: auto; right: 64px; height: min(370px, calc(var(--vvh, 100vh) - 16px)); transform-origin: top right;
  }
  .chat-head { padding: 5px 8px 5px 12px; font-size: 15px; }
  .chat-row { padding: 6px 8px 8px; }
  .wheel { --R: 96px; width: 256px; height: 256px; }
  .wheel-btn { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .wheel-btn .em { font-size: 28px; }
  .wheel-center .big { font-size: 40px; }
  .wheel-quick { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; gap: 6px; }
  .wq-title { grid-column: 1 / -1; }
  .wheel-quick button { font-size: 13px; padding: 6px 10px; }
  .ef-em { font-size: 34px; }
  .card-bubble.cb-emote { width: 58px; height: 58px; margin-left: -29px; font-size: 34px; }
}
/* Handy hoch (schmal) */
@media (max-width: 560px) {
  .vote-opts { grid-template-columns: 1fr; }
  .vote-card { flex-direction: row; flex-wrap: wrap; text-align: left; padding: 10px 12px 10px 30px; }
  .vote-card small { display: none; }
  .vote-card .voters { margin: 0 0 0 auto; }
  .mg-vote h2, .mg-standings h2 { font-size: 28px; }
  #chat-panel, body[data-social] #chat-panel {
    left: 8px; right: 8px; width: auto; top: calc(var(--vvt, 0px) + 8px); bottom: auto; height: min(440px, calc(var(--vvh, 100vh) - 16px)); transform-origin: top center;
  }
  body[data-social="game"] #social-dock { bottom: 52px; right: 8px; }
  .wheel-wrap { flex-direction: column; gap: 12px; }
  .wheel-quick { display: grid; grid-template-columns: 1fr 1fr; width: min(330px, calc(100vw - 20px)); }
  .wq-title { grid-column: 1 / -1; }
  .wheel-quick button { white-space: normal; }
}
@media (pointer: coarse) { .wheel-btn small { display: none; } }
