:root {
  --bg: #fffaf1;
  --surface: #fffdf8;
  --surface-strong: #fff3a8;
  --panel: rgba(255, 255, 255, 0.7);
  --primary: #ffcc70;
  --secondary: #ff8ec7;
  --sky: #9ad9ff;
  --mint: #baf3cf;
  --ink: #332d2a;
  --muted: #5d5652;
  --shadow: rgba(40, 23, 18, 0.12);
  --success: #3a9b59;
  --danger: #d65a73;
}

body.dark-mode {
  --bg: #1d1a2e;
  --surface: #2a2543;
  --surface-strong: #40385b;
  --panel: rgba(45, 36, 66, 0.8);
  --primary: #ffd877;
  --secondary: #ff9ecb;
  --sky: #7ec2ff;
  --mint: #7ce7b0;
  --ink: #f6f1ff;
  --muted: #d3d0eb;
  --shadow: rgba(0, 0, 0, 0.35);
}

body.dark-mode .sound-play {
  background: linear-gradient(135deg, #ffe58b, #ffd166);
  color: #2b1d24;
  border: 1px solid rgba(255, 244, 179, 0.8);
  box-shadow: 0 10px 18px rgba(255, 197, 66, 0.3);
}

body.dark-mode .rating-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  color: #ffe889;
  border: 1px solid rgba(255, 230, 138, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 210, 125, 0.35), transparent 28%),
    radial-gradient(circle at top right, rgba(154, 217, 255, 0.35), transparent 24%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255, 250, 241, 0.8);
  border-bottom: 2px solid rgba(255, 170, 200, 0.35);
}

body.dark-mode .site-header {
  background: rgba(29, 26, 46, 0.75);
}

.top-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: rgba(255, 167, 202, 0.18);
  transform: translateY(-2px);
  animation: whoosh 0.35s ease;
}

.theme-toggle {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--ink);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(255, 145, 161, 0.2);
}

.section-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 2rem;
  padding-top: 4rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.subtitle {
  margin: 1rem 0 0;
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 32rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.primary-btn,
.secondary-btn,
.generator-button,
.submit-btn {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn,
.submit-btn,
.generator-button {
  background: linear-gradient(135deg, var(--secondary), #ffbf9c);
  color: #2e1f28;
  box-shadow: 0 12px 28px rgba(255, 111, 171, 0.28);
}

.secondary-btn {
  background: rgba(154, 217, 255, 0.6);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(154, 217, 255, 0.24);
}

.primary-btn:hover,
.secondary-btn:hover,
.generator-button:hover,
.submit-btn:hover,
.theme-toggle:hover {
  transform: translateY(-2px) scale(1.02);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hero-stats div {
  background: var(--panel);
  border: 1px solid rgba(255, 206, 92, 0.4);
  border-radius: 18px;
  min-width: 120px;
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 20px var(--shadow);
}

.hero-stats strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
}

.hero-stats span {
  font-size: 0.9rem;
  color: var(--muted);
}

.hero-visual {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 205, 118, 0.22), rgba(154, 217, 255, 0.28));
  border-radius: 28px;
  padding: 1rem;
  box-shadow: 0 20px 45px rgba(255, 140, 173, 0.18);
  animation: floaty 4s ease-in-out infinite;
}

.hero-visual img {
  width: min(100%, 440px);
  filter: drop-shadow(0 22px 30px rgba(74, 55, 41, 0.08));
}

.section-heading {
  margin-bottom: 1.4rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.2rem;
}

.sound-card {
  background: var(--panel);
  border: 1px solid rgba(255, 198, 112, 0.45);
  border-radius: 24px;
  padding: 1rem;
  box-shadow: 0 12px 24px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sound-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 28px rgba(255, 140, 173, 0.16);
}

.sound-thumb {
  position: relative;
  margin-bottom: 1rem;
  display: grid;
  place-items: center;
  min-height: 130px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 231, 146, 0.6), rgba(154, 217, 255, 0.5));
}

.sound-thumb img {
  width: 92px;
  animation: wobble 1.8s ease-in-out infinite alternate;
}

.sound-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.sound-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sound-play {
  flex: 1;
  background: #fff3a4;
  color: var(--ink);
  border: none;
  border-radius: 999px;
  font-weight: 800;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
}

.rating-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
}

.generator-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 1.4rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(155, 126, 255, 0.18);
  border-radius: 30px;
  padding: 2rem;
}

.generator-button {
  width: fit-content;
  font-size: 1.1rem;
  padding: 1rem 1.8rem;
}

.fart-burst {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255, 214, 229, 0.8), rgba(154, 217, 255, 0.72));
  overflow: hidden;
}

.fart-burst img {
  width: min(100%, 220px);
  transition: transform 0.2s ease;
}

.fart-burst.bursting img {
  animation: fart-pop 0.6s ease-out;
}

.generator-metrics {
  font-size: 1.05rem;
  font-weight: 700;
}

.generator-metrics p {
  margin: 0.25rem 0;
}

.jokes-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.4rem;
}

.joke-list {
  display: grid;
  gap: 1rem;
}

.joke-item {
  background: var(--panel);
  border-radius: 20px;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(255, 160, 195, 0.3);
  box-shadow: 0 10px 20px var(--shadow);
}

.joke-item strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.joke-item p {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.joke-actions {
  display: flex;
  justify-content: flex-end;
}

.laugh-btn {
  background: rgba(154, 217, 255, 0.8);
  border: none;
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.joke-form {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 189, 109, 0.4);
  border-radius: 24px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.joke-form h3 {
  margin: 0 0 0.3rem;
  font-size: 1.5rem;
}

.joke-form label {
  font-weight: 700;
}

.joke-form input,
.joke-form textarea {
  width: 100%;
  border: 1px solid rgba(57, 56, 71, 0.15);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
}

.status-message {
  min-height: 1.4em;
  margin: 0;
  font-weight: 700;
  color: var(--success);
}

.contact-card {
  background: linear-gradient(135deg, rgba(255, 209, 118, 0.3), rgba(154, 217, 255, 0.22));
  border: 1px solid rgba(162, 213, 255, 0.55);
  border-radius: 24px;
  padding: 1.4rem;
  box-shadow: 0 10px 20px var(--shadow);
}

.contact-card p {
  margin-top: 0;
}

.site-footer {
  background: rgba(51, 45, 42, 0.95);
  color: #f9f1ef;
  padding: 1.5rem 1.2rem 2rem;
  text-align: center;
}

.footer-top {
  max-width: 1180px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.social-links {
  display: flex;
  gap: 0.8rem;
  font-size: 1.4rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

@keyframes whoosh {
  0% { transform: translateX(0); }
  50% { transform: translateX(2px) scale(1.02); }
  100% { transform: translateX(0); }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes wobble {
  0% { transform: rotate(-4deg) scale(1); }
  100% { transform: rotate(4deg) scale(1.06); }
}

@keyframes fart-pop {
  0% { transform: scale(0.75); opacity: 0.7; }
  40% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0.9; }
}

@media (max-width: 780px) {
  .top-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero,
  .generator-panel,
  .jokes-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 2.8rem;
  }

  .nav-links {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .section-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn,
  .generator-button,
  .submit-btn {
    width: 100%;
    text-align: center;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
