* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0B2027 0%, #122C3C 40%, #1B3A4B 100%);
  color: #EAF2FA;
  min-height: 100vh;
  overflow-x: hidden;
}

#SearchFrameWrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 32, 39, 0.95);
  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;
}

.container {
  max-width: 100vw;
  margin: 0 auto;
  padding: 10vh 4vw 4vh;
}

.search-section {
  max-width: 92vw;
  margin: 0 auto 4vh;
}

.search-bar {
  display: flex;
  gap: 2vw;
  position: relative;
}

#searchInput {
  flex: 1;
  padding: 2vh 4vw;
  background: rgba(255, 255, 255, 0.05);
  border: 0.3vw solid rgba(46,139,192,0.25);
  border-radius: 2vw;
  font-size: 3.5vw;
  color: #EAF2FA;
  transition: all 0.3s ease;
}

#searchInput::placeholder {
  color: #A7C0CC;
}

#searchInput:focus {
  outline: none;
  border-color: rgba(46,139,192,0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 0.5vw rgba(46,139,192,0.15);
}

.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 15vw;
  margin-top: 1vh;
  backdrop-filter: blur(1.8vh);
  background: rgba(20, 45, 65, 0.95);
  border: 0.3vw solid rgba(46,139,192,0.3);
  border-radius: 2vw;
  box-shadow: 0 1vh 3.5vh rgba(0, 0, 0, 0.4);
  list-style: none;
  padding: 0.5vh 0;
  z-index: 1000;
  max-height: 36vh;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-1vh);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.suggestions-list.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-1vh);
}

.suggestions-list.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.suggestion-item {
  padding: 0.7vh 2vw;
  font-size: 3.8vw;
  color: #00f0ff;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  text-align: left;
}

.suggestion-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 96.25%;
  height: 100%;
  background: linear-gradient(120deg, rgba(0, 217, 232, 0.2), rgba(0, 217, 232, 0.1));
  transition: left 0.4s ease;
  z-index: -1;
}

.suggestion-item:hover::before {
  left: 0;
}

.suggestion-item:hover {
  color: #B6E9FF;
  transform: translateX(1.5vw);
}

.suggestion-item.hover-sim {
  color: #B6E9FF;
  transform: translateX(1.5vw);
}

.suggestion-item.hover-sim::before {
  left: 0;
}

.results-container {
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.results-header {
  margin-bottom: 3vh;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2vh;
}

.results-title {
  font-size: 4vw;
  color: #2DA8C7;
  font-weight: 600;
}

.results-count {
  background: rgba(46,139,192,0.2);
  padding: 1vh 3vw;
  border-radius: 3vw;
  font-size: 3vw;
  color: #A7C0CC;
}

.word-group {
  margin-bottom: 2vh;
}

.group-title {
  font-size: 5vw;
  font-weight: 600;
  color: #2DA8C7;
  margin-bottom: 1vh;
  border-bottom: 0.4vh solid rgba(46,139,192,0.3);
  padding-bottom: 1vh;
  text-shadow: 0 0 2vw rgba(46,139,192,0.4);
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4vh 2vw;
}

.word-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.1));
  border: 0.3vw solid rgba(46,139,192,0.25);
  border-radius: 3vw;
  width: 100%;
  padding: 2vh 2vw;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 1vh 2vh rgba(0,0,0,0.25);
  user-select: none;
  animation: cardAppear 0.5s ease-out forwards;
  opacity: 0;
  transform: translateY(2vh);
}

@keyframes cardAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.word-card:hover {
  background: rgba(46,139,192,0.15);
  transform: translateY(-0.5vh) scale(1.02);
  border-color: rgba(46,139,192,0.6);
  box-shadow: 0 2vh 4vh rgba(46,139,192,0.25);
}

.word-chinese {
  font-size: 7vw;
  color: #EAF2FA;
  transition: 0.25s;
  margin-bottom: 1vh;
}

.word-card:hover .word-chinese {
  text-shadow:
    0 0 1.5vw rgba(46,139,192,0.8),
    0 0 3vw rgba(46,139,192,0.6),
    0 0 6vw rgba(46,139,192,0.4);
}

.word-pinyin {
  font-size: 4.2vw;
  color: #A7C0CC;
  margin-bottom: 1vh;
}

.word-meaning {
  font-size: 3.6vw;
  color: #9FBAC9;
  line-height: 1.3;
  margin-top: 1vh;
}

.word-hsk {
  display: inline-block;
  background: rgba(46,139,192,0.3);
  color: #2DA8C7;
  padding: 0.5vh 2vw;
  border-radius: 2vw;
  font-size: 3vw;
  font-weight: 600;
  margin-top: 1vh;
}

