body, html {
  overflow-x: hidden;
  overflow-y: hidden;
}

label {
  margin-bottom: 0;
  text-align: left;
}

.col-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xl-2 {
  padding-left: 5px;
  padding-right: 5px;
}

.logo {
  position: relative;
  width: 50px;
  top: -16px;
}

.logo-text {
  float: right;
  font-family: 'Grandstander', cursive;
  font-size: x-large;
  color: #93dbe9;
  -webkit-text-stroke: 1px #689cc6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.core-nav .dropdown>.dropdown-menu {
  width: fit-content;
  cursor: pointer;
}

.masthead__gradient-content {
  padding-top: 10vh;
  padding-bottom: 4.9vh;
  background: no-repeat center center fixed;
  background-image: url('../img/bg/main-bg.svg');
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

#working-zone {
  min-height: 80vh;
  flex: 1;
  display: flex;
  align-items: center;
  padding: clamp(10px, 2vw, 20px);
  border-width: 2px;
  border-radius: clamp(10px, 2vw, 20px);
  border-color: #eeeeee;
  border-style: dashed;
  background-color: #fafafa;
  outline: none;
  transition: border .24s ease-in-out;
  opacity: .7;
  flex-direction: column;
}

#working-item-container {
  max-height: 80vh;
  border-style: dashed;
  border-radius: 20px;
  border-color: #eeeeee;
  background-color: #fafafa;
  opacity: .75;
  overflow: auto;
  overflow-x: hidden;
  margin-left: 2vw;
  padding: clamp(5px, 1vw, 8px) 0;
  display: flex;
  flex-direction: column;
  width: clamp(100px, 25vw, 300px);
  gap: 0.5rem;
}

#working-zone>h3 {
  color: #bdbdbd61;
  position: absolute;
  top: 10px;
}

#footer {
  color: #689cc6;
}

#footer-sub-menu {
  color: #689cc6;
  position: relative;
  left: -40px;
  top: 2px;
}

#build-no {
  color: #ddd;
  text-align: center;
  position: relative;
  top: 2px;
}

.footer__subfooter-liststyle li a {
  color: #689cc6;
}

.working-zone-menu {
  width: 100%;
  position: absolute;
  top: 0;
  right: 0;
}

.working-zone-btn {
  display: inline-block;
  box-shadow: 0 0.1rem 1rem rgba(200, 200, 200, 0.1), 0 0 0.5rem rgba(200, 200, 200, 0.1);
  border-radius: 50%;
  background-color: rgba(200, 200, 200, 0.1);
  margin: 14px 5px;
  position: relative;
  left: -15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.working-zone-btn:hover {
  background-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.05);
}

.working-zone-btn>img {
  height: 30px;
  width: 30px;
  transition: transform 0.3s ease;
}

.working-zone-btn:hover>img {
  transform: scale(1.1);
}

.working-zone-menu>.reset {
  float: left;
}

.heart-icon {
  width: 30px;
}

.item-container {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0.5rem;
  transition: transform 0.2s ease;
}

.item, .working-item {
  display: block;
  float: left;
  touch-action: none;
  user-select: none;
  cursor: pointer;
  width: clamp(3em, 6vw, 6em);
  height: clamp(3em, 6vw, 6em);
  margin: clamp(3px, 0.5vw, 6px);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Remove custom shakeX animation */
.animate__shakeX {
  animation-duration: 0.80s !important;
}

.item-name {
  display: flex;
  height: auto;
  min-height: 2em;
  width: auto;
  align-items: center;
  margin-left: 0.5em;
  text-transform: lowercase;
  font-size: clamp(14px, 1.5vw, 16px);
}

.item-droppable {
  box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.1), 0 0 0.5rem rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.1);
  /* transition: all 0.2s ease; */
}

.swal2-title {
  color: #fff !important;
}

.footer {
  padding: 0;
}

.footer__subfooter {
  padding: 0;
}

.footer__subfooter {
  margin-top: 20px;
}

.searchbar {
  margin-bottom: auto;
  margin-top: 8px;
  margin-right: 8px;
  height: 40px;
  box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.1), 0 0 0.5rem rgba(0, 0, 0, 0.1);
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 60px;
  padding: 0px;
  float: right;
  width: clamp(150px, 20vw, 200px); /* Changed to be always expanded */
  transition: all 0.3s ease;
  position: relative; /* Add this */
  display: flex;
  align-items: center;
}

