/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap');

/* Global Body Styles */
body {
  font-family: 'Fredoka', sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  font-size: 16px;
  background: linear-gradient(135deg, #fceabb, #f8b500);
}

/* Fixed Top Header */
.title-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 107, 107, 0.95);
  color: white;
  padding: 16px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: flex-start;
}

.title-bar .title {
  font-size: 1.6em;
  white-space: nowrap;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 20px 20px 20px;
  box-sizing: border-box;
  display: grid;
  gap: 20px;
}

/* Game Selection Grid */
.container.game-selection {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* Section Styling */
.section {
  background: rgba(255, 255, 255, 0.85);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.section h2 {
  margin-top: 0;
  font-size: 1.5em;
  color: #ff6b6b;
}

/* Buttons */
button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: white;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s, background 0.3s;
}

button:hover:enabled {
  transform: scale(1.05);
  background: linear-gradient(135deg, #ff4b2b, #ff416c);
}

button:active:enabled {
  transform: scale(0.95);
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

/* Labels, Inputs, Selects */
label, input, select {
  font-size: 16px;
  font-family: inherit;
}

/* Game Tile (Page 1) */
.game-tile {
  background: rgba(255, 255, 255, 0.85);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
}

.game-tile:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.95);
}

.game-icon {
  font-size: 2.5em;
  margin-bottom: 12px;
}

.game-name {
  font-size: 1.2em;
  font-weight: 600;
  color: #ff6b6b;
}

/* Game Code Box (Lobby) */

.game-code-box {
  font-family: "Courier New", Courier, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #333;
  background: #fff3e0;
  border: 2px solid #ff6b6b;
  border-radius: 12px;
  height: 44px;       /* unified height */
  line-height: 44px;  /* vertical center */
  padding: 0 20px;
  display: inline-block;
  box-sizing: border-box;
}

/* Player Table (Page 2) */
.player-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 16px;
}

.player-table tr:not(:last-child) {
  border-bottom: 2px solid #ffb380;
}

.player-table td {
  padding: 12px 14px;
  font-weight: 600;
  min-height: 40px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-pic {
  font-size: 1.6em;
}

.empty-slot {
  color: #777;
  font-style: italic;
  font-weight: 400;
}

.empty-slot .player-pic {
  font-style: normal;
}

/* Profile Section */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.profile-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Lobby Page: Inputs, Dropdown, Buttons same height as code field */
.container.lobby-page input[type="text"],
.container.lobby-page select,
.container.lobby-page button {
  height: 44px;             /* same height as code field */
  box-sizing: border-box;
}

/* Name field font unchanged */
.container.lobby-page input[type="text"] {
  width: 100%;
  border-radius: 12px;
  border: 2px solid #ff6b6b;
  padding: 0 10px;
  text-align: left;
  font-size: 16px;
}

/* Emoji dropdown larger font, same height */
.container.lobby-page select#profile_picture {
  width: 100%;
  border-radius: 12px;
  border: 2px solid #ff6b6b;
  padding: 0 8px;          /* reduce horizontal padding for full emoji visibility */
  font-size: 28px;         /* large emoji */
  line-height: 44px;       /* vertically center the emoji */
  text-align: left;
  background-color: white;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

select {
  border-radius: 12px;
  border: 2px solid #ff6b6b;
  text-align: left;
  padding: 8px 8px;          /* reduce horizontal padding for full emoji visibility */
  background-color: white;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

/* Lobby buttons fixed width */
.container.lobby-page button {
  width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

/* Game Code Input (Page 3) */
input[type="text"]#game_code {
  padding: 10px;
  border: 2px solid #ff6b6b;
  border-radius: 12px;
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  font-size: 20px;
  display: inline-block;
  margin: 0;
  height: 44px;          /* same as lobby code field */
  line-height: 44px;     /* vertically center */
  box-sizing: border-box;
}

/* Join container */
.join-container {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: nowrap;
}

/* Radio Buttons */
.radio-group {
  display: flex;
  gap: 15px;
  margin: 15px 0;
}

input[type="radio"] {
  accent-color: black;
  transform: scale(1.2);
}

/* Description Section */
.description {
  line-height: 1.6;
}

.description ul {
  padding-left: 20px;
}

.description strong {
  color: #ff6b6b;
}

/* Waiting Message */
.waiting-msg {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 500;
  color: #444;
  text-align: center;
}

/* Waiting Room Button */
.container.waiting-room button#start_button {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
  font-size: 18px;
  height: 44px;         /* match code field height */
  padding: 0 20px;
  box-sizing: border-box;
}

/* Waiting Room: Game code box same height as lobby */
.container.waiting-room .game-code-box {
  height: 44px;           /* same as lobby code field */
  padding: 0 20px;
  font-size: 20px;
  line-height: 44px;      /* vertically center text */
  box-sizing: border-box;
}

/* Remove link styling for game tiles */
.game-tile-link {
  text-decoration: none; /* removes underline */
  color: inherit;        /* keep the text color as in the tile */
  display: block;        /* ensures the link covers the entire tile */
}

.wait-gif {
  max-height: 10%;
  max-width: 10%;
}

.wait-message {
  height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content:center;
  gap: 5vh;
  color: #FFFFFF;
}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 200px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 3px solid #ff6b6b;
  width: 80%;
  border-radius: 10px 10px 10px 10px;  
  color: #555555;
}

/* The Close Button */
.close_span {
  color: #000000;
  float: right;
  font-size: 38px;
  font-weight: bold;
}

.close_span:hover,
.close_span:focus {
  color: #000000;
  text-decoration: none;
  cursor: pointer;
}


/* Responsive Adjustments */
@media (max-width: 600px) {
  .radio-group {
    flex-direction: column;
  }
  .join-container {
    flex-direction: row;
  }
  .container {
    gap: 16px;
  }
}
