html, body {
  margin: 0;
  background: #0b0e13;
  color: #e7ecf3;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  height: 100%;
  overflow: hidden;
  user-select: none;
}

/* Globale Scrollbar-Stile mit transparentem Hintergrund */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}
:root {
  --hp-wave-height: 25px;
  --hud-scale: 1.5;
}
#ui {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  pointer-events: none;
  transform: scale(var(--hud-scale));
  transform-origin: top left;
  width: calc(100% / var(--hud-scale));
  height: calc(100% / var(--hud-scale));
}
#top {
  display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
#attributes {
  background: rgba(255,255,255,0.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  padding: 8px; border-radius: 10px; font-size: 14px;
}
#attributes .attr { display: flex; gap: 4px; align-items: center; }
#attributes .attr:not(:last-child){ margin-bottom: 4px; }
#attributes .attrIcon { width: 18px; height: 18px; }
#centerTop { flex: 1; text-align: center; font-size: 28px; }
#waveIcon, #nextWaveIcon { color: #fff; }
#waveBar {
  width:200px;
  height:8px;
  background:rgba(255,255,255,0.2);
  margin:4px auto 0;
  border-radius:4px;
  overflow:hidden;
}
#waveBarFill {
  height:100%;
  width:0%;
  background:#ff3030;
  border-radius:4px;
}
#skillPad { width: 64px; }
#skills {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}
.skill {
  background: rgba(255,255,255,0.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 6px;
  width: 64px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.skill .label {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 10px;
}
.skill .skillIcon {
  margin-top: 10px;
  margin-bottom: 4px;
  width: 36px;
  height: 36px;
  display: block;
}
.skill .cd {
  font-size: 20px;
  font-weight: 700;
}
.charges {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
}
.charges iconify-icon {
  width: 14px;
  height: 14px;
}
.charges .empty { opacity: 0.3; }

#xpHud { position: absolute; bottom: 20px; right: 20px; width: 200px; height: 200px; }
#xpCircle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#hpGlass {
  position: absolute;
  top: 34px;
  left: 34px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(80,0,0,0.4);
  border: 2px solid silver;
}
#hpFill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ff3030;
  transition: height .2s linear;
  overflow: hidden;
}
#hpFill::before {
  content: '';
  position: absolute;
  left: 0;
  top: calc(-1 * var(--hp-wave-height));
  width: 200%;
  height: calc(var(--hp-wave-height) * 2);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 20'><path fill='%23ff6060' d='M0 20 Q30 0 60 20 T120 20 V20z'/></svg>") repeat-x;
  background-size: 50% 100%;
  background-position: 0 var(--hp-wave-height);
  animation: wave 2s linear infinite;
}

#hpFill.full { --hp-wave-height: 0px; }
#hpFill.full::before { animation: none; }
@keyframes wave {
  0% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(-25%) translateY(calc(var(--hp-wave-height) * -0.4)); }
  100% { transform: translateX(-50%) translateY(0); }
}
#hpFill .hpBubble {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  animation: bubble 2s ease-out forwards;
  pointer-events: none;
}
@keyframes bubble {
  from { transform: translateY(0) scale(1); opacity: 0.8; }
  to { transform: translateY(-20px) scale(0.3); opacity: 0; }
}
#hpText { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-weight: 700; }
#xpProgress {
  transition: stroke-dashoffset .2s linear;
}

.controlsHint {
  font-size: 14px;
  opacity: .8;
  text-align: center;
  margin-top: 12px;
}
.statsPanel {
  margin: 8px 0;
  font-size: 16px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
}
#pause .statsPanel, #levelUp .statsPanel, #gameOver .statsPanel {
  flex: 1 1 auto;
}
#pause .pauseContent {
  display: flex;
  gap: 20px;
}
#pause .pauseLayout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.statsPanel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.statsPanel::-webkit-scrollbar {
  width: 8px;
}
.statsPanel::-webkit-scrollbar-track {
  background: transparent;
}
.statsPanel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}
#settings .statsPanel { gap: 20px; }

.settingsControls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.settingsCard {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settingsCard h3 {
  margin-top: 0;
}

.settingOption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  column-gap: 4px;
  row-gap: 0.5em;
  font-size: 14px;
}

.soundTable {
  width: 100%;
  height: 100%;
}

.soundTable td {
  text-align: center;
  height: 25%;
}

.soundLabel {
  font-size: 14px;
}

.soundSlider {
  width: 80%;
  margin: 0 auto;
  display: block;
}


