/* The guess form: input, Guess/Skip/Give-Up buttons, and the autocomplete
   dropdown that hangs off the input. Typing drives both this dropdown and the
   inventory grid below the form — two routes to the same guess. */

/* Guess form */
#guessForm {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  position: relative;
}

/* Primary action. */
#guessBtn {
  background: var(--success);
  border-color: var(--success);
  color: #05200F;
  font-weight: 700;
}
#guessBtn:hover:not(:disabled) {
  background: var(--success-hover);
  border-color: var(--success-hover);
}

/* Neither primary nor destructive — a neutral outline, quieter than Guess and
   less alarming than Give Up. */
#skipBtn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
#skipBtn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text);
  background: transparent;
}

/* Red, but outlined rather than filled — clearly the destructive option
   without competing with Guess for attention. */
#giveUpBtn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
#giveUpBtn:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

/* position: relative is load-bearing, not decoration: it makes this the
   containing block for the absolutely-positioned dropdown below. Without it the
   dropdown resolves against #guessForm and sits over the buttons. */
#guessInputWrap {
  flex: 1;
  position: relative;
}

#guessInput {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-lg);
  /* Matches the buttons beside it, so the row's controls stay the same height
     now that body carries prose leading. */
  line-height: var(--leading-snug);
  padding: 11px 14px;
}
#guessInput:focus {
  outline: none;
  border-color: var(--accent);
}
/* The page's focus ring rather than a weaker local copy. This ID selector
   outranks the :where() rule in base.css, so keyboard focus on the one field
   you actually type into was the only control on the page getting a 1px accent
   line instead of the double ring. */
#guessInput:focus-visible {
  box-shadow: var(--focus-ring);
}

/* Autocomplete dropdown */
#dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  /* Above the header. The two used to tie at 20, which resolved in the
     dropdown's favour only because it comes later in the document — a fragile
     thing to rely on for the one element that must never be covered. */
  z-index: 30;
}
#dropdown.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text);
}
.dropdown-item:hover,
.dropdown-item.active {
  background: var(--surface-hover);
}
.dropdown-item img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.dropdown-empty {
  padding: 10px 12px;
  font-size: var(--text-md);
  color: var(--text-faint);
}

@media (max-width: 640px) {
    #guessForm {
      flex-direction: column;
    }

    #guessInputWrap {
      width: 100%;
    }

    #guessForm button {
      width: 100%;
    }

    .dropdown-item {
      padding: 10px 12px;
    }
}
