html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'alwyn-new-web', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

/* ============================================================
   GLOSSY ACRYLIC BINGO THEME
   ------------------------------------------------------------
   Nur Design/Animation. Die Funktionalität bleibt in scripts.js:
   - Google Sheet laden
   - Spielname aus URL lesen
   - Kacheln erzeugen
   - Logo wird in index.html geladen
   ============================================================ */

/* ------------------------------------------------------------
   1) Zentrale Farbpalette
   ------------------------------------------------------------ */
:root {
  --pink: #ff0f78;
  --turquoise: #12d5da;
  --purple: #5527d8;
  --yellow: #ffc400;
  --white: #ffffff;
  --black: #0b0b0f;

  --inactive-gray-light: #d9d9d9;
  --inactive-gray-mid: #b9b9b9;
  --inactive-gray-dark: #8f8f8f;

  --logo-area-height: 76px;
  --board-gap: 12px;
  --board-padding: 12px;

  --font-main: 'alwyn-new-web', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ------------------------------------------------------------
   2) Mobile Website Background im Key-Visual-Look
   ------------------------------------------------------------ */
html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: #f4f4f4;
  font-family: var(--font-main);
}

/* Farbflächen im Hintergrund, angelehnt an die Key Visuals */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 13%, var(--turquoise) 14% 39%, transparent 40%),
    linear-gradient(72deg, transparent 0 47%, var(--pink) 48% 76%, transparent 77%),
    linear-gradient(142deg, transparent 0 69%, var(--purple) 70% 86%, transparent 87%),
    linear-gradient(160deg, var(--white) 0 34%, #f6f6f6 35% 100%);
}

/* Schwarze Sprenkel wie im Moodboard */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .22;
  background:
    radial-gradient(circle, var(--black) 0 2px, transparent 2.7px);
  background-size: 22px 22px;
}

/* ------------------------------------------------------------
   3) Header / Logo
   ------------------------------------------------------------
   Transparenz-Fix:
   Das Logo selbst bekommt KEINEN CSS-Shadow mehr, weil transparente
   GIFs dadurch harte Kanten oder abgeschnittene Verläufe zeigen können.
   Die Trennung zum Spielfeld entsteht stattdessen über den Header.
   ------------------------------------------------------------ */
.header {
  position: relative;
  z-index: 4;
  width: 100%;
  max-width: 430px;
  height: var(--logo-area-height);
  min-height: var(--logo-area-height);
  max-height: var(--logo-area-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px 7px;
  box-sizing: border-box;
  overflow: visible;

  background: rgba(255, 255, 255, .34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(11, 11, 15, .16);
  box-shadow: 0 10px 22px rgba(11, 11, 15, .10);
}

/* Das geladene GIF bleibt dasselbe. Nur Darstellung wird angepasst. */
.bingo-logo {
  display: block;
  width: auto;
  max-width: 96%;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  margin: 0 auto;

  background: transparent !important;
  filter: none !important;
  box-shadow: none !important;
  overflow: visible;
}

/* ------------------------------------------------------------
   4) Bingo Grid
   ------------------------------------------------------------ */
.bingo-container {
  position: relative;
  z-index: 3;
  width: min(100vw, 430px);
  max-width: 430px;
  height: calc(100svh - var(--logo-area-height));
  min-height: calc(100svh - var(--logo-area-height));
  margin: 0 auto;
  padding: var(--board-padding);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: var(--board-gap);
  overflow: hidden;
}

/* ------------------------------------------------------------
   5) Glossy Acrylic Buttons
   ------------------------------------------------------------ */
.bingo-tile {
  --bg: var(--pink);
  --glow: rgba(255,15,120,.72);
  --text: var(--white);

  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 12px 9px;
  box-sizing: border-box;
  border-radius: 22px;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  color: var(--text);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.38), transparent 24%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 92%, white), var(--bg) 50%, color-mix(in srgb, var(--bg) 72%, black));

  box-shadow:
    0 0 0 4px rgba(255,255,255,.92) inset,
    0 0 0 8px color-mix(in srgb, var(--bg) 78%, white) inset,
    0 7px 0 color-mix(in srgb, var(--bg) 68%, black),
    0 12px 24px rgba(0,0,0,.22),
    0 0 20px var(--glow);

  font-family: var(--font-main);
  font-size: clamp(14px, 3.9vw, 20px);
  line-height: 1.03;
  font-weight: 900;
  letter-spacing: -.035em;
  text-shadow:
    0 2px 0 rgba(0,0,0,.35),
    0 0 12px rgba(255,255,255,.22);

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;

  transform: translateY(0);
  animation: tilePopIn .46s cubic-bezier(.16,1.2,.25,1) both;
  animation-delay: calc(var(--tile-index, 0) * 65ms);
  transition:
    transform .15s ease,
    box-shadow .15s ease,
    filter .15s ease,
    opacity .15s ease;
}

/* Innere Lichtkante */
.bingo-tile::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 15px;
  border: 2px solid rgba(255,255,255,.36);
  box-shadow:
    0 0 20px rgba(255,255,255,.20) inset,
    0 0 18px rgba(255,255,255,.28);
  pointer-events: none;
}

/* Weicher Glanz oben links */
.bingo-tile::after {
  content: "";
  position: absolute;
  left: -35%;
  top: -28%;
  width: 76%;
  height: 60%;
  border-radius: 999px;
  background: rgba(255,255,255,.36);
  filter: blur(10px);
  transform: rotate(-18deg);
  pointer-events: none;
}

/* Farbwechsel je Kachel, aber gleicher Button-Stil */
.bingo-tile:nth-child(4n+1) {
  --bg: var(--pink);
  --glow: rgba(255,15,120,.72);
  --text: var(--white);
}

