/* Base Styles */
body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  min-width: 320px;
  text-align: center;
  height: 100%;
  overflow-x: hidden;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}


.country-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
}

.page-title {
	font-family: 'Poppins', sans-serif;
  font-weight: 600;
  margin-top: 40px; /* adjust as needed */
}

@keyframes flashHighlight {
  0% { background-color: #d4edda; }
  50% { background-color: #c3e6cb; }
  100% { background-color: #d4edda; }
}

.continent-complete {
  font-weight: bold;
  color: green;
  animation: flashHighlight 1s ease-in-out;
  border-radius: 5px;
  padding: 2px 6px;
  display: inline-block;
}

#targetCountry img {
  height: 18px;
  width: 24px;
  vertical-align: middle;
}


select {
  appearance: none;
  background-color: #fff;
  color: #333;
  padding: 10px 40px 10px 14px; /* ⬅️ Extra right padding */
  font-size: 16px;
  border: 2px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center; /* ⬅️ Push arrow further right */
  background-size: 16px;
  font-family: 'Inter', 'Segoe UI Emoji', sans-serif;
}


body.dark-mode select {
  background-color: #333;
  color: #fff;
  border-color: #555;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
}


select:hover {
  border-color: #999;
}

select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0,123,255,0.5);
}

@media (max-width: 768px) {
  select {
    width: auto;
    max-width: 90%;
    margin: 0 auto;
    display: block;
  }
}



#modeSelector {
  margin-bottom: 10px;
}

#modeTimer {
  font-size: 20px;
  font-weight: bold;
  margin-top: 10px;
  color: #005;
}

body.dark-mode #modeTimer {
  color: #ff9933;
}

#donateButtons {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  display: flex;
  gap: 10px;
}

.donate-button {
  background-color: #ffc439;
  color: #111;
  padding: 8px 12px;
  font-weight: bold;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.donate-button a {
  color: inherit;
  text-decoration: none;
}

.donate-button:hover {
  background-color: #ffb347;
  transform: scale(1.05); /* Subtle grow */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Glow effect */
}

body.dark-mode .donate-button {
  background-color: #ff9933;
  color: #1a1a1a;
}

body.dark-mode .donate-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(255, 165, 0, 0.4);
}



/* Updated Style.css with dark mode styles */
.guessed {
  fill: red !important;
  transition: fill 0.2s ease;
}

.guessed:hover {
  fill: darkred !important;
  cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.6));
}

body.dark-mode {
  background-color: #1a1a1a;
  color: #f0f0f0;
}

body.dark-mode input {
  background-color: #333;
  color: #fff;
  border: 2px solid #555;
}

body.dark-mode .sidebar {
  background: #2a2a2a;
  border-color: #444;
  color: #ddd;
}

body.dark-mode .guessed {
  fill: orange !important;
}

body.dark-mode #map path.guessed:hover {
  fill: darkorange !important;
  transform: translateY(-2px);
}

#map path.hovered {
  stroke: black;
  stroke-width: 1.2;
  fill-opacity: 0.85;
  transition: fill-opacity 0.2s, transform 0.2s;
  transform: translateY(-2px); /* <-- added */
}


#map path {
  stroke-width: 0.7;
  cursor: pointer;
  touch-action: manipulation;
}


#map path:hover {
  cursor: pointer;
  /*fill: #ccc !important;*/
  stroke: #666;
  stroke-width: 0.5;
}

#map path.guessed:hover {
  fill: darkred !important;
  transform: translateY(-2px);
}

#map path.hovered.guessed {
  fill: darkred !important;
  transform: translateY(-2px);
}

body.dark-mode #map path.hovered.guessed {
  fill: darkorange !important;
}


.sidebar {
  position: fixed;
  top: 100px;
  right: 20px;
  background: #f8f8f8;
  padding: 12px 18px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-width: 240px;
  text-align: left;
  font-size: 14px;
  z-index: 1000;
  margin-top: 0;       /* ✅ Add this */
}

.sidebar h4 {
  font-size: 18px;
  margin: 0 0 10px 0;  /* ✅ No top margin */
  border-bottom: 1px solid #444;
  padding-bottom: 4px;
}

@media only screen and (max-width: 768px) {
  #continentStats {
    text-align: center;
    display: block;
    width: 100%;
    padding: 10px 0;
	padding-left: 43px; /* ✅ adjust as needed */
  }

  #continentStats div {
    display: block !important;  /* override flex */
    text-align: center !important;
    margin: 4px 0;
    padding: 2px 0;
    width: 100%;
  }
}


#continentStats div {
  display: flex;
  justify-content: space-between;
  white-space: nowrap;
}


#countryInfoPanel, #continentStats {
  font-size: 15px;
  line-height: 1.5;
}

#siteFooter {
  width: 100vw; /* 100% of viewport width */
  margin: 0;
  padding: 20px;
  background-color: #f8f8f8;
  color: #333;
  text-align: center;
  font-size: 14px;
  border-top: 1px solid #ccc;
  position: relative; /* important for layout */
  left: 50%;
  right: 50%;
  transform: translateX(-50%); /* center and stretch */
}

