* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #f0c95c;
  --panel: rgba(14, 18, 28, 0.58);
  --panel-border: rgba(240, 201, 92, 0.30);
  --text: #e8e2d0;
}

/* frosted-glass chrome */
.panel, #heroPanel, #topbar, #shop, #wavePreview, #chatInput, #towerPanel {
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
}
.panel, #heroPanel, #towerPanel {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

html, body {
  /* fest am sichtbaren Viewport verankert — Android-Chrome machte die Seite sonst
     scrollbar (Adressleiste blähte die Höhe auf) und man musste erst runterscrollen */
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #0b0e14;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  user-select: none;
}

#game {
  position: fixed;
  image-rendering: auto;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
}

/* die Lobby darf innerlich scrollen (12 Kartenkacheln), die Seite selbst nicht */
.overlay { touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#lobbyChatLog, #edCode, .credits-body { touch-action: pan-y; }

.hidden { display: none !important; }

/* ===== overlays & panels ===== */

.overlay {
  position: fixed; inset: 0;
  display: flex; justify-content: center;
  /* hohe Panels (12 Karten!) dürfen scrollen — margin:auto zentriert, ohne oben abzuschneiden */
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(20,28,44,0.75), rgba(5,7,12,0.92));
  z-index: 50;
}
.overlay .panel { margin: auto; }

/* Startseite: Key-Art-Szene als Hintergrund — dunkler Verlauf hält das Panel lesbar.
   Als fixierte ::before-Ebene statt background-attachment:fixed — iOS Safari kennt
   fixed-Attachment nicht und würde das Bild über die volle Scrollhöhe zerren. */
#lobby { background: none; }
#lobby::before {
  content: "";
  position: fixed; inset: 0;
  z-index: -1;   /* liegt über dem Element-Hintergrund, aber unter dem Panel */
  background:
    radial-gradient(ellipse at center, rgba(9,12,20,0.55), rgba(5,7,12,0.88)),
    url("assets/lobby-bg.jpg") center / cover no-repeat;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 28px 34px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
}

.lobby-panel { width: 720px; max-width: 94vw; text-align: center; }

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  color: var(--gold);
  text-shadow: 0 2px 12px rgba(240,201,92,0.35);
  margin-bottom: 4px;
}

