.menu-container {
  width: 100%;
  max-width: var(--layout-width);
  margin: 0 auto 1.4rem;
  padding: 0;
  box-sizing: border-box;
}

.main-nav {
  width: 100%;
  height: 70px;
  background: var(--nav-bg);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.main-nav-layout {
  width: 100%;
  max-width: var(--layout-width);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

.logo {
  font-family: 'Impact', 'Segoe UI', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent-bright);
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent-bright) 0%, #e879f9 50%, var(--accent-bright) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: logoNeonFlow 6s linear infinite;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb, 37, 99, 235), 0.35));
}

@keyframes logoNeonFlow {
  to {
    background-position: 200% center;
  }
}

body.light-mode .logo {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--accent);
  filter: none;
  animation: none;
}

.menu-wrapper {
  flex: 1;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.menu>li>a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  font-weight: 700;
  color: var(--nav-text);
  background: var(--glass-bg);
  border: 1px solid transparent;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  text-decoration: none;
}

.menu>li>a.active,
.menu>li:hover>a,
.menu>li:focus-within>a {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #0d1119;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
}

.nav-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 36px;
  height: 36px;
  justify-content: center;
}

.nav-mobile-toggle span {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: var(--text);
  display: block;
}

.nav-tool,
.action-btn {
  min-width: 40px;
  height: 40px;
}

.nav-tool {
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--nav-text);
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-tool:hover {
  background: var(--hover-bg);
  transform: translateY(-1px);
}

/* Continuous Shine Effect */
@keyframes buttonShine {
  0% {
    left: -100%;
  }

  20% {
    left: 100%;
  }

  100% {
    left: 100%;
  }
}

.action-btn {
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  padding: 0 1.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 0 14px var(--accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 42px;
  height: 42px;
  padding: 0;
}

.action-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  animation: buttonShine 4s infinite ease-in-out;
}

@keyframes diceShake {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  25% {
    transform: translate(-1px, 1px) rotate(-5deg);
  }

  50% {
    transform: translate(1px, -1px) rotate(5deg);
  }

  75% {
    transform: translate(-1px, -1px) rotate(-5deg);
  }

  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

@keyframes dotBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.1;
  }
}

.action-btn svg {
  transition: transform 0.2s ease;
}

.action-btn:hover svg {
  animation: diceShake 0.3s ease-in-out infinite;
}

/* Internal Dice Animation */
.die-dot {
  opacity: 1;
  transition: opacity 0.1s;
}

/* Default state: Number 5 */
.die-dot.dot-ml,
.die-dot.dot-mr {
  opacity: 0;
}

.action-btn:hover .die-dot {
  animation: dotBlink 0.4s linear infinite;
}

.action-btn:hover .dot-c {
  animation-duration: 0.2s;
  animation-delay: 0s;
}

.action-btn:hover .dot-tl {
  animation-duration: 0.3s;
  animation-delay: 0.1s;
}

.action-btn:hover .dot-tr {
  animation-duration: 0.25s;
  animation-delay: 0.05s;
}

.action-btn:hover .dot-bl {
  animation-duration: 0.35s;
  animation-delay: 0.15s;
}

.action-btn:hover .dot-br {
  animation-duration: 0.28s;
  animation-delay: 0.1s;
}

.action-btn:hover .dot-ml {
  animation-duration: 0.32s;
  animation-delay: 0.2s;
}

.action-btn:hover .dot-mr {
  animation-duration: 0.22s;
  animation-delay: 0.05s;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--accent);
}

.main-nav::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 16px;
  pointer-events: none;
}

.menu li.menu-item-has-children {
  position: relative;
}

.menu li.menu-item-has-children .sub-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 15px);
  background: var(--panel);
  border-radius: 14px;
  padding: 0.5rem 0;
  min-width: 180px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
  list-style: none;
  margin: 0;
}

.menu li.menu-item-has-children:hover .sub-menu,
.menu li.menu-item-has-children:focus-within .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.sub-menu a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: var(--nav-text);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.sub-menu a:hover {
  color: var(--accent);
  background: var(--hover-bg);
}

.main-nav.is-mobile-open {
  height: auto;
}

.main-nav.is-mobile-open .menu {
  display: flex !important;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: 0;
  box-shadow: none;
  gap: 1.5rem;
  z-index: 999;
  animation: mobileMenuFade 0.3s ease-out;
}

@keyframes mobileMenuFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.main-nav.is-mobile-open .menu>li>a {
  justify-content: center;
  padding: 1rem 2rem;
  width: auto;
  min-width: 200px;
  box-sizing: border-box;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.main-nav.is-mobile-open .menu>li>a:hover,
.main-nav.is-mobile-open .menu>li>a:active {
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.main-nav.is-mobile-open .menu li.menu-item-has-children .sub-menu {
  position: static;
  transform: none;
  border: none;
  box-shadow: none;
  padding: 1rem 0;
  background: transparent;
  text-align: center;
  opacity: 1;
  visibility: visible;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-nav.is-mobile-open .menu li.menu-item-has-children .sub-menu a {
  font-size: 1rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .main-nav-layout {
    padding: 0 0.75rem;
    gap: 0.35rem;
  }

  .menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-mobile-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    padding: 5px;
  }
}

.nav-search-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 50;
}

.nav-search-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-search-modal__panel {
  width: min(600px, calc(100% - 2rem));
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--accent);
  padding: 0;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.nav-search-modal.is-visible .nav-search-modal__panel {
  transform: scale(1);
}

.nav-search-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-search-modal__title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0;
}

.nav-search-close {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.nav-search-close:hover {
  color: #fff;
  transform: scale(1.1);
}

.nav-search-form {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  margin: 0;
}

.nav-search-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  background: #050505;
  color: #fff;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

@media (max-width: 480px) {
  .nav-search-form {
    padding: 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .nav-search-form input {
    width: 100%;
    flex: 1 1 100%;
  }

  .nav-search-submit {
    width: 100%;
    justify-content: center;
  }
}

.nav-search-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.25);
  background: #000;
}

.nav-search-submit {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 1.5rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 14px var(--accent);
  position: relative;
  overflow: hidden;
}

.nav-search-submit::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  animation: buttonShine 4s infinite ease-in-out;
}

.nav-search-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px var(--accent);
}