body.dark-mode #siteFooter {
  background-color: #2a2a2a;
  color: #ddd;
  border-color: #444;
  border-bottom: none;
}



body {
  font-family: sans-serif;
  text-align: center;
  padding: 20px;
  height: 100%;
}

#map svg {
  max-width: 100%;
  height: auto;
  touch-action: none; /* important for gesture recognition */
}

/* Use dynamic viewport height if supported */
@supports (height: 100dvh) {
  #map svg {
    max-height: calc(100dvh - 150px); /* adjust offset as needed */
  }
}

@supports (height: 100dvh) {
  html, body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    margin: 0;
    padding: 0;
  }
}


@media (max-width: 768px) {
  #map {
    margin-top: 10px;
  }

  #map svg {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  @supports (height: 100dvh) {
    #map svg {
      max-height: calc(100dvh - 140px); /* adjust to fit your layout */
    }
  }
}


@media (max-width: 768px) {
  #guessInput {
    position: relative;
    top: auto;
    margin-top: 12px;
    margin-bottom: 12px;
  }

  #guessInput.sticky {
    position: sticky;
    top: 60px;
    z-index: 1001;
  }
}


input {
  padding: 10px;
  font-size: 16px;
  width: 300px;
  border: 2px solid #ccc;
  border-radius: 6px;
  transition: border-color 0.3s ease;
}


#statusBar {
  margin-top: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}


.continent-stats {
  margin-top: 20px;
}

.guessed-list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin-inline: auto;
  text-align: left;
}

.guessed-list h3 {
  margin-bottom: 5px;
  display: inline-block; /* so the ::after only spans text width */
  position: relative;
}

.guessed-list h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px; /* adjust to sit nicely under text */
  width: 100%;
  height: 2px;
  background-color: #000; /* or any color */
}

body.dark-mode .guessed-list h3::after {
  background-color: #ffa500; /* dark mode: orange line */
}

.guessed-list ul {
  list-style: none;
  padding: 0;
}

.guessed-list li {
  padding: 2px 0;
}

.correct-guess {
  color: #28a745;
  font-weight: bold;
}

.wrong-guess {
  color: #dc3545;
  font-weight: bold;
}

button {
  background-color: grey;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  background-color: #cc8400;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}


button:active {
  transform: translateY(1px);
}

body.dark-mode button {
  background-color: #ffa500;
  color: #1a1a1a;
}

body.dark-mode button:hover {
  background-color: #cc8400;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(255, 165, 0, 0.4);
}

.country-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
}

body.dark-mode .country-tooltip {
  background: rgba(255, 165, 0, 0.9); /* orange background */
  color: #1a1a1a; /* dark text */
}

@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    box-sizing: border-box;
    padding-left: 12px;
    padding-right: 12px;
	text-align: center;
  }
  
  input, button {
  width: 100%;	
  max-width: 100%;
  box-sizing: border-box;
  font-size: 18px;
  margin-bottom: 10px; 
}

}

/* Fade-in animation for win screen */
@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to { opacity: 1; transform: translate(-50%, -30%); }
}

#winScreen {
  animation: fadeIn 0.6s ease-out;
}

path.guessed {
    fill: gold;
    stroke: black;
    stroke-width: 1;
    transition: fill 0.5s ease;
}

.sidebar.hidden {
  display: none;
}

/* --- INSERT TOGGLE BUTTON STYLES BELOW --- */

/* Hide toggle button by default (desktop view) */
#toggleSidebarButton {
  display: none;
}


/* Use dynamic height to prevent keyboard overlap*/
@media (max-width: 768px) {
	html, body {
	  height: auto;
	  min-height: 100dvh;
	  overflow-y: auto;
	}

	#mainContent {
	  padding-bottom: 200px; /* leaves space for keyboard */
	  padding-left: 12px;
	padding-right: 12px;
	}

  #guessInput {
    scroll-margin-top: 80px;
  }
}


/* Show toggle button on small screens */
@media (max-width: 768px) {
  #toggleSidebarButton {
    display: inline-block;
  }
}

/*Increase button size and spacing for mobile*/

@media (max-width: 768px) {
  button {
    padding: 14px 20px;
    font-size: 18px;
    border-radius: 10px;
    margin-bottom: 12px;
  }

  #hintButton,
  #toggleSidebarButton,
  #startClickMode,
  #startChallengeButton {
    width: 100%;
    box-sizing: border-box;
  }
}

/*Add spacing around interactive input area*/

#guessInput {
  margin-bottom: 12px;
}

#feedbackContainer {
  margin-bottom: 16px;
}


#zoomControls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#zoomControls button {
  background-color: grey;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

#zoomControls button:hover {
  background-color: #666;
}

#zoomControls button svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}


#toggleZoomControls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1002;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #444;
  color: white;
  border: none;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: none;

  align-items: center;
  justify-content: center;
  padding: 0;
}


#toggleZoomControls:hover {
  background-color: #666;
}

@media (max-width: 768px) {
  #zoomControls {
    display: none;
    flex-direction: row;
    bottom: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 12px;
    border-radius: 10px;
  }

  #zoomControls.visible {
    display: flex;
  }

  #toggleZoomControls {
    display: flex;
  }
}