.subtitle { color: #9aa3b5; margin-bottom: 22px; font-size: 14px; }

label { display: block; text-align: left; font-size: 12px; color: #9aa3b5; margin: 10px 0 4px; }

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a4358;
  background: #171c28;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
input:focus { border-color: var(--gold); }

.row { display: flex; gap: 10px; margin-top: 12px; }
.row > * { flex: 1; }
.join-row input { flex: 0 0 110px; text-transform: uppercase; text-align: center; letter-spacing: 3px; font-weight: 700; }

/* Zielprioritäts-Umschalter im Turm-Panel */
.aim-row { display: flex; align-items: center; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.aim-row .aim-label { font-size: 12px; color: #9aa5b6; margin-right: 2px; }
.aim-btn {
  flex: 1; min-width: 44px; padding: 4px 6px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.05); color: #c6cddc;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; cursor: pointer;
}
.aim-btn:hover { background: rgba(255,255,255,0.12); }
.aim-btn.active { background: var(--gold); color: #1a1207; border-color: var(--gold); font-weight: 800; }

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #3a4358;
  background: #232a3a;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: filter .1s, transform .05s;
}
button:hover { filter: brightness(1.25); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; filter: none; }

button.primary {
  background: linear-gradient(180deg, #b8912f, #8a6a1d);
  border-color: var(--gold);
  color: #fff8e0;
  font-weight: 700;
}
button.danger { background: #5b2020; border-color: #a04040; }
button.ghost { background: transparent; border-color: #3a4358; color: #9aa3b5; margin-top: 10px; }

.hint { font-size: 12px; color: #7d8699; margin-top: 10px; line-height: 1.5; }

.room-code-label { font-size: 13px; color: #9aa3b5; margin-bottom: 6px; }
.room-code {
  font-family: Consolas, monospace;
  font-size: 44px; font-weight: 800;
  letter-spacing: 12px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(240,201,92,0.5);
  margin-bottom: 8px;
}

#playerChips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 18px; }
.chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid #3a4358; background: #1a2030;
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip.host::after { content: "👑"; font-size: 12px; }

.sect-label {
  font-size: 12px; color: #9aa3b5;
  text-align: left; margin: 14px 0 6px;
  text-transform: uppercase; letter-spacing: 1px;
}
.host-note { text-transform: none; letter-spacing: 0; color: #6b7385; }

.pick-row { display: flex; gap: 8px; }
.pick {
  flex: 1;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid #3a4358;
  background: #171c28;
  cursor: pointer;
  text-align: center;
  transition: border-color .1s;
}
.pick:hover { border-color: #6b76a0; }
.pick.selected { border-color: var(--gold); box-shadow: 0 0 10px rgba(240,201,92,0.35); }
.pick.locked { cursor: default; opacity: 0.75; }
.pick.locked:hover { border-color: #3a4358; }
.pick .pi { font-size: 22px; display: block; }
.pick .pn { font-size: 12px; font-weight: 700; display: block; margin-top: 2px; }
.pick .pd { font-size: 10px; color: #8d96a8; display: block; margin-top: 2px; line-height: 1.35; }

.scores { margin-top: 16px; }
.score-row {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12px; color: #c6cddc;
  padding: 3px 6px; border-radius: 5px; text-align: left;
}
.score-row:nth-child(odd) { background: rgba(255,255,255,0.04); }
.score-row .sr-rank { color: var(--gold); font-weight: 800; width: 18px; }
.score-row .sr-wave { font-weight: 700; width: 68px; white-space: nowrap; }
.score-row .sr-names { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .sr-meta { color: #7d8699; font-size: 11px; white-space: nowrap; }

.speed-btn {
  padding: 5px 12px; font-size: 13px; font-weight: 700;
  background: #232a3a; border-color: #3a4358;
}
.speed-btn.fast {
  background: linear-gradient(180deg, #7a4a1d, #5e3512);
  border-color: #d0873c;
}

#wavePreview .wp-mod {
  color: #ff9a5c; font-weight: 800;
  border: 1px solid rgba(255,154,92,0.4);
  border-radius: 5px; padding: 1px 7px;
}

#wavePreview {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 16px;
  background: rgba(10,13,20,0.88);
  border: 1px solid rgba(240,201,92,0.3);
  border-radius: 12px;
  z-index: 19;
  font-size: 14px; color: #d3dae8;
  cursor: pointer;
  pointer-events: auto;
  max-width: min(92vw, 900px);
  transition: background 0.12s, border-color 0.12s;
}
#wavePreview:hover { background: rgba(16,21,32,0.95); border-color: rgba(240,201,92,0.55); }
#wavePreview .wp-head { display: flex; align-items: center; gap: 10px; }
#wavePreview .wp-title { color: var(--gold); font-weight: 700; font-size: 15px; }
#wavePreview .wp-toggle { color: #8b95a8; font-size: 11px; }
#wavePreview .wp-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
#wavePreview .wp-item { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
#wavePreview .wp-count { font-size: 15px; }
#wavePreview canvas { display: block; }

/* aufgeklappt: Steckbrief je Gegnertyp */
#wavePreview.wp-big { padding: 12px 18px; gap: 8px; }
#wavePreview.wp-big .wp-body { gap: 10px; align-items: stretch; }
#wavePreview.wp-big .wp-item {
  align-items: center; gap: 8px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 9px;
  padding: 8px 12px 8px 8px;
  max-width: 260px;
}
#wavePreview .wp-detail { display: flex; flex-direction: column; gap: 2px; text-align: left; }
#wavePreview .wp-name { font-size: 14px; color: #eef2f8; font-weight: 700; }
#wavePreview .wp-name b { color: var(--gold); }
#wavePreview .wp-stats { font-size: 11px; color: #9aa5b6; }
#wavePreview .wp-trait { font-size: 11px; color: #ffcf8a; line-height: 1.35; }

#lobbyChat { margin-top: 14px; }
#lobbyChatLog {
  max-height: 110px; min-height: 34px;
  overflow-y: auto;
  text-align: left;
  font-size: 12px; line-height: 1.5;
  padding: 6px 8px;
  background: rgba(10, 14, 22, 0.5);
  border: 1px solid #262e40;
  border-radius: 8px 8px 0 0;
}
#lobbyChatLog .sys { color: var(--gold); font-style: italic; }
#lobbyChatLog .taunt { color: #ffb9b0; }
#lobbyChatLog .taunt b { color: #ff6152; }
#lobbyChatInput { border-radius: 0 0 8px 8px; border-top: none; font-size: 13px; padding: 8px 10px; }

.howto {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid #262e40;
  font-size: 12px; color: #8d96a8; text-align: left; line-height: 1.7;
}
.ht-dim { color: #6b7488; }
.install-tip {
  margin-top: 14px; padding: 12px 14px;
  background: rgba(240,201,92,0.07);
  border: 1px solid rgba(240,201,92,0.28);
  border-radius: 10px;
  font-size: 12px; color: #a8b0c0; text-align: left; line-height: 1.65;
}
.install-tip > b:first-child { color: var(--gold); }
.inst-os { display: block; margin-top: 5px; }
.inst-os b { color: #cfe0ff; }
.inst-ic {
  display: inline-block; border: 1px solid #5a6478; border-radius: 4px;
  padding: 0 5px; font-size: 11px; line-height: 1.4; color: #cfe0ff;
}
kbd {
  background: #262e40; border: 1px solid #3a4358; border-bottom-width: 2px;
  border-radius: 4px; padding: 0 5px; font-size: 11px; color: var(--text);
}

/* ===== HUD ===== */

#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 44px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(10,13,20,0.95), rgba(10,13,20,0.78));
  border-bottom: 1px solid rgba(240,201,92,0.2);
  z-index: 20;
  font-size: 15px;
}
.stat { font-weight: 700; white-space: nowrap; }
.stat.gold { color: var(--gold); }
.stat.code {
  color: var(--gold); cursor: pointer;
  font-family: Consolas, monospace; letter-spacing: 2px;
  border: 1px solid rgba(240,201,92,0.35); border-radius: 6px;
  padding: 2px 8px; font-size: 13px;
}
.stat.code:hover { background: rgba(240,201,92,0.12); }
.spacer { flex: 1; }

.wave-btn {
  padding: 5px 14px; font-size: 13px; font-weight: 700;
  background: linear-gradient(180deg, #2e6b3a, #1d4726);
  border-color: #4a9c5c;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 14px rgba(90,200,120,0.5); } }

#playerBar { display: flex; gap: 12px; font-size: 13px; }
.pb-entry { display: inline-flex; align-items: center; gap: 5px; color: #c6cddc; }
.pb-entry .dot { width: 9px; height: 9px; border-radius: 50%; }

.icon-btn { padding: 4px 10px; font-size: 16px; background: transparent; border: none; }

/* ===== shop ===== */

#shop {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(0deg, rgba(10,13,20,0.95), rgba(10,13,20,0.8));
  border: 1px solid rgba(240,201,92,0.2); border-bottom: none;
  border-radius: 12px 12px 0 0;
  z-index: 20;
}
.card {
  width: 86px;
  padding: 6px 4px 5px;
  border-radius: 8px;
  border: 1px solid #3a4358;
  background: #171c28;
  text-align: center;
  cursor: pointer;
  transition: border-color .1s, transform .08s;
  position: relative;
}
.card:hover { border-color: #6b76a0; transform: translateY(-3px); }
.card.selected { border-color: var(--gold); box-shadow: 0 0 12px rgba(240,201,92,0.4); }
.card.poor { opacity: 0.45; }
.card canvas { display: block; margin: 0 auto; }
.card .cname { font-size: 11px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; }
.card .ccost { font-size: 12px; color: var(--gold); font-weight: 700; }
.card .hotkey {
  position: absolute; top: 3px; left: 5px;
  font-size: 10px; color: #7d8699;
  background: #262e40; border-radius: 3px; padding: 0 4px;
}

/* ===== tower panel ===== */

#towerPanel {
  position: fixed; right: 12px; bottom: 12px;
  width: 230px;
  padding: 14px 16px;
  z-index: 21;
}
#tpTitle { font-weight: 800; font-size: 16px; color: var(--gold); margin-bottom: 8px; }
#tpStats { font-size: 13px; line-height: 1.8; color: #c6cddc; margin-bottom: 10px; }
#towerPanel button { font-size: 13px; padding: 8px 10px; }

/* ===== Karten-Auswahl mit Vorschau ===== */

.map-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.map-grid .pick { display: flex; flex-direction: column; align-items: center; padding: 7px 6px; }
.mapthumb {
  width: 100%; height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 5px;
  image-rendering: pixelated;
}
.pick .pd.lanes { color: #9fc57a; }

/* ===== Live-Punkteübersicht (Multiplayer) ===== */

#scoreboard {
  position: fixed; right: 12px; top: 52px;
  width: 210px;
  z-index: 20;
  background: rgba(10,13,20,0.78);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px 6px;
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(10px);
}
#scoreboard .sb-title { font-weight: 800; color: var(--gold); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
#scoreboard .sb-row { position: relative; display: flex; align-items: center; gap: 5px; padding: 3px 2px 6px; }
#scoreboard .sb-row.me { background: rgba(240,201,92,0.07); border-radius: 5px; }
#scoreboard .sb-rank { color: #8d96a8; width: 15px; font-weight: 700; }
#scoreboard .sb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scoreboard .sb-val { font-weight: 800; color: #e8edf7; }
#scoreboard .sb-kills { color: #8d96a8; font-size: 11px; }
#scoreboard .sb-bar { position: absolute; left: 22px; right: 2px; bottom: 1px; height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
#scoreboard .sb-bar div { height: 100%; border-radius: 2px; opacity: 0.85; }
#scoreboard .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
#scoreboard .sb-lives { color: #ff7a7a; font-weight: 800; font-size: 11px; }
#scoreboard .sb-row.dead { opacity: 0.45; }
#scoreboard .sb-row.dead .sb-lives { color: #8d96a8; }

/* ===== Versus: Gegner senden ===== */

#sendPanel {
  position: fixed; right: 12px; bottom: 230px;
  width: 202px;
  z-index: 21;
  background: rgba(10,13,20,0.82);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
  backdrop-filter: blur(10px);
}
#sendPanel .sp-title { font-weight: 800; color: #ff9a5c; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
#sendPanel .sp-title #spInc { color: #9fe07a; text-transform: none; letter-spacing: 0; float: right; }
#sendPanel .sp-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#sendPanel .sp-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 2px 3px;
  background: #171c28;
  border: 1px solid #3a4358;
  border-radius: 8px;
  cursor: pointer;
  color: #e8edf7;
}
#sendPanel .sp-btn:hover:not(:disabled) { border-color: #ff9a5c; }
#sendPanel .sp-btn:disabled { opacity: 0.4; cursor: default; }
#sendPanel .sp-cost { font-size: 10px; font-weight: 700; color: var(--gold); }
#sendPanel .sp-inc { font-size: 9px; color: #9fe07a; }

/* Sponsor-Zeile auf der Startseite */
.sponsor { color: #f0c95c; font-size: 13px; letter-spacing: 0.4px; }
.sponsor b { color: #ffe9a8; }

#sendPanel #spTarget {
  width: 100%; margin-bottom: 6px;
  background: #171c28; color: #e8edf7;
  border: 1px solid #3a4358; border-radius: 6px;
  font-size: 11px; padding: 3px 4px;
}
#sendPanel .sp-hint { margin-top: 5px; font-size: 9px; color: #6b7385; text-align: center; }

/* öffentliche Spieleliste + Öffentlich-Schalter + Talente */
#pubGames { margin-top: 14px; }
.pub-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; margin-bottom: 5px;
  background: #171c28; border: 1px solid #2a3245; border-radius: 8px;
  font-size: 13px; text-align: left;
}
.pub-row .pub-name { font-weight: 700; }
.pub-row .pub-meta { flex: 1; color: #8d96a8; font-size: 11px; }
.pub-row button { font-size: 12px; padding: 4px 10px; }
/* Share-Box: Code + Öffentlich-Schalter kompakt gerahmt */
.share-box {
  background: rgba(240,201,92,0.05);
  border: 1px solid rgba(240,201,92,0.22);
  border-radius: 12px;
  padding: 10px 14px 8px;
  margin-bottom: 12px;
}
.share-box .room-code { margin-bottom: 6px; }
.share-hint { font-size: 11px; color: #7d8699; line-height: 1.5; margin-top: 8px; }

/* Info-Text + FAQ am Fuß der Startseite — echter, indexierbarer Inhalt für Suchmaschinen */
.seo-info {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: left; font-size: 12px; color: #8d96a8; line-height: 1.6;
}
.seo-info h2 { font-size: 13px; color: #aab3c5; margin: 0 0 6px; }
.seo-info p { margin: 0 0 8px; }
.seo-info b { color: #c9d2e4; }
.seo-info details { margin-top: 6px; }
.seo-info summary { cursor: pointer; color: #aab3c5; font-weight: 700; padding: 4px 0; }
.seo-info summary:hover { color: #dfe6f2; }
.seo-info details p { margin: 8px 0 10px; }

/* 📤 Teilen-Knopf auf dem Endbildschirm */
#btnShare { margin-bottom: 8px; }

/* 🎓 Tutorial: Sprechblase unten Mitte + pulsierender Zielring */
#tutBox {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  max-width: min(560px, 92vw);
  background: rgba(13,17,26,0.94); border: 1px solid rgba(240,201,92,0.55);
  border-radius: 14px; padding: 12px 16px;
  font-size: 15px; line-height: 1.45; color: #eef2fa;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55);
  z-index: 40;
}
#tutBox kbd {
  background: #1d2434; border: 1px solid #3a4358; border-bottom-width: 2px;
  border-radius: 5px; padding: 0 6px; font-size: 13px;
}
#tutStep {
  flex: 0 0 auto; background: rgba(240,201,92,0.15); color: var(--gold);
  border-radius: 10px; padding: 2px 9px; font-size: 12px; font-weight: 800;
}
#tutSkip {
  flex: 0 0 auto; margin-left: 4px;
  background: none; border: 1px solid #3a4358; border-radius: 8px;
  color: #8d96a8; font-size: 11px; padding: 4px 8px; cursor: pointer;
}
#tutSkip:hover { color: #dfe6f2; border-color: #5a6478; }
#tutRing {
  position: fixed; pointer-events: none; z-index: 39;
  border: 3px solid var(--gold); border-radius: 50%;
  box-shadow: 0 0 18px rgba(240,201,92,0.75), inset 0 0 14px rgba(240,201,92,0.4);
  animation: tutPulse 1.1s ease-in-out infinite;
}
@keyframes tutPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.14); opacity: 0.6; }
}
body.m-app #tutBox { bottom: 74px; font-size: 13px; padding: 9px 12px; }

/* 🎯 Bonusziel-Banner: schmale Zeile oben Mitte, unter der Wellen-Vorschau */
#goalBar {
  position: fixed; top: 46px; left: 50%; transform: translateX(-50%);
  background: rgba(13,17,26,0.88); border: 1px solid rgba(159,224,122,0.45);
  border-radius: 20px; padding: 5px 14px;
  font-size: 13px; color: #cfe8bd; white-space: nowrap;
  z-index: 18; pointer-events: none;
}
#goalBar b { color: #9fe07a; }
#goalBar .gb-n { color: #8d96a8; }
#goalBar.gb-bad { border-color: rgba(224,82,68,0.5); color: #b08a8a; filter: grayscale(0.4); }
body.m-app #goalBar { top: 36px; font-size: 11px; padding: 3px 10px; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }

/* 🪙 Gold verschenken: Mini-Knopf in der Punkte-Tafel … */
.sb-gift {
  padding: 0 5px; margin-left: 4px;
  background: rgba(240,201,92,0.12); border: 1px solid rgba(240,201,92,0.35);
  border-radius: 6px; cursor: pointer; font-size: 11px; line-height: 17px;
}
.sb-gift:hover { background: rgba(240,201,92,0.3); }
/* … und am Handy als Leiste im Chat-Sheet (Scoreboard ist dort aus) */
#giftRow { display: none; }
body.m-app #giftRow:not(.hidden) {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px 2px;
}
body.m-app #giftRow button {
  background: #171c28; border: 1px solid rgba(240,201,92,0.4);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}

/* 🔗 Einladen-Knopf: kopiert den fertigen Beitritts-Link */
.invite-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 8px; padding: 9px 12px;
  border-radius: 9px; cursor: pointer;
  background: rgba(240,201,92,0.14); border: 1px solid rgba(240,201,92,0.42);
  color: #f0c95c; font-weight: 700; font-size: 13px;
  transition: background .15s, transform .05s;
}
.invite-btn:hover { background: rgba(240,201,92,0.24); }
.invite-btn:active { transform: scale(0.98); }

.pub-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: #171c28;
  border: 1px solid #3a4358;
  border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #c6cddc;
  cursor: pointer;
  transition: border-color .12s;
  white-space: nowrap;
}
.pub-toggle:hover { border-color: #6b76a0; }
#roomNameInput {
  display: block;
  margin: 8px auto 0;
  width: min(280px, 90%);
  padding: 6px 12px;
  background: #171c28;
  border: 1px solid #3a4358;
  border-radius: 999px;
  font-size: 13px; color: #c6cddc;
  text-align: center;
}
#roomNameInput:focus { border-color: var(--gold); outline: none; }
#roomNameInput:disabled { opacity: 0.55; }
.coffee {
  display: block;
  margin-top: 5px;
  font-size: 12px; font-weight: 600;
  color: #b9962f;
  text-decoration: none;
  transition: color .12s;
}
.coffee:hover { color: var(--gold); text-decoration: underline; }
.leave-panel { max-width: 340px; text-align: center; }
.leave-panel button { display: block; width: 100%; margin-top: 10px; }
#btnLeaveDrop {
  background: #2b1214;
  border: 1px solid #7a3038;
  color: #ff8a80;
}
#btnLeaveDrop:hover { border-color: #c94a3a; }
.save-del {
  flex: none;
  margin-left: 6px;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid #3a4358;
  color: #9aa3b5;
}
.save-del:hover { border-color: #c94a3a; color: #ff8a80; }
.pub-toggle:has(input:checked) { border-color: var(--gold); color: #ffe9a8; box-shadow: 0 0 10px rgba(240,201,92,0.25); }
.pub-toggle input { accent-color: #f0c95c; flex: none; margin: 0; width: 15px; height: 15px; }
.pub-toggle input:disabled + span { opacity: 0.55; }

#heroGear {
  display: flex; gap: 6px; justify-content: center;
  margin: 5px 0 4px;
  font-size: 12px; font-weight: 700;
}
#heroGear span {
  background: #1d2433; border: 1px solid #3a4358; border-radius: 6px;
  padding: 2px 6px; cursor: help;
}

#wavePreview .wp-warn {
  color: #ffd9d9; font-weight: 800;
  background: rgba(190,40,40,0.85);
  border: 1px solid #ff8080;
  border-radius: 5px; padding: 1px 8px;
  animation: warnPulse 1s infinite;
}
@keyframes warnPulse { 50% { background: rgba(230,60,60,0.95); } }

#wavePreview .wp-special {
  color: #ff9a5c; font-weight: 800;
  border: 1px solid rgba(255,154,92,0.5);
  background: rgba(255,120,60,0.12);
  border-radius: 5px; padding: 1px 7px;
}

#btnHeroMove, #btnPing {
  width: 100%; margin-bottom: 4px;
  font-size: 12px; padding: 6px 8px;
  background: #1d2433; border: 1px solid #3a4358; border-radius: 7px; color: #c6cddc; cursor: pointer;
}
#btnHeroMove.active, #btnPing.active {
  background: linear-gradient(180deg, #2f6f3a, #1e4d27);
  border-color: #7ee06a; color: #eaffe4; font-weight: 700;
}

/* Boss-Lebensbalken: hängt mittig unter der Wellenvorschau, solange ein Boss lebt */
#bossBar {
  position: fixed; top: 96px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: rgba(24,8,10,0.88);
  border: 1px solid rgba(255,80,64,0.55);
  border-radius: 10px;
  z-index: 18;
  font-size: 13px; font-weight: 800; color: #ffd9d9;
  pointer-events: none;
}
#bossBarTrack {
  width: min(38vw, 340px); height: 12px;
  background: rgba(255,255,255,0.10);
  border-radius: 6px; overflow: hidden;
}
#bossBarFill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff6152, #b81f1f);
  transition: width 0.25s;
}
#bossBarHp { font-size: 11px; color: #ffb9b0; font-weight: 600; }

