* {
  user-select: none;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#SearchFrameWrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  backdrop-filter: blur(1.2vw);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#SearchFrameWrapper.hidden {
  display: none;
}

#SearchFrame {
  width: 100vw;
  height: 100vh;
  border: none;
}

#CloseFrameButton {
  position: fixed;
  top: 1.1vh;
  left: 4vw;
  z-index: 10000;
}

#MainLayout {
  margin-top: 4vh;
  flex: 1;
  display: flex;
  overflow: hidden;
}

#AlphaNav {
  width: 8vw;
  background: rgba(0, 217, 232, 0.03);
  border-right: 0.3vw solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
}

#AlphaNav::-webkit-scrollbar {
  width: 0;
}

#AlphaNav ul {
  list-style: none;
  margin: 0;
  text-align: center;
  width: 100%;
}

#AlphaNav li {
  position: relative;
  color: var(--text-secondary);
  font-size: 2.75vw;
  font-weight: 500;
  padding: 0.9vh 0;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
}

#AlphaNav li.active {
  color: var(--accent-primary) !important;
  font-weight: 700 !important;
  transform: scale(1.4) !important;
  text-shadow: 0 0 2vw rgba(0, 217, 232, 1) !important;
}

#AlphaNav li:not(.active):hover {
  color: var(--text-primary);
  transform: scale(1.5);
  text-shadow:
    0 0 1.5vw rgba(0, 217, 232, 0.8),
    0 0 3vw rgba(0, 217, 232, 0.6),
    0 0 5vw rgba(0, 217, 232, 0.4);
}

#AlphaNav li.active:hover {
  transform: scale(1.6);
}

#WordList {
  flex: 1;
  padding: 1vh 1vw;
  overflow-y: auto;
  scroll-behavior: smooth;
  margin-top: 4vh;
  height: 100%;
}

#WordList::after {
  content: "";
  display: block;
  height: 10vh; 
  width: 100%;
  flex-shrink: 0;
}

.word-group {
  margin-bottom: 2vh;
}

.group-title {
  font-size: 5vw;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 1vh;
  border-bottom: 0.3vh solid var(--card-border);
  padding-bottom: 0.8vh;
  text-shadow: 0 0 1.2vw rgba(0, 217, 232, 0.4);
}

.word-group .word-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1vh 1.5vw;
}

.word-card {
  background: var(--card-bg);
  border: 0.2vw solid var(--card-border);
  border-radius: 2vw;
  width: 100%;
  padding: 1.5vh 2vw;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-md);
  user-select: none;
}

.word-card:hover {
  background: var(--btn-secondary-hover);
  transform: translateY(-0.5vh) scale(1.02);
  border-color: var(--card-border-hover);
  box-shadow: var(--card-shadow-hover);
}

.word-chinese {
  font-size: 5vw;
  color: var(--text-primary);
  transition: 0.25s;
}

.word-pinyin {
  font-size: 4vw;
  color: var(--text-secondary);
}

.word-meaning {
  font-size: 3.6vw;
  color: var(--text-muted);
  margin-top: 0.5vh;
}

.word-card:hover .word-chinese {
  text-shadow:
    0 0 1vw rgba(0, 217, 232, 0.8),
    0 0 2vw rgba(0, 217, 232, 0.6),
    0 0 4vw rgba(0, 217, 232, 0.4);
}

@keyframes pulseGlow {
  0% {
    text-shadow: 0 0 0 rgba(46, 139, 192, 0);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 1.2vw rgba(46, 139, 192, 0.9),
      0 0 2.5vw rgba(46, 139, 192, 0.7),
      0 0 4.5vw rgba(46, 139, 192, 0.4);
    transform: scale(1.65);
  }
  100% {
    text-shadow:
      0 0 1vw rgba(46, 139, 192, 0.8),
      0 0 1.8vw rgba(46, 139, 192, 0.5);
    transform: scale(1.5);
  }
}

