/* base.css - Common styles for all games */
:root {
  --color-primary: #ffffff;
  --color-primary-dark: #ffffff;
  --color-secondary: #2743FF;
  --color-secondary-dark: #2139DB;
  --color-text: #ffffff;
  --color-background: #151515;
  --color-border: #E5E7EB;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Hanken Grotesk', sans-serif;
  background-color: var(--color-background);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header Styles */
header {
  background-color: var(--color-background);
  z-index: 10;
  display: flex;
  top: 0;
  position: static;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 2vh 4vw;
  box-sizing: border-box;
}

#game-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#game-content header {
  background-color: var(--color-background);
  z-index: 10;
  display: flex;
  top: 0;
  position: static;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 2vh 4vw;
  box-sizing: border-box;
}

.logo img {
  height: 4vh;
  cursor: pointer;
}

.close-game-button {
  padding: 0.5rem 1.25rem;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  background: transparent;
  font-size: 1rem;
  font-weight: 400;
  font-family: 'Hanken Grotesk', sans-serif;
  line-height: 1.5;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.close-game-button:hover {
  background-color: #464646;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 2rem auto;
  border: 3px solid var(--color-secondary);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Common Game Title Styles */
.game-title {
  position: relative;
  text-align: center;
  margin-top: 2rem;
}

.game-title h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(3.5vh, 6vw, 3rem);
  color: var(--color-text);
  font-weight: bold;
  margin-bottom: 1rem;
}

/* Common Main Layout */
main {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

/* Common Popup Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 11;
}

.popup {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: #151515;
  border-radius: 1.25rem;
  padding: 2rem;
  text-align: center;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 12;
}

.popup h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: bold;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: white;
}

.popup p {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1rem;
  color: white;
  margin-bottom: 1rem;
}

.popup .confirm-exit {
  flex: 1;
  background: var(--color-secondary);
  color: white;
  border: 1px solid var(--color-secondary);
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 400;
  font-family: 'Hanken Grotesk', sans-serif;
  line-height: 1.5;
  border-radius: 0.5rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}  

.popup .confirm-exit:hover {
  background-color: var(--color-secondary-dark);
}

.popup .cancel-exit {
  flex: 1;
  padding: 0.5rem 1.25rem;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  background: transparent;
  font-size: 1rem;
  font-weight: 400;
  font-family: 'Hanken Grotesk', sans-serif;
  line-height: 1.5;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.popup .cancel-exit:hover {
  background-color: rgba(39, 67, 255, 0.05);
}

/* Common Button Styles */
.next-question {
  background-color: black;
  color: white;
  border: 1px solid black;
  border-radius: 0.5rem;
  padding: 0.8rem 1.25rem;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  position: absolute;
  bottom: 2rem;
  margin-top: 2vh;
  transition: background-color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .next-question:hover {
    background-color: #464646;
  }
  .end-trial:hover {
    background-color: #fd6f6f;
  }
}

/* Start Popup Overlay */
.start-popup-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.5s ease forwards;
}

/* Start Popup Container */
.start-popup {
  background-color: #1d1d1d;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
  width: 90%;
  max-width: 600px;
  animation: popupFadeIn 0.5s ease forwards;
}

.start-popup h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.5rem;
  color: white;
  margin-bottom: 1rem;
}

.start-popup p.intro-text {
  margin-bottom: 2rem;
  color: white;
  font-size: 1rem;
  line-height: 1.5;
}

