body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #e15656;
  color: #000;
  margin: 0px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

#p5_loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #e15656;
  color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  z-index: 9999;
}

#start,
#game,
#leaderboard,
#countdown {
  position: fixed;
  inset: 0;
  padding: 20px;
  box-sizing: border-box;
  display: none;
}

#start,
#countdown {
  text-align: center;
  background: #e15656;
}

#game,
#leaderboard {
  background: #ffffff;
}

h1 {
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  margin: 0;
}

.subtitle {
  font-size: 1.5rem;
  margin: 1rem auto 3rem;
  max-width: 300px;
  text-align: center;
  padding: 0 1rem;
}

/* Progress Indicator Styles */
#progressIndicator {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 1;
}

.turns-remaining {
  font-size: 1rem;
  color: #666;
  margin-right: 10px;
}

/* Default mobile-friendly layout for all screens */
#progressIndicator {
  gap: 6px;
  bottom: 7.5rem;
  padding: 0 10px;
}

.progress-dot {
  width: 10px;
  height: 10px;
}

.turns-remaining {
  font-size: 0.9rem;
  margin-right: 8px;
}

.progress-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #5a594e;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
}

.progress-dot.completed {
  background-color: #5a594e;
  border-color: #5a594e;
}

.progress-dot.current {
  background-color: #e15656;
  border-color: #e15656;
}

.progress-dot.upcoming {
  background-color: #fff;
  border-color: #5a594e;
}

.button-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 300px;
  margin: 0 auto;
}

#versusButton {
  background-color: transparent;
  color: #000;
  border: 1px solid currentColor;
  padding: 0.6rem 2rem;
  transition: all 0.2s ease;
  opacity: 1;
  display: none;
}

#versusButton:hover {
  transform: translateY(-1px);
}

#versusButton span {
  display: block;
  font-size: 12px;
  color: #000;
}

#versusButton.active {
  color: #000;
}

#versusButton.active:hover {
  background-color: #000;
  color: white;
}

#versusButton.active span {
  color: inherit;
}

button {
  background-color: #000;
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

button.secondary {
  background-color: transparent;
  border: 2px solid #000;
  color: #000;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#optionsCont button {
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 1.3rem;
  color: #000;
}

#optionsCont button.disabled {
  background-color: #e15656;
  border-color: #e15656;
  cursor: not-allowed;
  color: white;
}

#optionsCont button.disabled:hover {
  background-color: #e15656;
  transform: none;
}

/* Versus Lobby Screen Styles */
.player-list {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 1rem;
  margin: 2rem auto;
  max-width: 400px;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
}

.player-item {
  padding: 0.8rem;
  margin-bottom: 0.5rem;
  background: #fff;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.player-item.host {
  background: #000;
  color: #fff;
}

.waiting-message {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 2rem 0;
}

.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
}

.theme-container {
  background: #ffffff;
  border: 1px solid #ddd;
  max-width: 600px;
  text-align: center;
  border-radius: 8px;
  margin: 60px auto 2rem;
  overflow: hidden;
}

.theme-label-container {
  background: #b2ebf2;
  width: 100%;
  padding: 4px 0;
  margin: 0;
}

.theme-text {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 8px 0;
  padding: 0 8px;
}

.instruction-text {
  color: #666;
  font-size: 1rem;
  margin: 3.5rem auto 0.5rem;
  text-align: center;
  max-width: 600px;
}

#headline,
#leaderboard {
  background-color: #ffffff;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin: 0 auto 1.5rem;
  max-width: 600px;
  font-size: 1.3rem;
  text-align: center;
}

#headline {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  padding: 1rem;
  line-height: 1.3;
  transition: opacity 0.3s ease;
}

.headline-text {
  width: 100%;
}

#optionsCont {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

#optionsCont button {
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 1.3rem;
  color: #000;
}

#optionsCont button.disabled {
  background-color: #e15656;
  border-color: #e15656;
  cursor: not-allowed;
  color: white;
}

#optionsCont button.disabled:hover {
  background-color: #e15656;
  transform: none;
}

#next {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: transparent;
  color: #999;
  border: 1px solid currentColor;
  width: auto;
  padding: 0.6rem 2rem;
  transition: all 0.2s ease;
  display: none;
}

#next.active {
  color: #000;
}

#next:hover {
  transform: translateX(-50%) translateY(-1px);
}

#next.active:hover {
  background-color: #000;
  color: white;
}

#scores {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 400px;
  margin: 0 auto;
  padding: 0;
}

#scores > div:not(.score-row) {
  padding: 1rem;
  border-radius: 8px;
  background: #f8f8f8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#scores span {
  font-weight: bold;
  color: #e15656;
}

