@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a1a, #2c2c2c);
    margin: 0;
    margin-top: 20px;
    color: #ffffff;
}

html, body {
    touch-action: auto;
    -webkit-tap-highlight-color: transparent;
        max-width: 100vw; /* Optional: removes highlight on tap */
}

/* Menu Styles */
#menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
      width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    /* height: 100vh; */
}

#menu-icon, #game-icon {
    width: 250px;
    height: 250px;
}

#menu-title,
#game-title {
  font-family: 'Cinzel', serif;
  font-size: 48px;
  color: #eec566;
  -webkit-text-stroke: 0.2px #000000;

  text-shadow:
    -1px -1px 0 #000000,
    1px -1px 0 #000000,
    -1px 1px 0 #000000,
    1px 1px 0 #000000,
    0px -3px 2px #7f241b;
  /* heavier bottom glow */

  /* letter-spacing: 2px; */
  margin: 10px 0;
}

#banner-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 30px;
  max-width: 900px;
}

#moving-banner {
  position: absolute;
  font-style: italic;
  color: #eec566;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(0);
  transition: none;
}

#start-game, #daily-challenge  {
    padding: 12px 20px;
    background-color: #7f241b;
    color: #ffffff;
    border: 1px solid #eec566;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 20px 0;
    transition: background-color 0.3s ease, transform 0.2s ease;
}



#daily-challenge:hover {
    padding: 12px 20px;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
        border: 1px solid #eec566;
    margin: 20px 0;
    background-color: #c0392b;
    transform: scale(1.5);
    box-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
}


#start-game:hover {
    padding: 12px 20px;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
        border: 1px solid #eec566;
    margin: 20px 0;
    background-color: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
}

#stats {
    font-size: 18px;
    text-align: center;
}

#stats p {
    margin: 5px 0;
}

#contribute-message {
  color: #eec566;
  font-size: 0.85em;
  width: 100%;
  max-width: 900px;
  text-align: center;
  line-height: 1.0em;
  margin: 0px auto;
  padding: 0px 0;
}

.decimal {
  font-size: 0.6em;
  color: #999;
}
.small-cell {
  font-size: 0.85em !important;
  color: #999 !important;
}
/* Game Styles */
#game-container {
    width: 100%;
}

#main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 30px;
}


#score-display {
    width: 100%;
    text-align: center;
    padding: 10px;
    background-color: #ffffff;
    color: #c0392b;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid #eec566;
    border-radius: 8px;
    margin-bottom: 10px;
    box-sizing: border-box; /* Padding and border are included in width */
}

#face-container {
    width: 100%;
    height: 270px;
    position: relative;
    perspective: 1000px;
    margin-bottom: 0px;
    overflow: hidden;          /* ✅ Prevents scroll bleed */
    touch-action: none;        /* ✅ Enables custom touch dragging */
    -ms-touch-action: none;    /* ✅ Compatibility with older IE/Edge */
    cursor: grab;              /* ✅ Optional: visual feedback on desktop */
}


#face-flip-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border: 0px solid #eec566;
}

#face-flip-container.flip {
    transform: rotateY(180deg);
}

#face-front, #result-popup {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

#face-front {
    transform: rotateY(0deg);
    overflow: hidden;
    height: 100%;
}

#image-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-around; /* spread images evenly */
    align-items: center;

}

.difficulty-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 50%;
    border: 1px solid #eec566;
}

@media (max-width: 768px) {
  .difficulty-image {
    width: 45%;
    height: auto;
  }

  #image-container {
    gap: 5px;
  }
}

#face-image {
    width: auto;
    height: auto;
    transform: scale(5);
    transition: transform 0.1s ease;
        border-radius: 50%;
        border: 1px solid #eec566;
    pointer-events: none;       /* ❗ Keep - prevents cheating via direct mouse drag */
    user-select: none;          /* ✅ Prevents accidental selection */
    -webkit-user-drag: none;    /* ✅ Prevents browser drag behavior on Safari */
    /* touch-action: none; ❌ Remove — we now handle gestures on the container instead */
}


canvas {
    max-width: 100%;
    max-height: 100%;
}

#result-popup {
    transform: rotateY(180deg);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    color: #333;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
    height: fill; /* Double the original 300px */
    top: 0; /* Anchor to the bottom of the parent */
    bottom: auto; /* Remove default top positioning */
}

#result-content {
    max-width: 100%;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
    max-height: 150px; /* Each image up to 150px, total 300px to match face container */
    width: auto;
    display: block;
}

