/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Black+Ops+One&display=swap');

/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow: hidden !important;
  height: 100vh;
}

/* Hide theme elements */
footer {
  display: none !important;
}

/* Game container */
#game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* Game UI */
#user-interface {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
}

#user-interface > * {
  pointer-events: auto;
}

/* Game section positioning */
#game-section {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

#result {
  position: fixed;
  left: 50%;
  top: 65%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 600px;
  min-height: 30px;
  max-height: 120px;
  font-size: 14px;
  color: #FFFFFF;
  font-family: 'Special Elite', cursive;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  text-align: center;
  padding: 10px;
  pointer-events: none;
  background: rgba(0, 0, 0, 0);
  border-radius: 10px;
  z-index: 4;
  letter-spacing: 1px;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0 auto;
  overflow-y: auto;
  line-height: 1.4;
}

#result.correct-answer {
  font-size: 14px;
}

@media (max-width: 768px) {
  #result {
    top: 58%;
    font-size: 14px;
    padding: 8px;
    width: 95%;
    max-height: 100px;
  }
  
  #result.correct-answer {
    font-size: 12px;
  }
}

#word-section {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-width: 80%;
  pointer-events: all;
}

.input-row {
  width: 100%;
  position: relative;
}

#user-input {
  width: 100%;
  height: 50px;
  padding: 10px 60px 10px 10px;
  font-size: 18px;
  font-family: 'Special Elite', cursive;
  text-align: left;
  border: 3px solid #4a5f34;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.8);
  z-index: 5;
  caret-color: #00ff00;
  animation: blink 1s step-end infinite;
  color: #00ff00;
  outline: none;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.desktop-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 50px;
  padding: 0;
  background: transparent;
  border: none;
  outline: none;
  flex-shrink: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
}

.desktop-send img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.mobile-send {
  display: none;
  border: none;
  outline: none;
  padding: 0;
  width: 120px;
  height: 50px;
}

@keyframes blink {
  from, to { caret-color: black; }
  50% { caret-color: transparent; }
}

/* Virtual keyboard */
.virtual-keyboard {
  display: none;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 10px;
  background: none;
  z-index: 7;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  margin-bottom: 5px;
  padding: 0 5px;
  max-width: 100%;
  gap: 4px;
}

.key {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  transition: transform 0.1s;
  width: calc(100% / 10);
  max-width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.key[data-key="BACKSPACE"] {
  width: calc(100% / 8);
  max-width: 60px;
}

.key img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.key:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .virtual-keyboard {
    display: block;
    padding: 10px 5px;
  }

  .keyboard-row {
    gap: 2px;
  }
  
  .key {
    padding: 1px;
  }

  .mobile-send {
    display: flex;
    width: 120px;
    max-width: 120px;
    height: 50px;
    background: transparent;
  }

  .mobile-send img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
  }

  #game-section {
    bottom: 40%;
  }
  
  #result {
    margin-bottom: 10px;
  }
}

.definition-container {
  position: fixed;
  left: 20px; /* Left-aligned */
  bottom: 160px; /* Position under the input field */
  z-index: 1001; /* Higher than keyboard (1000) */
  width: auto; /* Auto width to fit content */
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Align items to the left */
}

.definition-header {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer; /* Make the whole header clickable */
  width: auto; /* Auto width to fit content */
}

.definition-label {
  font-family: 'Special Elite', cursive;
  color: hsl(35, 50%, 70%);
  font-size: 16px;
  margin-right: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  flex-grow: 1; /* Take up all available space */
}

.definition-toggle {
  background-color: transparent;
  border: none;
  color: hsl(35, 50%, 70%);
  font-size: 16px;
  cursor: pointer;
  font-family: 'Special Elite', cursive;
  padding: 0 5px;
}

#word-definition {
  font-size: 18px;
  font-family: 'Special Elite', cursive;
  color: hsl(35, 50%, 70%);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  text-align: left;
  overflow-wrap: break-word;
  background-color: rgb(0, 0, 0); /* Fully opaque background */
  padding: 10px;
  border-radius: 5px;
  border-left: 3px solid hsl(35, 50%, 70%);
  transition: opacity 0.3s ease;
  max-height: 120px; /* Reduced height to fit between input and keyboard */
  overflow-y: auto;
  width: calc(100vw - 40px); /* Full viewport width minus margins */
  max-width: 600px;
  position: absolute;
  left: 0;
  top: 100%; /* Position directly below the header */
}

@media (max-width: 768px) {
  .definition-container {
    bottom: 260px; /* Higher position to avoid keyboard */
  }
  
  #word-definition {
    font-size: 14px;
    padding: 8px;
    max-height: 100px; /* Smaller height on mobile */
  }
}

#score-display {
  font-size: 20px;
  font-family: 'Black Ops One', cursive;
  color: hsl(35, 50%, 70%);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  position: fixed;
  right: 20px;
  top: 14vh; /* Return to original position */
  text-align: right;
  z-index: 5;
}

/* Game text */
#game-over {
  display: none;
  font-size: 24px;
  font-family: 'Black Ops One', cursive;
  color: #ff0000;
  text-shadow: 2px 2px 4px rgba(255, 0, 0, 0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}
