*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

/* ── CSS theme variables (default = purple) ── */
:root {
  --accent: #9900ff;
  --bg-a: #110033;
  --bg-b: #1a0040;
  --bg-c: #220055;
  --bg-d: #150038;
  --bg-e: #0d0028;

  --b0c1: #9900ff; --b0c2: #6600cc;
  --b1c1: #7711dd; --b1c2: #550099;
  --b2c1: #bb44ff; --b2c2: #8800ee;
  --b3c1: #6600bb; --b3c2: #440088;
  --b4c1: #cc77ff; --b4c2: #9933ee;

  --card-bg: rgba(30, 10, 60, 0.42);
  --card-border: rgba(255, 255, 255, 0.13);

  --br0: 50%; --br1: 50%; --br2: 50%; --br3: 50%; --br4: 50%;
  --delay-before: -3s; --delay-after: -7s;
  --delay-b1: -2s; --delay-b2: -5s; --delay-b3: -1s;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  position: relative;
}

/* ── Animated background ── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  animation: bgShift 22s ease-in-out infinite alternate;
}

.bg::before,
.bg::after {
  content: '';
  position: absolute;
  border-radius: var(--br0, 50%);
  filter: blur(55px);
  transition: border-radius 12s ease-in-out;
  will-change: transform;
}

.bg::before {
  width: 80vw; height: 80vw;
  top: -25%; left: -25%;
  background: radial-gradient(circle, var(--b0c1), var(--b0c2), transparent 70%);
  animation: blobA 12s ease-in-out infinite alternate;
  animation-delay: var(--delay-before);
  border-radius: var(--br0, 50%);
}

.bg::after {
  width: 70vw; height: 70vw;
  bottom: -25%; right: -20%;
  background: radial-gradient(circle, var(--b1c1), var(--b1c2), transparent 70%);
  animation: blobB 15s ease-in-out infinite alternate;
  animation-delay: var(--delay-after);
  border-radius: var(--br1, 50%);
}

@keyframes bgShift {
  0%   { background: var(--bg-a); }
  25%  { background: var(--bg-b); }
  50%  { background: var(--bg-c); }
  75%  { background: var(--bg-d); }
  100% { background: var(--bg-e); }
}

@keyframes blobA {
  0%   { transform: scale(1)    translate(0%,   0%)   rotate(0deg);   }
  25%  { transform: scale(1.15) translate(14%,  18%)  rotate(22deg);  }
  50%  { transform: scale(0.9)  translate(-10%, 24%)  rotate(-15deg); }
  75%  { transform: scale(1.1)  translate(20%, -12%)  rotate(35deg);  }
  100% { transform: scale(1.05) translate(-6%,  -18%) rotate(-8deg);  }
}

@keyframes blobB {
  0%   { transform: scale(1)    translate(0%,   0%)   rotate(0deg);   }
  25%  { transform: scale(0.92) translate(-16%, -14%) rotate(-18deg); }
  50%  { transform: scale(1.2)  translate(12%,  -22%) rotate(12deg);  }
  75%  { transform: scale(0.88) translate(-20%, 10%)  rotate(-30deg); }
  100% { transform: scale(1.08) translate(8%,   16%)  rotate(15deg);  }
}

@keyframes blobC {
  0%   { transform: scale(1)    translate(0%,   0%)   rotate(0deg);   }
  20%  { transform: scale(1.15) translate(-18%, 16%)  rotate(16deg);  }
  40%  { transform: scale(0.88) translate(14%, -12%)  rotate(-22deg); }
  60%  { transform: scale(1.12) translate(-8%, -20%)  rotate(12deg);  }
  80%  { transform: scale(0.93) translate(22%,  8%)   rotate(-16deg); }
  100% { transform: scale(1.08) translate(-4%,  14%)  rotate(20deg);  }
}

@keyframes blobD {
  0%   { transform: scale(1)    translate(0%,   0%)   rotate(0deg);   }
  33%  { transform: scale(1.22) translate(16%, -16%)  rotate(-28deg); }
  66%  { transform: scale(0.82) translate(-20%, 12%)  rotate(20deg);  }
  100% { transform: scale(1.12) translate(10%,  18%)  rotate(-12deg); }
}

@keyframes blobE {
  0%   { transform: scale(1)    translate(0%,   0%)   rotate(0deg);   }
  25%  { transform: scale(0.88) translate(18%,  18%)  rotate(24deg);  }
  50%  { transform: scale(1.18) translate(-14%, -16%) rotate(-20deg); }
  75%  { transform: scale(0.92) translate(8%,  -22%)  rotate(32deg);  }
  100% { transform: scale(1.08) translate(-16%, 8%)   rotate(-8deg);  }
}

/* Extra floating blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(65px);
  z-index: 0;
  pointer-events: none;
  transition: border-radius 12s ease-in-out;
  will-change: transform;
}

.blob-1 {
  width: 50vw; height: 50vw;
  top: 10%; right: -28%;
  background: radial-gradient(circle, var(--b2c1), var(--b2c2), transparent 70%);
  animation: blobC 13s ease-in-out infinite alternate;
  animation-delay: var(--delay-b1);
  border-radius: var(--br2, 50%);
}

.blob-2 {
  width: 40vw; height: 40vw;
  bottom: -12%; left: -8%;
  background: radial-gradient(circle, var(--b3c1), var(--b3c2), transparent 70%);
  animation: blobD 10s ease-in-out infinite alternate;
  animation-delay: var(--delay-b2);
  border-radius: var(--br3, 50%);
}

.blob-3 {
  width: 35vw; height: 35vw;
  top: -5%; left: 33%;
  background: radial-gradient(circle, var(--b4c1), var(--b4c2), transparent 70%);
  animation: blobE 16s ease-in-out infinite alternate;
  animation-delay: var(--delay-b3);
  border-radius: var(--br4, 50%);
}

/* ── Wave canvas ── */
#wave-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
}

