:root {
  --bg-color: #f4f1ea;
  --text-color: #2b2b2b;
  --accent-color: #ff6b6b;
  --secondary-accent: #4ecdc4;
  --panel-bg: #ffffff;
  --line-soft: rgba(43, 43, 43, 0.22);
  --font-serif: "Playfair Display", serif;
  --font-mono: "Space Mono", monospace;
}

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

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-serif);
  overflow-x: hidden;
  cursor: crosshair;
}

.container {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--text-color);
  padding-bottom: 1rem;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 3rem 0;
  width: 100%;
}

/* Typography */
h1, h2, h3 {
  font-weight: 400;
  margin: 0;
}

.hero-text {
  font-size: clamp(3rem, 10vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-align: center;
  mix-blend-mode: exclusion;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-panel {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
  width: min(100%, 860px);
  border: 1px solid var(--line-soft);
  background: var(--panel-bg);
  padding: 0.65rem 0.9rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  width: min(100%, 860px);
  margin-top: 0.7rem;
}

button {
  border: 1px solid var(--text-color);
  background: var(--panel-bg);
  color: var(--text-color);
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 4px 4px 0 var(--text-color);
}

button:active {
  transform: translateY(1px);
  box-shadow: none;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.fortune-box {
  width: min(100%, 860px);
  margin-top: 0.8rem;
  border: 1px dashed var(--line-soft);
  background: var(--panel-bg);
  padding: 0.9rem;
  text-align: center;
  min-height: 3.6rem;
  display: grid;
  place-items: center;
}

/* The Cat */
.cat-container {
  position: relative;
  margin: 2.4rem 0 1.9rem;
  transition: transform 0.3s ease;
  max-width: 100%;
}

.cat-kaomoji {
  font-family: "Arial", sans-serif; /* Standard font for kaomoji alignment */
  font-size: clamp(4rem, 15vw, 12rem);
  white-space: pre;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: text-shadow 0.3s ease;
}

.cat-kaomoji:hover {
  text-shadow: 4px 4px 0px var(--accent-color), -4px -4px 0px var(--secondary-accent);
  transform: scale(1.05) rotate(-2deg);
}

.speech-bubble {
  position: absolute;
  top: -40px;
  right: -20px;
  background: var(--text-color);
  color: var(--bg-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.cat-container:hover .speech-bubble {
  opacity: 1;
  transform: translateY(0);
}

.laser-game {
  width: min(100%, 860px);
  margin-top: 1.1rem;
}

.laser-head {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 0.75rem;
}

.laser-arena {
  position: relative;
  width: 100%;
  height: 170px;
  margin-top: 0.45rem;
  border: 1px solid var(--text-color);
  background:
    linear-gradient(
      to right,
      rgba(78, 205, 196, 0.05) 0,
      rgba(78, 205, 196, 0.05) 1px,
      transparent 1px,
      transparent 28px
    ),
    linear-gradient(
      to bottom,
      rgba(78, 205, 196, 0.05) 0,
      rgba(78, 205, 196, 0.05) 1px,
      transparent 1px,
      transparent 28px
    ),
    var(--panel-bg);
}

.laser-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, #ffb3b3 0, #ff6b6b 38%, #d63031 100%);
  position: absolute;
  box-shadow: 0 0 24px rgba(255, 107, 107, 0.75);
  transition: left 0.12s linear, top 0.12s linear;
}

/* Gallery Grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 960px;
  margin-top: 1.5rem;
}

.gallery-item {
  border: 1px solid var(--text-color);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: var(--panel-bg);
  min-height: 170px;
}

.gallery-item:hover {
  transform: translateY(-6px);
  box-shadow: 7px 7px 0px var(--text-color);
}

.item-kaomoji {
  font-size: 2.45rem;
  margin-bottom: 1rem;
  word-break: break-word;
  text-align: center;
}

.item-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.7;
  text-align: center;
}

.item-hint {
  margin-top: 0.5rem;
  font-size: 0.67rem;
  opacity: 0.58;
  text-transform: uppercase;
  font-family: var(--font-mono);
  text-align: center;
}

.gallery-item.locked {
  opacity: 0.47;
  filter: grayscale(1);
}

.gallery-item.locked .item-kaomoji,
.gallery-item.locked .item-title,
.gallery-item.locked .item-hint {
  user-select: none;
}

.secret-banner {
  margin-top: 1rem;
  border: 1px solid var(--text-color);
  background: #222;
  color: #f0f0f0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.6rem 0.85rem;
  text-transform: uppercase;
}

.neon-cat {
  margin-top: 0.7rem;
  font-size: clamp(1.5rem, 6vw, 2.3rem);
  color: #ff3d81;
  text-shadow: 0 0 8px #ff3d81, 0 0 18px #ff3d81, 0 0 28px #46f8ff;
  animation: float 2.4s ease-in-out infinite;
}

/* Footer */
footer {
  border-top: 1px solid var(--text-color);
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

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

.float {
  animation: float 6s ease-in-out infinite;
}

.chaos-mode {
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 107, 107, 0.35), transparent 45%),
    radial-gradient(circle at 88% 80%, rgba(78, 205, 196, 0.35), transparent 35%),
    linear-gradient(130deg, #f7f3e8, #ffe2d9 38%, #defff8);
}

.chaos-mode .hero-text {
  animation: chaosWobble 1.4s infinite steps(40);
}

.chaos-mode .gallery-item {
  animation: shakey 1.6s infinite;
}

.chaos-mode .cat-kaomoji:hover {
  text-shadow: 5px 5px 0px var(--accent-color), -5px -5px 0px var(--secondary-accent);
}

@keyframes chaosWobble {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-2px) rotate(-0.7deg); }
  50% { transform: translateX(3px) rotate(0.5deg); }
  75% { transform: translateX(-3px) rotate(-0.5deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes shakey {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(1px, -2px); }
  60% { transform: translate(-1px, 1px); }
}

@media (max-width: 760px) {
  .container {
    padding: 1rem;
  }

  .mono {
    letter-spacing: 0.06em;
  }

  .hero-text {
    font-size: clamp(2.45rem, 16vw, 5.8rem);
  }

  .cat-container {
    margin: 1.5rem 0 1.2rem;
  }

  .cat-kaomoji {
    font-size: clamp(3.2rem, 17vw, 6rem);
  }

  .speech-bubble {
    right: -6px;
    top: -34px;
    padding: 0.45rem 0.7rem;
  }

  .status-panel {
    justify-content: space-between;
    gap: 0.55rem;
  }

  .status-panel > div {
    width: calc(50% - 0.35rem);
  }

  .control-row button {
    width: 100%;
  }

  .laser-head {
    justify-content: flex-start;
    gap: 0.45rem 1rem;
  }

  .laser-arena {
    height: 150px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .gallery-item {
    min-height: 145px;
    padding: 0.85rem;
  }

  .item-kaomoji {
    font-size: clamp(1.8rem, 9vw, 2.45rem);
    margin-bottom: 0.7rem;
  }

  .item-title {
    font-size: 0.66rem;
  }

  .item-hint {
    font-size: 0.58rem;
    line-height: 1.45;
  }

  footer {
    justify-content: center;
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  body {
    cursor: default;
  }

  header {
    align-items: center;
  }

  .mono {
    font-size: 0.76rem;
    letter-spacing: 0.045em;
  }

  main {
    padding: 2rem 0;
  }

  .status-panel > div {
    width: 100%;
  }

  .fortune-box {
    min-height: 4.4rem;
    text-align: left;
    place-items: center start;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
}