/* Live-Statistik (Tab halten oder 📊) */
#statsPanel {
  position: fixed; top: 96px; left: 50%; transform: translateX(-50%);
  z-index: 30;
  background: rgba(10,13,20,0.94);
  border: 1px solid rgba(240,201,92,0.35);
  border-radius: 12px;
  padding: 12px 18px;
  pointer-events: none;
}
#statsPanel table { border-collapse: collapse; font-size: 13px; }
#statsPanel th { color: #8b95a8; font-weight: 600; text-align: left; padding: 2px 14px 6px 0; }
#statsPanel td { padding: 3px 14px 3px 0; color: #d3dae8; }
#statsPanel .sp-hint { margin-top: 6px; font-size: 10px; color: #6b7488; text-align: center; }
#btnStats.active { border-color: var(--gold); color: var(--gold); }

/* Upgrade-Vorschau im Turm-Panel */
.tp-next { color: #9fe07a; font-size: 11.5px; }
.tp-next b { color: #c6f5a8; }

/* Auto-Wiedereinstieg nach Verbindungsabriss */
#reconnOverlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,8,13,0.62);
  backdrop-filter: blur(3px);
}
#reconnOverlay .reconn-box {
  background: rgba(16,21,32,0.95);
  border: 1px solid rgba(240,201,92,0.4);
  border-radius: 12px;
  padding: 20px 30px;
  text-align: center; font-size: 17px; font-weight: 800; color: #f0c95c;
  animation: pulse 1.6s infinite;
}
#reconnOverlay .reconn-box span { font-size: 13px; font-weight: 500; color: #c6cddc; }