#result-content h2 {
    color: #c0392b;
    text-align: center;
    margin: 0px 0;
    font-size: 24px;
}


#result-content pre {
    white-space: pre-wrap;
    overflow-x: hidden;
    margin: 10px 0;
    text-align: left;
    width: 100%;
}

#result-content .image-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    /* gap: 10px;
    margin: 10px 0; */
}

.arrow {
    position: absolute;
    font-size: 24px;
    color: #eec566;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.arrow:hover {
    background-color: #c0392b;
    color: #ffffff;
}

#arrow-up { top: 10px; left: 50%; transform: translateX(-50%); }
#arrow-right { right: 10px; top: 50%; transform: translateY(-50%); }
#arrow-down { bottom: 10px; left: 50%; transform: translateX(-50%); }
#arrow-left { left: 10px; top: 50%; transform: translateY(-50%); }

#map-container {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    border: 1px solid #eec566;
    margin: 10px auto;
    position: relative;
    overflow: hidden;
    touch-action: manipulation; /* Replaces touch-action: auto; */
    -ms-touch-action: manipulation; /* For broader compatibility */
}

#confirm-guess {
    width: 100%;
    padding: 12px 20px;
    background-color: #c0392b;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-bottom: 10px;
    border-top: 1px solid #eec566;
    box-sizing: border-box;
}

#confirm-guess:hover:not(.disabled) {
    background-color: #a93226;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
    animation: pulse-gold 0s infinite ease-in-out;

}

#confirm-guess:active:not(.disabled) {
    transform: scale(0.95);


}


#confirm-guess:not(.disabled) {

    animation: pulse-gold 1.2s infinite ease-in-out;


}

#confirm-guess.disabled {
    background-color: #000000;
    color: #ffffff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#left-timer-container, #right-timer-container {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 5vw;
    z-index: -1;
}

#left-timer-container {
    left: 0;
}

#right-timer-container {
    right: 0;
}

#left-timer-bar, #right-timer-bar {
    position: absolute;
    bottom: -5vh;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 5px 5px 0 0;
    transition: height 0.1s linear, background 0.3s ease;
}

#left-timer-bar.full, #right-timer-bar.full { background: rgba(255, 255, 255); }
#left-timer-bar.safe, #right-timer-bar.safe { background: rgb(255, 255, 255); }
#left-timer-bar.intermediate, #right-timer-bar.intermediate { background: rgb(199, 199, 199); }
#left-timer-bar.warning, #right-timer-bar.warning { background: rgb(159, 134, 134); }
#left-timer-bar.caution, #right-timer-bar.caution { background: rgb(130, 71, 71); }
#left-timer-bar.danger-1, #right-timer-bar.danger-1 {
    background: rgb(180, 40, 30);
    animation: vibrate-1 0.2s infinite;
}
#left-timer-bar.danger-2, #right-timer-bar.danger-2 {
    background: rgb(255, 0, 0);
    animation: vibrate-2 0.1s infinite;
}

@keyframes vibrate-1 {
    0% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    50% { transform: translateY(2px); }
    75% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes vibrate-2 {
    0% { transform: translateY(0); }
    20% { transform: translateY(-4px); }
    40% { transform: translateY(4px); }
    60% { transform: translateY(-4px); }
    80% { transform: translateY(4px); }
    100% { transform: translateY(0); }
}

#close-popup {
    width: 100%;
    padding: 12px 20px;
    background-color: #c0392b;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-top: 10px;
    border-top: 1px solid #eec566;
}

#close-popup:hover {
    background-color: #a93226;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
}

#close-popup:active {
    transform: scale(0.95);
}

#score-tooltip {
    position: absolute;
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 5px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 10000;
}

/* #left-pillar, #right-pillar {
    position: fixed;
    top: 0;
    height: 100vh;
    width: auto;
    z-index: 1000;
    pointer-events: none;
}

#left-pillar {
    left: 0;
}

#right-pillar {
    right: 0;
    transform: scaleX(-1);
} */

#back-to-menu {
    position: relative; /* no longer fixed */
    padding: 10px 20px;
    background-color: #000000;
    color: #c0392b;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    z-index: 10000;

    display: block;
}

#back-to-menu-popup {
  position: relative;
  /* no longer fixed */
  padding: 0px 0px;
  background-color: #000000;
  color: #c0392b;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  z-index: 10000;

  display: block;
}

