:root {
  /* Light Mode (Default) */
  --bg-color: #f4f7f6;
  --text-color: #333;
  --text-secondary-color: #555;
  --heading-color: #0a323c;
  --card-bg-color: #ffffff;
  --choice-bg-color: #f9f9f9;
  --button-bg-color: #0077cc;
  --button-text-color: white;
  --button-hover-bg-color: #005fa3;
  --button-restart-bg-color: #c8aa6e;
  --button-restart-text-color: #0a323c;
  --button-restart-hover-bg-color: #b39556;
  --button-disabled-bg-color: #aaa;
  --shadow-color-light: rgba(0, 0, 0, 0.1);
  --shadow-color-medium: rgba(0, 0, 0, 0.15);
  --shadow-color-dark: rgba(0, 0, 0, 0.2);
  --overlay-bg-color: rgba(0, 0, 0, 0.75);
  --stat-value-color: #555;
  --feedback-low-color: #cc0000; /* Default red for low win rate */
  --feedback-high-color: #0077cc; /* Default blue for high win rate */
  --feedback-bad-color: red; /* Red for high deaths/pings */
  --fun-fact-bg-color: #2c2c2c;
  --fun-fact-text-color: #e0e0e0;
  --fun-fact-border-color: #444;
  --timer-color: var(--text-secondary-color); /* Use secondary text color */
  --fun-fact-link-color: var(--button-bg-color); /* Link color for light mode */
  --tooltip-bg-color: #333; /* Dark background for tooltip */
  --tooltip-text-color: #fff; /* White text for tooltip */
}

body.dark-mode {
  /* Dark Mode Overrides */
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --text-secondary-color: #a0a0a0;
  --heading-color: #66b2ff;
  --card-bg-color: #2c2c2c;
  --choice-bg-color: #333333;
  --button-bg-color: #0077cc;
  --button-text-color: white;
  --button-hover-bg-color: #005fa3;
  --button-restart-bg-color: #c8aa6e;
  --button-restart-text-color: #1a1a1a;
  --button-restart-hover-bg-color: #b39556;
  --button-disabled-bg-color: #555;
  --shadow-color-light: rgba(255, 255, 255, 0.05);
  --shadow-color-medium: rgba(255, 255, 255, 0.1);
  --shadow-color-dark: rgba(255, 255, 255, 0.15);
  --overlay-bg-color: rgba(0, 0, 0, 0.85);
  --stat-value-color: #a0a0a0;
  --feedback-low-color: #ff6666; /* Lighter red */
  --feedback-high-color: #66b2ff; /* Lighter blue */
  --feedback-bad-color: #ff6666; /* Lighter red */
  --fun-fact-bg-color: #2c2c2c;
  --fun-fact-text-color: #e0e0e0;
  --fun-fact-border-color: #444;
  --timer-color: var(--text-secondary-color); /* Use secondary text color */
  --fun-fact-link-color: #80bfff; /* Lighter blue for dark mode link */
  --tooltip-bg-color: #222; /* Slightly different dark for dark mode tooltip */
  --tooltip-text-color: #eee; /* Off-white text for dark mode tooltip */
}

body {
  font-family: "Poppins", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  text-align: center;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.screen,
.overlay-content {
  background-color: var(--card-bg-color);
  padding: 30px 40px;
  margin-top: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow-color-light);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out,
    background-color 0.3s ease;
  opacity: 1;
  transform: scale(1);
}

.screen.hidden,
.overlay.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
}

.overlay.hidden {
  display: none;
}

#initial-screen h1,
#game-over-screen h1 {
  color: var(--heading-color);
  margin-bottom: 10px;
}
#initial-screen p,
#game-over-screen p {
  margin-bottom: 25px;
  color: var(--text-secondary-color);
}

#game-screen h2 {
  margin-bottom: 20px;
  color: var(--heading-color);
}

.choices {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 20px;
  margin-bottom: 20px;
  gap: 0;
}