.bingo-tile:nth-child(4n+2) {
  --bg: var(--turquoise);
  --glow: rgba(18,213,218,.72);
  --text: var(--black);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}

.bingo-tile:nth-child(4n+3) {
  --bg: var(--purple);
  --glow: rgba(85,39,216,.72);
  --text: var(--white);
}

.bingo-tile:nth-child(4n+4) {
  --bg: var(--yellow);
  --glow: rgba(255,196,0,.72);
  --text: var(--black);
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}

/* Klick / Touch */
.bingo-tile:active {
  transform: translateY(5px) scale(.98);
}

/* Ausgewählt = inaktiv, grau, bleibt sichtbar */
.bingo-tile.active,
.bingo-tile.tile-clicked.active {
  --bg: var(--inactive-gray-mid);
  --glow: rgba(0,0,0,.12);
  --text: var(--black);
  color: var(--black);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.32), transparent 24%),
    linear-gradient(145deg, var(--inactive-gray-light), var(--inactive-gray-mid) 52%, var(--inactive-gray-dark));
  box-shadow:
    0 0 0 4px rgba(255,255,255,.76) inset,
    0 0 0 8px rgba(255,255,255,.30) inset,
    0 4px 0 #777,
    0 8px 18px rgba(0,0,0,.18);
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
  transform: translateY(5px) scale(.98);
  opacity: .96;
}

/* Kurzer Pop beim Anklicken */
.bingo-tile.tile-clicked {
  animation: tileClickPop .26s cubic-bezier(.16,1.3,.25,1) both;
}

/* ------------------------------------------------------------
   6) Abschlussanimation aus scripts.js
   ------------------------------------------------------------ */
.bingo-container.bingo-complete .bingo-tile {
  pointer-events: none;
  animation:
    tileExplode .72s cubic-bezier(.18,.82,.25,1) calc(var(--tile-index, 0) * 35ms) forwards !important;
}

/* Vollbild Bingo */
.bingo-win-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(112deg, transparent 0 16%, var(--turquoise) 17% 42%, transparent 43%),
    linear-gradient(72deg, transparent 0 46%, var(--pink) 47% 76%, transparent 77%),
    linear-gradient(142deg, transparent 0 68%, var(--purple) 69% 86%, transparent 87%),
    var(--white);
  animation: bingoScreenIn .42s ease-out forwards;
}

.bingo-win-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  background:
    radial-gradient(circle, var(--black) 0 2px, transparent 2.7px);
  background-size: 22px 22px;
}

.bingo-win-text {
  position: relative;
  z-index: 1;
  padding: .18em .34em .22em;
  border-radius: 36px;
  color: var(--white);
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.38), transparent 24%),
    linear-gradient(145deg, #ff5aa6, var(--pink) 52%, #c50058);
  box-shadow:
    0 0 0 6px rgba(255,255,255,.95) inset,
    0 0 0 12px rgba(255,255,255,.28) inset,
    0 12px 0 #980046,
    0 22px 36px rgba(0,0,0,.26),
    0 0 42px rgba(255,15,120,.72);
  font-family: var(--font-main);
  font-size: clamp(70px, 24vw, 150px);
  line-height: .82;
  font-weight: 1000;
  letter-spacing: -.08em;
  text-transform: uppercase;
  text-shadow:
    0 5px 0 rgba(0,0,0,.42),
    0 0 18px rgba(255,255,255,.42);
  transform: scale(.65);
  opacity: 0;
  animation: bingoTextIn .62s cubic-bezier(.12,1.45,.24,1) .08s forwards;
}

/* Fehlermeldung lesbar über dem Design */
#error-message {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10000;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  color: var(--black) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.20);
}

/* ------------------------------------------------------------
   7) Desktop Fallback
   ------------------------------------------------------------ */
@media (min-width: 701px) {
  .header,
  .bingo-container {
    max-width: 430px;
  }
}

/* Kleine Phones */
@media (max-height: 760px) {
  :root {
    --logo-area-height: 64px;
    --board-gap: 10px;
    --board-padding: 10px;
  }

  .bingo-logo {
    max-height: 52px;
  }

  .bingo-tile {
    font-size: clamp(13px, 3.6vw, 18px);
    border-radius: 19px;
    padding: 9px 7px;
  }

  .bingo-tile::before {
    inset: 7px;
    border-radius: 13px;
  }
}

/* Fallback für ältere Browser ohne svh */
@supports not (height: 100svh) {
  .bingo-container {
    height: calc(100vh - var(--logo-area-height));
    min-height: calc(100vh - var(--logo-area-height));
  }
}

/* ------------------------------------------------------------
   8) Animationen
   ------------------------------------------------------------ */
@keyframes tilePopIn {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(.86);
    filter: blur(8px);
  }
  70% {
    opacity: 1;
    transform: translateY(-5px) scale(1.04);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes tileClickPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: translateY(5px) scale(.98);
  }
}

@keyframes tileExplode {
  0% {
    opacity: .96;
    transform: translate(0, 5px) scale(.98);
    filter: none;
  }
  38% {
    opacity: 1;
    transform: translate(0, -10px) scale(1.08) rotate(6deg);
    filter: brightness(1.08);
  }
  100% {
    opacity: 0;
    transform:
      translate(var(--explode-x, 0px), var(--explode-y, -120px))
      scale(.18)
      rotate(var(--explode-r, 18deg));
    filter: none;
  }
}

@keyframes bingoScreenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bingoTextIn {
  0% {
    opacity: 0;
    transform: scale(.65) rotate(-3deg);
  }
  68% {
    opacity: 1;
    transform: scale(1.08) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-1deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