#instructions {
    text-align: center;
    font-size: 16px;
    margin: 10px auto;
    color: #eec566;
}



#back-to-menu:hover {
    background-color: #eec566;
    color: black;
    border: 2px solid #eec566;
    box-shadow: 0 0 10px #eec566, 0 0 20px #eec566 inset;
    animation: pulse-gold 1.2s infinite ease-in-out;
}

/* Overlay to dim the background */
#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    z-index: 999; /* Behind the popup */
}

/* Popup container */
#end-game-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the popup */
    background: #ffffff00;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000; /* Above the overlay */
    max-width: 500px;
    width: 90%;
    text-align: center;
}

/* Icon styling */
.popup-icon {
    width: 100px; /* Adjust as needed */
    height: auto;
    margin-bottom: 15px;
}

/* Content inside the popup */
/* === Restyled Popup Content === */
.popup-content {
  background: #000;
  border: 1px solid #eec566;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(238, 197, 102, 0.2);
  padding: 20px;
  color: #eec566;
  font-family: inherit;
  text-align: center;
}

.popup-content h2 {
  margin: 0 0 10px;
  font-size: 26px;
  color: #eec566;
}

.popup-content h1 {
  margin: 10px 0;
  font-size: 32px;
  color: #fff;
  text-shadow: 0 0 4px rgba(255,255,255,0.2);
}

.popup-content p {
  font-size: 15px;
  color: #ccc;
  margin: 10px 0;
  line-height: 1.5;
}

.popup-content strong {
  color: #eec566;
}

/* === Buttons container === */
.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 25px;
}

.popup-buttons button {
  padding: 10px 18px;
  font-size: 16px;
  border: 1px solid #eec566;
  background-color: #1a1a1a;
  color: #eec566;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 0 8px rgba(238, 197, 102, 0.1);
}

.popup-buttons button:hover {
  background-color: #2a2a2a;
  box-shadow: 0 0 12px rgba(238, 197, 102, 0.3);
}



#player-name {
    padding: 5px;
    font-size: 16px;
    border: 1px solid #eec566;
    border-radius: 5px;
    background-color: #2c2c2c;
    color: #ffffff;
}

#save-name {
    padding: 5px 10px;
    background-color: #c0392b;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
}

#save-name:hover {
    background-color: #a93226;
}
#leaderboard {
  margin-top: 20px;
  text-align: center;
}

#leaderboard h2 {
  font-size: 22px;
  color: #eec566;
  margin-bottom: 10px;
}

#leaderboard label {
  font-size: 16px;
  margin-right: 10px;
}

/* Default styles */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  /* Enables scrolling on larger screens if needed */
  box-sizing: border-box;
  margin: 0 auto;
    max-height: 50VH;
      overflow-y: auto;
}

#leaderboard .table-wrapper::-webkit-scrollbar {
  width: 8px;
}

#leaderboard .table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

#leaderboard table {
  width: 100%;
  max-width: 80%;
  margin: 0 auto;
  background-color: #2c2c2c;
  border: 1px solid #eec566;
  border-collapse: collapse;
}

#leaderboard th,
#leaderboard td {
  padding: 10px;
  border: 1px solid #eec566;
  font-size: 16px;
    white-space: normal;
      /* Allow text to wrap to a new line */
      word-wrap: break-word;
      /* Legacy support for older browsers */
      overflow-wrap: break-word;
      /* Standard property for breaking long words */
}

#leaderboard th {
  background-color: #c0392b;
  color: #ffffff;
}

#leaderboard td {
  color: #ffffff;
}

/* Media query for small screens */
@media (max-width: 768px) {
  .table-wrapper {
    overflow-x: hidden;
    /* Disable horizontal scrolling */
  }

  #leaderboard table {
    width: 100%;
    /* Use full available width */
    max-width: none;
    /* Remove the 80% limitation */
    table-layout: fixed;
    /* Evenly distributes columns */
    font-size: 10px;
    /* Optional: reduce font size for better fit */
    margin: 0;
    /* Align table with the container edge */
  }

  #leaderboard th,
  #leaderboard td {
    padding: 3px;
    /* Reduce padding for a more compact layout */
  }
}
#options-container {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 20px 0;
  box-sizing: border-box;
    max-width: 100%;
}

#ethnos-column, #difficulty-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#ethnos-column h2, #difficulty-column h2 {
  font-size: 20px;
  color: #eec566;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  #options-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 10px;
  }

  #ethnos-column,
  #difficulty-column {
    width: 100%;
    max-width: 400px;
  }

  .difficulty-btn-wrapper {
    width: 100%;
  }

  #racial-group-selector, #continent-selector {
    width: 100%;
  }
}