.choice {
  border: none;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease-out, background-color 0.3s ease;
  min-width: 150px;
  max-width: 308px;
  background-color: var(--choice-bg-color);
  box-shadow: 0 1px 3px var(--shadow-color-light);
  overflow: hidden;
}

#choice-left {
  margin-right: -2px;
}

#choice-right {
  margin-left: -2px;
}

.choice h3 {
  font-weight: 600;
  margin: 10px 10px 5px 10px;
  font-size: 1.1em;
  min-height: 2.4em;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--text-color); /* Ensure h3 text color updates */
}

/* Styles for the statistic value span */
.stat-value {
  font-size: 0.8em; /* Make it smaller than the champion name */
  color: var(--stat-value-color);
  font-weight: 400; /* Use normal weight (Poppins 400) */
  margin-left: 8px; /* Space it from the name */
  font-family: "Poppins", sans-serif; /* Keep Poppins for consistency, just lighter */
  /* Optional: Slightly different font if preferred */
  /* font-family: 'Open Sans', sans-serif; */
}

.choice:hover {
  transform: scale(1.03) translateY(-3px);
  box-shadow: 0 4px 8px var(--shadow-color-medium);
}

/* .win-rate { */
/* Remove this old rule or keep for backward compatibility if needed */
/* font-size: 0.7em; */
/* color: #555; */
/* font-weight: normal; */
/* margin-left: 8px; */
/* This rule is now superseded by .stat-value */
/* } */

.blurred {
  filter: blur(4px);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: default;
}

.champion-image {
  display: block;
  margin: 0;
  max-width: 100%;
  height: auto;
  border-radius: 0 0 4px 4px;
}

.image-container {
  position: relative;
  margin: 0;
  max-width: 100%;
  line-height: 0;
  font-size: 0;
  overflow: hidden;
}

.vs {
  font-size: 2em;
  font-weight: bold;
  display: none;
}

button {
  padding: 12px 25px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  border: none;
  border-radius: 6px;
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
  transition: background-color 0.2s ease-out, transform 0.1s ease-out;
  box-shadow: 0 2px 4px var(--shadow-color-light);
}

button:hover {
  background-color: var(--button-hover-bg-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color-medium);
}

button:active {
  transform: translateY(0px);
  box-shadow: 0 1px 2px var(--shadow-color-light);
}

button:disabled {
  background-color: var(--button-disabled-bg-color);
  color: var(--text-secondary-color); /* Ensure disabled text is visible */
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#restart-button {
  background-color: var(--button-restart-bg-color);
  color: var(--button-restart-text-color);
}
#restart-button:hover {
  background-color: var(--button-restart-hover-bg-color);
}

.score {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--text-secondary-color);
  position: absolute;
  top: 20px;
  right: 30px;
}

#feedback {
  margin-top: 15px;
  font-weight: bold;
  min-height: 1.2em;
  /* Feedback text color is set dynamically in JS */
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, visibility 0s linear 0.4s,
    background-color 0.3s ease;
}
.overlay:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease-out, visibility 0s linear 0s,
    background-color 0.3s ease;
}

/* Define the slide-in animation */
@keyframes slideInBounce {
  0% {
    transform: translateY(100vh);
    opacity: 0;
  }
  60% {
    transform: translateY(-15px); /* Overshoot past center */
    opacity: 1;
  }
  80% {
    transform: translateY(5px); /* Bounce back slightly */
  }
  100% {
    transform: translateY(0); /* Settle in center */
    opacity: 1;
  }
}

.overlay-content {
  background-color: var(--card-bg-color);
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 5px 15px var(--shadow-color-dark);
  text-align: center;
  /* Remove initial transform/opacity from base state */
  /* opacity: 0; */
  /* transform: translateY(100vh); */
  /* transition property removed previously */
}

.overlay:not(.hidden) .overlay-content {
  /* Apply the animation when the overlay becomes visible */
  animation: slideInBounce 0.7s ease-out forwards;
  /* Remove the direct transform/opacity setting and transition */
  /* opacity: 1; */
  /* transform: translateY(0); */
  /* transition: opacity 0.6s ease-out, 
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); */
}