.profile-icon {
  width: 150px;
  height: 150px;
  object-fit: cover;
  margin: 15vh 0 0;
}

.date {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.2rem;
}

/* Mobile-specific adjustments (applied by default, overridden by desktop when sufficient size) */
#start,
#game,
#end,
#countdown,
#results {
  padding: 10px;
}

.theme-container {
  margin: 40px auto 1.5rem;
  font-size: 0.9rem;
}

.theme-text {
  font-size: 1.1rem;
}

.instruction-text {
  font-size: 0.9rem;
  margin: 2rem auto 0.5rem;
}

#optionsCont {
  gap: 8px;
  margin: 1rem auto 0;
  padding: 0 0.5rem;
}

#optionsCont button {
  font-size: 1.1rem;
  padding: 0.5rem;
  min-height: 44px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

#next {
  width: 80%;
  bottom: 1.5rem;
  min-height: 44px;
}

.score-display {
  font-size: 2rem;
}

.headline-text-result {
  font-size: 1rem;
}

.headline-result-item {
  padding: 10px;
}

.headline-result-item .headline-controls {
  margin-bottom: 8px;
}

#headline {
  min-height: 70px;
  font-size: 1.1rem;
  padding: 0.8rem;
  margin: 0 auto 1rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#timer {
  font-size: 2.5rem;
  top: 8px;
}

#game {
  padding-bottom: 12rem;
}

.headline-text {
  line-height: 1.4;
}

#timer {
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  margin: 0.5rem 0;
  color: #000;
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  z-index: 10;
}

#timer.warning {
  color: #e15656;
}

#game {
  padding-top: 10px;
  position: fixed;
  inset: 0;
  padding: 20px;
  box-sizing: border-box;
  display: none;
  background: #ffffff;
}

.how-to {
  position: absolute;
  top: 20px;
  right: 20px;
  cursor: pointer;
  z-index: 10;
}

.how-to img {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.how-to img:hover {
  transform: scale(1.1);
}

/* Modal styles */
.modal {
  position: fixed;
  bottom: -90vh;
  left: 0;
  width: 100%;
  height: 80vh;
  background-color: transparent;
  border-radius: 20px 20px 0 0;
  /* box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1); */
  transition: transform 0.3s ease-in-out;
  z-index: 100;
  overflow-y: auto;
  display: none;
}

.modal.show {
  transform: translateY(-90vh);
  display: block;
}

.modal-content {
  background-color: #fff;
  padding: 40px;
  border-radius: 12px;
  position: relative;
  max-width: 600px;
  width: 90%;
  margin: 20px auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h1 {
  font-size: 32px;
  margin-bottom: 24px;
  color: #333;
  text-align: center;
}

.how-to-content {
  font-size: 16px;
  line-height: 1.6;
  color: #444;
}

.how-to-content p {
  margin-bottom: 20px;
}

.contact-info {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.contact-info p {
  font-size: 14px;
  color: #666;
}

.contact-info a {
  color: #e15656;
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact-info a:hover {
  color: #c13e3e;
  text-decoration: underline;
}

.back-arrow {
  position: absolute;
  top: 30px;
  left: 30px;
  cursor: pointer;
}

.back-arrow img {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.back-arrow img:hover {
  transform: scale(1.1);
}

#results {
  display: none;
  position: fixed;
  inset: 0;
  background-color: white;
  color: black;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.score-display {
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  color: #000;
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  margin: 0;
  z-index: 2;
  background: white;
  padding: 10px 0;
}

.score-subtitle {
  color: #666;
  font-size: 1rem;
  text-align: center;
  margin: 0;
  font-weight: normal;
}

#headlines-results-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 100px 0 0;
  height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 0 20px 20px;
  border-bottom: 1px solid #eee;
}

.headline-result-item {
  background-color: #ffffff;
  border-radius: 16px;
  border: 1px solid #ddd;
  padding: 15px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
}

.headline-text-result {
  font-size: 1.2rem;
  line-height: 1.4;
}

.headline-result-item .check-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.headline-result-item .check-mark.correct {
  background-color: #43a047;
  color: white;
}

.headline-result-item .check-mark.incorrect {
  background-color: #cccccc;
  color: white;
}

.headline-result-item .read-button {
  background-color: transparent !important;
  color: #000 !important;
  border: 1px solid currentColor !important;
  border-radius: 100px !important;
  padding: 8px 20px !important;
  font-size: 0.8rem !important;
  font-weight: normal !important;
  display: flex !important;
  align-items: center !important;
  text-transform: capitalize !important;
  white-space: nowrap !important;
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.2s ease;
}

.headline-result-item .read-button:hover {
  background-color: #000 !important;
  color: white !important;
  transform: translateY(-1px);
}

.headline-result-item .read-button::after {
  content: "" !important;
}

.headline-text-result .answer {
  background-color: #ffcdd2;
  padding: 2px 5px;
  border-radius: 3px;
}

.headline-result-item .check-mark.correct ~ .headline-text-result .answer {
  background-color: #c8e6c9;
}

.headline-text-result .wrong-answer {
  color: #d32f2f;
  text-decoration: line-through;
  padding: 2px 5px;
}

#resultsActionsCont {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: white;
  z-index: 2;
  border-top: 1px solid #eee;
}

#resultsActionsCont button {
  width: auto;
  background-color: transparent;
  color: #000;
  border: 1px solid currentColor;
  padding: 0.6rem 2rem;
  margin: 0 10px;
  font-size: 1.2rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  z-index: 10;
}

#resultsActionsCont button:hover {
  background-color: #000;
  color: white;
  transform: translateY(-1px);
}

#numPlayersCont {
  padding-top: 15px;
}