@media (max-width: 480px) {
  #leaderboard table {
    font-size: 14px;
  }

  #leaderboard th,
  #leaderboard td {
    padding: 8px;
  }
}

#login-twitter, #toggle-twitter-leaderboard {
  padding: 10px 20px;
  background-color: #1a1a1a;

  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

#login-twitter.connected,
#toggle-twitter-leaderboard.active {
  border: 2px solid #eec566;
    background-color: black;
    color: #eec566;
    box-shadow: 0 0 10px #eec566, 0 0 20px #eec566 inset;
    animation: pulse-gold 1.2s infinite ease-in-out;
    transform: scale(1.05);
    cursor: default;
}
.twitter-name {
  color: #c0392b;
  font-weight: bold;
}

.twitter-name:hover {
  color: #eec566;
  text-decoration: underline;
}
/* Daily Toggle Button Styles */
#toggle-daily-leaderboard {
  padding: 10px 20px;
  background-color: #1a1a1a;

  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

#toggle-daily-leaderboard.active {
  border: 2px solid #eec566;
    background-color: black;
    color: #eec566;
    box-shadow: 0 0 10px #eec566, 0 0 20px #eec566 inset;
    animation: pulse-gold 1.2s infinite ease-in-out;
    transform: scale(1.05);
}

#difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px; /* Space between buttons */
  width: 200px; /* Adjust this to fit your design */
}

.difficulty-btn {
  padding: 10px 20px;
  background-color: #c0392b; /* Adjust color as needed */
  color: #ffffff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  width: 100%; /* Makes buttons fill the container */
  box-sizing: border-box; /* Keeps padding inside the width */
    transition: background-color 0.3s ease;
}

.difficulty-btn.locked {
  background-color: #555;
  cursor: not-allowed;
}

.difficulty-btn.selected {
  border: 2px solid #eec566;
  background-color: black;
  color: #eec566;
  box-shadow: 0 0 10px #eec566, 0 0 20px #eec566 inset;
  animation: pulse-gold 1.2s infinite ease-in-out;
  transform: scale(1.05);
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 5px #eec566, 0 0 10px #eec566 inset;
  }
  50% {
    box-shadow: 0 0 15px #ffce5d, 0 0 25px #ffce5d inset;
  }
  100% {
    box-shadow: 0 0 5px #eec566, 0 0 10px #eec566 inset;
  }
}

@keyframes pulse-white {
  0% {
    box-shadow: 0 0 5px rgb(208, 208, 208), 0 0 10px rgb(208, 208, 208) inset;
  }
  50% {
    box-shadow: 0 0 15px white, 0 0 25px white inset;
  }
  100% {
    box-shadow: 0 0 5px rgb(208, 208, 208), 0 0 10px rgb(208, 208, 208) inset;
  }
}

#racial-group-selector, #continent-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

#racial-group-selector label, #continent-selector label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #eec566;
  font-size: 16px;
}

#racial-group-selector input[type="checkbox"], #continent-selector input[type="checkbox"], #no-timer-toggle {
  accent-color: #c0392b;
  width: 16px;
  height: 16px;
}

/* Tooltip Styles */
.tooltip {
  position: absolute;
  background-color: #1a1a1a;
  color: #eec566;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
    white-space: normal;
    word-break: break-word;
    max-width: 80vw;
  z-index: 100;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.difficulty-btn-wrapper {
  position: relative;
  display: inline-block;
}

.difficulty-btn-wrapper:hover .tooltip,
.difficulty-btn-wrapper.show-tooltip .tooltip {
  opacity: 1;
  transform: translateY(0);
}

.unlocked-animate {
  animation: unlockPulse 0.6s ease-out;
}

@keyframes unlockPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

#compatibility-warning {
  font-size: 14px;
  margin-top: 10px;
  color: #ccc;
  text-align: center;
  padding: 5px 15px;
}

.how-to-section {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 20px;
  margin: 15px auto;
  max-width: 900px; /* Ensures consistent total width */
  width: 100%;
}

.how-to-play {
  flex: 1;
  background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
  border: 1px solid #eec566;
  border-radius: 12px;
  padding: 5px 8px;
  color: #fff;
  font-size: 15px;
  text-align: left;
  line-height: 1.5;
}
.double-line {
  width: 75%;
  height: 5px; /* thin line height */
  border-top: 2px solid #eec266;
  border-bottom: 4px solid #eec566;
  margin: 1.5em 0 2em 0; /* spacing above and below */
}


