@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap");

/* ==================== CSS Variables ==================== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e1b4b;
  --card-bg: rgba(255, 255, 255, 0.96);
  --border-color: #0c0a09;
  --text-primary: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;

  --play-btn-bg: #22c55e;
  --play-btn-hover: #16a34a;
  --play-btn-active: #15803d;

  --create-btn-bg: #3b82f6;
  --create-btn-hover: #2563eb;
  --create-btn-active: #1d4ed8;

  --join-btn-bg: #f59e0b;
  --join-btn-hover: #d97706;
  --join-btn-active: #b45309;

  --input-bg: #f5f5f4;
  --input-border: #d6d3d1;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  /* Bubbly letters colors */
  --color-s: #ef4444;
  --color-c: #f97316;
  --color-r: #eab308;
  --color-i: #22c55e;
  --color-b1: #06b6d4;
  --color-b2: #3b82f6;
  --color-l: #a855f7;
}

/* ==================== Reset ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Nunito", sans-serif;
  background: linear-gradient(-45deg, #2e1065, #1e1b4b, #0369a1, #0d9488);
  background-size: 400% 400%;
  animation: gradientBG 18s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  padding: 16px;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ==================== Background Shapes ==================== */
.background-shapes {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float 25s infinite ease-in-out;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: #db2777; /* Rose */
  top: -10%;
  left: -5%;
  animation-duration: 30s;
}

.shape-2 {
  width: 280px;
  height: 280px;
  background: #2563eb; /* Blue */
  bottom: 5%;
  right: -5%;
  animation-duration: 25s;
  animation-delay: -5s;
}

.shape-3 {
  width: 220px;
  height: 220px;
  background: #eab308; /* Yellow */
  bottom: -5%;
  left: 15%;
  animation-duration: 20s;
  animation-delay: -2s;
}

.shape-4 {
  width: 200px;
  height: 200px;
  background: #10b981; /* Green */
  top: 25%;
  right: 20%;
  animation-duration: 24s;
  animation-delay: -10s;
}

.shape-5 {
  width: 180px;
  height: 180px;
  background: #a855f7; /* Purple */
  top: 45%;
  left: -10%;
  animation-duration: 18s;
  animation-delay: -7s;
}

.shape-6 {
  width: 240px;
  height: 240px;
  background: #f97316; /* Orange */
  top: -5%;
  right: 10%;
  animation-duration: 32s;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-40px) rotate(180deg) scale(1.15);
  }
}

/* ==================== Page Wrapper ==================== */
.page-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 450px;
  margin: auto;
  gap: 16px;
}

/* ==================== Logo & Tagline ==================== */
.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.logo {
  font-size: 4.2rem;
  font-weight: 900;
  display: flex;
  justify-content: center;
  gap: 2px;
  letter-spacing: -2px;
  filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.4));
  user-select: none;
}

.logo span {
  display: inline-block;
  -webkit-text-stroke: 3px var(--border-color);
  paint-order: stroke fill;
  animation: bounceLetter 1.8s ease-in-out infinite alternate;
}

/* Bouncy letter animation & coloring */
.letter-s { color: var(--color-s); animation-delay: 0s; }
.letter-c { color: var(--color-c); animation-delay: 0.15s; }
.letter-r { color: var(--color-r); animation-delay: 0.3s; }
.letter-i { color: var(--color-i); animation-delay: 0.45s; }
.letter-b { color: var(--color-b1); animation-delay: 0.6s; }
.letter-b2 { color: var(--color-b2); animation-delay: 0.75s; } /* Class fallback */
.logo span:nth-child(6) { color: var(--color-b2); animation-delay: 0.75s; }
.letter-l { color: var(--color-l); animation-delay: 0.9s; }

@keyframes bounceLetter {
  0% {
    transform: translateY(0) rotate(-3deg);
  }
  100% {
    transform: translateY(-12px) rotate(5deg);
  }
}

.tagline {
  font-size: 1.1rem;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
}

/* ==================== Card ==================== */
.container {
  width: 100%;
}

.card.unified-card {
  background: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow:
    0 8px 0 var(--border-color),
    0 15px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease;
}

.card.unified-card:hover {
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 3px dashed var(--input-border);
  padding-bottom: 12px;
  margin-bottom: 2px;
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* ==================== Forms & Inputs ==================== */
form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

input {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
}

input::placeholder {
  color: var(--text-muted);
  font-weight: 700;
}

input:focus {
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* ==================== Buttons ==================== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 3px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: "Nunito", sans-serif;
  font-weight: 900;
  cursor: pointer;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  top: 0;
  box-shadow: 0 4px 0 var(--border-color);
  transition: all 0.1s ease;
  user-select: none;
}

.btn:hover {
  top: -2px;
  box-shadow: 0 6px 0 var(--border-color);
}
.btn:active {
  top: 4px;
  box-shadow: none;
}

.btn-play-random {
  background: var(--play-btn-bg);
  width: 100%;
  text-shadow: 0 2px 0 var(--play-btn-active);
}
.btn-play-random:hover {
  background: var(--play-btn-hover);
}
.btn-play-random:active {
  background: var(--play-btn-active);
}

.btn-create-private {
  background: var(--create-btn-bg);
  width: 100%;
  text-shadow: 0 2px 0 var(--create-btn-active);
}
.btn-create-private:hover {
  background: var(--create-btn-hover);
}
.btn-create-private:active {
  background: var(--create-btn-active);
}

.btn-join-private {
  background: var(--join-btn-bg);
  text-shadow: 0 2px 0 var(--join-btn-active);
}
.btn-join-private:hover {
  background: var(--join-btn-hover);
}
.btn-join-private:active {
  background: var(--join-btn-active);
}

/* ==================== Divider ==================== */
.card-section-divider {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 6px 0;
}

.card-section-divider .divider-line {
  flex: 1;
  height: 3px;
  background-color: var(--input-border);
  border-radius: 2px;
}

.card-section-divider .divider-text {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text-muted);
  padding: 0 12px;
  letter-spacing: 1.2px;
  white-space: nowrap;
}

/* ==================== Join Section ==================== */
.actions-grid {
  width: 100%;
}

.join-private-section {
  display: flex;
  gap: 10px;
  width: 100%;
}

.join-private-section .input-group {
  flex: 1.3;
}

.join-private-section .btn-join-private {
  flex: 0.7;
}

/* ==================== Footer ==================== */
.footer {
  text-align: center;
  margin-top: 8px;
}

.footer p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.footer a {
  color: #fbbf24;
  text-decoration: none;
  font-weight: 800;
  transition: all 0.15s ease;
  border-bottom: 2px dashed rgba(251, 191, 36, 0.4);
}

.footer a:hover {
  color: #f59e0b;
  border-bottom-style: solid;
}

/* ==================== Mobile ==================== */
@media (max-width: 480px) {
  .page-wrapper {
    gap: 12px;
  }
  
  .logo {
    font-size: 3.2rem;
  }
  
  .logo span {
    -webkit-text-stroke: 2px var(--border-color);
  }

  .tagline {
    font-size: 0.9rem;
  }

  .card.unified-card {
    padding: 18px;
    gap: 12px;
    border-radius: 12px;
  }
  
  .card-header {
    padding-bottom: 8px;
  }
  
  .card-header h2 {
    font-size: 1.25rem;
  }
  
  .card-desc {
    font-size: 0.8rem;
  }

  input {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .btn {
    font-size: 0.9rem;
    padding: 10px 16px;
  }

  .join-private-section {
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-join-private {
    width: 100%;
  }
}