/* Wochen-Herausforderung auf der Startseite */
#weeklyBox {
  margin-top: 14px; padding: 10px 12px;
  background: rgba(240,201,92,0.06);
  border: 1px solid rgba(240,201,92,0.3);
  border-radius: 10px;
}
.weekly-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 6px; }
.weekly-row span { font-size: 13px; color: #c6cddc; }
.weekly-row button {
  flex: 0 0 auto; padding: 7px 16px; font-weight: 800; cursor: pointer;
  background: linear-gradient(180deg, #7a5c1d, #5e4312); color: #ffe9b0;
  border: 1px solid #d0a73c; border-radius: 8px;
}
.weekly-row button:hover { background: linear-gradient(180deg, #8f6d24, #6e4f16); }

#talentRow, #talentRow2 { margin-bottom: 6px; }
#talentRow .tal-title, #talentRow2 .tal-title { font-size: 11px; font-weight: 800; color: #f0c95c; margin: 2px 0 4px; text-transform: uppercase; letter-spacing: 0.5px; }
#talentRow button, #talentRow2 button {
  width: 100%; margin-bottom: 3px; font-size: 12px; padding: 5px 8px;
  background: #1d2433; border: 1px solid #f0c95c66; border-radius: 7px; color: #e8edf7; cursor: pointer;
}
#talentRow button:hover, #talentRow2 button:hover { border-color: #f0c95c; background: #262e40; }

/* Lautstärke-Panel */
#soundPanel {
  position: fixed; top: 46px; right: 12px;
  z-index: 30;
  background: rgba(10,13,20,0.92);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(10px);
}
#soundPanel label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #c6cddc; margin: 4px 0; }
#soundPanel input[type="range"] { width: 140px; accent-color: #f0c95c; }

/* Karten-Editor + eigene Karte + Badges */
.editor-panel { width: 830px; max-width: 96vw; text-align: center; }
.editor-panel h2 { color: var(--gold); font-family: Georgia, serif; margin-bottom: 8px; }
#edCanvas { display: block; margin: 8px auto; border-radius: 8px; border: 1px solid #3a4358; cursor: crosshair; max-width: 100%; }
.ed-toolbar { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.ed-toolbar input[type="text"], .ed-toolbar input:not([type]), .ed-toolbar select {
  background: #171c28; color: #e8edf7; border: 1px solid #3a4358; border-radius: 7px; padding: 6px 9px; font-size: 13px;
}
.ed-toolbar button, .ed-tool { font-size: 13px; padding: 6px 12px; }
.ed-tool.selected { border-color: var(--gold); color: #ffe9a8; }
.ed-lanes { font-size: 12px; color: #9aa3b5; display: inline-flex; align-items: center; gap: 5px; }
#edCode { width: 100%; margin: 8px 0; background: #10141e; color: #8d96a8; border: 1px solid #2a3245; border-radius: 7px; font-size: 11px; padding: 6px; resize: none; }

.custom-row { margin-top: 8px; }
.custom-row input { flex: 1; font-size: 12px; }
#customInfo { display: flex; gap: 10px; align-items: center; text-align: left; margin-top: 8px; padding: 8px; background: rgba(240,201,92,0.06); border: 1px solid rgba(240,201,92,0.25); border-radius: 8px; font-size: 12px; }
#customInfo .mapthumb { width: 130px; flex: none; }

.chip-badges { font-size: 11px; letter-spacing: 1px; }
.chip-kick {
  margin-left: 3px; padding: 0 5px;
  font-size: 11px; line-height: 1.4;
  background: rgba(190,40,40,0.25); color: #ff8a8a;
  border: 1px solid rgba(255,80,64,0.4); border-radius: 5px; cursor: pointer;
}
.chip-kick:hover { background: rgba(190,40,40,0.6); color: #fff; }

/* Kompakt-Layout für kleine Bildschirme/Fenster */
@media (max-width: 1100px), (max-height: 780px) {
  #shop { transform: scale(0.8); transform-origin: bottom center; }
  #heroPanel { transform: scale(0.8); transform-origin: bottom left; left: 176px; }
  #mmWrap { transform: scale(0.8); transform-origin: bottom left; }
  #chat { transform: scale(0.85); transform-origin: bottom left; bottom: 116px; width: 280px; }
  #towerPanel { transform: scale(0.85); transform-origin: bottom right; }
  #sendPanel { transform: scale(0.85); transform-origin: bottom right; bottom: 196px; }
  #scoreboard { transform: scale(0.85); transform-origin: top right; }
  #shopInfo { transform: scale(0.85); transform-origin: bottom right; }
  #topbar { font-size: 12px; }
  #topbar .stat { padding: 2px 6px; }
}

#rotateHint {
  position: fixed; left: 50%; bottom: 116px; transform: translateX(-50%);
  z-index: 26;
  background: rgba(240,201,92,0.92); color: #1a1408;
  font-size: 12px; font-weight: 700;
  padding: 7px 14px; border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-width: calc(100vw - 24px); text-align: center; line-height: 1.35;
}

/* Turm-Info beim Shop-Klick (links) */
#shopInfo {
  /* sitzt im Slot des Turm-Panels — Shop- und Turm-Auswahl schließen sich aus */
  position: fixed; right: 12px; bottom: 12px;
  width: 240px;
  z-index: 21;
  background: rgba(10,13,20,0.85);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
  font-size: 12px;
  pointer-events: none;
}
#shopInfo .si-name { font-weight: 800; font-size: 14px; color: var(--gold); margin-bottom: 3px; }
#shopInfo .si-cost { float: right; font-weight: 700; }
#shopInfo .si-desc { color: #c6cddc; margin-bottom: 5px; }
#shopInfo .si-special { color: #9fe07a; margin-bottom: 5px; line-height: 1.4; }
#shopInfo .si-stats { color: #8d96a8; margin-bottom: 4px; }
#shopInfo .si-hint { color: #5f6879; font-size: 10px; }

/* Version + Credits */
.version-line { margin-top: 12px; font-size: 11px; color: #5f6879; }
.version-line a { color: #8d96a8; cursor: pointer; text-decoration: underline; }
.version-line a:hover { color: var(--gold); }
.credits-panel { width: 440px; max-width: 92vw; text-align: center; }
.credits-panel h2 { color: var(--gold); font-family: Georgia, serif; margin-bottom: 10px; }
.credits-body { text-align: left; font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
.credits-body p { margin-bottom: 6px; }

#goExtra { margin: 6px 0 4px; }
#goExtra .go-extra { font-size: 13px; color: #c6cddc; padding: 2px 0; }
#goGraph { display: block; margin: 8px auto 4px; max-width: 100%; border-radius: 8px; }

/* ===== chat ===== */

#chat {
  position: fixed; left: 12px; bottom: 148px;
  width: 320px;
  z-index: 21;
  pointer-events: none;
}
#chat > * { pointer-events: auto; }

#mmWrap {
  position: fixed; left: 12px; bottom: 12px;
  z-index: 21;
}
#minimap {
  display: block;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0a0e14;
  cursor: pointer;
}

/* ⠿-Griffe: HUD-Fenster mit der Maus verschieben (am Handy bleibt das feste Layout) */
.grip {
  position: absolute; left: 4px; top: 4px; z-index: 3;
  font-size: 12px; line-height: 1; padding: 3px 6px;
  color: #8b95a8; background: rgba(23,28,40,0.92);
  border: 1px solid #3a4358; border-radius: 6px;
  cursor: grab; opacity: 0.55; user-select: none; touch-action: none;
}
.grip:hover { opacity: 1; border-color: var(--gold); color: var(--text); }
.grip:active { cursor: grabbing; }
/* Finger brauchen größere Ziele als Mauszeiger */
@media (pointer: coarse) {
  .grip { font-size: 16px; padding: 7px 10px; opacity: 0.75; }
  #chatSize { font-size: 16px; padding: 6px 8px; }
  #chatMin, #heroMin { font-size: 15px; padding: 6px 10px; }
}

/* ===== 📱 App-Modus: nur die Karte + Icon-Leiste, Panels als Bottom-Sheets =====
   Aktiv, sobald die kürzere Bildschirmseite ≤ 760 px ist (setzt main.js als body.m-app). */
#mBar { display: none; }
body.m-app #mBar {
  display: flex; gap: 10px;
  position: fixed; left: 10px; bottom: 10px;
  z-index: 30;
}
body.m-app #mBar button {
  width: 46px; height: 46px;
  font-size: 22px; line-height: 1; padding: 0;
  background: rgba(10,13,20,0.88);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}
body.m-app #mBar button.active { border-color: var(--gold); box-shadow: 0 0 10px rgba(240,201,92,0.35); }
body.m-app #mBar button.unread { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 8px rgba(240,201,92,0.55); }

/* Schwebende Panels weg — sie öffnen nur noch auf Anforderung als Sheet */
body.m-app #chat, body.m-app #mmWrap, body.m-app #heroPanel, body.m-app #shop { display: none; }
body.m-app #chat.m-open, body.m-app #heroPanel.m-open, body.m-app #mmWrap.m-open { display: block; }
body.m-app #shop.m-open { display: flex; }
body.m-app .grip, body.m-app #chatSize, body.m-app #chatMin, body.m-app #heroMin { display: none !important; }

/* Sheets liegen über der Icon-Leiste, ignorieren PC-Verschiebe-Positionen und Skalierungen */
body.m-app #shop.m-open {
  left: 0 !important; right: 0 !important; bottom: 64px !important; top: auto !important;
  transform: none !important;
  width: auto !important;
  overflow-x: auto;
  border-radius: 12px 12px 0 0;
}
body.m-app #chat.m-open, body.m-app #heroPanel.m-open {
  position: fixed;
  left: 8px !important; right: 8px !important; bottom: 64px !important; top: auto !important;
  transform: none !important;
  width: auto !important;
}
body.m-app #mmWrap.m-open {
  position: fixed;
  left: 8px !important; bottom: 64px !important; top: auto !important; right: auto !important;
  transform: none !important;
}