.disclaimer {
  flex: 1;
  background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
  border: 0px solid #eec566;
  border-radius: 12px;
  padding: 15px;
  color: #eec566;
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;


  /* Centering styles */
  display: flex;
  flex-direction: column;
  justify-content: center;  /* vertical centering */
  align-items: center;      /* horizontal centering */
  text-align: center;       /* text center */
}


.showcase-icon {
  flex-shrink: 0;
  width: 300px;
  height: auto;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .how-to-section {
    flex-direction: column;
    align-items: center;
  }

  #contribute-message {
    width: 90%;
  }

  .showcase-icon {
    width: 90%;
    max-width: 300px;
  }

  .how-to-play {
    width: 90%;
    max-width: none;
    text-align: center;
  }
}

#how-to-play h3 {
  color: #eec566;
  margin-bottom: 8px;
  text-align: center;
}

.result-wrapper {
    max-width: 1000px;
    margin: auto;
    padding: 20px;
    font-family: sans-serif;
}

.phenotype-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.result-columns {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    min-height: 500px;
}

.right-column {
    flex: 1;
    min-width: 300px;
}

.full-info {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    text-align: justify;
    font-family: 'Poopins', sans-serif; /* You can change this to another ethnographic-feeling font */
    line-height: 1.6;
    white-space: normal;
      max-width: 100%;
        overflow-wrap: break-word;
        box-sizing: border-box;
}

@media (max-width: 768px) {
  .right-column {
    margin-bottom: 20px;
  }
}

.left-column {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: top;
}

.result-stat {
    background: #c0392b;
    color: #f5f5f5;
    padding: 8px 12px;
    border-radius: 4px;
    width: 85%;
    text-align: center;
    font-size: 12px;
    width: 80%;
    height: 15px;
}

.image-row {
    display: flex;
    justify-content: center;
    gap: 0px;
    margin-top: 0px;
}

.result-image {
    max-height: 120px; /* Each image up to 150px, total 300px to match face container */
    width: auto;
    display: block;
    margin: 0 auto;
}

.map-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 6px;
    margin-top: 10px;
}

.cache-clear-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 2em;
}

.cache-clear-btn {
  padding: 0.5em 1em;
  background-color: black;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.cache-clear-btn:hover {
  background-color: #a93226;
}

.mode-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  background: #000;
  border: 1px solid #eec566;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(238, 197, 102, 0.2);
}

.mode-toggle label {
  color: #eec566;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s ease-in-out;
  background-color: #1a1a1a;
  border: 1px solid transparent;
}

.mode-toggle input[type="radio"] {
  display: none;
}

.mode-toggle input[type="radio"]:checked + span {
  background-color: #000000;
  color: #eec566;
  border: 2px solid #eec566;
  box-shadow: 0 0 10px #eec566, 0 0 20px #eec566 inset;
  animation: pulse-gold 1.2s infinite ease-in-out;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
}

.mode-toggle span {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

/* ==== IQ-MODE STYLING ==== */
#face-front {
  /* no scroll or dragging on the face while guessing IQ */
  overflow: hidden !important;
  touch-action: none !important;
}
/* Disabled “Next” button styling */
#confirm-guess.disabled {
  background-color: #000;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
}

/* When in IQ mode, make any full-info container transparent */
body.iq-mode .full-info {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* IQ block container */
#iq-guess-block {
  position: relative;
  /* for absolute-positioned labels */
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  color: black;
}

/* Slider base track, driven by --percent */
#iq-guess-block input[type="range"] {
  --percent: 50%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right,
      #eec566 0%,
      #eec566 var(--percent),
      #444 var(--percent),
      #444 100%);
  outline: none;
  cursor: ew-resize;
  transition: background 0.1s ease;
  animation: pulse-gold 1.2s infinite ease-in-out;
}

/* Keep the track draggable */
#iq-guess-block input[type="range"]::-webkit-slider-runnable-track,
#iq-guess-block input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 6px;
}

/* Remove any focus outline around the slider itself */
#iq-guess-block input[type="range"]:focus {
  outline: none;
}


/* ─── 1) Prevent any browser accent from drawing a knob ─── */
#iq-guess-block input[type="range"] {
  accent-color: transparent !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* ─── 2) Make every engine’s “track” show your JS-driven background ─── */
