* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive;
  background-color: #fffbe0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 0, 204, .08) 0 20px, transparent 20px 40px),
    repeating-linear-gradient(-45deg, rgba(0, 170, 255, .08) 0 20px, transparent 20px 40px);
  color: #222;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

main {
  width: 100%;
  max-width: 960px;
  padding: 2.5rem 1rem 4rem;
  text-align: center;
}

/*
 * WordArt: the element itself renders the dark 3D extrusion via stacked
 * text-shadows, and ::after overlays the same text (from data-text) with a
 * gradient fill and outline.
 */
.wordart {
  --fill: linear-gradient(180deg, #fff 0%, #aaa 100%);
  --stroke: #000;
  --depth: #333;
  position: relative;
  display: inline-block;
  font-family: Impact, "Haettenschweiler", "Arial Black", sans-serif;
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.1;
  color: var(--depth);
  text-shadow:
    1px 1px 0 var(--depth), 2px 2px 0 var(--depth), 3px 3px 0 var(--depth),
    4px 4px 0 var(--depth), 5px 5px 0 var(--depth), 6px 6px 0 var(--depth),
    8px 10px 6px rgba(0, 0, 0, .35);
}

.wordart::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  inset: 0;
  background: var(--fill);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px var(--stroke);
  text-shadow: none;
}

.rainbow {
  --fill: linear-gradient(90deg, #ff0000, #ff8a00, #ffe600, #14e81e, #00b7ff, #7a00ff, #ff00cc);
  --depth: #3b0a57;
}

.chrome {
  --fill: linear-gradient(180deg, #ffffff 0%, #d8d8d8 40%, #6b6b6b 50%, #c9c9c9 62%, #ffffff 100%);
  --depth: #1d2a4a;
  --stroke: #1d2a4a;
}

.fire {
  --fill: linear-gradient(180deg, #fff35c 0%, #ffae00 45%, #ff3c00 80%, #b30000 100%);
  --depth: #5a0000;
}

.ocean {
  --fill: linear-gradient(180deg, #e0ffff 0%, #33ccff 45%, #0055ff 80%, #001a80 100%);
  --depth: #001040;
}

.lime {
  --fill: linear-gradient(180deg, #faffb0 0%, #9dff00 50%, #1f8a00 100%);
  --depth: #0d3300;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.6rem, 10vw, 6rem);
  transform: perspective(500px) rotateX(18deg) skewX(-8deg);
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: perspective(500px) rotateX(18deg) skewX(-8deg) translateY(0); }
  50% { transform: perspective(500px) rotateX(18deg) skewX(-8deg) translateY(-6px); }
}

.status {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  margin: 0 0 2.5rem;
  transform: rotate(-3deg);
}

.status:empty { display: none; }

.board {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.category h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 7vw, 3.4rem);
  transform: rotate(-2deg) skewX(-10deg);
}

.category:nth-child(2n) h2 {
  --fill: linear-gradient(180deg, #ffe3ff 0%, #ff66e0 45%, #c400a0 80%, #5c0050 100%);
  --depth: #33002b;
  transform: rotate(2deg) skewX(10deg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.5rem;
}

.board[hidden], .closed[hidden] { display: none; }

.sound {
  min-height: 150px;
  padding: 1rem;
  border: 4px outset #e6e6e6;
  border-radius: 0;
  background: linear-gradient(180deg, #ffffff, #d4d0c8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 6px 6px 0 #000;
  transition: transform .08s, box-shadow .08s;
}

.sound .wordart {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  -webkit-text-stroke: 0;
}

.sound:nth-child(5n + 1) .wordart { --fill: linear-gradient(90deg, #ff0000, #ff8a00, #ffe600, #14e81e, #00b7ff, #7a00ff); --depth: #3b0a57; transform: rotate(-4deg); }
.sound:nth-child(5n + 2) .wordart { --fill: linear-gradient(180deg, #fff35c, #ffae00 45%, #ff3c00 80%, #b30000); --depth: #5a0000; transform: skewX(-12deg); }
.sound:nth-child(5n + 3) .wordart { --fill: linear-gradient(180deg, #e0ffff, #33ccff 45%, #0055ff 80%, #001a80); --depth: #001040; transform: rotate(3deg) scaleY(1.2); }
.sound:nth-child(5n + 4) .wordart { --fill: linear-gradient(180deg, #fff, #d8d8d8 40%, #6b6b6b 50%, #c9c9c9 62%, #fff); --depth: #1d2a4a; --stroke: #1d2a4a; transform: perspective(300px) rotateY(-15deg); }
.sound:nth-child(5n + 5) .wordart { --fill: linear-gradient(180deg, #faffb0, #9dff00 50%, #1f8a00); --depth: #0d3300; transform: skewY(-5deg); }

.sound:hover { background: linear-gradient(180deg, #ffffff, #ece9d8); }

.sound:active, .sound.playing {
  border-style: inset;
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 #000;
}

.sound.playing .wordart { animation: wiggle .25s ease-in-out infinite; }

@keyframes wiggle {
  0%, 100% { translate: 0 0; }
  25% { translate: -3px 2px; }
  75% { translate: 3px -2px; }
}

.closed .big {
  margin-top: 2.5rem;
  font-size: clamp(1.8rem, 7vw, 3.6rem);
  transform: perspective(400px) rotateX(-12deg) skewX(6deg);
}

.countdown {
  margin-top: 2.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ff00cc;
  text-shadow: 2px 2px 0 #00e5ff;
}

@media (prefers-reduced-motion: reduce) {
  h1, .sound.playing .wordart { animation: none; }
}