/* Turm-Info (angetippter Turm) liegt im App-Modus als Bottom-Sheet über der Icon-Leiste,
   sobald ein Turm angetippt ist — statt fest rechts unten zu schweben und die Karte zu decken. */
body.m-app #towerPanel:not(.hidden) {
  position: fixed;
  left: 8px !important; right: 8px !important; bottom: 64px !important; top: auto !important;
  width: auto !important; max-width: none !important; transform: none !important;
  max-height: 56vh; overflow: hidden;
  display: flex; flex-direction: column;
  border-radius: 12px 12px 0 0;
  z-index: 25;
}
/* nur die (bei manchen Türmen langen) Werte scrollen — Titel und Upgrade/Verkaufen/Ziel
   bleiben immer sichtbar, ohne dass man erst durch die Statistik scrollen muss */
body.m-app #towerPanel:not(.hidden) > * { flex: 0 0 auto; }
body.m-app #towerPanel:not(.hidden) #tpStats { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
/* Versus-Senden liegt NICHT mehr dauerhaft über der Karte — es öffnet nur über das ⚔-Icon
   in der Leiste als Sheet (wie Bauen/Held/Chat/Karte), immer nur eines gleichzeitig. */
body.m-app #sendPanel { display: none; }
body.m-app #sendPanel.m-open {
  display: block; position: fixed;
  left: 8px !important; right: 8px !important; bottom: 64px !important; top: auto !important;
  width: auto !important; max-width: none !important; transform: none !important;
  max-height: 52vh; overflow-y: auto;
  border-radius: 14px 14px 0 0;
  padding: 12px 12px 14px;
  z-index: 25;
}
/* Versus am Handy: fette Touch-Ziele, größere Gegner-Sprites, gut lesbare Preise */
body.m-app #sendPanel.m-open .sp-title { font-size: 14px; margin-bottom: 10px; }
body.m-app #sendPanel.m-open #spTarget { font-size: 15px; padding: 10px 8px; margin-bottom: 10px; border-radius: 9px; }
body.m-app #sendPanel.m-open .sp-row { gap: 9px; }
body.m-app #sendPanel.m-open .sp-btn { padding: 11px 4px 9px; border-radius: 11px; }
body.m-app #sendPanel.m-open .sp-btn canvas { width: 40px !important; height: 40px !important; }
body.m-app #sendPanel.m-open .sp-cost { font-size: 13px; margin-top: 2px; }
body.m-app #sendPanel.m-open .sp-inc { font-size: 11px; }
body.m-app #sendPanel.m-open .sp-hint { font-size: 11px; margin-top: 10px; }