.feedback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  opacity: 0;
  border-radius: 0 0 4px 4px;
  transition: opacity 0.15s ease-in-out, background-color 0.15s ease-in-out,
    transform 0.15s ease-in-out;
  pointer-events: none;
  transform: scale(1);
}

.feedback-overlay.show {
  opacity: 1;
  transform: scale(1.05);
}

.feedback-overlay.show.correct {
  background: linear-gradient(
    to top,
    rgba(46, 204, 113, 0.7),
    rgba(46, 204, 113, 0.4)
  );
}

.feedback-overlay.show.incorrect {
  background: linear-gradient(
    to top,
    rgba(231, 76, 60, 0.7),
    rgba(231, 76, 60, 0.4)
  );
}

/* Use CSS variables for feedback text colors */
.low-winrate-feedback {
  /* color: var(--feedback-low-color); /* Use variable, but JS overrides with red currently */
  font-size: 0.8em;
  font-weight: bold;
  margin-left: 8px;
  font-family: "Comic Neue", cursive;
}

.high-winrate-feedback {
  /* color: var(--feedback-high-color); /* Use variable, but JS overrides */
  font-size: 0.8em;
  font-weight: bold;
  margin-left: 8px;
  font-family: "Comic Neue", cursive;
}

/* Styling for the dark mode toggle */
#theme-toggle {
  position: absolute;
  top: 20px;
  left: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary-color);
  padding: 5px;
  line-height: 1;
}

body:not(.dark-mode) #theme-toggle::after {
  content: "☀️"; /* Sun icon for light mode */
}

body.dark-mode #theme-toggle::after {
  content: "🌙"; /* Moon icon for dark mode */
}

/* Style for low win rate feedback */
.low-winrate-feedback {
  font-family: "Comic Neue", cursive; /* Apply funny font */
  font-size: 0.8em; /* Slightly larger than win rate */
  color: #e74c3c; /* Use the 'incorrect' red color */
  margin-left: 10px; /* Space it out */
  font-weight: 700; /* Make it bold */
}

/* Style for high win rate feedback */
.high-winrate-feedback {
  font-family: "Poppins", sans-serif; /* Use main font or keep Comic Neue? */
  font-size: 0.8em;
  color: #2ecc71; /* Use the 'correct' green color */
  margin-left: 10px;
  font-weight: 600; /* Slightly less bold than low WR? */
}

/* Fun Fact Styling */
.fun-fact {
  position: fixed;
  background-color: var(--fun-fact-bg-color, rgba(40, 40, 40, 0.85));
  color: var(--fun-fact-text-color, #eee);
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  max-width: 250px;
  font-size: 0.9rem;
  line-height: 1.4;
  z-index: 100;

  /* --- Reverted Animation --- */
  opacity: 0; /* Start hidden */
  transition: opacity 0.4s ease-in-out; /* Revert to only opacity transition */
}

.fun-fact.show {
  opacity: 1; /* Fade in */
}

/* Separate positioning for left and right */
#fun-fact-left {
  left: 30px; /* Position from left */
  /* top is set by JS */
}

#fun-fact-right {
  right: 30px; /* Position from right */
  /* top is set by JS */
}

.fun-fact-img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle; /* Align image nicely with text */
  border-radius: 4px; /* Optional rounded corners */
}