#search-input {
  color: black; /* Changed to black */
  border: 0;
  outline: 0;
  background: none;
  width: calc(100% - 40px); /* Changed to be always expanded */
  padding: 0 10px;
  caret-color: #689cc6;
  line-height: 40px;
  transition: all 0.3s ease;
}

.searchbar:hover,
.searchbar:focus-within {
  background-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.02);
}

.search-icon, .search-clear {
  height: 40px;
  width: 40px;
  float: right;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  color: #689cc6;
  text-decoration: none;
  transition: all 0.3s ease;
  position: absolute;
  right: 0;
  top: 0;
}

.searchbar:hover .search-icon,
.searchbar:hover .search-clear {
  color: #ff00ff;
  transform: scale(1.05);
  text-decoration: none; /* Add this */
}

.btn {
  color: #689cc6;
}

/* Language dropdown styles */
#language-select {
    min-width: 120px; /* Ensure minimum width for the dropdown */
}

#language-select li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    white-space: nowrap;
}

#language-select li a img {
    width: 20px;
    height: auto;
}

/* Add new mega-menu styles */
.mega-dropdown {
    position: relative;
}

.mega-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 1rem;
    width: min(90vw, 600px);
    border: 1px solid rgba(0,0,0,0.1);
}

.mega-dropdown:hover .mega-dropdown-menu {
    display: block;
}

.mega-dropdown-content {
    max-height: 70vh;
    overflow-y: auto;
}

.language-search {
    position: sticky;
    top: 0;
    background: white;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    z-index: 1;
}

.language-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.language-grid li {
    padding: 0;
}

.language-grid li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.language-grid li a:hover {
    background-color: rgba(104, 156, 198, 0.1);
}

.language-grid li img {
    width: 20px;
    height: auto;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .mega-dropdown-menu {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90vw;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .language-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/*==========  Non-Mobile First Method  ==========*/
/* Large Devices, Wide Screens */
@media only screen and (max-width : 1200px) {}

/* Medium Devices, Desktops */
@media only screen and (max-width : 992px) {
  .item-container {
    display: grid;
    margin-bottom: 10px;
  }

  .item, .working-item {
    width: 6em;
    height: 6em;
    margin: 6px;
    background-size: 6em;
    margin: auto;
  }

  .item-name {
    height: 2em;
    margin: auto;
  }
}

/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
  #working-item-container {
    margin-left: 1vw;
    padding: 2vw 0;
    width: 100%;
    max-height: 30vh;
    margin-bottom: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: auto;
  }

  .item-container {
    display: grid;
    margin-bottom: 10px;
    flex: 0 0 auto;
    flex-direction: column;
    text-align: center;
    width: clamp(80px, 20vw, 120px);
  }

  .item, .working-item {
    display: block;
    float: left;
    touch-action: none;
    user-select: none;
    cursor: pointer;
    width: 6em;
    height: 6em;
    margin: 6px;
    background-size: 6em;
    margin: auto;
  }

  .item-name {
    height: 2em;
    margin: auto;
  }

  .working-zone-menu {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(250, 250, 250, 0.9);
    padding: 4px 0;
    backdrop-filter: blur(4px);
  }
}

/* Extra Small Devices, Phones */
@media only screen and (max-width : 480px) {
  #working-item-container {
    margin-left: 0;
  }

  .item, .working-item {
    width: 3.8em;
    height: 3.8em;
    margin: 6px;
    background-size: 3.8em;
  }

  .working-zone-menu .col-4 {
    padding: 0 5px;
  }

  #discovered-items {
    font-size: 0.875rem;
  }

  .working-zone-btn {
    margin: 10px 2px;
  }

  .working-zone-btn > img {
    height: 24px;
    width: 24px;
  }
}

/* Custom, iPhone Retina */
@media only screen and (max-width : 320px) {
  #working-item-container {
    margin-left: 0;
  }

  .masthead__gradient-content {
    padding: 20px 0 20px;
  }
}