/* Topbar entrümpeln und flach machen: nur Leben, Welle, Gold, Wellen-Knopf + Schalter */
body.m-app #statCode, body.m-app #playerBar, body.m-app #btnStats, body.m-app #statPing,
body.m-app #statPhase, body.m-app #scoreboard { display: none !important; }
body.m-app #topbar {
  height: 32px;
  gap: 8px;
  padding: 0 8px;
  font-size: 12px;
  overflow-x: auto; overflow-y: hidden;
}
body.m-app #topbar .stat { padding: 2px 5px; }
body.m-app .wave-btn {
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 10px;
  max-height: 26px;
}
body.m-app .speed-btn { font-size: 12px; padding: 3px 8px; }
body.m-app #topbar .icon-btn { font-size: 14px; padding: 3px 6px; }

/* „Nächste Welle"-Vorschau: kompakt und dicht unter die flache Leiste */
body.m-app #wavePreview {
  top: 34px;
  transform: translateX(-50%) scale(0.75);
  transform-origin: top center;
}
#chatSize {
  position: absolute; right: 2px; bottom: 2px; z-index: 3;
  font-size: 11px; line-height: 1; padding: 2px 4px;
  color: #8b95a8; cursor: nwse-resize; user-select: none; touch-action: none;
  opacity: 0.55;
}
#chatSize:hover { opacity: 1; color: var(--gold); }
/* frei platzierte Fenster: Kompakt-Skalierung aus, sonst stimmen die Koordinaten nicht */
.dragged { transform: none !important; }
.hp-top { cursor: grab; }
.hp-top:active { cursor: grabbing; }

