:root {
  /* ===== PRIMARY PALETTE (Warm & Premium) ===== */
  /* Backgrounds - Deep, warm, sophisticated */
  --color-bg-primary: #0a0805; /* Deepest warm-black */
  --color-bg-secondary: #12100f; /* Primary background */
  --color-bg-tertiary: #1a1815; /* Elevated surfaces */

  /* Surfaces - Glass & Cards */
  --color-surface-primary: rgba(26, 24, 21, 0.6); /* Main glass surface */
  --color-surface-secondary: rgba(32, 30, 27, 0.5); /* Secondary surface */
  --color-surface-elevated: rgba(42, 38, 34, 0.7); /* Elevated glass */

  /* Text - Warm, refined hierarchy */
  --color-text-primary: #f5f1ed; /* Off-white, warm cream */
  --color-text-secondary: #d4c4b0; /* Warm beige */
  --color-text-muted: #a0816f; /* Warm taupe (muted) */
  --color-text-subtle: #8b7355; /* Deep warm taupe */

  /* Accents - Warm, premium feel */
  --color-accent-primary: #c9b8a3; /* Warm taupe accent */
  --color-accent-secondary: #8b7355; /* Deep warm brown */
  --color-accent-light: #d4c4b0; /* Light warm beige */
  --color-accent-hover: #a0816f; /* Hover state */
  --color-accent-active: #8b7355; /* Active state */

  /* Borders & Dividers */
  --color-border-primary: rgba(201, 184, 163, 0.15); /* Warm taupe border */
  --color-border-secondary: rgba(139, 115, 85, 0.1); /* Subtle warm border */
  --color-border-soft: rgba(212, 196, 176, 0.05); /* Very subtle */

  /* Semantic Colors */
  --color-success: #6b9f7f; /* Muted green (warm tone) */
  --color-warning: #d4a574; /* Warm amber */
  --color-error: #b5726f; /* Warm muted red */
  --color-info: #9fadb7; /* Cool-neutral for info */

  /* Effects & Overlays */
  --color-shadow: rgba(10, 8, 5, 0.5); /* Warm shadow */
  --color-overlay: rgba(0, 0, 0, 0.4); /* Dark overlay */

  /* Glass & Backdrop */
  --color-glass-bg: rgba(255, 255, 255, 0.03);
  --color-glass-border: rgba(201, 184, 163, 0.15);

  /* Legacy variables (for transition compatibility) */
  --primary: #c9b8a3;
  --primary-soft: #0f0c0a;
  --accent: #c9b8a3;
  --accent-soft: rgba(201, 184, 163, 0.12);
  --text-on-dark: #f5f1ed;
  --text-light: #f5f1ed;
  --text-muted: #a0816f;
  --bg-dark: #0a0805;
  --bg-color: #12100f;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(201, 184, 163, 0.15);
}

/* Base / Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    'Inter',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  padding: 1rem;
  width: 100%;
  margin-bottom: 10rem; /* leaves space for fixed footer */
}

body {
  background: var(--bg-color);
  color: var(--text-on-dark);
  padding-top: 110px; /* leaves space for fixed navbar used by guess-my-number layout */
  line-height: 1.4;
  min-height: 100vh;
}

#general-container {
  display: inline-block;
}

html,
body {
  height: 100%;
  margin: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: rgba(159, 173, 183, 0.4);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Selection */
::selection {
  background: var(--accent);
  color: #ffffff;
}

/* Accessibility helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: var(--bg-dark);
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  z-index: 10000;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
}

/* Focus-visible states */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: 4px;
}

.nav-link.active {
  background: linear-gradient(145deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  color: #ffd700;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow:
    0 0 15px rgba(255, 215, 0, 0.3),
    inset 0 0 10px rgba(255, 215, 0, 0.2);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  transition: none 0.3s ease;
}

.nav-link.active:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 25px rgba(255, 215, 0, 0.5),
    inset 0 0 15px rgba(255, 215, 0, 0.3);
  background: linear-gradient(145deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.1));
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Premium / Home button (top-left) */
.premium-home-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.2rem 0.6rem 0.6rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  backdrop-filter: blur(10px);
  width: fit-content;
  z-index: 10;
}
.premium-home-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(159, 173, 183, 0.2), transparent);
  transition: all 0.6s ease;
}
.premium-home-btn:hover::before {
  left: 100%;
}
.premium-home-btn:hover {
  border-color: var(--primary);
  background: rgba(159, 173, 183, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(159, 173, 183, 0.15);
}
.icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transition: all 0.4s ease;
}
.premium-home-btn:hover .icon-wrapper {
  background: var(--primary);
  color: var(--primary-soft);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(159, 173, 183, 0.4);
}
.icon-wrapper svg {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.4s ease;
}
.premium-home-btn:hover .icon-wrapper svg {
  transform: translateY(-2px);
}
.premium-home-btn .text {
  transition: color 0.4s ease;
}
.premium-home-btn:hover .text {
  color: var(--primary);
}