/* Styling for the links within fun facts */
.fun-fact-link {
  color: var(--fun-fact-link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.fun-fact-link:hover {
  filter: brightness(1.15);
}

/* Custom CSS Tooltip for Links with data-tooltip */
.fun-fact-link[data-tooltip] {
  position: relative;
}

/* Tooltip Box */
.fun-fact-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  background-color: var(--tooltip-bg-color, #333);
  color: var(--tooltip-text-color, #fff);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: nowrap;
  z-index: 10;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out, visibility 0s linear 0.15s;
}

/* Tooltip Arrow */
.fun-fact-link[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0px);
  border-width: 5px;
  border-style: solid;
  border-color: var(--tooltip-bg-color, #333) transparent transparent
    transparent;
  z-index: 11;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out, visibility 0s linear 0.15s;
}

/* Show Tooltip on Link Hover */
.fun-fact-link[data-tooltip]:hover::after,
.fun-fact-link[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease-in-out;
}

/* Game Timer Styling */
.game-timer {
  position: absolute;
  top: 20px; /* Align with score or adjust */
  right: 15px; /* Position closer to the right edge */
  font-family: "Courier New", Courier, monospace; /* Monospaced font */
  font-size: 1.4em; /* Larger font size */
  font-weight: bold;
  color: var(--timer-color);
  background-color: rgba(0, 0, 0, 0.05); /* Optional subtle background */
  padding: 5px 10px;
  border-radius: 4px;
}

body.dark-mode .game-timer {
  background-color: rgba(
    255,
    255,
    255,
    0.08
  ); /* Different subtle bg for dark */
}

/* Keyframes for image sliding */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Animation classes */
.slide-in-left {
  animation: slideInLeft 0.4s ease-out forwards;
}

.slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

/* Style for low win rate feedback */
.low-winrate-feedback {
  font-family: "Comic Neue", cursive; /* Apply funny font */
  font-size: 0.8em; /* Slightly larger than win rate */
  color: #e74c3c; /* Use the 'incorrect' red color */
  margin-left: 10px; /* Space it out */
  font-weight: 700; /* Make it bold */
}

/* Keyframes for sliding OVER */
@keyframes slideOverLeft {
  from {
    transform: translateX(-50%); /* Start halfway across */
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOverRight {
  from {
    transform: translateX(50%); /* Start halfway across */
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Animation classes */
.slide-over-left {
  animation: slideOverLeft 0.4s ease-out forwards;
}

.slide-over-right {
  animation: slideOverRight 0.4s ease-out forwards;
}

/* Style for low win rate feedback */
.low-winrate-feedback {
  font-family: "Comic Neue", cursive; /* Apply funny font */
  font-size: 0.8em; /* Slightly larger than win rate */
  color: #e74c3c; /* Use the 'incorrect' red color */
  margin-left: 10px; /* Space it out */
  font-weight: 700; /* Make it bold */
}

/* Styling for the timer SVG container */
.fun-fact-timer-svg {
  position: absolute;
  bottom: 4px; /* Position in bottom right */
  right: 4px;
  width: 20px; /* Fixed size (TIMER_RADIUS * 2 + padding) */
  height: 20px;
  transform: rotate(-90deg); /* Start animation from the top */
  transform-origin: center;
  pointer-events: none; /* Don't interfere with hover on fact */
}

/* Styling for the timer circle */
.fun-fact-timer-circle {
  fill: none;
  stroke: var(
    --fun-fact-link-color,
    #80bfff
  ); /* Use link color or another theme color */
  stroke-width: 2; /* Adjust thickness */
  /* stroke-dasharray and stroke-dashoffset are set by JS */
  transition: stroke-dashoffset 0.1s linear; /* Smooth updates slightly */
}

/* Style for the disclaimer text */
.disclaimer {
  position: fixed; /* Keep it visible */
  bottom: 10px; /* Position at bottom-left */
  left: 10px;
  background-color: #ffcc00; /* Bright yellow background */
  color: #333; /* Dark text */
  padding: 8px 12px;
  border: 1px solid #cc9900; /* Darker border */
  border-radius: 4px;
  font-size: 0.9em; /* Keep it readable but not huge */
  font-weight: bold;
  z-index: 2000; /* Ensure it's above everything */
  max-width: 300px; /* Prevent it from being too wide */
  text-align: left; /* Align text left within the box */
  line-height: 1.3;
}

/* Utility class for simple hiding */
.hidden-display {
  display: none !important;
}