@media (-webkit-min-device-pixel-ratio: 1.5) {
  .masthead__gradient-content {
    padding-bottom: 6.4vh;
  }
}

.swal2-backdrop-show {
  -webkit-background-size: cover !important;
  -moz-background-size: cover !important;
  -o-background-size: cover !important;
  background-size: cover !important;
}

.InputElement .ElementsApp {
  margin-left: 50px;
}

.grecaptcha-badge { opacity:0; }

/* Update base container styles */
#app-container {
  display: flex;
  flex-direction: row;
  min-height: 80vh;
  gap: 1rem;
}

/* Add touch device optimizations */
@media (hover: none) {
  .item-container:active {
    transform: scale(0.98);
  }

  .searchbar {
    width: clamp(150px, 30vw, 200px);
  }

  #search-input {
    width: calc(100% - 40px);
    padding: 0 10px;
    caret-color: #689cc6;
  }

  .searchbar:hover > #search-input {
    width: calc(100% - 40px);
  }
}

/* Fix iOS Safari viewport height issue */
@supports (-webkit-touch-callout: none) {
  .masthead__gradient-content {
    min-height: -webkit-fill-available;
  }

  #working-zone,
  #working-item-container {
    max-height: -webkit-fill-available;
  }
}

.click-anywhere-dismiss {
  cursor: pointer;
}

.click-anywhere-dismiss * {
  pointer-events: none;
}

.swal-centered-content {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.swal-centered-content img {
  object-fit: contain;
  margin: 0 auto;
}

.swal-centered-content .swal2-title {
  width: 100%;
  margin: 1em 0 !important;
}

/* Header and navigation base styles */
.header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 1rem;
  background: transparent;
  transition: background-color 0.3s ease;
}

.nav-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu {
  display: flex;
  align-items: stretch; /* Changed from center to stretch */
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}

/* Clean up redundant language selector styles */
.language-selector {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.language-selector button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 15px;
  color: #689cc6;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-selector button:hover {
  background-color: rgba(104, 156, 198, 0.1);
  color: #93dbe9;
}

/* Header nav hover states */
.header nav {
  background: transparent;
  transition: background-color 0.3s ease;
}

.header nav:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.menu {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Language selector styles - clean implementation */
.language-selector {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.language-selector button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 28px;
  background: none;
  border: none;
  color: #689cc6;
  cursor: pointer;
  font-size: 14px;
}

.language-selector button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.language-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 1rem;
  width: min(90vw, 320px);
  display: none;
  z-index: 1001;
}

.language-dropdown.show {
  display: block;
}

/* Language selector alignment with nav */
.menu .language-selector {
  height: 100%;
  display: flex;
  align-items: center;
}

.menu .language-selector button {
  height: 100%;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #689cc6;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu .language-selector button:hover {
  color: #93dbe9;
}

/* Header navigation styles */
.header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Clean language selector styles */
.core-nav .menu .language-selector {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.core-nav .menu .language-selector button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 15px;
  color: #689cc6;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
}

.core-nav .menu .language-selector button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Language dropdown positioning */
.language-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 1rem;
  width: min(90vw, 320px);
  display: none;
  z-index: 1001;
}

.fa-chevron-down:before {
  display: none;
}

.language-dropdown.show {
  display: block;
}

/* Header and navigation styles */
.header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 1rem;
}

/* Clean language selector styles */
.language-selector.header__button {
  height: 100%;
  display: flex;
  align-items: center;
  margin: 0 0.5rem;
}

.language-selector.header__button button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  color: #689cc6;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-selector.header__button button:hover {
  color: #93dbe9;
}

.language-selector.header__button button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Language dropdown adjustments */
.language-selector .language-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  transform: none;
  left: auto;
  min-width: 200px;
}

.header .nav-header .brand {
  margin-top: 40px !important; 
}

.header:hover .nav-header .brand {
  margin-top: 25px !important; 
}

/* Override core-nav styles for better positioning */
.header nav .wrap-core-nav-list .core-nav-list {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}

.header nav .wrap-core-nav-list {
  height: 100%;
  display: flex;
  align-items: center;
}

/* Adjust language selector to match other header buttons */
.header nav .language-selector.header__button {
  height: auto;
  margin: 0 0.5rem;
}