.player-input-section {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.player-input-section input {
  flex: 1;
  padding: 0.8rem;
  background: #151515;
  color: white;
  border: 1px solid white;
  border-radius: 0.8rem;
}

.player-input-section button {
  background: var(--color-secondary);
  border: none;
  color: white;
  font-size: 1.5rem;
  padding: 0 1rem;
  border-radius: 0.8rem;
  cursor: pointer;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.player-chip {
  background: var(--color-secondary);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remove-chip {
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.players-count {
  color: white;
  margin-bottom: 1.5rem;
}

.rules-button, .start-button {
  width: 100%;
  padding: 1rem;
  border-radius: 0.8rem;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  margin-top: 1rem;
  cursor: pointer;
}

.rules-button {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.start-button {
  background: var(--color-secondary);
  color: white;
  border: none;
}

/* Animations for Start Popup */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popupFadeIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Start Screen Styles */
#start-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

#start-overlay.fade-out {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.welcome-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 2.5rem;
  color: white;
  margin-bottom: 1rem;
}

.intro-text {
  margin-bottom: 2rem;
  color: white;
  font-size: 1rem;
  line-height: 1.5;
}

.player-input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 400px;
}

.player-input-wrapper input {
  flex: 1;
  padding: 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid white;
  background: #151515;
  color: white;
  font-size: 1rem;
}

.player-input-wrapper button {
  padding: 0.8rem;
  background: var(--color-secondary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1.5rem;
  cursor: pointer;
}

#player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin-bottom: 1rem;
}

#player-count {
  color: white;
  margin-bottom: 1.5rem;
}

#start-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
}

.start-rules, .start-game {
  width: 100%;
  padding: 1rem;
  border-radius: 0.8rem;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  margin-top: 0.5rem;
  cursor: pointer;
}

.start-rules {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.start-rules:hover {
  background: rgba(255,255,255,0.1);
}

.start-game {
  background: var(--color-secondary);
  color: white;
  border: none;
}

.start-game:hover {
  background: var(--color-secondary-dark);
}

.start-game:disabled {
  background: grey;
  cursor: not-allowed;
}

/* Rules Screen Styles */
#rules-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rules-popup {
  background-color: #1f1f1f;
  border-radius: 1.25rem;
  width: 90%;
  max-width: 600px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  max-height: 90vh;
  overflow: hidden;
}

/* Rules popup header */
.rules-popup h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 2.5rem;
  color: white;
  margin-bottom: 1.5rem;
  text-align: center;
  width: 100%;
}

/* Rules content paragraphs */
.rules-content p {
  margin-bottom: 1rem;
  line-height: 1.5;
  text-align: left;
  color: white;
}

/* Rules content section headers */
.rules-content h3 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: bold;
  font-size: 1.3rem;
  color: white;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  text-align: left;
}

/* Ensure proper scrolling and spacing */
.rules-content {
  padding: 0 1rem 1rem 0;
  overflow-y: auto;
  max-height: 60vh;
  width: 100%;
  text-align: left;
}

.rules-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
  margin-top: 1rem;
}

.back-to-start {
  background: transparent;
  color: white;
  border: 2px solid white;
  width: 100%;
  padding: 1rem;
  border-radius: 0.8rem;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  margin-top: 0.5rem;
  cursor: pointer;
}

.back-to-start:hover {
  background: rgba(255,255,255,0.1);
}

/* Make sure start game button has the right color */
.rules-popup .start-game {
  background: var(--color-secondary, #2743FF);
  color: white;
  width: 100%;
  padding: 1rem;
  border-radius: 0.8rem;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  cursor: pointer;
  margin-top: 0.5rem;
}

.rules-popup .start-game:hover {
  background: var(--color-secondary-dark, #2139DB);
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
  .start-popup, .rules-popup {
    width: 95%;
    padding: 1.5rem;
  }
}

/* Trial game styles */
.trial-badge {
  background-color: #FFE1C3;
  color: #2743FF;
  padding: 0.3rem 0.8rem;
  border-radius: 0.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.trial-banner {
  display: flex;
  height: 3.2rem;
  width: 100%; 
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #2743FF;
  color: white;
  padding: 0.3rem 1rem;
  font-weight: bold;
  font-size: 1rem;
}

.end-trial {
  background-color: #FF4E50;
  border: 1px solid #FF4E50;
}

.trial-end-popup {
  max-width: 430px;
}

.trial-end-popup .confirm-exit {
  background-color: #2743FF;
  margin-bottom: 0.5rem;
}