/* Instructions Screen Styles */
#instructions {
  position: fixed;
  inset: 0;
  padding: 20px;
  box-sizing: border-box;
  display: none;
  background: #e15656;
  text-align: center;
}

.instructions-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
}

.instructions-text {
  font-size: 1.2rem;
  color: #000;
  margin: 1rem auto;
  line-height: 1.4;
  max-width: 500px;
}

.video-container {
  margin: 1rem auto;
  max-width: 300px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.preview-video {
  width: 100%;
  height: auto;
  display: block;
}

.next-button {
  background-color: #000;
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.2rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  margin-top: 1rem;
}

.next-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Countdown Screen Styles */
#countdown {
  display: none;
}

body.countdown-active #countdown {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ready-text {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 2rem;
}

.countdown-number {
  font-size: 10rem;
  font-weight: bold;
  line-height: 1;
}

#end {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  box-sizing: border-box;
  display: none;
  min-height: 100vh;
  overflow-y: auto;
}

.end-content {
  padding-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: calc(100vh - 40px);
}

#leaderboard {
  padding: 20px 20px 80px 20px; /* Add bottom padding for BMC button */
  text-align: center;
  width: 100%;
  background: #e15656;
  color: #000;
  border: none;
  position: fixed;
  inset: 0;
  display: none;
  overflow-y: auto;
  max-height: 100vh;
}

#leaderboard .profile-icon {
  width: 100px;
  height: 100px;
  object-fit: cover;
  margin: 0.5vh auto 0;
}

#leaderboard h1 {
  font-size: 3rem;
  font-weight: bold;
  margin: 0;
  line-height: 1;
}

#leaderboard .date {
  font-size: 1.2rem;
  margin: 0.1rem 0 1.5rem;
  position: static;
}

.daily-leaderboard {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  color: #000;
}

#user-score-message {
  color: #000;
  font-size: 1rem;
  text-align: center;
  margin: 0 auto 1rem;
  max-width: 600px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  margin-bottom: 2px;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
}

.score-label {
  font-size: 1rem;
  font-weight: bold;
  width: 25px;
  text-align: right;
  color: #000;
}

.score-bar {
  flex-grow: 1;
  height: 12px;
  background: transparent;
  position: relative;
}

.score-bar-fill {
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: #000;
  font-weight: bold;
  font-size: 0.7rem;
  transition: width 0.3s ease;
  width: 0;
  border-radius: 0;
}

.score-value {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #e15656;
  font-weight: bold;
}

.daily-leaderboard-container {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  margin: 20px auto 100px auto; /* Add bottom margin for BMC button */
  max-width: 400px;
}

/* Buy Me a Coffee Button Styles */
.bmc-button-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(225, 86, 86, 0.9);
  padding: 10px;
  border-radius: 8px;
  backdrop-filter: blur(5px);
}

/* Responsive adjustments for mobile */
@media (max-width: 600px) {
  .bmc-button-container {
    bottom: 15px;
    padding: 6px;
    width: auto;
    min-width: 140px;
  }

  /* Target the actual Buy Me a Coffee button */
  .bmc-button-container iframe {
    max-width: 100%;
    width: auto !important;
    min-width: 120px !important;
  }

  #leaderboard {
    padding: 10px 10px 70px 10px; /* Adjust padding for mobile */
  }

  .daily-leaderboard-container {
    margin-bottom: 80px;
  }
}