.settingOption .colorIndicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  font-size: 0;
  position: relative;
  background: linear-gradient(180deg, #2f2f2f, #121212);
  box-shadow: 0 0 0 1px #0008;
  --clr: transparent;
}

.settingOption .colorIndicator::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border-radius: 50%;
  background: var(--clr);
}


/* Toggle switch style */
.toggle {
  --on1: #70a1ff;
  --on2: #1e90ff;
  position: relative;
  width: 60px;
  height: 30px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(0deg, #333, #000);
  outline: none;
  border-radius: 15px;
  box-shadow: 0 0 0 2px #353535, 0 0 0 3px #3e3e3e, inset 0 0 5px rgba(0,0,0,1);
  cursor: pointer;
  margin: 0;
}

.toggle:checked {
  background: linear-gradient(0deg, var(--on1), var(--on2));
  box-shadow: 0 0 0 2px #353535, 0 0 0 3px #3e3e3e, inset 0 0 5px rgba(0,0,0,1);
}

.toggle:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 30px;
  background: linear-gradient(0deg, #000, #6b6b6b);
  border-radius: 15px;
  box-shadow: 0 0 0 1px #232323;
  transform: scale(.98,.96);
  transition: .5s;
}

.toggle:checked:before {
  left: 20px;
}

.toggle:after {
  content: '';
  position: absolute;
  top: calc(50% - 2px);
  left: 35px;
  width: 4px;
  height: 4px;
  background: linear-gradient(0deg, #6b6b6b, #000);
  border-radius: 50%;
  transition: .5s;
}

.toggle:checked:after {
  left: 55px;
}
.slider {
  --on1: #70a1ff;
  --on2: #1e90ff;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(0deg, #333, #000);
  box-shadow: 0 0 0 2px #353535, 0 0 0 3px #3e3e3e, inset 0 0 5px rgba(0,0,0,1);
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(0deg, #000, #6b6b6b);
  box-shadow: 0 0 0 1px #232323;
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(0deg, #000, #6b6b6b);
  box-shadow: 0 0 0 1px #232323;
  border: none;
}
.settingsPreview {
  position: relative;
  width: 100%;
  height: 120px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  margin-top: 8px;
}

.settingsPreview svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.settingsPreview iconify-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#previewTracer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 2px;
  transform: translate(-50%, -50%);
}
.groupTitle {
  font-weight: 700;
  margin: 0 0 4px;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stats .stat {
  flex: 1 1 calc((100% - 5 * 6px) / 6);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px;
}
.statLine {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex-wrap: wrap;
}
.stats .stat iconify-icon {
  width: 20px;
  height: 20px;
}
.statName {
  font-weight: 700;
  min-width: 0;
  word-break: break-word;
}
.statValue {
  font-size: 13px;
  margin-left: auto;
  min-width: 0;
  word-break: break-word;
}
.statBar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.statFill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #81c784);
}
.chargeBars {
  display: flex;
  gap: 4px;
}
.chargeBar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.chargeFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #81c784);
}
.chargeFill.full {
  width: 100%;
}

#statTooltip {
  position: absolute;
  pointer-events: none;
  display: none;
  background: rgba(12,14,20,0.9);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  z-index: 1000;
  white-space: nowrap;
}

.perkDivider {
  height:2px;
  background: rgba(255,255,255,0.25);
  margin: 24px 0;
}
#menu, #levelUp, #gameOver, #pause, #settings, #wiki {
  position: absolute; inset: 0; display: none; place-items: center; backdrop-filter: blur(6px);
  background: radial-gradient(1000px 600px at 50% -10%, rgba(255,255,255,0.06), transparent);
}
.panel {
  pointer-events: auto; background: rgba(12,14,20,.9); border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  width: min(960px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
}
#pause .panel, #levelUp .panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
h1,h2,h3 { margin: 8px 0 12px; }
h1 { font-size: 28px; letter-spacing: .5px;}
h2 { font-size: 22px;}
.btn {
  display: inline-block; background: linear-gradient(180deg,#3044ff,#1c2ad6);
  border: none; color: white; font-weight: 800; padding: 12px 16px; border-radius: 12px;
  cursor: pointer; transition: transform .05s ease, filter .2s ease; text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { background: #555; cursor: not-allowed; filter: none; }
.perkTypeBtn {
  background: linear-gradient(180deg,#1a1f7a,#0b0e3d);
}
.iconBtn {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.iconBtn iconify-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.iconBtn .refreshIcon { z-index: 0; }
.iconBtn .bloodIcon { color: #ff3030; z-index: 1; }
#pauseMenuBtn {
  margin-left: auto;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
}
#menu .grid {
  grid-template-columns: minmax(220px, 1fr) 2fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "start leaderboard"
    "tips leaderboard";
}
#startCard { grid-area: start; }
#tipsCard { grid-area: tips; }
#leaderboardCard { grid-area: leaderboard; }
.card {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 12px;
}
.choice { cursor: pointer; transition: transform .05s ease, filter .2s ease; position: relative; }
.choice:hover { filter: brightness(1.1); transform: translateY(-1px); }
.choice.selected { outline: 2px solid #fff; }
input { cursor: text; }
#c { display: block; width: 100vw; height: 100vh; image-rendering: pixelated; }

.perkType {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  opacity: 0.8;
}

.choice h3,
.choice .perkType {
  color: var(--perk-color, #fff);
}

/* Wiki redesign */
.wikiMenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.wikiMenu #wikiBackBtn {
  margin-left: auto;
}
.wikiPage {
  display: none;
}
.wikiPage.active {
  display: block;
}
#wiki .grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.wikiTile {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-areas:
    "icon header"
    "desc desc";
  column-gap: 8px;
  row-gap: 4px;
}

.wikiTile iconify-icon {
  grid-area: icon;
  font-size: 32px;
}

.wikiTile iconify-icon,
.wikiTile .wikiTileTitle,
.wikiTile .wikiTileType {
  color: var(--perk-color, #fff);
}

.wikiTileHeader {
  grid-area: header;
  display: flex;
  flex-direction: column;
}

.wikiTileTitle {
  font-weight: 700;
}

.wikiTileType {
  font-size: 12px;
  opacity: 0.7;
}

.wikiTileDesc {
  grid-area: desc;
  margin-top: 4px;
}
a { color: #9dd1ff; }

body.crosshair-active,
body.crosshair-active *:not(#cursorCross) {
  cursor: none !important;
}

.hint {
  text-align: center;
  opacity: .8;
  font-size: 14px;
  margin-top: 8px;
}

#leaderboardTable {
  width: 100%;
  border-collapse: collapse;
}
#leaderboardTable th,
#leaderboardTable td {
  padding: 8px 12px;
  text-align: left;
}
#leaderboardTable .lbTrophy {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-left: 4px;
}
#leaderboardTable thead th {
  border-bottom: 2px solid rgba(255,255,255,.2);
}
#leaderboardTable tbody tr {
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
#leaderboardTable tbody tr:last-child {
  border-bottom: none;
}
#leaderboardTable tbody tr:hover {
  background: rgba(255,255,255,.05);
}
#leaderboardPagination {
  display: none;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}
