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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f1117;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: #e2e8f0;
  overflow-x: hidden;
}

/* --- Background grain --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 20% 0%,
      rgba(99, 179, 237, 0.08) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 80% 100%,
      rgba(72, 187, 120, 0.06) 0%,
      transparent 60%
    );
  filter: hue-rotate(var(--hue, 0deg));
  pointer-events: none;
  z-index: 0;
  transition: transform 0.1s ease-out;
  transform: translate(var(--parallax-x, 0px), var(--parallax-y, 0px));
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 2rem;
  gap: 0.75rem;
}

.logo-wrap {
  position: relative;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.mascot {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 0 30px rgba(99, 179, 237, 0.25));
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.3s ease;
  animation: float 4s ease-in-out infinite;
}

.mascot:hover {
  transform: scale(1.1) rotate(-5deg);
  filter: drop-shadow(0 0 40px rgba(99, 179, 237, 0.45));
  animation: none;
}

/* Long-press angry state */
.mascot.angry {
  animation: rage-shake 0.1s linear infinite;
  filter: drop-shadow(0 0 40px rgba(237, 64, 64, 0.6)) saturate(0.5)
    hue-rotate(-30deg);
}

@keyframes rage-shake {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  25% {
    transform: translateX(-4px) rotate(-2deg);
  }
  75% {
    transform: translateX(4px) rotate(2deg);
  }
}

.speech-bubble {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: #1a202c;
  border: 1px solid rgba(237, 64, 64, 0.4);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #fc8181;
  white-space: nowrap;
  pointer-events: none;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
  opacity: 0;
}

.speech-bubble.visible {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1a202c;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(
    135deg,
    var(--grad-from, #63b3ed),
    var(--grad-to, #48bb78)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.quote {
  color: #4a5568;
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  max-width: 360px;
  line-height: 1.5;
}

/* --- Pull-to-refresh --- */
.pull-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  background: rgba(15, 17, 23, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
  transition: height 0.2s ease;
  color: #ed8936;
  font-size: 0.8rem;
  font-style: italic;
}

.pull-indicator.active {
  height: 48px;
}

/* --- Time counter --- */
.time-counter {
  position: relative;
  z-index: 1;
  color: #2d3748;
  font-size: 0.7rem;
  text-align: center;
  margin-top: 0.5rem;
  transition: color 0.5s ease;
}

/* --- Links grid --- */
.section-title {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #4a5568;
  margin-top: 1rem;
  padding: 0 1.5rem;
  width: 100%;
  max-width: 640px;
}

.links {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 1.5rem 1.5rem;
  width: 100%;
  max-width: 640px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  text-decoration: none;
  color: #e2e8f0;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.link-card {
  filter: hue-rotate(var(--hue, 0deg));
}

.link-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 179, 237, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.link-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.25rem;
}

.link-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.link-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-url {
  font-size: 0.75rem;
  color: #718096;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* icon colors */
.icon-challenge {
  background: rgba(237, 137, 54, 0.15);
  color: #ed8936;
}
.icon-click {
  background: rgba(236, 64, 122, 0.15);
  color: #ec407a;
}
.icon-cookbook {
  background: rgba(72, 187, 120, 0.15);
  color: #48bb78;
}
.icon-games {
  background: rgba(99, 179, 237, 0.15);
  color: #63b3ed;
}
.icon-mathquest {
  background: rgba(159, 122, 234, 0.15);
  color: #9f7aea;
}
.icon-wizard {
  background: rgba(237, 100, 166, 0.15);
  color: #ed64a6;
}
.icon-yatzy {
  background: rgba(246, 224, 94, 0.15);
  color: #f6e05e;
}
.icon-uno {
  background: rgba(252, 129, 74, 0.15);
  color: #fc814a;
}

/* --- Roulette button --- */
.roulette-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  padding: 0.5rem 1.5rem 1.5rem;
}

.roulette-btn {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(237, 137, 54, 0.08);
  border: 1px dashed rgba(237, 137, 54, 0.3);
  border-radius: 12px;
  color: #ed8936;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.roulette-btn:hover {
  background: rgba(237, 137, 54, 0.15);
  border-color: rgba(237, 137, 54, 0.5);
  transform: translateY(-2px);
}

.roulette-btn:active {
  transform: scale(0.97);
}

.roulette-btn.spinning {
  animation: slot-spin 0.1s linear infinite;
}

@keyframes slot-spin {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  color: #4a5568;
  font-size: 0.8rem;
}

.footer span {
  color: #ed8936;
}

.visit-count {
  position: relative;
  z-index: 1;
  color: #2d3748;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* --- Bouncing logos (easter egg) --- */
.bouncer {
  position: fixed;
  top: 0;
  left: 0;
  width: 60px;
  height: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  transition: opacity 1.5s ease;
}

.bouncer.active {
  opacity: 0.07;
}
