@font-face {
  font-family: "Unbounded";
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/unbounded-latin-800-normal.woff2") format("woff2");
}

:root {
  --bg: #05040b;
  --ink: #ece9ff;
  --muted: #9a96bd;
  --c1: #22d3ee;
  --c2: #a855f7;
  --c3: #f472b6;
  --card: rgba(18, 14, 38, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --head: "Unbounded", "Arial Black", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }

.screen {
  position: absolute; inset: 0; overflow-y: auto; pointer-events: auto;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.screen.game { pointer-events: none; overflow: hidden; padding: 0; display: block; }
.screen.game button { pointer-events: auto; }

body:not(.ready) #ui { opacity: 0; }
body.ready #ui { animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Karten & Knöpfe ---------- */

.card {
  width: 100%; max-width: 440px; margin: auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 18px 20px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn {
  display: block; width: 100%; min-height: 50px; margin: 10px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--head); font-size: 15px; letter-spacing: 0.02em;
  transition: transform .12s, background .2s, box-shadow .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary {
  border: 0;
  background: linear-gradient(100deg, var(--c1), var(--c2) 55%, var(--c3));
  color: #0b0716;
  box-shadow: 0 8px 28px rgba(168, 85, 247, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.big { min-height: 60px; font-size: 18px; }
.btn.small { display: inline-block; width: auto; min-height: 38px; margin: 0; padding: 0 14px; font-size: 12px; }
.btn.danger { background: #ef4444; border: 0; color: #fff; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06); font-size: 20px;
}
.back { background: none; border: 0; color: var(--muted); padding: 6px 0; font-size: 14px; }

/* ---------- Startseite ---------- */

.logo {
  margin: 4px 0 6px; text-align: center;
  font-family: var(--head); font-weight: 800; font-size: min(12.5vw, 58px); line-height: 1; letter-spacing: -0.02em; white-space: nowrap;
}
.logo span {
  display: inline-block;
  background: linear-gradient(180deg, #fff 10%, var(--c1) 45%, var(--c2) 75%, var(--c3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.5)) drop-shadow(0 0 18px rgba(168, 85, 247, 0.45));
  animation: hop 2.6s cubic-bezier(.3, .7, .3, 1) infinite;
}
.logo span:nth-child(2) { animation-delay: .08s; }
.logo span:nth-child(3) { animation-delay: .16s; }
.logo span:nth-child(4) { animation-delay: .24s; }
.logo span:nth-child(5) { animation-delay: .32s; }
.logo span:nth-child(6) { animation-delay: .40s; }
.logo span:nth-child(7) { animation-delay: .48s; color: transparent; }
@keyframes hop {
  0%, 60%, 100% { transform: translateY(0) scale(1, 1); }
  10% { transform: translateY(2px) scale(1.12, .84); }
  22% { transform: translateY(-14px) scale(.92, 1.1); }
  34% { transform: translateY(0) scale(1.08, .9); }
  44% { transform: translateY(0) scale(1, 1); }
}
.claim { margin: 0 0 14px; text-align: center; color: var(--muted); }
.status { margin: 0 0 8px; text-align: center; color: var(--c1); font-size: 13px; min-height: 0; }
.status:empty { display: none; }

.field label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px 2px; letter-spacing: .04em; text-transform: uppercase; }
.row { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3); color: var(--ink); font-size: 17px; font-weight: 600;
  outline: none;
}
.field input:focus { border-color: var(--c2); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25); }

.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; }
.list-head h2 { margin: 0; font: 800 14px var(--head); letter-spacing: .03em; }
#online { font-size: 12px; color: var(--muted); }
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms .empty { padding: 16px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 14px; }
.room-item {
  width: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 10px; align-items: center;
  margin: 0 0 8px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.04);
}
.room-item:active { transform: scale(.98); }
.room-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { display: flex; align-items: center; gap: 3px; font-size: 13px; color: var(--muted); }
.room-meta b { margin-left: 6px; color: var(--ink); }
.room-join { grid-row: 1 / 3; grid-column: 2; font: 800 12px var(--head); color: var(--c1); }

.howto { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.howto summary { cursor: pointer; font: 800 13px var(--head); color: var(--muted); list-style: none; }
.howto summary::before { content: "＋ "; }
.howto[open] summary::before { content: "－ "; }
.howto h3 { font: 800 13px var(--head); margin: 14px 0 6px; }
.steps { padding-left: 20px; margin: 10px 0; color: #d6d3f0; font-size: 14px; }
.steps li { margin: 4px 0; }
.items { list-style: none; padding: 0; margin: 0; font-size: 13px; color: #d6d3f0; }
.items li { display: flex; gap: 10px; align-items: center; margin: 6px 0; }
.items img { width: 26px; height: 26px; flex: none; }

/* ---------- Spielfiguren als kleine Kugeln (HTML) ---------- */

.blob {
  --c: #888;
  position: relative; display: inline-block; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c);
  background: radial-gradient(circle at 34% 30%, #fff 0, color-mix(in srgb, var(--c) 55%, #fff) 14%, var(--c) 42%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 50%, transparent), inset 0 -2px 4px rgba(0, 0, 0, 0.35);
}
.blob i {
  position: absolute; top: 30%; width: 22%; height: 28%; border-radius: 50%; background: #fff;
}
.blob i:first-child { left: 26%; }
.blob i:last-child { right: 26%; }
.blob i::after { content: ""; position: absolute; left: 25%; top: 30%; width: 55%; height: 55%; border-radius: 50%; background: #1a1033; }
.blob.mini { width: 16px; height: 16px; }
.blob.ghost { opacity: .25; filter: grayscale(.6); }
.blob.crown::before { content: "👑"; position: absolute; left: 50%; top: -0.95em; transform: translateX(-50%); font-size: 26px; }

/* ---------- Warteraum ---------- */

.room-title { font: 800 22px var(--head); margin: 6px 0 8px; overflow-wrap: anywhere; }
.code-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.code-row b { font: 800 18px var(--head); color: var(--ink); letter-spacing: .12em; margin-left: 4px; }
.slots { list-style: none; padding: 0; margin: 16px 0 6px; }
.slots li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}
.slots li.me { border-color: rgba(168, 85, 247, 0.6); background: rgba(168, 85, 247, 0.12); }
.slots li.free { background: none; border-style: dashed; color: var(--muted); font-size: 13px; animation: none; }
.slots li.off { opacity: .55; }
.slots .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slots li.free .nm { font-weight: 400; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); color: var(--muted); }
.tag.host { background: rgba(250, 204, 21, 0.18); color: #fde047; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.settings { margin: 12px 0 2px; display: grid; gap: 8px; }
.seg { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seg span { flex: 1; }
.seg button {
  width: 44px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
  font: 800 14px var(--head);
}
.seg button.on { background: var(--c2); border-color: var(--c2); color: #fff; box-shadow: 0 0 16px rgba(168, 85, 247, 0.5); }
.seg button:disabled { opacity: .3; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 0; }
.hint .expire { display: block; margin-top: 4px; font-size: 12px; opacity: .8; }

/* ---------- Im Spiel ---------- */

.hud {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; justify-content: center; gap: 4px;
  padding: max(6px, env(safe-area-inset-top)) 48px 0 6px;
}
.chip {
  --c: #888;
  flex: 1 1 0; min-width: 0; max-width: 150px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 7px 5px; border-radius: 11px;
  background: rgba(10, 8, 24, 0.74); border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 2px solid var(--c);
  transition: opacity .3s, transform .3s;
}
.chip.me { box-shadow: 0 0 0 1px var(--c), 0 0 16px color-mix(in srgb, var(--c) 45%, transparent); }
.chip.out { opacity: .38; transform: scale(.94); }
.chip .ct { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.chip .nm { font-size: 10.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.chip.bot .nm::after { content: " 🤖"; font-size: 9px; }
.chip .pips { display: flex; gap: 3px; }
.chip .pips i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
.chip .pips i.on { background: #fde047; border-color: #fde047; box-shadow: 0 0 6px #fde047; }
.chip .dmg { font: 800 13px var(--head); white-space: nowrap; }

.top-btns { position: absolute; top: max(6px, env(safe-area-inset-top)); right: 6px; display: flex; flex-direction: column; gap: 5px; }
.top-btns .icon-btn { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; background: rgba(10, 8, 24, 0.74); }

.feed { position: absolute; left: 0; right: 0; bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px)); display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
.feed-item {
  font-size: 13px; padding: 5px 12px; border-radius: 99px; background: rgba(10, 8, 24, 0.78); border: 1px solid var(--line);
  animation: feedIn .35s cubic-bezier(.3, 1.5, .5, 1), feedOut .5s ease 3.3s forwards;
}
@keyframes feedIn { from { transform: translateY(10px) scale(.9); opacity: 0; } }
@keyframes feedOut { to { opacity: 0; transform: translateY(-6px); } }

.tip {
  position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 99px; background: rgba(10, 8, 24, 0.85); border: 1px solid rgba(34, 211, 238, 0.5);
  font-size: 14px; white-space: nowrap; box-shadow: 0 0 24px rgba(34, 211, 238, 0.25);
  animation: tipPulse 1.6s ease-in-out infinite;
}
.tip b { color: var(--c1); }
@keyframes tipPulse { 50% { box-shadow: 0 0 34px rgba(34, 211, 238, 0.5); } }

.item-toast {
  position: absolute; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  display: flex; gap: 10px; align-items: center; width: min(92vw, 380px);
  padding: 10px 14px; border-radius: 16px; background: rgba(10, 8, 24, 0.9); border: 1px solid var(--line);
  font-size: 13px; opacity: 0;
}
.item-toast img { width: 30px; height: 30px; flex: none; }
.item-toast.show { animation: itemIn 2.8s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes itemIn {
  0% { transform: translate(-50%, 140%); opacity: 0; }
  12%, 85% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, 0); opacity: 0; }
}

.emotes {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 18px; background: rgba(10, 8, 24, 0.8); border: 1px solid var(--line);
  pointer-events: auto; animation: pop .3s ease;
}
.emotes button { width: 40px; height: 40px; border: 0; background: none; font-size: 22px; border-radius: 10px; }
.emotes button:active { transform: scale(1.3); background: rgba(255, 255, 255, 0.1); }

#emo-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.emo-pop {
  position: absolute; bottom: 90px; display: flex; flex-direction: column; align-items: center;
  animation: emoRise 2.6s cubic-bezier(.2, .7, .3, 1) forwards;
}
.emo-pop .em { font-size: 40px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.emo-pop .who { font: 800 11px var(--head); text-shadow: 0 1px 3px #000; }
@keyframes emoRise {
  0% { transform: translateY(30px) scale(.4); opacity: 0; }
  15% { transform: translateY(0) scale(1.15); opacity: 1; }
  25% { transform: translateY(-10px) scale(1); }
  100% { transform: translateY(-220px) scale(.9); opacity: 0; }
}

/* ---------- Ergebnis ---------- */

#s-end { background: rgba(5, 4, 11, 0.35); }
.end-title { font: 800 26px var(--head); text-align: center; margin: 4px 0 18px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 34px 0 8px; }
.pod { flex: 1; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.pod.p1 { animation-delay: .3s; }
.pod.p2 { animation-delay: .15s; }
.pod .blob { width: 46px; height: 46px; }
.pod.p1 .blob { width: 60px; height: 60px; }
.pod .nm { font-weight: 800; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .sc { font-size: 11px; color: var(--muted); }
.pod .step {
  width: 100%; display: grid; place-items: center; font: 800 22px var(--head);
  border-radius: 12px 12px 4px 4px; background: linear-gradient(180deg, rgba(168, 85, 247, 0.55), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(168, 85, 247, 0.5);
}
.pod.p1 .step { height: 84px; background: linear-gradient(180deg, rgba(250, 204, 21, 0.6), rgba(250, 204, 21, 0.12)); border-color: rgba(250, 204, 21, 0.6); }
.pod.p2 .step { height: 60px; }
.pod.p3 .step { height: 44px; }
.awards { list-style: none; padding: 0; margin: 16px 0 6px; }
.awards li {
  display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: center;
  padding: 8px 12px; margin-bottom: 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 13px;
}
.awards b { grid-column: 1 / 4; font: 800 12px var(--head); color: #fde047; }
.awards em { font-style: normal; color: var(--muted); text-align: right; }

/* ---------- Meldungen ---------- */

#toast {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translate(-50%, -150%);
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 14px;
  background: rgba(20, 16, 44, 0.95); border: 1px solid rgba(168, 85, 247, 0.5); font-size: 14px; text-align: center;
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); z-index: 20; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); }
#net {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 99px; background: #7f1d1d; color: #fff; font-size: 13px; z-index: 20;
  animation: tipPulse 1.2s infinite;
}
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(5, 4, 11, 0.8); z-index: 30; padding: 16px; }
.small-card { max-width: 340px; text-align: center; }
dialog {
  border: 1px solid var(--line); border-radius: 20px; background: #141029; color: var(--ink);
  padding: 20px; max-width: 320px; text-align: center;
}
dialog::backdrop { background: rgba(5, 4, 11, 0.7); }
dialog .row .btn { margin-top: 6px; }
dialog small { color: var(--muted); }

@media (min-width: 700px) {
  .chip { max-width: 170px; padding: 7px 10px; }
  .chip .nm { font-size: 12px; }
  .chip .dmg { font-size: 15px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .feed { top: 78px; bottom: auto; flex-direction: column; }
  .feed-item { font-size: 12px; padding: 3px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo span, .tip, #net { animation: none; }
}