.header nav .language-selector.header__button button {
  padding: 0.5rem 1rem;
  height: auto;
  line-height: 1;
}

/* Header navigation layout */
.header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 1rem;
  height: 75px;
}

.wrap-core-nav-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  gap: 1rem;
}

/* Prevent nested wrappers */
.wrap-core-nav-list .wrap-core-nav-list {
  display: none;
}

/* Ensure proper ordering of elements */
.wrap-core-nav-list > .core-nav-list {
  order: -1;
}

.wrap-core-nav-list .core-nav-list {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  order: -1; /* Ensure language selector comes first */
}

.wrap-core-nav-list .attributes {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.5rem;
}

/* Remove any nested .wrap-core-nav-list styles */
.wrap-core-nav-list .wrap-core-nav-list {
  display: none; /* Hide any nested nav lists */
}

.wrap-core-nav-list,
.core-nav-list,
.attributes {
  float: none;
}

.wrap-core-nav-list {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 1rem;
}

.core-nav-list {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  order: -1; /* This ensures the language selector appears first */
}

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

.header__button {
  display: flex;
  align-items: center;
}

/* Adjust language selector position */
.language-selector.header__button {
  margin-right: 1rem;
}

/* Clean up header button styles */
.header__button {
  display: flex;
  align-items: center;
}

/* Language selector hover styles */
#language {
  cursor: pointer;
}

.language-grid li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
  cursor: pointer;
}

#language img {
  margin-bottom: 6px;
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

.language-grid img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

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

#discovered-items {
  color: #689cc6;
  /* background-color: rgba(0, 0, 0, 0.1); */
  border-radius: 60px;
  padding: 6px 16px;
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#discovered-items:hover {
  /* background-color: rgba(255, 255, 255, 0.9); */
  color: #ff00ff;
  transform: scale(1.05);
}

/* AI Hint Tooltip */
.tooltip-container {
  position: relative;
  display: inline-block;
  width: 38px; /* Match the button width */
}

.ai-hint-tooltip {
  position: relative;
  /* ... existing tooltip styles ... */
}

.close-hint {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 20px;
  color: #e3e3e3;
  cursor: pointer;
  z-index: 1;
}

.close-hint:hover {
  color: #4a7fa8;
}

.ai-hint-tooltip {
  position: relative;
  /* ... existing tooltip styles ... */
}

.ai-hint-tooltip {
  position: absolute;
  top: 85%;
  left: 13%;
  transform: translateX(-50%);
  width: max(200px, 25vw);
  background-color: rgba(104, 156, 198, 0.85);
  color: white;
  text-align: center; /* Changed from center to left for better readability */
  padding: 20px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  z-index: 1741337199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  white-space: pre-line; /* Changed from pre-wrap to pre-line */
  margin-top: 8px; /* Add margin-top instead of using calc */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-hint-tooltip::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;  /* Align with center */
  transform: translateX(-50%);
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent rgba(104, 156, 198, 0.95) transparent;
}

.ai-hint-tooltip .hint-content {
  white-space: pre-line; /* Add explicit pre-line to content */
  line-height: 1.6; /* Increase line height for better readability */
  margin-bottom: 8px;
}

.ai-hint-tooltip .hint-footer {
  font-size: 1em;
  opacity: 0.8;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 16px;
}

.ai-hint-tooltip.show {
  opacity: 1;
  visibility: visible;
}

.ai-hint-tooltip.loading {
  padding: 20px;
}

.ai-hint-tooltip .loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  min-height: 1.2em;
}

.ai-hint-tooltip .loading-spinner {
  margin: 2px auto;
}

.reveal-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.reveal-placeholder {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.reveal-placeholder:hover {
  transform: scale(1.1);
}

.reveal-trigger {
  width: 84px;
  height: 84px;
  transition: opacity 0.2s ease;
}

.reveal-trigger:hover {
  opacity: 1;
}

.element-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.element-content.hidden {
  display: none;
}

.reveal-placeholder.hidden {
  display: none;
}

.element-image {
  width: 84px;
  height: 84px;
}

.element-name {
  font-size: 14px;
  color: #fff;
  font-weight: 500;
}