/* ── Page wrapper ── */
.page-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  width: min(860px, 92vw);
  position: relative;
  z-index: 2;
}

/* ── Glass card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: clamp(1.4rem, 4vw, 2.8rem) clamp(1.2rem, 4vw, 3rem);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.5);
}

/* ── Header ── */
.tree {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  line-height: 1;
}

h1 {
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1;
}

.subtitle {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-bottom: 0.2rem;
}

/* ── Scrolling carousel ── */
.links-wrapper {
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.links-wrapper:active { cursor: grabbing; }

.links-track {
  display: flex;
  gap: 0.65rem;
  width: max-content;
  will-change: transform;
}

.links-track.is-dragging { cursor: grabbing; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: clamp(0.82rem, 2.5vw, 0.93rem);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.btn:hover {
  filter: brightness(1.2);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(0.92);
  box-shadow: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 0 0 5px var(--accent, #9900ff);
}

.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Button colours */
.discord { background: #5865F2; }
.twitch  { background: #9146FF; }
.youtube { background: #FF0000; }
.steam   { background: #1b2838; }
.tiktok  { background: #010101; }
.games   { background: #1f6feb; }
.muted   { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); }

/* ── Live banner ── */
#live-banner {
  display: none;
  flex-direction: column;
  width: 100%;
  background: rgba(20, 8, 40, 0.55);
  border: 1px solid rgba(145, 70, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  overflow: hidden;
  animation: fadeInBanner 0.5s ease;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.live-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4444;
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,68,68,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(255,68,68,0.08); }
}

.live-badge {
  background: #ff4444;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.live-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  flex: 1;
}

.watch-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: #c084fc;
  text-decoration: none;
  flex-shrink: 0;
}

.watch-link:hover { color: #e879f9; }

.live-embed-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.live-embed-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Theme picker ── */
#theme-picker {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  z-index: 200;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 0.6rem 0.45rem;
}

/* Style toggle (blobs / waves) */
.tp-style-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.tp-style-btn {
  width: 26px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.tp-style-btn.active {
  border-color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.tp-style-btn:hover {
  border-color: rgba(255,255,255,0.55);
}

.tp-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.tp-btn:hover {
  transform: scale(1.3);
  border-color: rgba(255, 255, 255, 0.8);
}

.tp-btn.active {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* ── Sub-page: back link ── */
.back-btn {
  align-self: flex-start;
  margin-top: 0.3rem;
}

/* ── Games page ── */
.game-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-game {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.13);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-game:hover {
  background: rgba(255,255,255,0.17);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn-game:active { transform: translateY(0); }

.game-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.game-name { flex: 1; }

.arrow {
  opacity: 0.45;
  font-size: 0.9rem;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .bg  { animation: none !important; }
  .blob { animation: none !important; }
  .btn  { transition: filter 0.1s, box-shadow 0.1s; }
  #live-banner { animation: none; }
}

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
  body { padding: 1rem 0.75rem; }
  .card { border-radius: 18px; gap: 0.65rem; }
  .btn { padding: 0.65rem 1rem; font-size: 0.88rem; }
  .icon { width: 16px; height: 16px; }
  #theme-picker { bottom: 0.8rem; right: 0.8rem; }
}
