* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { overscroll-behavior: none; }

body {
  background: #0b0d12;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #e8e6ef;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game { position: fixed; inset: 0; display: block; touch-action: none; }

button { touch-action: manipulation; }

#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 5, 0.5) 100%);
}

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 14px; padding: 20px;
  background: rgba(7, 9, 15, 0.68);
  backdrop-filter: blur(7px);
  overflow-y: auto;
}
/* Sicheres Zentrieren: mittig wenn es passt, scrollbar statt abgeschnitten wenn nicht */
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }
.hidden { display: none !important; }

.panel {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 40px;
  border-radius: 22px;
  background: linear-gradient(175deg, rgba(28, 32, 46, 0.85), rgba(14, 16, 26, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  max-width: min(720px, 94vw);
}

h1 {
  font-size: clamp(44px, 8vw, 78px);
  font-weight: 900; letter-spacing: 6px; line-height: 1;
  background: linear-gradient(180deg, #ffe9b0 5%, #ffb347 55%, #e06d1f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 150, 50, 0.35));
}
.sub { color: #b9b4c9; font-size: 15px; margin-top: -6px; }
h2 { font-size: 24px; letter-spacing: 1px; }
.go-title { color: #ff8f6b; font-size: 32px; }
.stats { color: #cfcadd; font-size: 16px; }

#logo { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)); }

.btnrow { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

button {
  font: inherit; color: #efeaf6; cursor: pointer;
  background: linear-gradient(180deg, #333a4e, #232838);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px; padding: 10px 20px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:hover { transform: translateY(-2px); filter: brightness(1.15); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); }
button:active { transform: translateY(0); }
button.big { font-size: 19px; font-weight: 700; padding: 14px 30px; }
button.big small { font-weight: 400; opacity: 0.7; }
button.primary {
  background: linear-gradient(180deg, #ffb347, #e07a1f);
  color: #241505; border-color: rgba(255, 220, 160, 0.5);
  box-shadow: 0 6px 22px rgba(255, 150, 50, 0.3);
}
button.danger { background: linear-gradient(180deg, #aa3b4c, #6f1f2e); }
button:disabled { opacity: 0.4; cursor: default; transform: none; filter: none; box-shadow: none; }

.sliders { display: flex; flex-direction: column; gap: 8px; }
.sliders label { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #cfcadd; }
.sliders label span { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 240px; accent-color: #ffb347; }

.shop { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.shopcard {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px; padding: 10px 14px;
}
.shopcard .icon { font-size: 26px; }
.shopcard .info { flex: 1; display: flex; flex-direction: column; }
.shopcard .info b { font-size: 15px; }
.shopcard .info span { font-size: 12.5px; color: #a49fb6; }
.shopcard .pips { font-size: 11px; letter-spacing: 2px; color: #ffb347; margin-top: 2px; }
.shopcard button { white-space: nowrap; font-size: 14px; }

.hint { color: #7f7a92; font-size: 13px; }

.diffrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.difflabel { color: #b9b4c9; font-size: 14px; }
#diffBtns { display: flex; gap: 6px; }
.diffbtn { font-size: 14px; padding: 7px 14px; border-radius: 10px; opacity: 0.6; }
.diffbtn.active {
  opacity: 1;
  background: linear-gradient(180deg, #ffb347, #e07a1f);
  color: #241505; font-weight: 700;
  border-color: rgba(255, 220, 160, 0.5);
}
.diffbtn.active.sturm { background: linear-gradient(180deg, #b0403f, #6f1f2e); color: #ffe4e0; }
.diffdesc { width: 100%; text-align: center; font-size: 12.5px; color: #8f8aa2; min-height: 16px; }

.online { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.online-btn { background: linear-gradient(180deg, #2c5a72, #1c3a4c); border-color: rgba(120, 210, 255, 0.3); }
.joinrow { display: flex; gap: 8px; }
.joinrow input {
  width: 96px; text-align: center; font: inherit; font-weight: 800; font-size: 18px;
  letter-spacing: 4px; text-transform: uppercase;
  color: #ffe9b0; background: #171a24;
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px; padding: 8px;
  outline: none;
}
.joinrow input:focus { border-color: #ffb347; }
.netstatus { width: 100%; text-align: center; color: #8fd2ff; font-size: 15px; min-height: 20px; }
.netstatus b { color: #ffe9b0; letter-spacing: 4px; font-size: 18px; }

.card.combo {
  border: 1px solid rgba(90, 230, 210, 0.7);
  background: linear-gradient(180deg, #14453e, #0c2823);
  box-shadow: 0 0 24px rgba(80, 220, 200, 0.35);
  animation: evoPulse 1.4s ease-in-out infinite;
}
.card.combo .ctitle { color: #6ef0d8; }

.waitnote { color: #b9b4c9; font-size: 17px; animation: blinkWait 1.2s ease-in-out infinite; }

.reroll {
  font-size: 15px; padding: 9px 18px;
  background: linear-gradient(180deg, #4a3a6a, #2c2244);
  border-color: rgba(200, 160, 255, 0.4);
}
.publicurl {
  width: 100%; text-align: center; font-size: 13.5px; color: #8fd2ff;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.publicurl b { color: #b6ffcb; font-weight: 600; word-break: break-all; }
.publicurl button { font-size: 12px; padding: 3px 10px; border-radius: 8px; }
@keyframes blinkWait { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ---------- Highscores ---------- */
.hsrow { display: flex; gap: 8px; align-items: center; }
.hsrow input {
  font: inherit; font-size: 16px; padding: 9px 14px; width: 180px;
  color: #efeaf6; background: #171a24;
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px; outline: none;
}
.hsrow input:focus { border-color: #ffb347; }
.hslist { display: flex; flex-direction: column; gap: 3px; width: 100%; max-width: 380px; }
.hsentry {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 5px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.hsentry .hsrank { width: 26px; color: #8f8aa2; font-weight: 700; }
.hsentry .hsname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hsentry .hswave { color: #ffd76a; font-weight: 800; white-space: nowrap; }
.hsentry .hskills { color: #8f8aa2; font-size: 12px; white-space: nowrap; }
.hsentry.top1 { background: rgba(255, 200, 90, 0.14); border: 1px solid rgba(255, 200, 90, 0.4); }
.hsentry.top1 .hsrank { color: #ffd76a; }
.hsentry.mine { border: 1px solid rgba(120, 230, 140, 0.5); }
.hstitlebox { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.hstitlebox h2 { font-size: 18px; }

/* ---------- Querformat-Hinweis (Handy) ---------- */
.rotatebox {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 34px 44px; border-radius: 22px; text-align: center;
  background: linear-gradient(175deg, rgba(28, 32, 46, 0.95), rgba(14, 16, 26, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.rotateicon { font-size: 56px; animation: rotWiggle 1.6s ease-in-out infinite; }
@keyframes rotWiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* ---------- Schrottmarkt (Shop-Phase) — groß und gut lesbar ---------- */
.shoppanel { max-width: min(880px, 96vw); width: 100%; gap: 16px; }
.shoppanel h2 { font-size: 30px; }
.shopmats { color: #8fe870; font-weight: 800; }
.shopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.shopcard {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: 16px; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.1s ease, background 0.1s ease;
  min-height: 84px;
}
.shopcard:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.1); }
.shopcard.wpn { border-color: rgba(255, 200, 90, 0.4); }
.shopcard.stat { border-color: rgba(120, 200, 255, 0.35); }
.shopcard.poor { opacity: 0.4; cursor: default; }
.shopcard.poor:hover { transform: none; background: rgba(255, 255, 255, 0.05); }
.shopcard.bought { opacity: 0.35; justify-content: center; cursor: default; font-style: italic; }
.shopcard .sicon { font-size: 40px; width: 52px; text-align: center; }
.shopcard .sinfo { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.shopcard .sinfo b { font-size: 18px; }
.shopcard .sinfo span { font-size: 14px; color: #b3aec4; line-height: 1.3; }
.shopcard .sprice { font-weight: 800; color: #8fe870; white-space: nowrap; font-size: 18px; }

@media (max-width: 720px), (max-height: 500px) {
  .shoppanel { gap: 8px; }
  .shoppanel h2 { font-size: 20px; }
  .shopgrid { gap: 8px; }
  .shopcard { padding: 8px 12px; min-height: 0; gap: 10px; }
  .shopcard .sicon { font-size: 24px; width: 30px; }
  .shopcard .sinfo b { font-size: 14px; }
  .shopcard .sinfo span { font-size: 11.5px; }
  .shopcard .sprice { font-size: 14px; }
}

/* ---------- Schatzkiste: Las-Vegas-Moment ---------- */
.chestbox {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 34px 48px; border-radius: 24px;
  background: linear-gradient(175deg, rgba(60, 44, 14, 0.95), rgba(30, 22, 8, 0.97));
  border: 2px solid rgba(255, 200, 90, 0.55);
  box-shadow: 0 0 60px rgba(255, 190, 60, 0.35), 0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.chestglow {
  position: absolute; inset: -60%;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(255, 210, 100, 0.14) 18deg, transparent 40deg,
    transparent 90deg, rgba(255, 210, 100, 0.14) 108deg, transparent 130deg,
    transparent 180deg, rgba(255, 210, 100, 0.14) 198deg, transparent 220deg,
    transparent 270deg, rgba(255, 210, 100, 0.14) 288deg, transparent 310deg);
  animation: raysSpin 7s linear infinite;
  pointer-events: none;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }
.chesticon { font-size: 64px; animation: chestShake 0.7s ease-in-out; z-index: 1; }
@keyframes chestShake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-8deg) scale(1.1); }
  40% { transform: rotate(8deg) scale(1.15); }
  60% { transform: rotate(-6deg) scale(1.1); }
  80% { transform: rotate(4deg) scale(1.05); }
}
.chesttitle {
  z-index: 1; letter-spacing: 4px;
  background: linear-gradient(180deg, #ffe9b0, #ff9d3d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chestitems { display: flex; flex-direction: column; gap: 10px; z-index: 1; min-width: 300px; }
.chestitem {
  display: flex; flex-direction: column; padding: 10px 16px; border-radius: 12px;
  opacity: 0; transform: translateY(14px) scale(0.9);
  animation: itemPop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}
.chestitem b { font-size: 16px; }
.chestitem span { font-size: 13px; color: #cfc7b0; }
.chestitem.evo { border-color: rgba(255, 210, 90, 0.8); background: rgba(120, 85, 15, 0.45); box-shadow: 0 0 20px rgba(255, 190, 60, 0.4); }
.chestitem.evo b { color: #ffd76a; }
.chestitem.hint { border-color: rgba(200, 140, 255, 0.6); background: rgba(70, 40, 110, 0.35); }
.chestitem.hint b { color: #cfa3ff; }
.chestitem.up b { color: #8ec5ff; }
.chestitem.gold b { color: #ffe066; }
@keyframes itemPop { to { opacity: 1; transform: translateY(0) scale(1); } }
#btnChestOk { z-index: 1; }

/* ---------- Mobile ---------- */
#mobileBtns {
  position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; z-index: 5;
}
#mobileBtns button {
  width: 48px; height: 48px; border-radius: 50%;
  font-size: 20px; padding: 0;
  background: rgba(25, 28, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
}
#mobileBtns button:hover { transform: none; }

@media (max-width: 700px) {
  .panel { padding: 18px 14px; gap: 10px; max-width: 96vw; }
  h1 { letter-spacing: 3px; }
  .sub { font-size: 13px; }
  h2 { font-size: 20px; }
  #logo { width: 100px; height: 100px; }
  button.big { font-size: 15px; padding: 11px 16px; }
  .btnrow { gap: 8px; }
  .card { width: min(320px, 86vw); min-height: 0; padding: 12px 14px; }
  .cards { gap: 10px; }
  input[type="range"] { width: 160px; }
  .joinrow input { width: 80px; font-size: 16px; }
  .chestbox { padding: 20px 16px; max-width: 94vw; }
  .chestitems { min-width: 0; width: 100%; }
  .hint { font-size: 11.5px; }
  .diffbtn { font-size: 12.5px; padding: 6px 10px; }
  .online { gap: 8px; }
}
kbd {
  background: #2a2f40; border: 1px solid #444a60; border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11.5px; font-family: inherit;
}

#levelupTitle { font-size: 30px; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7); }
.cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.card {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  width: 240px; min-height: 130px; padding: 16px 18px; text-align: left;
  border-radius: 16px;
}
.card .ctitle { font-size: 17px; font-weight: 800; }
.card .cdesc { font-size: 13.5px; color: #c5c0d4; line-height: 1.35; }
.card:hover { transform: translateY(-4px) scale(1.03); }
.card.new { border-color: rgba(120, 230, 140, 0.5); background: linear-gradient(180deg, #24402c, #16241c); }
.card.new .ctitle { color: #8df0a0; }
.card.up { border-color: rgba(110, 180, 255, 0.45); background: linear-gradient(180deg, #23324c, #151d2e); }
.card.up .ctitle { color: #8ec5ff; }
.card.pass { border-color: rgba(200, 140, 255, 0.45); background: linear-gradient(180deg, #35284a, #1d1730); }
.card.pass .ctitle { color: #cfa3ff; }
.card.evo {
  border: 1px solid rgba(255, 210, 90, 0.7);
  background: linear-gradient(180deg, #4a3a18, #2a2010);
  box-shadow: 0 0 24px rgba(255, 190, 60, 0.35);
  animation: evoPulse 1.4s ease-in-out infinite;
}
.card.evo .ctitle { color: #ffd76a; }
@keyframes evoPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 190, 60, 0.25); }
  50% { box-shadow: 0 0 34px rgba(255, 190, 60, 0.5); }
}