#leaderboardPagination button {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  min-width: 32px;
}
#leaderboardPagination button iconify-icon {
  pointer-events: none;
}
#leaderboardPagination button.active {
  background: rgba(255,255,255,.2);
}
#leaderboardPagination button:disabled {
  opacity: .5;
  cursor: default;
}
#lbStatsPanel {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
#lbStatsInfo {
  display: flex;
  justify-content: center;
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 20px;
}

#lbStatsInfo .lbInfoLine {
  display: flex;
  align-items: center;
  gap: 16px;
}

#lbStatsInfo .lbInfoItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

#lbStatsInfo .lbRank {
  background: rgba(0,0,0,0.4);
  padding: 4px 8px;
  border-radius: 4px;
  color: #ffd700;
}

#lbStatsInfo iconify-icon {
  width: 24px;
  height: 24px;
}

#lbStatsInfo .lbScore iconify-icon {
  color: #ffd700;
}

#lbStatsInfo .lbTime iconify-icon {
  color: #9cf;
}

#lbStatsInfo .lbWaves iconify-icon {
  color: #6cf;
}
#lbStats {
  max-height: 60vh;
  overflow-y: auto;
}

#saveScoreArea p {
  margin: 0 0 8px;
}

.saveScoreRow {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.saveScoreRow > * + * {
  margin-left: 8px;
}

#saveScoreForm input {
  flex: 1;
  background: #222;
  color: #fff;
  border: 1px solid #555;
  padding: 4px;
}

#gameOverActions {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

#saveScoreArea {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#gameOverButtons {
  display: flex;
  gap: 8px;
}

#cookieConsent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.85);
  padding: 20px;
  display: none;
  text-align: center;
  z-index: 2000;
}

#cookieConsent .btn {
  margin: 0 8px;
}
