* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #e3f2fd; /* soft light blue */
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: #1a1a1a;
}

header {
  margin-top: 3rem;
  text-align: center;
  position: relative;
}

h1 {
  font-weight: 900;
  font-size: 3rem;
  letter-spacing: 0.1em;
  color: #1565c0; /* dark blue */
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  font-family: 'Segoe UI Black', sans-serif;
}

.header-underline {
  width: 120px;
  height: 4px;
  margin: 0 auto;
  background: #ffb74d; /* warm amber accent */
  border-radius: 4px;
}

.scoreboard {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin: 1.5rem auto 3rem;
  font-weight: 700;
  font-size: 1.3rem;
  max-width: 600px;
  background: white;
  padding: 0.9rem 2.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgb(21 101 192 / 0.15);
  color: #1565c0;
  user-select: none;
}

main {
  width: 90vw;
  max-width: 600px;
  padding: 2.5rem 2rem 3rem;
  background: white;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgb(21 101 192 / 0.15);
  text-align: center;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.flag-card {
  background-color: #f0f4ff; /* lighter blue */
  border: 1px solid #c3d2f2;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgb(21 101 192 / 0.2);
  margin-bottom: 2rem;
  transition: opacity 0.4s ease;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-card.hide {
  opacity: 0;
}

.flag-card img {
  max-height: 90%;
  max-width: 90%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  border-radius: 12px;
  background-color: white;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
  padding: 10px;
}

form {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
  align-items: center;
}

.input-wrapper {
  position: relative;
  width: 65%;
  min-width: 220px;
}

input[type="text"] {
  font-size: 1.3rem;
  padding: 0.9rem 0.9rem 0.9rem 2.8rem;
  width: 100%;
  border: 2px solid #90caf9;
  border-radius: 12px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-weight: 600;
  color: #1565c0;
}

input[type="text"]::placeholder {
  color: #82b1ff;
  font-weight: 500;
}

input[type="text"]:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 8px #1565c0aa;
}

.input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

button {
  font-size: 1.2rem;
  padding: 0.85rem 1.5rem;
  margin-top: 0.5rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: white;
  box-shadow: 0 4px 8px rgb(21 101 192 / 0.3);
  background-color: #1565c0;
}

button .btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

button:hover:not(:disabled) {
  background-color: #0d3c75;
  box-shadow: 0 6px 14px rgb(13 60 117 / 0.5);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  background-color: #90caf9;
  color: #eee;
}

/* Different button styles */
button#skip-button {
  background-color: #f48fb1; /* soft pink */
  color: white;
  box-shadow: 0 4px 8px rgb(244 143 177 / 0.4);
}

button#skip-button:hover:not(:disabled) {
  background-color: #b13653;
  box-shadow: 0 6px 14px rgb(177 54 83 / 0.6);
}

button#reveal-button {
  background-color: #ffb74d; /* warm amber */
  color: #333;
  box-shadow: 0 4px 8px rgb(255 183 77 / 0.4);
}

button#reveal-button:hover:not(:disabled) {
  background-color: #ff9d00;
  box-shadow: 0 6px 14px rgb(255 157 0 / 0.6);
}

#feedback {
  margin-top: 1.4rem;
  font-size: 1.3rem;
  min-height: 1.5em;
  font-weight: 700;
  user-select: none;
  color: #1565c0;
  min-height: 1.8em;
  transition: color 0.3s ease;
}

/* Shake animation for wrong guesses */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  20%, 60% {
    transform: translateX(-8px);
  }
  40%, 80% {
    transform: translateX(8px);
  }
}

.shake {
  animation: shake 0.5s;
}

/* Autocomplete styles */

.autocomplete-items {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 150px;
  overflow-y: auto;
  background-color: white;
  border: 1px solid #90caf9;
  border-top: none;
  border-radius: 0 0 12px 12px;
  z-index: 99;
  text-align: left;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgb(21 101 192 / 0.15);
}

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #e0e7ff;
  font-weight: 600;
  color: #1565c0;
}

.autocomplete-item:hover,
.autocomplete-active {
  background-color: #1565c0;
  color: white;
}

/* Responsive tweaks for mobile */
@media (max-width: 480px) {
  input[type="text"] {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  form {
    flex-direction: column;
  }

  button {
    width: 100%;
    margin: 0.25rem 0;
    justify-content: center;
  }

  .autocomplete-items {
    width: 100%;
  }

  .scoreboard {
  background: #f4f9ff; /* slightly tinted soft blue instead of white */
  color: #0d47a1; /* darker for better contrast */
}

/* Adjusted skip button for better default contrast */
button#skip-button {
  background-color: #c62828; /* stronger red */
  color: white;
  box-shadow: 0 4px 8px rgba(198, 40, 40, 0.4);
}

button#skip-button:hover:not(:disabled) {
  background-color: #8e0000;
  box-shadow: 0 6px 14px rgba(142, 0, 0, 0.6);
}

/* Optional: tweak reveal hover color slightly warmer */
button#reveal-button:hover:not(:disabled) {
  background-color: #ff9800;
}

}