/* Extra small screens - make button even smaller */
@media (max-width: 480px) {
  .bmc-button-container {
    bottom: 12px;
    padding: 4px;
    min-width: 120px;
  }

  .bmc-button-container iframe {
    max-width: 100%;
    width: auto !important;
    min-width: 100px !important;
  }
}

.share-button {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: #000;
  color: white;
  border: none;
  width: auto;
  padding: 0.6rem 2rem;
  transition: all 0.2s ease;
  font-size: 1.2rem;
  border-radius: 100px;
  cursor: pointer;
}

.share-button:hover {
  opacity: 0.9;
  transform: translateX(-50%) translateY(-1px);
}

.share-button:active {
  opacity: 0.9;
}

/* Override any border styles when button is green */
.share-button[style*="background-color: #4CAF50"],
.share-button[style*="background-color: rgb(76, 175, 80)"] {
  background-color: #4caf50 !important;
  color: white !important;
}

.feedback-button {
  position: absolute;
  top: 30px;
  right: 30px;
  background-color: transparent !important;
  color: #000 !important;
  border: none !important;
  padding: 8px 16px !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  text-decoration: underline !important;
  cursor: pointer;
  transition: color 0.2s ease;
}

.feedback-button:hover {
  color: #666 !important;
  transform: none !important;
}

/* Desktop layout - only when there's sufficient width AND height */
@media (min-width: 800px) and (min-height: 900px) {
  #start,
  #game,
  #end,
  #countdown,
  #results {
    padding: 20px;
  }

  #progressIndicator {
    gap: 10px;
    bottom: 8rem;
    padding: 0 20px;
  }

  .progress-dot {
    width: 16px;
    height: 16px;
  }

  .turns-remaining {
    font-size: 1rem;
    margin-right: 10px;
  }

  .theme-container {
    margin: 60px auto 2rem;
    font-size: inherit;
  }

  .theme-text {
    font-size: 1.3rem;
  }

  .instruction-text {
    font-size: 1rem;
    margin: 3.5rem auto 0.5rem;
  }

  #optionsCont {
    margin: 1.5rem auto 0;
    gap: 12px;
    padding: 0 1rem;
  }

  #optionsCont button {
    font-size: 1.3rem;
    padding: 0.6rem;
    min-height: auto;
    white-space: initial;
  }

  #headline {
    min-height: 90px;
    font-size: 1.3rem;
    padding: 1rem;
    margin: 0 auto 1.5rem;
  }

  #timer {
    font-size: 3rem;
    top: 10px;
  }

  #next {
    width: auto;
    bottom: 2rem;
    min-height: auto;
  }

  #game {
    padding-bottom: 20px;
  }

  .headline-text {
    line-height: 1.3;
  }
}

/* Extra small screens - even more compact */
@media (max-width: 480px) {
  .theme-container {
    margin: 30px auto 1rem;
  }

  .theme-text {
    font-size: 1rem;
    padding: 0 4px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.3rem;
    margin: 0.8rem auto 2rem;
  }

  #headline {
    min-height: 60px;
    font-size: 1rem;
    padding: 0.6rem;
  }

  #timer {
    font-size: 2rem;
  }

  #optionsCont {
    gap: 6px;
    padding: 0 0.3rem;
  }

  #optionsCont button {
    font-size: 1rem;
    padding: 0.4rem;
    min-height: 40px;
  }

  #progressIndicator {
    bottom: 7rem;
    gap: 4px;
  }

  .progress-dot {
    width: 8px;
    height: 8px;
  }

  .turns-remaining {
    font-size: 0.8rem;
    margin-right: 6px;
  }

  #game {
    padding-bottom: 11rem;
  }

  /* Instructions screen mobile styles */
  #instructions {
    padding: 10px;
  }

  .instructions-content {
    padding: 0.5rem 0;
    min-height: calc(100vh - 80px);
  }

  .instructions-text {
    font-size: 1rem;
    margin: 0.5rem auto;
    max-width: 90%;
  }

  .video-container {
    max-width: 80%;
    margin: 0.5rem auto;
  }

  .next-button {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    margin-top: 0.5rem;
  }
}

@media (max-width: 600px) {
  .modal-content {
    padding: 18px;
    border-radius: 8px;
    max-width: 98vw;
    width: 98vw;
    margin: 10px auto;
  }
  .modal-content h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }
  .how-to-content {
    font-size: 0.98rem;
  }
  .contact-info p {
    font-size: 0.85rem;
  }
  .back-arrow {
    top: 14px;
    left: 14px;
  }
  .back-arrow img {
    width: 20px;
    height: 20px;
  }
}