/* WebKit */
#iq-guess-block input[type="range"]::-webkit-slider-runnable-track {
  background: inherit !important;
}

/* Firefox */
#iq-guess-block input[type="range"]::-moz-range-track {
  background: inherit !important;
}

/* IE/Edge Legacy */
#iq-guess-block input[type="range"]::-ms-fill-lower,
#iq-guess-block input[type="range"]::-ms-fill-upper {
  background: inherit !important;
}

/* ─── 3) Obliterate every native thumb ─── */
/* Chrome/Safari/Edge Chromium (double- and single-colon) */
#iq-guess-block input[type="range"]::-webkit-slider-thumb,
#iq-guess-block input[type="range"]:-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
  margin: 0 !important;
}

/* Firefox */
#iq-guess-block input[type="range"]::-moz-range-thumb {
  -moz-appearance: none !important;
  appearance: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
  margin: 0 !important;
}

/* IE/Edge Legacy */
#iq-guess-block input[type="range"]::-ms-thumb {
  appearance: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
  margin: 0 !important;
}
/* Also suppress any focus ring color on WebKit */
#iq-guess-block input[type="range"]::-webkit-focus-ring-color {
  display: none;
}

/* Disabled slider styling */
#iq-guess-block input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
    animation: pulse-gold 0s infinite ease-in-out;
}

/* Floating labels for guess and actual IQ */
/* value labels */
.iq-thumb-label,
.iq-actual-label {
  position: absolute;
  top: 3.8em;
  /* or 2.6em for actual */
  left: 50%;
  transform: translateX(-40%);

  /* new: center the two lines */
  text-align: center;
  white-space: nowrap;

  background: rgba(0, 0, 0, 0.7);
  color: #eec566;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
}


/* Position the “your guess” label above the slider */
.iq-thumb-label {
  top: 8.18em;
}

/* Position the “actual IQ” label below the slider, in red—but hide it until JS reveals it */
.iq-actual-label {
  top: 3.31em;
  background: #a93226;
  display: none;
}


/* 1) Make the IQ-result wrapper full width and center its contents */
body.iq-mode #iq-result-area {
  display: flex;
    flex-direction: column;         /* turn it into a flex container */
  width: 100%;              /* span the full parent width */
  justify-content: center;  /* center horizontally */
  align-items: center;      /* center vertically (if it ever grows taller) */
         /* a little breathing room above */
}


/* 2) Force the .result-stat to size to its content and not stretch or vanish */
body.iq-mode #iq-result-area .result-stat {
  display: inline-block !important;  /* shrink-wrap to its text */
  width: auto      !important;       /* override that 80% rule */
  height: auto     !important;       /* let padding define height */
  width: 100%;                            /* remove any unintended offsets */;
}



/* completely disable any pointer interaction (incl. wheel) on the face in IQ‐mode */

body.iq-mode #result-popup {
  overflow-y: hidden;
}



body.game-view, html.game-view {
    height: 100vh;
    overflow: hidden;
}

@media (max-width: 768px) {
  .right-column {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
  }

  #result-popup {
    overflow-y: auto !important;
    max-height: 90vh;
  }

  body.iq-mode #result-popup {
    overflow-y: scroll !important;
  }
}

#result-popup {
  position: relative;
  background-color: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  box-sizing: border-box;
}
#iq-slider {
  height: 100px;
}

/* Default mobile: stack vertically */
@media (max-width: 768px) {
  .result-columns {
    flex-direction: column;
    gap: 0px;
  }
}

/* BUT in IQ mode: stay side-by-side and shrink */
@media (max-width: 768px) {
  body.iq-mode .result-columns {
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 25px;
    transform: scale(0.9);
    transform-origin: top center;
  }

  body.iq-mode .left-column,
  body.iq-mode .right-column {
    flex: 1 1 50%;
    min-width: 0;
    /* allow shrinking */
  }


  body.iq-mode .full-info {
    font-size: 11px;
  }

  body.iq-mode .result-stat {
    font-size: 10px;
    padding: 4px;
  }
    body.iq-mode .result-image {
          max-height: 90px;
        }

  body.iq-mode .phenotype-title {
    font-size: 18px;
  }

  body.iq-mode #iq-slider {
    height: 100px !important;
  }

        body.iq-mode .result-wrapper {
          padding: 0 !important;

          /* still overlap map nicely */
        }

        body.iq-mode .result-columns {
          padding: 0 !important;
          margin: 0 !important;
  }
}