#feedbackContainer {
  min-height: 24px; /* enough space for one line */
  margin-top: 8px;
  text-align: center;
}

#lastGuessFeedback {
  font-size: 16px;
  color: red;
  transition: opacity 0.3s ease;
}

#lastGuessFeedback.fade-out {
  opacity: 0;
}

#map path.dimmed {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#mainContent {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 16px; /* ← equal left and right padding */
  box-sizing: border-box;
}


#toggleDarkMode {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  background-color: rgba(255, 255, 255, 0.7);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  z-index: 2000;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#toggleDarkMode:hover {
  background-color: rgba(255, 255, 255, 0.85);
}

body.dark-mode #toggleDarkMode {
  background-color: rgba(50, 50, 50, 0.8);
}

body.dark-mode #toggleDarkMode:hover {
  background-color: rgba(70, 70, 70, 1);
}


@media (max-width: 768px) {
  #toggleDarkMode {
    font-size: 22px;
    top: 8px;
    right: 8px;
    padding: 4px;
  }
}


/*_______________Tablet______________*/

/* ============================================
   Responsive Design for Tablets (768px–1024px)
   ============================================ */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
  body {
    font-size: 16px;
    padding: 10px;
  }

  .country-tooltip {
    font-size: 12px;
    padding: 5px 8px;
  }

  #donateButtons {
    flex-direction: column;
    top: 10px;
    left: 10px;
  }

  #modeTimer {
    font-size: 18px;
  }

  .continent-complete {
    font-size: 14px;
  }
}

/* ============================================
   Responsive Design for Mobile Devices (<768px)
   ============================================ */
@media only screen and (max-width: 767px) {
svg#worldMap {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}


  .country-tooltip {
    font-size: 12px;
    padding: 4px 6px;
  }

  #donateButtons {
    flex-direction: row;
    gap: 5px;
    top: 10px;
    left: 10px;
  }

  #modeTimer {
    font-size: 16px;
  }

  .continent-complete {
    font-size: 12px;
  }
}

@media only screen and (max-width: 767px) {
  #continentStats {
    margin-top: 10px;
    width: 80%;
    text-align: center;
    min-height: 40px;
  }

  #continentStats div,
  #continentStats p {
    text-align: center;
  }
}


/* --- Input Feedback Animations --- */
@keyframes flashGreen {
  0% { background-color: #d4edda; border-color: #28a745; }
  50% { background-color: #c3e6cb; border-color: #80e0a0; }
  100% { background-color: #d4edda; border-color: #28a745; }
}

/*
@keyframes flashRed {
  0% { background-color: #f8d7da; border-color: #dc3545; }
  50% { background-color: #f5c6cb; border-color: #f5a6a0; }
  100% { background-color: #f8d7da; border-color: #dc3545; }
}
*/

input.success {
  animation: flashGreen 0.5s ease-out;
}

/*
input.error {
  animation: flashRed 0.5s ease-out;
}
*/

#infoSidebar {
  left: 20px;
  right: auto;
}
@media (max-width: 768px) {
  #infoSidebar {
    display: none;
  }

#mobileSidebarsContainer.visible-mobile .sidebar {
  display: block;
}

}

#mobileSidebarsContainer {
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  #mobileSidebarsContainer {
    display: none;
  }

  #mobileSidebarsContainer.visible-mobile {
    display: block;
  }
}

.button-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.button-container button {
  flex: 1 1 45%;
  min-width: 140px;
}

/* Default display behavior */
.desktop-only {
  display: inline-block;
}
.mobile-only {
  display: none;
}

/* Responsive layout: mobile view */
@media (max-width: 768px) {
  .desktop-only {
    display: none;
  }
  .mobile-only {
    display: inline-block;
  }
}

.hint-button {
  background-color: grey;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hint-button:hover {
  background-color: #cc8400;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .hint-button {
  background-color: #ffa500;
  color: #1a1a1a;
}

body.dark-mode .hint-button:hover {
  background-color: #cc8400;
  box-shadow: 0 4px 10px rgba(255, 165, 0, 0.4);
}


.button-pair {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.button-pair button {
  flex: 1 1 48%;
  min-width: 100px;
}


/* Tablets: keep layout tight */
@media (min-width: 768px) and (max-width: 1024px) {
  .button-pair {
    max-width: 600px;
  }

  .button-pair button {
    font-size: 16px;
    padding: 12px 18px;
  }
}

/* Mobile: stack on very narrow screens */
@media (max-width: 420px) {
  .button-pair {
    flex-direction: row !important;
  }

  .button-pair button {
    flex: 1 1 48%;
  }
}

/* Force Hint and Stats side-by-side even on narrow mobile */
@media (max-width: 768px) {
  .button-pair.mobile-only {
    flex-direction: row !important;
    gap: 10px;
    justify-content: center;
    padding: 0 8px;
  }

  .button-pair.mobile-only button {
    flex: 1 1 48%;
    min-width: 120px;
    max-width: 100%;
  }
}