#heroPanel {
  position: fixed; left: 232px; bottom: 12px;
  z-index: 21;
  width: 202px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
}
.hp-top { display: flex; gap: 8px; align-items: center; }
#heroIcon { background: #171c28; border-radius: 8px; flex: none; }
.hp-info { flex: 1; min-width: 0; }
#heroName { font-size: 12px; font-weight: 700; margin-bottom: 3px; white-space: nowrap; overflow: hidden; }
.hbar { height: 7px; background: #101420; border-radius: 4px; overflow: hidden; margin-bottom: 3px; }
.hbar div { height: 100%; width: 100%; background: linear-gradient(90deg, #58d05a, #3da53f); }
.hbar.xb { height: 5px; }
.hbar.xb div { background: linear-gradient(90deg, #b06ef0, #8a4ad0); }
#heroLvl {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: #f0c95c; color: #4a3208;
  font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
#btnCast { width: 100%; margin-top: 7px; font-size: 12px; padding: 6px; font-weight: 700; }
#btnUlt { width: 100%; margin-top: 5px; font-size: 12px; padding: 6px; font-weight: 700; }
#btnUlt.ready {
  background: linear-gradient(180deg, #b8912a, #8a5f14);
  border-color: #f0c95c;
  animation: pulse 1.6s infinite;
}
#btnStrike { width: 100%; margin-top: 5px; font-size: 12px; padding: 6px; font-weight: 700; }
#btnStrike.ready {
  background: linear-gradient(180deg, #b03a2a, #7a2418);
  border-color: #ff6a4a;
  animation: pulse 1.6s infinite;
}
#btnStrike.arming { background: #5e2018; border-color: #ff6a4a; }

.color-row { display: flex; gap: 10px; justify-content: center; }
.cdot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #3a4358;
  cursor: pointer;
  transition: transform .08s;
}
.cdot:hover { transform: scale(1.15); }
.cdot.selected { border-color: var(--gold); box-shadow: 0 0 10px rgba(240,201,92,0.5); }
.cdot.taken { opacity: 0.3; cursor: default; }
#btnCast.ready {
  background: linear-gradient(180deg, #7a4ad0, #5a2aa0);
  border-color: #b06ef0;
  animation: pulse 1.6s infinite;
}
#heroDead { font-size: 12px; color: #ff8a8a; margin-top: 6px; text-align: center; font-weight: 700; }
#chatLog {
  max-height: 160px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 12px; line-height: 1.5;
  /* geschlossene Box statt frei schwebender Zeilen über der Karte */
  background: rgba(10, 13, 20, 0.78);
  border: 1px solid #262e40;
  border-radius: 8px 8px 0 0;
  padding: 5px 9px;
  backdrop-filter: blur(8px);
}
#chatLog:empty { display: none; }
#chatLog .sys { color: var(--gold); font-style: italic; }
#chatInput { pointer-events: auto; background: rgba(23,28,40,0.92); border-radius: 0 0 8px 8px; }

/* Sprüche der Gegner — eigene Farbe, damit sie sich klar von Spieler- und Statuszeilen abheben */
.taunt { color: #ffb9b0; }
.taunt b { color: #ff6152; }

/* Statusmeldungen-Filter (📢/🔕) — greift bewusst NUR auf .sys, nicht auf .taunt */
.hide-sys .sys { display: none !important; }
/* ACHTUNG: #chat NICHT auf position:relative setzen — das überschreibt das fixed aus der
   Basisregel und der Chat landet mitten auf der Karte. „fixed" ist selbst ein Anker
   für absolut positionierte Kinder, der Filter-Knopf funktioniert also auch so. */
#chatFilter, #lobbyChatFilter {
  position: absolute; right: 6px; top: 4px;
  z-index: 2;
  font-size: 12px; line-height: 1; padding: 3px 6px;
  background: rgba(23,28,40,0.9); border: 1px solid #3a4358; border-radius: 6px;
  color: var(--text); cursor: pointer;
  opacity: 0.65; transition: opacity .12s;
}
#chatFilter:hover, #lobbyChatFilter:hover { opacity: 1; border-color: var(--gold); }
#lobbyChat { position: relative; }

/* ===== minimierbare HUD-Panels ===== */
#chatMin {
  position: absolute; right: 34px; top: 4px;
  z-index: 2;
  font-size: 12px; line-height: 1; padding: 3px 7px;
  background: rgba(23,28,40,0.9); border: 1px solid #3a4358; border-radius: 6px;
  color: var(--text); cursor: pointer;
  opacity: 0.65; transition: opacity .12s;
}
#chatMin:hover { opacity: 1; border-color: var(--gold); }
#chat.collapsed #chatLog, #chat.collapsed #chatInput, #chat.collapsed #chatSize, #chat.collapsed #chatFilter { display: none; }
#chat.collapsed #chatMin { position: static; display: inline-block; margin-left: 26px; opacity: 0.85; }
#chatMin.unread { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 8px rgba(240,201,92,0.55); opacity: 1; }

#heroMin {
  flex: none;
  font-size: 12px; line-height: 1; padding: 3px 7px;
  background: rgba(23,28,40,0.9); border: 1px solid #3a4358; border-radius: 6px;
  color: var(--text); cursor: pointer;
  opacity: 0.65; transition: opacity .12s;
}
#heroMin:hover { opacity: 1; border-color: var(--gold); }
#heroPanel.collapsed #heroGear, #heroPanel.collapsed #talentRow, #heroPanel.collapsed #talentRow2,
#heroPanel.collapsed #btnHeroMove, #heroPanel.collapsed #btnPing, #heroPanel.collapsed #btnCast,
#heroPanel.collapsed #btnUlt, #heroPanel.collapsed #btnStrike, #heroPanel.collapsed #heroDead { display: none; }

/* ===== game over ===== */

#goStats { margin: 16px auto 20px; border-collapse: collapse; min-width: 300px; }
#goStats td, #goStats th { padding: 6px 14px; text-align: left; font-size: 14px; }
#goStats th { color: #9aa3b5; font-weight: 600; border-bottom: 1px solid #3a4358; }

/* ===== toast ===== */

#toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(90, 30, 30, 0.95);
  border: 1px solid #c05050;
  color: #ffd9d9;
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  z-index: 60;
  animation: toastIn .15s;
  pointer-events: none;      /* darf nie Knöpfe blockieren (verdeckte das Helden-Panel) */
  max-width: 88vw;
}
/* grüne Variante für gute Nachrichten (z. B. Goldgeschenk) — rot bleibt für Fehler */
#toast.t-ok {
  background: rgba(24, 62, 32, 0.95);
  border-color: #4d9d5e;
  color: #d9ffe0;
}