.empty-state {
  text-align: center;
  padding: 10vh 4vw;
  color: #A7C0CC;
}

.empty-state-icon {
  font-size: 12vw;
  margin-bottom: 3vh;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2vh); }
}

.empty-state h3 {
  font-size: 5.5vw;
  margin-bottom: 2vh;
  color: #EAF2FA;
  font-weight: 500;
}

.empty-state p {
  font-size: 4vw;
  line-height: 1.6;
  margin-bottom: 3vh;
}

.suggestions {
  margin-top: 3vh;
  padding: 3vh 4vw;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2vw;
  border: 0.3vw solid rgba(46,139,192,0.2);
  max-width: 90vw;
  margin-left: auto;
  margin-right: auto;
}

.suggestions strong {
  color: #2DA8C7;
  font-size: 4vw;
}

.loading {
  text-align: center;
  padding: 10vh 4vw;
  font-size: 4.5vw;
  color: #2DA8C7;
}

.loading-spinner {
  display: inline-block;
  width: 10vw;
  height: 10vw;
  border: 1vw solid rgba(46,139,192,0.3);
  border-top-color: #2DA8C7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 2vh;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 768px) {
  #CloseFrameButton {
    top: 2vh;
    left: 2vw;
  }   

  .container {
    padding: 12vh 4vw 4vh;
  }

  .search-section {
    max-width: 60vw;
  }

  .search-bar {
    gap: 1vw;
  }

  #searchInput {
    padding: 1vh 1.5vw;
    border-radius: 1vw;
    border: 0.2vw solid rgba(46,139,192,0.25);
    font-size: 2vw;
  }

  #searchInput:focus {
    box-shadow: 0 0 0 0.25vw rgba(46,139,192,0.15);
  }

  .suggestions-list {
    right: 9vw;
    border-radius: 1vw;
    border: 0.2vw solid rgba(46,139,192,0.3);
    max-height: 35vh;
    padding: 0.8vh 0;
  }
  .suggestions-list::-webkit-scrollbar {
    width: 0.7vw;
  }
  .suggestion-item {
    padding: 0.7vh 1vw;
    font-size: 1.8vw;
  }

  .suggestion-item:hover {
    transform: translateX(0.9vw);
  }

  .suggestion-item.hover-sim {
    transform: translateX(0.9vw);
  }  

  .results-header {
    margin-bottom: 2.5vh;
    gap: 1.5vh;
  }

  .results-title {
    font-size: 2.5vw;
  }

  .results-count {
    padding: 0.8vh 1.8vw;
    border-radius: 2vw;
    font-size: 1.4vw;
  }

  .word-group {
    margin-bottom: 2.5vh;
  }

  .group-title {
    font-size: 2.2vw;
    margin-bottom: 1.3vh;
    border-bottom: 0.25vh solid rgba(46,139,192,0.3);
    padding-bottom: 1vh;
    text-shadow: 0 0 1vw rgba(46,139,192,0.4);
  }

  .word-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.4vh 1.2vw;
  }

  .word-card {
    border: 0.15vw solid rgba(46,139,192,0.25);
    border-radius: 1.2vw;
    padding: 1.4vh 1.2vw;
    transform: translateY(1vh);
  }

  .word-card:hover {
    transform: translateY(-0.4vh) scale(1.03);
  }

  .word-chinese {
    font-size: 3.5vw;
    margin-bottom: 0.5vh;
  }

  .word-card:hover .word-chinese {
    text-shadow:
      0 0 0.8vw rgba(46,139,192,0.8),
      0 0 1.6vw rgba(46,139,192,0.6),
      0 0 3.2vw rgba(46,139,192,0.4);
  }

  .word-pinyin {
    font-size: 2.1vw;
    margin-bottom: 0.5vh;
  }

  .word-meaning {
    font-size: 2vw;
    margin-bottom: 0.5vh;
  }

  .word-hsk {
    padding: 0.5vh 1.2vw;
    border-radius: 1vw;
    font-size: 1.3vw;
  }

  .empty-state {
    padding: 8vh 4vw;
  }

  .empty-state-icon {
    font-size: 6vw;
    margin-bottom: 2.5vh;
  }

  .empty-state h3 {
    font-size: 2.6vw;
    margin-bottom: 1.5vh;
  }

  .empty-state p {
    font-size: 1.8vw;
    margin-bottom: 2.5vh;
  }

  .suggestions {
    margin-top: 2.5vh;
    padding: 2.5vh 3vw;
    border-radius: 1vw;
    border: 0.2vw solid rgba(46,139,192,0.2);
    max-width: 55vw;
  }

  .suggestions strong {
    font-size: 1.9vw;
  }

  .loading {
    padding: 8vh 4vw;
    font-size: 1.8vw;
  }

  .loading-spinner {
    width: 5vw;
    height: 5vw;
    border: 0.5vw solid rgba(46,139,192,0.3);
    margin-bottom: 1.5vh;
  }
}