/* Small screens for premium button */
@media (max-width: 480px) {
  .premium-home-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    font-size: 0.85rem;
  }
  .icon-wrapper {
    width: 1.8rem;
    height: 1.8rem;
  }
}

/* Simple fade in up animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glass navbar (fixed to top) */
.glass-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

/* Container used in navbar */
.navbar-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 3rem;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-on-dark);
  text-decoration: none;
  letter-spacing: 1px;
}
.logo-icon {
  position: relative;
  font-size: 1.5rem;
  width: 4.95rem;
  height: 4.95rem;
  top: 1.21rem;
  left: 1.9rem;
}

#nav-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* Responsive nav links (mobile collapsed) */
.nav-links {
  display: flex;
  position: absolute;
  top: 70px;
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  flex-direction: column;
  gap: 0;
  overflow: scroll;
  max-height: 0;
  visibility: hidden;
  opacity: 0;
  transition:
    max-height 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.3s ease;
}

/* Hidden checkbox controlling mobile menu */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
  z-index: 10000;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 18px;
  background-color: var(--text-on-dark);
  border-radius: 2px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease,
    background-color 0.3s ease;
}

/* Nav link styles */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  transition:
    color 0.3s ease,
    background 0.3s ease;
  padding: 1rem 1.25rem;
  width: 100%;
  text-align: left;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-link:hover,
.nav-link:focus {
  color: var(--text-on-dark);
  background: rgba(255, 255, 255, 0.02);
}

/* When toggle is checked, show mobile menu */
.nav-links.menu-open {
  overflow: hidden;
  max-height: 320px;
  visibility: visible;
  width: 83%;
  opacity: 1;
  right: 10%;
  left: 10%;
  justify-content: center;
  border-radius: 14px;
}

/* Hamburger transform when active */
.nav-toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Desktop layout overrides */
@media (min-width: 769px) {
  /* Footer glass style */
  .glass-footer {
    position: relative;

    margin-top: 5%;
    margin-bottom: 0;
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    padding: 2rem 5% 1rem;
    width: 100%;
  }

  /* Tooltip helper */
  [data-tooltip] {
    position: relative;
    cursor: pointer;
  }
  [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
  }
  [data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
  }
}

/* Game/Project Logo Container */
.game-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}

.game-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  animation: logoFloat 3s ease-in-out infinite;
}

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

@media (max-width: 768px) {
  .game-logo {
    width: 80px;
    height: 80px;
  }
}

/* Guidance Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.guidance-modal {
  background-color: var(--bg-color);
  padding: 2rem;
  border-radius: 10px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--glass-border);
}

.modal-overlay.active .guidance-modal {
  transform: translateY(0);
  text-align: left;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

.modal-header h2 {
  color: var(--primary);
  margin: 0;
  font-size: 1.5rem;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--primary);
}

.modal-body h3 {
  color: var(--secondary);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-body p,
.modal-body ul {
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.modal-body ul {
  padding-left: 1.5rem;
}

.modal-body li {
  margin-bottom: 0.5rem;
}

/* Footer content styles */
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
.footer-brand h3 {
  color: var(--text-light);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 600px;
  line-height: 1.6;
  margin: 0rem 0rem 2rem 0rem;
}

.footer-bottom {
  text-align: center;
  margin-top: 0;
  padding-top: 1rem;
  padding-bottom: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  .footer-brand p {
    margin: 0 auto;
  }
}

/* Guide Button - Global Styles */
.guide-btn {
  position: absolute;
  top: 160%;
  right: 10%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: rgba(159, 173, 183, 0.1);
  border: 1px solid rgba(159, 173, 183, 0.3);
  border-radius: 12px;
  color: #b8c4cc;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  backdrop-filter: blur(10px);
  z-index: 100;
  box-shadow: 0 4px 15px rgba(159, 173, 183, 0.2);
}

.guide-btn:hover {
  background: rgba(159, 173, 183, 0.25);
  border-color: var(--primary);
  transform: translateY(-50%) translateX(-2px);
  box-shadow: 0 6px 20px rgba(159, 173, 183, 0.4);
  color: #fff;
}

.guide-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.guide-btn:hover i {
  transform: scale(1.1);
}

.guide-btn[hidden] {
  display: none !important;
}