/* der HUD-Container selbst darf keine Klicks abfangen — nur seine Panels */
#hud { pointer-events: none; }
#hud > * { pointer-events: auto; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ================================================================
   Handy/Tablet — MUSS ganz am Ende stehen, damit diese Regeln die
   Basis-Definitionen (position/bottom/width) sicher überschreiben.
   ================================================================ */
@media (max-width: 820px) {
  /* Shop unten über die volle Breite, waagerecht scrollbar */
  #shop {
    left: 0; right: 0; bottom: 0;
    transform: none;
    justify-content: flex-start;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    padding: 6px 8px;
    gap: 6px;
    z-index: 24;
  }
  .card { width: 70px; flex: none; }
  .card .cname { font-size: 10px; }

  /* Helden-Panel nach rechts oben — verdeckt weder Shop noch Spielfeld */
  #heroPanel {
    left: auto; right: 6px; bottom: auto; top: 46px;
    transform: scale(0.8); transform-origin: top right;
    width: 176px;
    backdrop-filter: none;               /* kein Blur übers Spielfeld */
    background: rgba(10,13,20,0.82);
  }
  #sendPanel {
    left: auto; right: 6px; bottom: auto; top: 210px;
    transform: scale(0.8); transform-origin: top right;
    backdrop-filter: none;
  }
  #scoreboard { display: none; }         /* Punkte stehen in der Topbar */

  #mmWrap { left: 6px; right: auto; bottom: 100px; top: auto; transform: scale(0.6); transform-origin: bottom left; }

  #chat { left: 6px; right: auto; bottom: 100px; top: auto; width: 210px; transform: scale(0.88); transform-origin: bottom left; }
  #chatLog { max-height: 74px; }
  .grip, #chatSize { display: none; }   /* am Handy: festes Layout, keine Griffe */

  #towerPanel, #shopInfo {
    left: auto; right: 6px; bottom: 100px; top: auto;
    width: 200px;
    transform: scale(0.88); transform-origin: bottom right;
    backdrop-filter: none;
    background: rgba(10,13,20,0.9);
  }

  #topbar { height: 40px; font-size: 11px; gap: 8px; padding: 0 8px; }
  #topbar .stat { padding: 1px 4px; }
  #playerBar { display: none; }
  /* auf dem Handy bleibt sie kompakt — aufgeklappt darf sie aber scrollen statt zu überlaufen */
  #wavePreview { top: 44px; font-size: 12px; padding: 5px 10px; max-width: 94vw; }
  #bossBar { top: 82px; font-size: 11px; padding: 4px 8px; gap: 6px; }
  #bossBarTrack { width: 34vw; }
  #wavePreview .wp-title { font-size: 13px; }
  #wavePreview.wp-big { max-height: 46vh; overflow-y: auto; }
  #wavePreview.wp-big .wp-item { max-width: 100%; }
  .lobby-panel { width: 96vw; padding: 14px 12px; }
  .map-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Handy: der Toast sitzt unten, damit er das Helden-Panel oben rechts nie verdeckt */
@media (max-width: 820px) {
  #toast { top: auto; bottom: 150px; font-size: 12px; padding: 7px 14px; }
}

/* Handy-Hochformat: es ist eng — die weniger wichtigen Elemente treten zurück,
   damit Topbar, Held-Panel und Shop sich nicht überlagern. */
@media (max-width: 820px) {
  .wave-btn { font-size: 10px; padding: 3px 7px; white-space: nowrap; }
  .speed-btn { font-size: 11px; padding: 3px 7px; }
  .icon-btn { font-size: 13px; }
  #toast { bottom: 168px; }
}
@media (max-width: 820px) and (orientation: portrait) {
  #wavePreview { display: none; }       /* im Hochformat kein Platz — quer ist sie wieder da */
  #rotateHint { bottom: 196px; }
  #chat { display: none; }              /* Chat im Hochformat aus, sonst deckt er die Minimap zu */
}
