@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
  --primary-green: #2e8b57;
  --light-green: #3cb371;
  --dark-green: #1a4c1e;
  --accent-green: #7fff7f;
  --error-red: #ff6b6b;
  --success-green: #32cd32;
  --text-light: #f0f8ff;
  --text-dark: #2f4f4f;
  --shadow: rgba(0, 0, 0, 0.3);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(
    135deg,
    #1a4c1e 0%,
    #285c2c 25%,
    #3cb371 50%,
    #2e8b57 75%,
    #228b22 100%
  );
  background-attachment: fixed;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-light);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="30" r="1" fill="rgba(255,255,255,0.1)"/></svg>')
    repeat;
  pointer-events: none;
  z-index: -1;
}

h1 {
  margin: 20px 0 10px;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 3px;
  text-shadow: 2px 2px 8px var(--shadow);
  text-align: center;
  background: linear-gradient(45deg, var(--accent-green), var(--text-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

p {
  color: var(--text-light);
  margin: 8px 0;
  font-size: 1.1rem;
  font-weight: 400;
  text-shadow: 1px 1px 2px var(--shadow);
}

.game-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  flex-grow: 1;
  box-sizing: border-box;
}

.left-side {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 250px;
  text-align: center;
  padding: 20px;
}

.left-side img {
  width: 100%;
  max-width: 450px;
  height: auto;
  object-fit: contain;
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  box-shadow: 0 6px 20px var(--shadow);
}

#word-display {
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 600;
  letter-spacing: clamp(8px, 1.5vw, 12px);
  margin-top: 10px;
  color: var(--text-light);
  max-width: 95%;
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px 20px;
  border-radius: var(--border-radius);
  box-shadow: inset 0 2px 4px var(--shadow);
}

.right-side {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 15px;
  text-align: left;
  min-width: 300px;
  padding: 25px;
}

.game-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 15px;
  font-weight: 500;
}

#hint-btn {
  font-size: 0.9rem;
  padding: 8px 12px;
  background: linear-gradient(45deg, var(--accent-green), var(--primary-green));
  border: none;
  border-radius: var(--border-radius);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px var(--shadow);
}

#hint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

#hint-btn:disabled {
  background: rgba(128, 128, 128, 0.5);
  cursor: not-allowed;
  transform: none;
}

#clue {
  font-style: italic;
  font-weight: 500;
  padding: 15px;
}

.input-area {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

input {
  font-size: 1.2rem;
  padding: 12px;
  width: 120px;
  text-align: center;
  border: 2px solid var(--light-green);
  border-radius: var(--border-radius);
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-dark);
  font-weight: 500;
  transition: var(--transition);
}

input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px rgba(127, 255, 127, 0.5);
  transform: scale(1.05);
}

button {
  font-size: 1rem;
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-radius);
  background: linear-gradient(45deg, var(--primary-green), var(--light-green));
  color: white;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  box-shadow: 0 4px 15px var(--shadow);
}

button:hover {
  background: linear-gradient(45deg, var(--light-green), var(--primary-green));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}

button:active {
  transform: translateY(0);
}

#restart-btn {
  margin-top: 15px;
  font-size: 1.1rem;
  padding: 14px 25px;
  margin-right: auto; /* left-align */
}

#win {
  font-size: 2rem;
  color: var(--success-green);
  animation: bounce 0.6s ease-in-out;
  font-weight: 600;
  text-shadow: 2px 2px 4px var(--shadow);
}

#lose {
  font-size: 1.8rem;
  color: var(--error-red);
  animation: shake 0.8s ease-in-out infinite;
  font-weight: 600;
  text-shadow: 2px 2px 4px var(--shadow);
}

#message {
  min-height: 24px;
  font-weight: 500;
}

/* Responsive behaviour for smaller screens */
@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 10px;
  }

  .left-side,
  .right-side {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .left-side img {
    max-width: 80%;
  }

  #word-display {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    font-size: clamp(18px, 5vw, 28px);
    letter-spacing: 8px;
    word-break: break-word;
  }

  h1 {
    font-size: 2rem;
  }
}

/* Enhanced mobile support for tablets */
@media (max-width: 768px) {
  .game-layout {
    padding: 15px;
    gap: 25px;
  }

  button {
    padding: 15px 25px;
    font-size: 1.1rem;
    min-height: 48px;
  }

  input {
    width: 150px;
    padding: 15px;
    font-size: 1.3rem;
    min-height: 48px;
  }

  #hint-btn {
    padding: 12px 18px;
    font-size: 1rem;
    min-height: 44px;
  }

  .left-side img {
    max-width: 85%;
  }

  #word-display {
    font-size: clamp(20px, 6vw, 30px);
    letter-spacing: clamp(6px, 1.2vw, 10px);
    padding: 18px 25px;
  }

  h1 {
    font-size: 2.2rem;
    margin: 15px 0 8px;
  }

  p {
    font-size: 1.2rem;
  }
}

/* Enhanced mobile support for phones */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .game-layout {
    padding: 10px;
    gap: 20px;
  }

  h1 {
    font-size: 1.8rem;
    margin: 10px 0 5px;
    letter-spacing: 2px;
  }

  .left-side img {
    max-width: 95%;
    margin-bottom: 10px;
  }

  #word-display {
    font-size: 22px;
    letter-spacing: 4px;
    padding: 15px 20px;
    margin-top: 5px;
  }

  .right-side {
    padding: 20px;
    gap: 12px;
  }

  .game-stats {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    justify-content: space-between;
  }

  .game-stats p {
    font-size: 1rem;
    flex-shrink: 0;
  }

  #hint-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    min-height: 36px;
    align-self: center;
  }

  #clue {
    padding: 12px;
    font-size: 1rem;
  }

  .input-area {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  input {
    width: 100%;
    max-width: 180px;
    padding: 12px;
    font-size: 1.2rem;
    min-height: 44px;
  }

  button {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.1rem;
    min-height: 44px;
  }

  #restart-btn {
    margin-top: 12px;
    padding: 14px 18px;
    font-size: 1.1rem;
    min-height: 44px;
  }

  #message,
  #win,
  #lose {
    font-size: 1.1rem;
  }

  p {
    font-size: 1rem;
    margin: 6px 0;
  }
}

/* Animations */
@keyframes bounce {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-8px);
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-6px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Additional animations */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
