/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background-image: url('https://www.archtoronto.org/siteassets/media/offices--ministries/pastoral-ministries/office-for-interreligious-dialogue/images/homepage/home-page.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  min-height: 100vh;
  width: 100%;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 0;
  margin: 0;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.mainContent {
  font-family: Arial, sans-serif;
  background-color: #f6f6f6;
  width: 550px;
  min-height: 700px;
  margin: 0 10px;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 {
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 0 0 4px;
  font-size: 28px;
  color: #222;
}

#countryName {
  font-size: 22px;
  font-weight: bold;
  margin: 6px 0 10px;
  color: #333;
  text-align: center;
}

/* ── Country map ──────────────────────────────────────────────────────────── */
.religionData {
  text-align: center;
  margin-bottom: 6px;
}

.countryImage {
  width: 180px;
  height: 130px;
  object-fit: contain;
  padding: 6px;
  display: block;
  margin: 0 auto;
}

/* ── Percentage slots ─────────────────────────────────────────────────────── */
#percentageSlots {
  width: 512px;
  margin: 6px 0 8px;
}

.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #ddd;
  border-radius: 8px;
  padding: 0 16px;
  height: 46px;
  margin-bottom: 8px;
  transition: background-color 0.3s ease;
}

.slot.revealed {
  background-color: #4caf50;
}

.slot-pct {
  font-size: 20px;
  font-weight: bold;
  width: 60px;
  flex-shrink: 0;
  color: #333;
}

.slot.revealed .slot-pct {
  color: #fff;
}

.slot-religion {
  font-size: 16px;
  color: #888;
  font-style: italic;
}

.slot.revealed .slot-religion {
  color: #fff;
  font-style: normal;
  font-weight: bold;
}

/* ── Guess history rows ───────────────────────────────────────────────────── */
#guessHistory {
  width: 512px;
  margin: 0 0 6px;
}

.guess-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 36px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

.guess-row.wrong {
  background-color: #ef9a9a;
  color: #b71c1c;
  font-weight: 500;
}

.guess-row.empty {
  background-color: #e0e0e0;
}

/* ── Game-over banner ─────────────────────────────────────────────────────── */
.game-over-banner {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
}

.game-over-banner.won {
  background-color: #c8e6c9;
  color: #2e7d32;
}

.game-over-banner.lost {
  background-color: #ffcdd2;
  color: #c62828;
}

/* ── Input + autocomplete ─────────────────────────────────────────────────── */
.inputField {
  position: relative;
  width: 512px;
  margin: 4px 0;
}

#guessInput {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 15px;
  font-family: Arial, sans-serif;
  border: 1px solid #bbb;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

#guessInput:focus {
  border-color: #888;
}

#guessInput:disabled {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background-color: #e8f0fe;
}

/* ── Guess button ─────────────────────────────────────────────────────────── */
.buttonContainer {
  width: 512px;
  display: flex;
  justify-content: flex-start;
}

.guessButton {
  padding: 8px 20px;
  margin-top: 4px;
  border: none;
  border-radius: 4px;
  background-color: #444;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.guessButton:hover:not(:disabled) {
  background-color: #222;
}

.guessButton:disabled {
  background-color: #999;
  cursor: not-allowed;
}

.play-again {
  display: block;
  margin: 10px auto 0;
  background-color: #4caf50;
}

.play-again:hover {
  background-color: #388e3c;
}
