/* styles.css – Updated for Bold Fonts, Adaptive Font Sizes, and Count Indicators */

/* Reset & Base Styles */
html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: Helvetica, sans-serif;
  background-color: #f5f5f5;
  display: flex;
  flex-direction: column;
}

body.spymaster {
  height: 90vh;
}

/* Header */
header {
  position: relative; /* So that absolutely positioned count indicators are relative to header */
  flex: 0 0 auto;
  text-align: center;
  padding: 0.5rem;
  font-weight: bold;
}

/* Universal box-sizing to ensure consistent sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Count Indicators */
.count-indicator {
  position: absolute;
  top: 4rem;
  font-size: 5vw;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
}
#redCount {
  left: 2rem;
  background-color: #FF0000; /* Primary red */
}
#blueCount {
  right: 1.5rem;
  background-color: #0000FF; /* Primary blue */
}

/* Main board area */
#board {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
}

/* Controls (only in main board view) */
#controls {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.5rem;
}

/* Card styling */
.card {
  border-radius: 25px;
  background-color: #e0e0e0;
  border: 2px solid #999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: background-color 0.5s ease, opacity 0.3s ease;
  user-select: none;
  cursor: pointer;
  font-size: 3vw; /* default for main board */
  font-weight: bold;
  text-align: center;
  padding: 0.5rem;
  white-space: normal;
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Revealed card colors – primary colors */
.card.revealed.red { 
  background-color: #8B0000; 
  color: #fff;
}
.card.revealed.blue { 
  background-color: #00008B; 
  color: #fff;
}
.card.revealed.neutral { 
  background-color: #aaaaaa;
  color: #000;
}
.card.revealed.assassin { 
  background-color: #000;
  color: #fff;
}

/* Spymaster view: reduced font size and slight transparency for unrevealed cards */
body.spymaster .card {
  opacity: 0.6;
  font-size: 2.5vw;
}
body.spymaster .card.revealed {
  opacity: 1;
}

/* Button styling */
button {
  padding: 0.5rem 1rem;
  font-size: 2vw;
  margin: 0.5rem;
  font-weight: bold;
}

/* Media Queries for smartphones (portrait) */
@media screen and (max-width: 600px) {
  header {
    padding: 0.3rem;
    font-size: 3.5vw;
  }
  #board {
    gap: 0.3rem;
    padding: 0.3rem;
  }
  .card {
    font-size: 4vw;
    padding: 0.3rem;
  }
  body.spymaster .card {
    font-size: 4vw;
  }
  button {
    font-size: 4vw;
  }
  .count-indicator {
    font-size: 8vw;
  }
}

/* Media Queries for UHD (very large) screens */
@media screen and (min-width: 1600px) {
  header {
    padding: 0.5rem;
  }
  #board {
    gap: 0.5rem;
    padding: 0.5rem;
  }
  .card {
    font-size: calc(1.2vw + 15pt);
    font-variant: small-caps;
    font-weight: bold;
    line-height: 50%;
    padding: 0.5rem;
  }
  body.spymaster .card {
    font-size: calc(1.2vw - 10pt);
  }
  button {
    font-size: 1.2vw;
  }
  .count-indicator {
    font-size: 3vw;
  }
}

/* === Spymaster View Overrides === */
body.spymaster .card {
  /* Always show the role color, regardless of the "revealed" flag */
  white-space: normal;
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* For red cards: unopened = primary red; opened = noticeably lighter red */
body.spymaster .card.red {
  background-color: #FF0000;  /* primary red */
  color: #fff;
}
body.spymaster .card.red.revealed {
  background-color: #FFCCCC;  /* lighter red */
  color: #000;
}

/* For blue cards: unopened = primary blue; opened = noticeably lighter blue */
body.spymaster .card.blue {
  background-color: #0000FF;  /* primary blue */
  color: #fff;
}
body.spymaster .card.blue.revealed {
  background-color: #CCCCFF;  /* lighter blue */
  color: #000;
}

/* For neutral cards: unopened = dark gray; opened = white */
body.spymaster .card.neutral {
  background-color: #808080;  /* dark gray */
  color: #fff;
}
body.spymaster .card.neutral.revealed {
  background-color: #FFFFFF;  /* white */
  color: #000;
}

/* For assassin cards: maintain black (optionally lighter on reveal) */
body.spymaster .card.assassin {
  background-color: #000000;
  color: #fff;
}
body.spymaster .card.assassin.revealed {
  background-color: #444444;  /* slightly lighter black */
  color: #fff;
}

/* Ensure that the spymaster board fits exactly within the viewport */
body.spymaster #board {
  /* Remove extra margins/padding if necessary */
  padding: 0.1rem;
  gap: 0.1rem;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
}

/* Optionally, if you find that the grid is still wider or taller than desired,
   you can adjust the header and board margins specifically for spymaster: */
body.spymaster {
  margin: 0;
  padding: 0;
}

/* Modal container hidden by default */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.6); /* Semi-transparent background */
  align-items: center;
  justify-content: center;
}

/* Modal content box */
.modal-content {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  width: 80%;
  max-width: 500px;
}

/* Styling for the modal title */
.modal-content h2 {
  margin-top: 0;
  font-size: 2em;
  color: #333;
}

/* Styling for the modal button */
#restartButton {
  padding: 0.5rem 1rem;
  font-size: 1.2em;
  margin-top: 1rem;
  cursor: pointer;
}