@media (min-width: 1024px), (orientation: landscape) {
  #CloseFrameButton {
    top: 2vh;
  }

  .container {
    max-width: 100vw;
    padding: 12vh 3vw 4vh;
  }

  .search-section {
    max-width: 50vw;
  }

  .search-bar {
    gap: 1vw;
  }

  #searchInput {
    padding: 1.5vh 1vw;
    border-radius: 1vw;
    border: 0.15vw solid rgba(46,139,192,0.25);
    font-size: 1.5vw;
  }

  #searchInput:focus {
    box-shadow: 0 0 0 0.3vw rgba(46,139,192,0.15);
  }

  .suggestions-list {
    right: 8vw;
    border-radius: 1vw;
    border: 0.15vw solid rgba(46,139,192,0.3);
    max-height: 32vh;
    padding: 0.8vh 0;
  }

  .suggestion-item {
    padding: 0.7vh 0.5vw;
    font-size: 1.2vw;
  }

  .suggestion-item:hover {
    transform: translateX(0.8vw);
  }

  .suggestion-item.hover-sim {
    transform: translateX(0.8vw);
  }  

  .results-header {
    margin-bottom: 2.5vh;
    gap: 1.5vh;
  }

  .results-title {
    font-size: 1.6vw;
  }

  .results-count {
    padding: 0.8vh 1.5vw;
    border-radius: 1.8vw;
    font-size: 1.1vw;
  }

  .word-group {
    margin-bottom: 3vh;
  }

  .group-title {
    font-size: 1.8vw;
    margin-bottom: 1.2vh;
    border-bottom: 0.2vh solid rgba(46,139,192,0.3);
    padding-bottom: 1vh;
    text-shadow: 0 0 0.8vw rgba(46,139,192,0.4);
  }

  .word-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.4vh 0.9vw;
  }

  .word-card {
    border: 0.12vw solid rgba(46,139,192,0.25);
    border-radius: 1.2vw;
    padding: 1.8vh 1.2vw;
    transform: translateY(1.2vh);
    box-shadow: 0 0.4vh 1vh rgba(0,0,0,0.25);
  }

  .word-card:hover {
    transform: translateY(-0.5vh) scale(1.04);
    box-shadow: 0 0.8vh 2vh rgba(46,139,192,0.25);
  }

  .word-chinese {
    font-size: 2.3vw;
    margin-bottom: 0.7vh;
  }

  .word-card:hover .word-chinese {
    text-shadow:
      0 0 0.6vw rgba(46,139,192,0.8),
      0 0 1.4vw rgba(46,139,192,0.6),
      0 0 2.8vw rgba(46,139,192,0.4);
  }

  .word-pinyin {
    font-size: 1.5vw;
    margin-bottom: 0.8vh;
  }

  .word-meaning {
    font-size: 1.3vw;
    line-height: 1.3;
  }

  .word-hsk {
    padding: 0.5vh 1vw;
    border-radius: 1vw;
    font-size: 0.9vw;
    margin-top: 0.8vh;
  }

  .empty-state {
    padding: 8vh 3vw;
  }

  .empty-state-icon {
    font-size: 4.5vw;
    margin-bottom: 2vh;
  }

  .empty-state h3 {
    font-size: 2vw;
    margin-bottom: 1.5vh;
  }

  .empty-state p {
    font-size: 1.3vw;
    margin-bottom: 2vh;
  }

  .suggestions {
    margin-top: 2.5vh;
    padding: 2vh 2.5vw;
    border-radius: 1vw;
    border: 0.15vw solid rgba(46,139,192,0.2);
    max-width: 45vw;
  }

  .suggestions strong {
    font-size: 1.4vw;
  }

  .loading {
    padding: 8vh 3vw;
    font-size: 1.5vw;
  }

  .loading-spinner {
    width: 3.5vw;
    height: 3.5vw;
    border: 0.4vw solid rgba(46,139,192,0.3);
    margin-bottom: 1.5vh;
  }
}
@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
    html, body {
        overflow: auto;
    }
}