:root {
  --bg: #14122b;
  --bg-2: #1d1a3d;
  --surface: #262250;
  --surface-2: #322d66;
  --text: #f3f1ff;
  --muted: #a9a3d6;
  --accent: #ffb547;
  --accent-text: #2a1a00;
  --radius: 20px;
  --display: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(90% 50% at 15% -10%, rgba(226, 85, 122, .28) 0%, transparent 60%),
    radial-gradient(80% 45% at 100% 0%, rgba(108, 140, 255, .22) 0%, transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main, .site-header, .site-footer {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- Kopfzeile ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 13px);
  gap: 3px;
}
.brand-mark i { width: 13px; height: 13px; border-radius: 4px; display: block; }
.brand-mark i:nth-child(1) { background: #ffb547; }
.brand-mark i:nth-child(2) { background: #e2557a; }
.brand-mark i:nth-child(3) { background: #5ee6a8; }
.brand-mark i:nth-child(4) { background: #6c8cff; transform: translate(2px, 2px) rotate(12deg); }

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .2px;
}

.lang-switch {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--surface);
  border-radius: 999px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 13px/1 system-ui, sans-serif;
  letter-spacing: .5px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

/* ---------- Hero ---------- */

main { flex: 1; }

.hero { padding: 36px 0 28px; max-width: 640px; }

.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 7vw, 52px);
  line-height: 1.08;
  letter-spacing: -.5px;
  margin: 0 0 14px;
  text-wrap: balance;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2.6vw, 18px);
  text-wrap: pretty;
}

/* ---------- Spieleliste ---------- */

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px 16px;
  padding: 2px 16px;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--muted);
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  margin: 0;
}
.count { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 30px rgba(0, 0, 0, .25);
  transition: transform .2s ease, box-shadow .2s ease;
}
a.card:hover, a.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 18px 40px rgba(0, 0, 0, .4);
}
a.card:active { transform: scale(.98); }
a.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.card-cover {
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  overflow: hidden;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
a.card:hover .card-cover img { transform: scale(1.04); }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 18px;
  flex: 1;
}

.card-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.card-text { margin: 0; color: var(--muted); font-size: 15px; }

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}

.play {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px 11px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 16px;
}

.card.soon {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px 24px;
  min-height: 220px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--surface-2);
  border: 0;
}
.card.soon .card-title { font-size: 19px; }
.soon-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ---------- Fußzeile ---------- */

.site-footer {
  padding-top: 20px;
  padding-bottom: 28px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.site-footer .parents { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }

/* ---------- Spieler-Bereich ---------- */

.hidden { display: none !important; }
.header-right { display: flex; align-items: center; gap: 8px; }
.player-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  border: 0;
  border-radius: 999px;
  padding: 5px 12px 5px 6px;
  background: var(--surface);
  color: var(--text);
  font: 700 14px system-ui, sans-serif;
  cursor: pointer;
}
.player-btn #playerAvatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); font-size: 18px;
}
.player-btn #playerName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  background: rgba(8, 6, 25, .65);
  backdrop-filter: blur(4px);
}
@media (min-width: 640px) { .sheet { place-items: center; } }
.sheet-card {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.4);
  animation: sheet-up .25s ease;
}
@media (min-width: 640px) { .sheet-card { border-radius: 24px; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-card h2 { font-family: var(--display); font-size: 24px; margin: 0 0 12px; }
.sheet-card h3 { font-family: var(--display); font-size: 18px; margin: 20px 0 6px; }
.sheet-card .hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }

.players { display: grid; gap: 10px; }
.pcard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  background: var(--bg);
  box-shadow: inset 0 0 0 2px transparent;
  cursor: pointer;
}
.pcard.active { box-shadow: inset 0 0 0 3px var(--accent); }
.pavatar {
  width: 58px; height: 58px; flex-shrink: 0;
  border: 0; border-radius: 16px;
  background: var(--surface-2);
  font-size: 34px;
  cursor: pointer;
}
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pname, .group-input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface-2);
  color: var(--text);
  font: 700 17px system-ui, sans-serif;
  outline: none;
}
.pname:focus, .group-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.pbadge { font-size: 13px; color: var(--muted); }
.pcard.active .pbadge { color: var(--accent); font-weight: 700; }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; margin-top: 10px; }
.avatar-grid button {
  height: 48px; border: 0; border-radius: 12px;
  background: var(--bg); font-size: 26px; cursor: pointer;
}
.avatar-grid button.on { box-shadow: inset 0 0 0 3px var(--accent); }

.boards { display: grid; gap: 10px; }
.brow .bgame { font-weight: 700; margin-bottom: 6px; }
.bchips { display: flex; flex-wrap: wrap; gap: 6px; }
.bchips .chip { padding: 8px 12px; font-size: 13px; background: var(--bg); }

.sheet-close {
  margin-top: 20px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font: 800 17px system-ui, sans-serif;
  cursor: pointer;
}