@media (min-width: 768px) {
  #MainLayout {
    margin-top: 8vh;
  }

  #CloseFrameButton {
  top: 2vh;
  left: 2vw;
  }  

  #AlphaNav {
    width: 6vw;
    min-height: 95vh;
    border-right: 0.2vw solid var(--card-border);
  }

  #AlphaNav li {
    position: relative;
    color: var(--text-secondary);
    font-size: 1.9vw;
    font-weight: 500;
    padding: 0.56vh 0;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
  }

  #AlphaNav li.active {
    color: var(--accent-primary) !important;
    font-weight: 700 !important;
    transform: scale(1.4) !important;
    text-shadow: 0 0 1.5vw rgba(0, 217, 232, 1) !important;
  }

  #AlphaNav li:not(.active):hover {
    color: var(--text-primary);
    transform: scale(1.5);
    text-shadow:
      0 0 1vw rgba(0, 217, 232, 0.8),
      0 0 2vw rgba(0, 217, 232, 0.6),
      0 0 4vw rgba(0, 217, 232, 0.4);
  }

  #AlphaNav li.active:hover {
    transform: scale(1.6);
  }

  #WordList {
    margin-top: 2vh;
    padding: 1vh 1vw;
  }

  #WordList::-webkit-scrollbar {
    width: 1vw;
  }

  #WordList::-webkit-scrollbar-thumb {
    border-radius: 0.6vw;
  }

  .word-group {
    margin-bottom: 2vh;
  }

  .group-title {
    font-size: 3.5vw;
    margin-bottom: 1vh;
    border-bottom: 0.25vh solid var(--card-border);
    padding-bottom: 0.6vh;
    text-shadow: 0 0 1vw rgba(0, 217, 232, 0.4);
  }

  .word-group .word-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.3vh 1.2vw;
  }

  .word-card {
    width: 100%;
    border-radius: 1.5vw;
    border: 0.15vw solid var(--card-border);
    padding: 1.5vh 1.5vw;
  }

  .word-card:hover {
    transform: translateY(-0.6vh) scale(1.04);
  }

  .word-chinese {
    font-size: 2.7vw;
  }

  .word-pinyin {
    font-size: 2.4vw;
  }

  .word-meaning {
    font-size: 2.2vw;
    margin-top: 0.3vh;
  }

  .word-card:hover .word-chinese {
    text-shadow:
      0 0 0.8vw rgba(0, 217, 232, 0.8),
      0 0 1.8vw rgba(0, 217, 232, 0.6),
      0 0 3.5vw rgba(0, 217, 232, 0.4);
  }
}

@media (min-width: 1024px), (orientation: landscape) {
  #CloseFrameButton {
  top: 2.3vh;
  }  

  #MainLayout {
    margin-top: 9vh;
  }

  #AlphaNav {
    width: 4vw;
    border-right: 0.15vw solid var(--card-border);
  }

  #AlphaNav li {
    font-size: 1vw;
    padding: 0.4vh 0;
  }

  #AlphaNav li.active {
    text-shadow: 0 0 1.2vw rgba(0, 217, 232, 1) !important;
  }

  #AlphaNav li:not(.active):hover {
    text-shadow:
      0 0 0.8vw rgba(0, 217, 232, 0.8),
      0 0 1.6vw rgba(0, 217, 232, 0.6),
      0 0 3.2vw rgba(0, 217, 232, 0.4);
  }

  #WordList {
    padding: 1vh 1vw;
  }

  #WordList::-webkit-scrollbar {
    width: 0.5vw;
  }

  #WordList::-webkit-scrollbar-thumb {
    border-radius: 0.2vw;
  }

  .word-group {
    margin-bottom: 3vh;
  }

  .group-title {
    font-size: 2.5vw;
    margin-bottom: 1vh;
    border-bottom: 0.2vh solid var(--card-border);
    padding-bottom: 0.5vh;
    text-shadow: 0 0 0.8vw rgba(0, 217, 232, 0.4);
  }

  .word-group .word-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.8vh 0.7vw;
  }

  .word-card {
    width: 100%;
    border-radius: 1.2vw;
    border: 0.12vw solid var(--card-border);
    padding: 1.8vh 1vw;
  }

  .word-card:hover {
    transform: translateY(-0.5vh) scale(1.05);
  }

  .word-chinese {
    font-size: 1.5vw;
  }

  .word-pinyin {
    font-size: 1.3vw;
  }

  .word-meaning {
    font-size: 1.3vw;
    margin-top: 0.2vh;
  }

  .word-card:hover .word-chinese {
    text-shadow:
      0 0 0.6vw rgba(0, 217, 232, 0.8),
      0 0 1.4vw rgba(0, 217, 232, 0.6),
      0 0 2.8vw rgba(0, 217, 232, 0.4);
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
    html, body {
        overflow: auto;
    }
}