* {
  box-sizing: border-box;
}

:root {
  --bg-main: #f7f2e9;
  --bg-soft: #fffaf2;
  --text-main: #2b2a27;
  --text-muted: #666055;
  --accent: #b35c2e;
  --accent-dark: #8f4620;
  --line: #e5d8c4;
  --surface: #ffffff;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(179, 92, 46, 0.09), transparent 30%),
    radial-gradient(circle at 85% 0%, rgba(49, 87, 44, 0.08), transparent 22%),
    var(--bg-main);
}

a {
  color: var(--accent-dark);
}

.container {
  width: min(1080px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: rgba(255, 250, 242, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-main);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: #f3e4d1;
  color: #4a2f1f;
}

.page-main {
  min-height: calc(100vh - 69px);
}

.page-hero {
  padding: 3rem 0 1.75rem;
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 2.2vw + 1rem, 3rem);
}

.page-hero p {
  margin-top: 0.7rem;
  max-width: 65ch;
  color: var(--text-muted);
  line-height: 1.7;
}

.content-section {
  margin: 0 auto 2.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.1rem;
}

.content-section h2 {
  margin: 0.3rem 0 0.7rem;
}

.content-section p,
.content-section li {
  line-height: 1.75;
  color: #4c463c;
}

.content-section ol {
  margin: 0.3rem 0 1.1rem;
  padding-left: 1.2rem;
}

.faq-list article + article {
  border-top: 1px dashed var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}

.game-container {
  position: relative;
  width: 100%;
  padding: 0 0 2rem;
}

.game-area {
  position: relative;
  min-height: 55vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 350px;
  aspect-ratio: 1;
  position: relative;
  z-index: 1;
  transition: all 0.5s ease;
  justify-content: center;
}

.grid-container.winning {
  transform: scale(1.05);
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.2));
}

.grid-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.grid-item:not(.empty):hover {
  transform: scale(1.1);
  cursor: pointer;
}

.grid-item.winning {
  animation: pulse 1s infinite;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.grid-item.red {
  background-color: #ff0000;
  border-color: #cc0000;
}

.grid-item.blue {
  background-color: #0066ff;
  border-color: #0052cc;
}

.grid-item.yellow {
  background-color: #ffd700;
  border-color: #ccac00;
}

.grid-item.green {
  background-color: #00cc00;
  border-color: #009900;
}

.grid-item.purple {
  background-color: #9933ff;
  border-color: #7a29cc;
}

.grid-item.empty {
  background-color: transparent;
  border: 2px dashed #999;
}

.win-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
  animation: fadeIn 0.5s ease;
  border-radius: 12px;
}

.win-overlay.hidden {
  display: none;
}

.win-message {
  background: #ffffff;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  animation: slideIn 0.5s ease;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.win-message h2 {
  color: #2c3e50;
  margin: 0 0 1rem;
  font-size: 2.5rem;
}

.win-message p {
  color: #7f8c8d;
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
}

.new-game-btn {
  background: linear-gradient(135deg, #00b09b, #96c93d);
  color: #ffffff;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.new-game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.new-game-btn:active {
  transform: translateY(1px);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #fffaf2;
}

.footer-wrap {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-wrap p {
  margin: 0;
  color: var(--text-muted);
}

.footer-wrap nav {
  display: flex;
  gap: 0.8rem;
}

.footer-wrap nav a {
  text-decoration: none;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media screen and (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: #fffaf2;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 4%;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    width: 100%;
    padding: 0.7rem 0.3rem;
  }

  .page-hero {
    padding: 2rem 0 1.35rem;
  }

  .grid-container {
    width: 100%;
    max-width: 300px;
  }

  .footer-wrap {
    flex-direction: column;
    justify-content: center;
    padding: 0.8rem 0;
  }
}

@media screen and (max-width: 480px) {
  .container {
    width: 94%;
  }

  .grid-container {
    max-width: 220px;
  }

  .content-section {
    padding: 1rem 0.9rem;
  }
}
